6.imp commands

Upload: vamsi-bonam

Post on 04-Jun-2018

214 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/13/2019 6.Imp Commands

    1/2

    List the files in current directory sorted by size ? - ls -l | grep ^- | sort -nr1. List the hidden files in current directory ? - ls -a1 | grep " \."2. Delete blan lines in a file ? - cat sa!ple.tt | grep -# $^%& ' ne()sa!ple.tt*. +earch for a sa!ple string in particular files ? - grep ,Debug .conf/ere grepuses the string ,Debug to search in all files (ith etension,.conf under current

    directory.0. Display the last ne(ly appending lines of a file during appendingdata to the sa!efile by so!e processes ? - tail f Debug.log/ere tail sho(s the ne(ly appended data intoDebug.log by so!e processesuser.3. Display the Dis 4sage of file sizes under each directory in currentDirectory ? -du - | sort nr 5or6 du . | sort -nr7. 8hange to a directory9 (hich is ha#ing #ery long na!e ? - cd8D:;)*/ere original directory na!e is ,8D:;)*>@;ABC)D;A;.. Display the all files recursi#ely (ith path under current directory ? - find . -depth-print

    E. +et the Display auto!atically for the current ne( user ? - eport DB+FL;GHIe#al$(ho a! i | cut -d"5" -f2 | cut -d"6" -f1JI/ere in abo#e co!!and9 see single Kuote9 doubleKuote9 gra#e ascent is used. Cbser#e carefully.. Display the processes9 (hich are running under youruserna!e ? - ps aef | grep:ahesh#M/ere9 :ahesh#M is the userna!e.1N. List so!e /ot Oeys for bash shell ? - 8trlPl 8lears the +creen. 8trlPr Does asearch in pre#iously gi#en co!!ands in shell. 8trlPu - 8lears the typing before thehotey. 8trlPa Flaces cursor at the beginning of the co!!and at shell. 8trlPe Flacescursor at the end of the co!!and at shell. 8trlPd Oills the shell. 8trlPz Flaces thecurrently running process into bacground.11. Display the files in the directory by file size ? - ls ltr | sort nr 3

    12. /o( to sa#e !an pages to a file ? - !an Qco!!and' | col b ' Qoutput-file'>a!ple R !an top | col b ' top)help.tt1*. /o( to no( the date S ti!e for (hen script is eecuted ? - ;dd the follo(ingscript line in shell script.e#al echo "+cript is eecuted at IdateI" '' ti!einfo.inf/ere9,ti!einfo.inf contains date S ti!e details ie.9 (hen script is eecuted and history relatedto eecution.10. /o( do you find out dri#e statistics ? - iostat ->13. Display dis usage in Oilobytes ? - du -17. Display top ten largest filesdirectories ? - du -s | sort -nr | head1. /o( !uch space is used for users in ilobytes ? - Kuot -af1E. /o( to create null file ? - cat de#null ' filena!e11. ;ccess co!!on co!!ands Kuicer ? - ps -ef | grep -i %T2N. Display the page size of !e!ory ? - pagesize -a21. Display >thernet ;ddress arp table ? - arp -a22. Display the no.of acti#e established connections to localhost ? - netstat -a | grep>+A2*. Display the state of interfaces used for A8FBF traffice ? - netstat -i20. Display the parentchild tree of a process ? - ptree Qpid' >a!pleR ptree 12723. +ho( the (oring directory of a process ? - p(d Qpid' >a!pleR p(d 127

  • 8/13/2019 6.Imp Commands

    2/2

    27. Display the processes current open files ? - pfiles Qpid' >a!pleR pfiles 1272. Display the inter-process co!!unication facility status ? - ipcs2E. Display the top !ost process utilizing !ost 8F4 ? - top b 12. ;lternati#e for top co!!and ? - prstat -a