Unix/Linux Command Reference File Commands 1. ls Directory listing 2. ls -al Formatted listing with hidden fles 3. ls -lt Sorting the Formatted listing by time modifcation 4. cd dir Change directory to dir 5. cd Change to home directory 6. wd Show c!rrent wor"ing directory #. m"dir dir Creating a directory dir $. cat %fle &laces the standard in!t into the fle '. more fle (!t!t the contents o) the fle 1*. head fle (!t!t the frst 1* lines o) the fle 11. tail fle (!t!t the last 1* lines o) the fle 12. tail -) fle (!t!t the contents o) fle as it grows+starting with the last 1* lines 13. to!ch fle Create or !date fle 14. rm fle Deleting the fle 15. rm -r dir Deleting the directory 16. rm -) fle Force to remo,e the fle 1#. rm -r) dir Force to remo,e the directory dir 1$. c fle1 fle2 Coy the contents o) fle1 to fle2 1'. c -r dir1 dir2 Coy dir1 to dir2create dir2 i) not resent 2*. m, fle1 fle2 ename or mo,e fle1 to fle2+i) fle2 is an e/isting directory 21. ln -s fle lin" Create symbolic symbolic lin" lin" to fle
&rocess management 1. s 0o dislay the c!rrently wor"ing rocesses 2. to Dislay all r!nning rocess Unix/Linux Command Reference
3. "ill id ill the rocess with gi,en id 4. "illall roc ill all the rocess named roc 5. "ill attern ill "ill all rocesses matching the attern 6. bg ist stoed or bac"gro!nd obs+res!me a stoed ob in the bac"gro!nd bac"gro!nd #. )g rings the most recent ob to )oregro!nd $. )g n rings ob n to the )oregro!nd
File ermission ermission 1. chmod octal fle Change the ermission o) fle to octal+which can be )o!nd searately )or !ser+gro!+world by adding+ •
•
4-readr7 2-writew7
•
1-e/ec!te/7
Searching 1. gre attern fle Search )or attern in fle 2. gre -r attern dir Search rec!rsi,ely )or attern in dir 3. command 8 gre attern Search attern in the o!t!t o) a command 4. locate fle Find all instances o) fle 5. fnd . -name flename Searches in the c!rrent directory reresented by a eriod7 and below it+ )or fles and directories with names starting with flename 6. gre attern Searches )or all the named rocesses + that matches with the attern and+ by de)a!lt+ ret!rns their 9D
System 9n)o 1. date Show the c!rrent date and time 2. cal Show this month:s calender 3. !time Show c!rrent !time 4. w Dislay who is on line 5. whoami ho yo! are logged in as Unix/Linux Command Reference
6. fnger !ser Dislay in)ormation abo!t !ser #. !name -a Show "ernel in)ormation $. cat ;roc;c!in)o C! in)ormation '. cat roc;memin)o <emory in)ormation 1*. man command Show the man!al )or command 11. d) Show the dis" !sage 12. d! Show directory sace !sage 13. )ree Show memory and swa !sage 14. whereis a Show ossible locations o) a 15. which a Show which alications will be r!n by de)a!lt
Comression 1. 2. 3. 4. 5. 6. #. $.
tar c) fle.tar fle Create tar named fle.tar containing fle tar /) fle.tar =/tract the fles )rom fle.tar tar c>) fle.tar.g> fles Create a tar with ?>i comression tar />) fle.tar.g> =/tract a tar !sing ?>i tar c) fle.tar.b>2 Create tar with >i2 comression tar /) fle.tar.b>2 =/tract a tar !sing >i2 g>i fle Comresses fle and renames it to fle.g> g>i -d fle.g> Decomresses fle.g> bac" to fle
Shortc!ts 1. ctrlAc Balts the c!rrent command 2. ctrlA> Stos the c!rrent command+ res!me with )g in the )oregro!nd or bg in the bac"gro!nd 3. ctrlAd ogo!t the c!rrent session+ similar to e/it 4. ctrlAw =rases one word in the c!rrent line 5. ctrlA! =rases the whole line 6. ctrlAr 0ye to bring ! a recent command #. eeats the last command $. e/it ogo!t the c!rrent session Unix/Linux Command Reference