Linux Primer Prerequisites for bash: there's no need to delve into the proving Bash manual and learn from Man bash. Understand VI: You may use Emacs or eclipse in your work, but VI is irreplaceable. Learn about SSH: Learn the basics of password-free authentication. Bash Job Management Basics: Use &, Ctrl-c, FG, BG, ctrl-z, Jobs, and kill. File management commands: such as hard links and soft links, permissions, and so on. Network Management commands: such as ifconfig. How to use regular expressions, how to use grep, sed, and so on. Learn to use Apt-get and Yum management packages.
Increase your daily productivity in bash, you can use the Ctrl+r command to search the command line history. In bash, you can use Ctrl+w to delete the last word and use Ctrl+u to delete the entire row. Use the CD-command to return to the previous working directory, using the CD. command returns the upper directory. Learn how to use Xargs:
$ find. -name *.py | Xargs grep some_function $ cat Hosts | xargs-i{} ssh root@{} Hostnamex View the process tree using the pstree-p command. Understand the different signals. For example, use Kill-stop [PID] to terminate a process. A detailed list of signals can be viewed in Man 7 signal. If you want to keep the process running in the background forever, you can use the Nohup and disown commands. Use the NETSTAT-LNTP command to view the listening process and refer to the lsof command. Use Subshells to group commands in a bash script:
#do Something in current dir (Cd/some/other/dir Other-command) #continue in original dir string trim (trimming Strings): ${ Var%suffix} and ${var#prefix}. For example, if Var=foo.pdf then echo ${var%.pdf}.txt prints "foo.txt". The output of the command can be used as a file. For example, compare local and remote/etc/hosts files:
Diff/etc/hosts < (SSH somehost cat/etc/hosts) understands "here documents" in bash. Understand standard output and standard error redirection. Understand the ASCII code table. You can run the man ASCII command as a reference in the terminal. When working remotely through SSH, you can save a reply using screen or Dtach. For web developers, curl, wget, and other commands are very useful. Convert an HTML page to a text file:
Lynx-dump-stdin if you want to master the Xml,xmlstarlet command is a very good tool. Learn about SSH port mappings. Use the Alt+shift+3 shortcut key to add a comment "#" before a row.
Data Processing understands the sort and uniq commands. Learn about the cut, paste, and join commands. Learn how to make intersection, set, and difference sets for text files:
Cat A B | Sort | Uniq > C # c is a union B cat a B | Sort | uniq-d > C # c is a intersect B cat a b b | Sort | Uniq-u > C # c is set difference A–b a summary of the second column of the text file, the following code is more refined, faster (3 times times) than the same Python code:
awk ' {x + + $} end {print X} ' understands string and grep commands. File Segmentation: Understanding Split (split by size) and Csplit (split by match) command.
System Diagnostics uses the Iostat, netstat, top, and Dstat commands to view the status of disks, processors, and networks. Use commands such as free, vmstat to understand system memory status. Use the MTR Network Diagnostics tool. Use tools such as Iftop, nethogs to view bandwidth-consuming processes and bandwidth. Use the AB tool to quickly gain insight into the performance of your Web server. Respond to complex network diagnostics with Wireshark and Tshark commands. Learn how to use strace and to diagnose running processes. This is helpful for analyzing why the program is running incorrectly. Use the LDD command to view shared library files. Learn how to use GDB to connect to a running process and make a stack trace. Knowledge of/proc is very important. How to diagnose errors that have occurred. The SAR command is a good choice to collect, save, and report system information.