SagerXiao's Blog

Restart of an old programmer

常用的shell指令

1.合并所有lst文件,排序,去重,输出到my.list

Scripts collections
1
cat *.lst|sort|uniq > my.list   #合并排序去重

2.使用tar拷贝目录下的所有文件

Copy all files
1
2
3
4
5
6
7
(cd /source/directory && tar cf - .)|(cd /dest/directory && tar xpvf -)

cd source/directory
tar cf - . |(cd /dest/directory; tar xpvf -)

cp -a /source/directory/* /dest/directory
cp -a /source/directory/* /source/directory/.[^.]* /dest/directory
Using tar
1
bunzip2 linux-2.6.13.tar.bz2 | tar xvf -

Comments