LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 09-14-2008, 06:54 PM   #1
joegumbo
Member
 
Registered: Sep 2006
Distribution: MX-16 Modified using TDE
Posts: 239

Rep: Reputation: 32
Quick vi question (SOLVED!!)


I'm taking an online Linux class this semester and we are using Lab Simulation software.

The software instructed me to "make a new file" with:

vi /etc/users.allow

I thought "touch" was the command. I tried vi /home/user/test1 on my own Slackware pc at home and of course, I was allowed to "edit" the file, but after :wq I was notified that the file doesn't exist.

Obviously, there are a lot of Linux distros and various versions of vi. Does anyone know of any distros that allow vi to create a new file rather than just editing it? I've contacted the teacher about this ( and I may refer him to this thread).

Thanks,
-Joe G.

Btw... I usually use emacs myself

Last edited by joegumbo; 09-17-2008 at 06:40 PM.
 
Old 09-14-2008, 07:21 PM   #2
rolf
Member
 
Registered: Jul 2001
Location: Oakland, CA
Distribution: Mageia 5 x86_64
Posts: 187

Rep: Reputation: 33
Well, this is Mandriva and, like you say, there are different implementations of vi.

Code:
[rolf@localhost ~]$ vi test1
<pressed 'i' to enter Insert mode, typed some text, pressed 'Esc, :wq' to return to command mode, write, quit>
Code:
[rolf@localhost ~]$ cat test1
this is it
So, you don't report entering insert mode, nor using Esc to leave it, in case that matters. You would have to be root to write to /etc but you know that.
 
Old 09-14-2008, 08:33 PM   #3
joegumbo
Member
 
Registered: Sep 2006
Distribution: MX-16 Modified using TDE
Posts: 239

Original Poster
Rep: Reputation: 32
Yes, I used "i" and "Esc".

Sometimes I can't type as fast as I think...

Or maybe think as fast as I type.

Sorry 'bout that.
 
Old 09-14-2008, 08:35 PM   #4
joegumbo
Member
 
Registered: Sep 2006
Distribution: MX-16 Modified using TDE
Posts: 239

Original Poster
Rep: Reputation: 32
Never mind... I'm wrong. vi made a file.
 
Old 09-16-2008, 03:11 AM   #5
pdown85
LQ Newbie
 
Registered: Dec 2006
Location: Surrey, UK
Distribution: CentOS 4.5
Posts: 26

Rep: Reputation: 15
vi is a long-standing editor on almost all Unix/Linux systems!
(I've routinely used it since the 80s). Creates and updates files.
I find the following "vi cheatsheet" pretty handy at times:

http://www.gentoo.org/doc/en/vi-guide.xml

touch is not an editor - it is used to modify file timestamps without opening the file.
 
Old 09-16-2008, 06:26 AM   #6
baretta
LQ Newbie
 
Registered: Nov 2007
Posts: 1

Rep: Reputation: 0
no write-access to this directory

It's slightly puzzling that you were unable to create the testfile, unless this was not your home directory. Normally, when you try to "wq" in a directory you have no write access to (you can check the permissions by typing ls -la on the commandline) vi will give an error and tell you what the error is.
Generally, you don't have write access to system-directories such as /etc as ordinary user, no matter which editor you use.
So this is not really a vi question but a write-access question.
 
Old 09-17-2008, 06:40 PM   #7
joegumbo
Member
 
Registered: Sep 2006
Distribution: MX-16 Modified using TDE
Posts: 239

Original Poster
Rep: Reputation: 32
Hi pdown85!

Thanks for the cheat sheet!

I didn't know you could change timestamps with touch. But, touch will create a new blank file.
(on my machine anyhow )

touch /home/username/file_test_of_touch

Thanks for the help!


Hi baretta!

I was probably making some stoopid mistakes when I first used vi. I've alway used emacs (touch to make the file; emacs to edit.)... but I've been wanting to learn vi

I've been using Slackware, but this is my first actual formal Linux class. Up 'til now, I've just been learning by reading documentation, reading/participating in Linux forums and trial and error.

Thank you all for your help!

-Joe

Last edited by joegumbo; 09-17-2008 at 06:41 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Question Concerning ISO's and one quick question. evrae Linux - Software 2 06-21-2004 03:53 AM
samba smb.config question (quick question) TheDOGG Linux - Networking 1 03-02-2004 07:19 AM
Quick RH question 777SPy Linux - General 2 12-23-2003 05:55 PM
Quick Question Epyon Linux - Software 1 08-06-2003 12:35 PM
Quick question! nabil Linux - Networking 7 11-07-2002 07:38 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 12:44 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration