Linux interview questions and Snippets for daily use on Linux :P
Wednesday, January 8, 2014
To find a folder with size more than 1 gb
du -ck ~ | awk '{if ($1>1048576) print $0 }'
Tuesday, January 7, 2014
To find folder size
du -sh <foldername>
Tuesday, December 31, 2013
To copy recent files from a folder to somewhere else:
cp $(ls -lrt | tail -2 |awk '{print $9}') ../ (copying last 2 recent files smwer)
Friday, December 27, 2013
To find a word in a directory lets say err
ls -Rl | grep ^-r | awk '{print $10}' |xargs cat | grep -w import
or
ls -Rl | grep ^-r | awk '{print $10}' |xargs cat | grep '\bimport\b'
Saturday, November 30, 2013
Suppose you are on top windo and want to kill a process. what to do ???
hit 'Q' and then do usual kill stuff . well but there is a choice. dnt quit and hit 'k'.
it will ask for id.give the id and it will kill the process. :)
Thursday, November 28, 2013
if a grep statement is successful then it retun 0 if failed then it returns 1.
bingo !
creating alias in mac/linux/unix/cent OS :)
alias ll="ls -lrt"
Caution : This will not remail permanent. add this line to ~/.bash_profile .Quit terminal and boom !!!
it's working now.
Older Posts
Home
Subscribe to:
Posts (Atom)