1. nano
Ø nano -: to start nano text editor
Ø ctrl+x -: to exit from nano text editor. Then press “y” & give a name with file format to save the file.
2. touch
Ø touch filename.fileFormat -: to create a new text file
3. more
Ø more filename.fileFormat -: to view the text file
4. cat
Ø cat filename.fileFormat -: to view the text file
Ø cat -n filename.fileFormat -: to display the content with the line number
Ø cat *.fileFormat -: to view the all text files’ contents.
Ø cat >filename.fileFormat
press enter
type file content
press enter
ctrl+d -: to create a text file
Ø cat file1name.fileFormat file2name.fileFormat >filename3.fileFormat -: concatenate existing 2 files and create new file
Ø cat filename2.fileFormat >filename1.fileFormat -: to copy the content of file2 to file1
Ø cat filename1.fileFormat >>filename2.fileFormat -: to append the contents from file1 to file2
5. vi – commands are case sensitive
I. Command mode
Ø vi fileName.fileFormat -: to create a text file.
II. To switch between 2 modes press “i”.
III. Insert mode
Ø Enter the content
Editing
Commands
|
|
i
|
Insert at cursor
|
a
|
Write after cursor
|
A
|
Write at the end of line
|
ESC
|
Terminate insert mode
|
u
|
Undo last change
|
U
|
Undo al changes to the entire line
|
o
|
Open a new line
|
dd
3dd
|
Delete line
Delete 3 lines
|
D
|
Delete contents of line after the cursor
|
C
|
Delete contents of a line after the cursor and insert new text. Press
“Esc” to end insertion.
|
dw
4dw
|
Delete word
Delete 4 words
|
cw
|
Change a word
|
x
|
Delete character at the cursor
|
r
|
Replace character
|
R
|
Overwrite characters from cursor onward
|
s
|
Substitute one character under cursor continue to insert
|
S
|
Substitute entire line and begin to insert at the beginning of the
line
|
~
|
Change case of individual character
|
Commands
for moving within a file
|
|
k
|
Move cursor up
|
j
|
Move cursor down
|
h
|
Move cursor left
|
I
|
Move cursor right
|
Commands
for saving and closing the file
|
|
Shift+zz
|
Save the file and quit
|
:w
|
Save the file while opened
|
:q
|
Quit without saving
|
:wq
|
Save the file and quit
|
No comments:
Post a Comment