红联Linux门户
Linux帮助

Some useful command tips in Linux

发布时间:2008-03-28 00:39:59来源:红联作者:Keiboc
1. To get the usual tar package :
tar cvf file.tar file/;

2. To get the tar.gz package:
tar zcvf file.tar.gz file/ ;
or:
tar cvf file.tar file/;
gzip file.tar ;
(will generate file.tar.gz automatically)

3. To extract a tar package:
tar xvf file.tar

4. To extract a tar.gz package:
tar xzvf file.tar.gz ;
or:
gunzip -d file.tar.gz;
tar xvf file.tar;

5. Use "-C" to extract a package to certain place:
gunzip -dc packet-2008_Mar25_20-00-00.tar.gz | tar -C / -xvf - cvs/cdcds

This is will extract the "cvs/cdcds" contained in the "packet-2008_Mar25_20-00-00.tar.gz" to the path "/".

6.How to list the before or after contents of the matching message when using "grep" ?
grep -A10 "strict" ; // List 10 lines after the matching line!
grep -B10 "strict"; //List 10 lines before the matching line!
文章评论

共有 0 条评论