One, pipe and operation control
1, the pipe symbol "|", is to put the results of the previous command run to the following command.
LS |wc-l; LS |grep test
2, how we are editing a file, want to pause this operation and exit can enter Ctrl Z Pause task
3. Jobs View background tasks
4. Bg[id] Transfer the task to the backstage; Fg[id] Move the mission to the front desk.
5, the command behind & directly dropped to the background, sleep 100 refers to the pause 100 seconds, and then continue to run
Second, shell variables
1. Get system variables using the command env command
PATH, HOME, PWD, logname, etc. are all variables.
Custom variables
Format: Variable name = variable Value
Variable name rule: it can be a letter, a number, an underscore, but the first cannot be a number.
Variable Value rule: you need to enclose the special symbol in single quotation marks. (special symbols include spaces)
Variable value overlay, such as c=a, variable b value, c
Global Variables Export
When we customize a variable on a terminal, it is limited to the shell under the current terminal to take effect, if you open a sub-shell under this terminal, this variable is not synchronized past, this is called non-global variables. If you want all of the child shells to synchronize this custom variable, use the global variable command: Export (only valid from top to bottom, not vice)
If you want to cancel a custom variable, use the command: unset variable name
III. environment variable configuration file
1,/etc/profile: This file presets a few important variables, such as path, USER, LOGNAME, MAIL, INPUTRC, HOSTNAME, histsize, umask, etc.
2,/ETC/BASHRC: This file is mainly preset umask and PS1. This PS1 is the string of characters in front of us when we are knocking at the command:
(\u is the user, \h hostname, \w is the current directory, $ = ' # ', the average user is displayed as ' $ ', the root user is shown as #)
With color setting: ps1= ' [\033[01;32m]\[email protected]\h[\033[00m]:[\033[01;36m]\w[\033[00m]\$ '
Pipe and job control, shell variables, and environment variable profiles