Sei sulla pagina 1di 4

Creation of files ----------------There 3 CMD 1)cat (concat and display files) 2)touch 3)vi editor (visual editor)

cat ---->It is used to make sinlge file in unix -->we can't make more then one file at a time -->we can add or append existing data but we can't remove data form the file syn # cat > filename To make file -----------ex #cat >myfile hi this is myfile Ctrl+d --> save and exit To add more data/ append -----------------------ex #cat >>myfile this is extra data Ctrl+d --> save/exit To open file/view file content -----------------------------syn #cat < filename ex #cat < myfile (or) syn #cat filename ex #cat myfile To view file content with line numbers -------------------------------------syn #cat -n filename ex #cat -n myfile

creation of hidden files ------------------------

syn #cat >.filename ex #cat >.myfile1 hi it's hidden file Ctrl+d -->save and exit To append file -------------syn #cat >>.filename ex #cat >>.myfile1 this is OSI file Ctrl+d -->save and exit To open hidden file ------------------syn #cat <.filename ex #cat <.myfile1 (or) syn #cat .filename ex #cat .myfile1 Touch ------> It is used to make multiple empty files at a time --> we can't add or modify the file syn #touch file1 file2 file3 ex #touch abc abcd abcde Vi-editor ----------> It is introduced by Bell Joy --> By using this editor we can add,modify,replace,copy... --> There are 3 modes 1) Insert mode 2) Escape mode 3) Colon mode

To open visual editor file -------------------------syn #vi filename

ex #vi myfile

Insert mode ------------> It is used to add data on the file --> we can also add new lines i I a A 0 O ->Insert ->Insert ->Insert ->Insert ->Insert ->Insert data at cursor position data at cursor starting posirion data after the cursor position data end of the cursor position new line below the cursor position new line above the cursor position

Esc-mode ---------> It is used to modify the file content Esc+dd -->To remove sinlge line at cursor position Esc+ndd ->To remove no.of lines from cursot position Esc+cc -> simler to dd and goes to insert mode Esc+dw -->To remove sinle word at cursor position Esc+ndw ->To remove no.of words from cursor postion Esc+x ->To remove sinlge character from cursor position Esc+nx ->To remove no.of characters from cursor position Esc+X ->To remove sinlge character before the cursor position Esc+nX ->To remove no.of character before the cursor position Esc+yy ->To copy single line at cursor position Esc+nyy ->To copy n.number of lines from cursor postion p ->To paste below the cursor postion P ->To paste above the cursor postion Esc+yw ->To copy single word at cursor postion Esc+nyw ->To copy n.no.of words from cursor position Esc+yl ->To copy single character at cursor position Esc+nyl ->To copy n.no.of charactes from cursor positon Esc+R ->To replase line at cursor position Esc+r ->To replase sinlge character at cursor position Esc+~ ->To change text from lower or upper/ upper to lower Esc+ZZ ->To save and exit Esc+G ->Moves the cursor to end of the file Esc+M ->Moves the cursor to middle of the file Esc+H ->Move the cursor to stating point of the file Esc+U ->Undo Esc+. Colon mode ----------> it is used to set line numbers as well as save/exit from file --> we can also replase particular/group of words To get Colon mode

-----------------Esc+shift+colon --> : --> Colon mode :set nu -> To set line numbers :se nu :set nonu :se nonu -> To un-set line numbers :w! -> save forcefully :q! -> quit forcefully :wq! -> save and quit forcefully :w -> save :q -> quit :wq -> save and quit :1,$s/old-string/new-string/g :

Potrebbero piacerti anche