web hosting company in bangladesh

web hosting company in bangladesh
Find Cheap Web Hosting

Wednesday, May 25, 2011

How to Create File in Linux

There are 3 editors are available in Linux OS:
1.touch [to create blank file]
2.cat [to create blank file, no edit but line can be added]
3.vi [everything can be done in this editor]

Creating a file with touch editor
# touch  file_name  [to create a blank file]
# touch  /home/file_name   [to create a file in home directory from root directory]
# touch  folder_name  a1  a2  a3  [ to create more than one file at a time ]

Creating a file with cat editor
# cat  >  file_name , then write & press Ctrl+d to save.
# cat  >  file_name   [to read a file, read only mood]
# cat  >>  file_name [to write in a file from last line]

Creating a file with vi editor
# vi  file_name   [to create a file, #vi  -O  a1  a2 (two file at a time),ctrl+w  n/s/v/↕]
Then press ‘ i ’ to write and then press ‘Esc’ then write,
1. :w -> to save and exist in the window.
2. :wq -> to save and quit the file.
3. :q -> to quit.
[ *If files are not save/quit then force the file with ‘ ! ‘, such as write: q! to quit ]

No comments:

Post a Comment