下面我将和大家分享一些学习Linux命令行的技巧,希望能对大家有所助益。如果在本文中遇到不太熟悉的命令,可以在终端中键入以下命令寻求帮助。

Man <command>

image

Where there's a shell, there's a way.

Linux入门必备

提升日常工作效率

  1. $ find . -name *.py | xargs grep some_function 
  2. $ cat hosts | xargs -I{} ssh root@{} hostnameX
  1. #do something in current dir 
  2. (cd /some/other/dir; other-command) 
  3. #continue in original dir
  1. diff /etc/hosts <(ssh somehost cat /etc/hosts)
  1. lynx -dump -stdin

数据处理

  1. cat a b | sort | uniq > c # c is a union b 
  2. cat a b | sort | uniq -d > c # c is a intersect b 
  3. cat a b b | sort | uniq -u > c # c is set difference a – b
  1. awk '{ x += $2 } END { print x }'

系统诊断

欢迎分享

我想,应该会有许多技巧,本文尚未提及。希望大家在评论中与我共同分享。(张志平/编译)

原文链接:

Linux Command Line tips that every Linux user should know

源链接

Hacking more

...