0% found this document useful (0 votes)
9 views

Linux Commands 3

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views

Linux Commands 3

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Linux Commands

• pwd : view the working directory


• cd : enter into directory
• touch : create the files
• vi : create and open the files
• ls : list the files in current directory
• ls -a : list the visible and hidden files in directory
• ls -l : display the files along with permissions
• touch -t [mm-dd-time](filename) : get the updated file
• ls -t : display the file which is modified in directory
• ls -S : list based on the file size
• ls -r : list the files in reverse order
• cd ~ : move to the home directory
• cd - : move to the directory where we previously viewed
• cd .. : move one level up to the directory
• cd ../../ : move to the 2 level up
• clear : clear the screen
• cd / : root directory
• mkdir : create the new directory
• mkdir -p f1 f2 f3 : creation of the parallel directories
• mkdir -p folder/fold1/fold2 : creating the nested folders
• mkdir folder2 cd folder2 : making and enter into folder
• cat (filename) : display the content of the file
• cat > (filename) : over write the content
• cat >> (filename) : append the content
• cat file1.v file2.v > file3.v : content will combine and append
• cp file1.v file2.v : copy the files content to another
• cp -prf folder folder2 : copy directory to directory
• cp -prf folder/* folder2 : copy 100% directory to directory
• mv folder2 newfolder : rename the folder
• mv file4.v folder/fold1 : moving the files to the destination
• cp file4.v ../../ : to the original location

• mv -i file4.v folder/fold1 : it will ask the permission to overwrite -


> y/n
• rm file4.v : used to remove the file
• rm -rf newfolder/ : used to delete the folder
• rm -ir newfolder/ : for removal confirmation
• rmdir folder2 : removing the empty directory
• alias c clear : replace the command as shortcut
• unalias c clear : remove shortcut
• less file3.v : open content of file (esc - > `q to exit)
• less -5 file3.v : open content from that line
• head file3.v : display the 10 lines of the content
• head -20 file3.v : display the 20 lines of the content
• tail file3.v : last 10 lines of the content
• more file3.v : display by pressing the enter key
• more -10 file3.v : display the 10 lines of the content
• more +5 file3.v : display the 5th line
• chmod 777 file1.v : it enable the read&write&execute the
permission

• chmod 750 file2.v : it will all to me & read to others and no write
permission
• chmod u+rwx (filename) : read,write,execute for user
• chmod o+rwx (filename) : read,write,execute for others
• date : to know the date

• ps: current running processor (used to detect the hagging


problem for application)
• kill (PID_number) : to remove the hagged application
• whoami : username
• du -sh file3.v : size of file
• wc file1.v : word count of the file
• wc -l/-c/-w file1.v : for printing the line/character/words
• gedit file1.v : open in coding terminal
• history : it can tell list of commands used upto now

• history | cat > (filename) : for store the list of used commands in
one file

Command to RUN the Cadence: irun (file name.v)


+define +CADENCE_DUMP +access +rw gui

• then simulation -> run


• bin -> sent to waveform

fgrep (keyword) (filename.v) : for searching the string

fgrep (keyword) -n (filename.v) : display with line number

fgrep (keyword) -v (filename.v) : display with remaining lines

fgrep (keyword) -i (filename.v) : display the keyword when it is in


capital letters

grep -rwn (keyword): find the string in directory or multiple lines

find *.sv : it will get the file with extension


find /home/../../ -type d -name (name of directory) : it will give the path

• instead of d as f : to find file find . -type f -name (filename) : to


find the current directory sort (filename) : it will sort(rearrange ) the
data uniq (filename) : it will give unique lines cat -n (filename) :get the
data with line number uniq -d (filename) : for duplication uniq -u
(filename) : for unique lines uniq -c (filename) : no. of times the lines
sort (filename) | uniq -c ls -l | tee report : to get the report of content
cmp file1 file2 : comparison of 2 files diff file1 file2 : which is different
among files sdiff file1 file2 : what is differ will appear vim diff file1 :
open in vim to show the difference gnome -terminal : open a new
terminal
man ‘ls’ : to get the details of command

GVIM _ COMMANDS:
vi (filename) : to open the content
u : undo esc : escape mode
“o” : to insert the next line
“O” : create new line above the cursor
:q -> quit without saving
:wq -> save and quit

Instead I in a : insert after the next letter


A : moving end of the line
Ctrl+r : redo in escape mode gg
-> to starting line
G -> end of the line
:se nu -> for the line number display
:se nonu -> disable line number
: . -> it will show the cursor line number
: = -> to see the total number of lines
: 3 -> to move cursor to that line 5+G
: move to corresponding line dw : to
delete the word at the cursor dd :
whole line delete / cut 4dd : 4lines
delete
:%d -> delete all / cut all
^ : start the line
$ : end of the line d : backward cursor
moment e : frontward cursor moment j
: move cursor below from the location
2j : it will move below 2 lines k : it will move
upwards l : cursor move right side / 5l : 5times
move h : left side cursor moment / 4h : 4 times
move
yy : yonk(copy)
:%y -> to copy all p
: pasting P : paste
of the line y6y :
copy 6 lines 3p :
paste 3 times
r : for replace the character of word
R : replace entire word cw
: for change word
c3w : 3 words can change through the command su
: to add some more lines
. -> it can able to repeat the previous operation
*-> to search keyword n :
downward after search
N : upwards after search
/(keyword) : it also search for keyword
:%s /(keyword)/(new word)/g -> to change the word in the file :%s
/(keyword)/(new word)/gc -> to change the word in the file with
confirmation
Shift+v : to select
Shift+vg : to paste in the last line
Ctrl+u : upwards
Ctrl+d : downwards
:q! -> no need to overwrite
:x -> to save and exit
:tabnew (filename) -> for another file edit
:vspl (filename) -> parallel view of 2 files
:spl (filename) -> horizontal view of another file
Tab+gt : for changing tabs
Ctrl+ww : move to file to file
Ctrl+wp : previous file viewing
Ctrl+w : will maximize the file
Ctrl+w ‘\’ : one file maximize
Ctrl+w ‘_’ : one file maximize
Ctrl+w ‘=’ : every file in equal size
Ctrl+w ‘+’ : add the file
Ctrl+w ‘r’ : rotate the files from one another
[+] : we have to save
:wa -> save all the files :qa -
> quit without saving all
vi -p file1 file2 file3 : open in different tabs
:w (filename) -> another file created and content saved in filename
:w >> (filename) -> append the data into another file
:tabdo %s/a/x/g -> to effect the file which search a string ‘a’ replaced
with ‘x’
:tabdo wa -> save all the files by replacing

Shift+d : delete the line from cursor


d2w : delete the 2words from the
cursor :setf vera -> to make keywords
different color
Cntrl+g : it show the path along with lines
Cntrl+p : it will enter the keywords as with single letter
Cntrl+f : forward
Cntrl+b : backward
:1,28 s/(keyword)/(new keyword)/g -> global change of word
:v//d -> grip and show [by selecting as *] that words in

You might also like