My preparation notes for Wells Fargo interview-Unix

find command:->

find . -mtime -7 -exec rm -f {} \; -> find files which are modified in last 7 days and delete them
find . -mtime +7 : find files older than 7 days
find . -empty -> gives empty files
find . -iname abc -> case insensitive search
find . ! -name abc -> find files whose name is not abc

last n mnutes

find . -mmin -10 : find files modified in less than 10 minutes

find . -size 50 : find files whose size is greater than 50MB

find . -maxdepth 1 -name abc -> search in current directory only
find . -type d -> find directories
find . -type f -> find files
to avoid issue with white space in files, use
find . -name abc -print 0 | xargs -o ls -lrt

find . -user abc

cut command :->

cut -f1 -da

sort command:->

sort -n -r -k2 -u:
-n numeric order in ascending
-r reverse order
-k2 sort on coulmn 2
-u or uniq keyword : removes duplicates

soft link : ln -s
update softlink ln -ns

if file deleted/modified/renamed, softlink is lost but not hardlink

nohup – to make process run even after closing session
& – to run process in background
fg – to run process in foreground

create alias:
alias abc=’ls -lrt /abc’
remove alias:
unalias abc

tar -cvf <tar-name> <directory-name> : to create tar archive
tar -xvf <tar-name> : to extract tar archive
tar -cvzf : tar.gz extension
tar -cvjf : tar.bz2 extension
tar -tvf : list the contents of archive
tar -rvf <file> <tar name> : add new file to tar


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s