Linux简单命令行:文件/目录,sudo,包管理

命令行学习笔记(搜索和压缩相关)

2016-12-08  本文已影响9人  TW安洋

效果如下:

➜  anyang cat file1     
Hello, anyang!
testhhhhhhhhhhhhh
rrrrrrrrrrrrrrrr
ddddddddddddd
testfsfdsccvv
➜  anyang grep test* file1 
testhhhhhhhhhhhhh
testfsfdsccvv
➜  anyang grep -r test* .
./test/test1:test is a problem
./test/test3:test is nice
./file1:testhhhhhhhhhhhhh
./file1:testfsfdsccvv
➜  anyang cat file1 | grep test*
testhhhhhhhhhhhhh
testfsfdsccvv
➜  anyang locate grep
/bin/bzegrep
/bin/bzfgrep
/bin/bzgrep
/bin/egrep
/bin/fgrep
/bin/grep
/bin/zegrep
/bin/zfgrep
/bin/zgrep
/etc/alternatives/lzegrep
/etc/alternatives/lzegrep.1.gz
/etc/alternatives/lzfgrep

tar 常用参数列表:

效果如下:

➜  test ls
file1  test1  test2  test3
➜  test tar cf test.tar test{1..3}
➜  test ls
file1  test1  test2  test3  test.tar
➜  test mv test.tar ..           
➜  test cd ..
➜  anyang ls
file1  learngit  test  test.tar
➜  anyang tar xf test.tar          
➜  anyang ls
file1  learngit  test  test1  test2  test3  test.tar
➜  anyang tar tf test.tar
test1
test2
test3

效果如下:

➜  anyang ls
file1  learngit  test
➜  anyang gzip file1 
➜  anyang ls
file1.gz  learngit  test
➜  anyang touch newfile
➜  anyang ls
file1.gz  learngit  newfile  test
➜  anyang gzip -c newfile > newfile.gz
➜  anyang ls
file1.gz  learngit  newfile  newfile.gz  test
➜  anyang gzip -d file1.gz 
➜  anyang ls
file1  learngit  newfile  newfile.gz  test

相关资料:

  1. 29个你必须知道的Linux命令: http://www.imooc.com/article/1285
  2. 常用命令行介绍: https://github.com/iamcoach/console/blob/master/COMMANDS.md
  3. 常用命令行cheet sheet: https://bbs.excellence-girls.org/topic/167
  4. 书籍《鸟哥的Linux私房菜》: https://book.douban.com/subject/4889838/
  5. Ubuntu各种技巧:http://wiki.ubuntu.org.cn/UbuntuSkills
上一篇下一篇

猜你喜欢

热点阅读