linux commands summary

dynamic monitor log file:  

bash-3.00$ tail -f console.log

estimate disk space usage:

bash-3.00$ df -h

FilesystemSizeUsedAvailUse%Mountedon

/dev/cciss/c0d0p3127G61G60G51%/

/dev/cciss/c0d0p176M13M60M18%/boot

/export/home/patrol127G61G60G51%/home/patrol

/export/home/pvprapp1127G61G60G51%/home/pvprapp1

hksafs2:/export/home/ai91716

40G14G26G34%/home/ai91716

hksafs2:/export/home/hf52065

                                 40G   14G   26G  34% /home/hf52065

show current date

bash-3.00$ date

TueMar1010:42:21HKT2009

bash-3.00$date'+%Y%m%d'

20090310

bash-3.00$ date '+%H%M%S'105859

==Folder related task==========================

copy folder

bash-3.00$ cp -r sourceFolder targetFolder

rename /move folder

bash-3.00$ mv sourceFolder targetFolder

delete not empty folders

bash-3.00$ rm -rf eqtg

estimate folder size:

bash-3.00$ du -s -h /home/hf52065

7.3M /home/hf52065

create symbolic link

bash-3.00$ ln -s ./projects/realTargetFolder falseEasyNameFolder

=========================================

extract tar/tar.gz file

tar -xvf foo.tar              verbosely extract foo.tar

tar -xzf foo.tar.gz              extract gzipped foo.tar.gz

tar -cjf foo.tar.bz2 bar/              create bzipped tar archive of the directory bar called foo.tar.bz2

tar -xjf foo.tar.bz2 -C bar/              extract bzipped foo.tar.bz2 after changing directory to bar

tar -xzf foo.tar.gz blah.txt              extract the file blah.txt from foo.tar.bz2

Tom's comments: the strange thing is, the above commands don't work, only this one work

gzip -dc *.tar.gz | tar xvf -   

unzip zip file

unzip *.zip

相关推荐