Sei sulla pagina 1di 23

Linux commands

Sr. no. Actions commands


1 terminate vnc session vncserver -kill:{give session no. {3}}
2 to get all vncserver list vncserver -list
3 to create new vnc session vncserver -depth 16 -geometry 1200*900
4 to kill process kill%%
to serach specific keyword and output some
5 lines below that keyword into new file grep -A <no. of lines below graped keywords> "<keyword>" '<input filename>' > outptut file name
6 to make zip file tar -zcvf <filename.tar.gz> content files
tar -zxvf <filename.tar.gz>
7 to unzip file tar -xvif Max_delays_warning.tar.gz
@out=grep(!$saw{$_}++,@array)

here saw is hash, array is input array in which we have to find unique

8 to find unique (in perl) out is output array of unique values


gvim *.sv -O ; for splitted display mode vertically
-o ; for splitted display mode horizontally
9 to open multiple files -P ; for different tabs mode
10 to see content of file without opening it cat <filename>
11 to change access mode of file chmod 777 <filename>
12 to check memory usage du -ksh <drive name>
13 to check free memory df -h <drive name >
14 to display who is logged on who
to display the resources being used on your system
15 (press q to exit) top
16 to display help information for specifed command man <command>
17 to compare two different files gvimdiff filename1 filename2
18 to copy any line from terminal cntrl+shift_c
19 to see previous command entered history
to copy data from one server to other
20 server (it asks for the password) scp -r <files to be copied> username@server_ip: <path of destination>
grep -lvrs "string" <path to search>
To search if a string(or file) exits in that particular
path(or directory) [l - list the file names
v - Inversion (gives files that doesn't contain the specific string)
(To display the file names which contain the string r - recursive
21 remove 'v' in the cmd) s - expressing the error messages]
22 to open doc files or spreedsheet files libreoffice <document name>
23 to open pdf files evince <doc name>
24 to open image files eog <filename>
25 dve with file name dve -vpd filename.vpd &
26 to go to previous path cd -
27 to print directory structure tree <directory name>
28 to adjust resolution of vnc xrandr -s <resolution>
GVim Commands note:(to write in new line within cell press cntrl+enter)

Sr. no Actions Commands


1. cntrl+v
2. select words
1 delete multiple words in vertical order 3. delete
1. cntrl+v
2. select spaces where words to be inserted by arrow keys
3. shift+i
4. type word to be inserted
2 to insert multiple words in vertical order 5. esc
3 to delete from complete line press "d" twice
4 to delete from part of line press "D"
5 to split display vertically :vsp
6 to split display horizontally :sp
1. esc
7 to search string in file 2. /pattern
to negotiate through searched pattern
8 in forward direction n
to negotiate through searched pattern
9 in backward direction N
10 to count the occurance of searched pattern :%s/pattern//gn
11 To go to beggining of line ^
12 To set tab space :se ts=number
13 To go to end of line $
14 To find the extensions of a word previously used ctrl+p
15 To copy lines n1 to n2 after line n3 :n1,n2 t n3
16 To write lines n1 to n2 to other file :n1,n2 w <filename>
17 To append lines n1 to n2 to other file :n1,n2 w>> <filename>
18 to go to first line in a file gg
19 to go to last line in a file G
if u want to open any file say 'x' and path of which 1.press esc
has mentioned in current file 'y' . 2.place cursur on the path
3. press gf , which opens x.
20 note: path must be valid 4. to return to file y press cntrl+6
21 to go to specific line number :<line number>
22 to traverese through splitted displays press cntrl+w twice
23 undo changes u
1. press esc
2. place cursor on pattern
3. press *
24 to search pattern in file 4. press 'n' or 'N' to navigate
1. select the line(in visual mode if vim) to be copied
2. go to shell where the line is to be copied
25 To copy a line or command from file to shell(terminal) 3. press middle button of mouse
1. esc
26 to go to last edited line 2. cntrl+o
1. esc
2. place cursor on the starting line of block
3.press "mm"
4. place cursor on last line of block
5. press "y ' m" (here press "y" key then " ' "key then "m" key)
in command line it shows no of lines yanked.
27 to copy block of lines 6. press p to paste
1. esc
28 to replace a letter with other 2. r
1. esc
29 to replace string with other 2. R
30 To reload the opened file :e
1. ctrl+v
2. select the place where the pattern is to be added(using
arrow keys)
3. press "I" and type the pattern
31 To add a pattern at the place of selection 4. press esc
1. esc
2. place the cursor on the path
32 To open a file(using its path) in split window 3. press ctrl+w+f
33 To auto fill any path while typing the path ctrl+x+f
:%s/abc/xyz/gc

[g - indicates global
34 To replace all strings "abc" in the file with "xyz" c - conditional replacement (asks for replacement)]
1. place the cursor on the number to be incremented
35 To increment a number 2. press ctrl+a
1. place the cursor on the number to be decremented
36 To decrement a number 2. press ctrl+x
1. esc
37 to insert a word in next line 2. press "o"
1. esc
38 to insert a word in previous line 2. press "O"
39 to delete lines without counting :<starting line no>,<last line no>d
1. esc
40 to compare the files in splitted mode 2. :windo diffthis
1. esc
41 to open a file 2. :E
1. esc
42 to repeat the previous command 2. . note: .(dot)
43 to disable file difference mode diffoff
1. esc
2. place cursor on the starting line of block
3.press "mm"
4. place cursor on last line of block
5. press "d ' m" (here, press "d" key then " ' "key then "m" key)
in command line it shows no of lines yanked.
44 to delete block of lines
1. esc
:g//d
45 To delete the selected lines with selected pattern 2. if any line is having that string the entire line will be deleted
1.esc
%s///gn
46 To find how many patterns are existed in opened vim 2. The number of strings will be displayed
47 To delete entire lines except matched pattern :v//d

Potrebbero piacerti anche