Linux - SoftwareThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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).
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.
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:
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.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.