How to file creation and update in Linux command

Sudo su : Super user do switch user 

Initial Step

Cat : create a file (> ‘overriding the data’)

[override: if delete existing data if will add new data.]

Cat > filename 
Enter content 
ctrl + d

1.1  (>> ‘appending the data’)

cat >> filename 
Enter content
ctrl + d

 Display the data of file

cat filename

Touch (create only empty file)

touch filename

Multiple files create

touch <filename1> <filename2> <filename3>

Nano (2nd method for file creation)

nano filename
enter content
ctrl + x

confirmation (Y- yes)

vi/vim ( 3rd method of file creation)

vi filename
i 
esc: wq  

i – insert mode

w- save, q- quit

Note:

Above 4 cmd is “primary operation”

Nano & vi/vim – Editors(add,delete, append, edit)

Cat – [add,override,append] [readonly purpose] [can’t edit][]

Append: already existing data and add another data as well.

Override: deleting existing one and adding one.

Clear screen

clear 

(or)

Ctrl+l

Leave a Reply

Your email address will not be published. Required fields are marked *