how to create a file in unix using vi command

Asked by satya ramesh

how to create a file in unix using vi command

Question information

Language:
English Edit question
Status:
Answered
For:
Ubuntu vim Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Ian Ace (iaculallad) said :
#1

Simple, open your terminal and do:

vi myFilename

HTH.

Revision history for this message
actionparsnip (andrew-woodhead666) said :
#2

If you edit a none-existant file with vi then save it, it will be created. If you do not have write access to the location you will need to run:

sudo vi filename

This will allow your user write access (assuming it is in the admin group)

Revision history for this message
kadaj (qlisp) said :
#3

vi filename in your terminal
To save give the command: w
w means write.
To quite give the command: q

Revision history for this message
Steve Sauls (steve.sauls) said :
#4

you may also touch a file to create an empty file.
The command is "touch <filename>"

Can you help with this problem?

Provide an answer of your own, or ask satya ramesh for more information if necessary.

To post a message you must log in.