Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
4 views3 pages

Linux Class-3

Uploaded by

saiteja
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views3 pages

Linux Class-3

Uploaded by

saiteja
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

LINUX CLASS-3

ll -r : used to reverse the files

ll -t : used to get the latest files on top

ll -a : used to get all files including hidden files

ll -lrt : used to get the latest files on bottom

cat filename : used to read the data in a file

cat -n filename : used to print the data along with lines

tac filename : it will reverse the lines

rev filename : it will reverse the words

cat file1 file2 file3 : used to read multiple files at the same time

more file1 file2 file3 : used to read multiple files at the same time

head filename : used to read top 10 lines of a file

tail filename : used to read last 10 lines of a file

tail -n 5 filename : used to read last 5 lines of a file

sed -n ‘12,18p’ filename : used to read 12 to 18 lines of a file

WORD COUNT:

wc filename : used to get no of lines, words & characters

wc -l filename : used to get only no of lines

wc -w filename : used to get only no of word

wc -c filename : used to get only no of characters


VIM EDITOR: This editor is used to edit the files in linux system. It has 3 modes

1. COMMAND MODE
2. INSERT MODE
3. SAVE & QUIT MODE

1. COMMAND MODE: This is the default mode in vim editor, This is used to perform some
actions like copy, delete, undo, redo, replace the words, find the words, move to certain etc
etc..

NOTE: If you want to perform any action we should be command only.

gg : used to go to 1st line of a file


7gg : used to go to 7th line of a file
G : used to go to end of the file
M : used to go to middle of a file
:21 : used to go to 21st line of a file
:set number : used to set numbers to our file
yy : used to copy the line
4yy : used to copy 4 lines at a time
p : used to print the copied content
5p : used to print 5 times
dd : used to delete the line
5dd : used to delete 5 lines
u : used to undo
2u : used to undo 2 times
ctrl + r : used to redo the changes
/word : used to search for a word in a file
?word : used to search for a word in a file
:%s/oldword/newword/g : used to replace a word in a file
ex: :%s/aws/azure/g ---> this will replace all aws words to azure

2. INSERT MODE: This mode is used to insert/modify the data.

i : used to go to insert mode from command mode


esc : used to go to command mode from insert mode
I : used to go to starting of the line
A : used to go to end of the line
O : used to create a new line (up)
o : used to create a new line (down)

3. SAVE & QUIT MODE: This mode is used to save the changes an quit from vim editor

:w : used to save the changes


:q : used to quit from vim editor
:q! : used to quit without saving the changes (forcefully)
:wq : save & quit at a time
:wq! : save & quit forcefully

You might also like