Linux pipe character is, in the environment variables redirection

1, input and output redirection
input redirection refers to the import file to the command, and the output is redirected to the original data to be output to the screen information is written to the specified file
to redirect standard input (STDIN, file description 0 ): default input from the keyboard, may also be entered from another file or command
standard output redirection (sTDOUT, as described in document 1): default output to the screen
error redirection (STDERR, as described in document 2): the default screen output to
the input and symbols used in the redirection action
command <file as a command file standard input
command section break << reads from the standard input, to know met stopped section break
command <document 1> file file 1 2 2 is output to a file as the standard input and standard commands

And output symbols used in effect redirection
command> file standard output to a file (original file data is empty)
command 2> file error output is redirected to a file (original file empty data)
command >> file standard output to a file (appended to the original content)
command file 2 >> error output is redirected to a file (appended to the original content)
command >> file 2> & 1 & >> file or command standard output and error output is redirected to a file (added later to the original content)
Linux pipe character is, in the environment variables redirection
2, character command pipeline
conduit in order to break the previous command is supposed to be output to the screen after standard normal data as a standard command input
Linux pipe character is, in the environment variables redirection
3, a wildcard command line
Linux pipe character is, in the environment variables redirection
Linux pipe character is, in the environment variables redirection
5, the commonly used escape
four most commonly used escape
backslash \ use a variable back into a simple string backslash
single quotation marks '' escape wherein all variables as a simple string of
double quotation marks "" wherein the retention variable properties, without escaping
backquote '' returns the result executes the commands
! [ ] Linux pipe character is, in the environment variables redirection
Linux pipe character is, in the environment variables redirection
5, important environmental variable
variable is a computer system used to store variable data type worth
after the user executes a command, linux system in the end what happened? Typically, the command execution in linux four steps
The first step: determining whether a user to have an absolute or relative path command input mode? (E.g., / bin / ls), and if so direct execution
Step two: Linux system check commands entered by the user is "Alias commands", that is to replace the original command name with the name of a custom command. The alias command can be used to create one of their own command aliases, in the format "alias alias = command." To cancel a command aliases, it is unalias command in the format of "unalias alias." When you delete a file before we use the rm command, Linux systems will require us to re-confirm whether the deletion, in fact, this is the alias rm command Linux system to prevent users from accidentally deleted files and deliberately set, then we cancel it:
Linux pipe character is, in the environment variables redirection
first three steps: Bash interpreter determines a user input command is an internal or external command. Internal command interpreter is an internal instruction is executed directly; most of the time while the user input is an external command, these commands referred to step 4 to continue the processing. You can use "type the command name" to determine the order entered by the user is an internal command or external command.
Step four: the system looks for files in multiple paths in order entered by the user, these paths defined variable called PATH, it can simply be understood as "the interpreter's little helper", is to tell the Bash interpreter to be the position of command may be stored, and then one by one to find Bash interpreter will obediently in these locations. PATH variable values composed of a plurality of paths, each path between values separated by colons of these paths add and delete operations will affect the look of the Linux Bash command interpreter.
Linux pipe character is, in the environment variables redirection
There are more classic question: "Why can not the current directory to the PATH in it (.)?" The reason is that, although the current directory to the PATH variable, which in some cases allows users to free (.) enter the path to command the trouble lies. However, if stored for a ls or cd command with the same name as in the more common public directory / tmp file, the user happened to execute these commands in the public directory, then it is very likely in the move.
So, as a cautious, experienced operation and maintenance personnel, took over after a Linux system will first check before executing the command for suspicious directory PATH variable, whether from another reader in the previous example PATH variable also particularly useful environment variables feel it. We can use the env command to view the Linux system all the environmental variables;
Linux system common 10 grid system variable
home directory HOME users (ie home directory)
SHELL user in the use of shell interpreter name
history command HISTSIZE output record
HISTFILESIZE saved command number of records
MAIL mail storage path
LANG system language, language name
rANDOM generates a random number
PS1 Bash interpreter prompt
pATH definition interpreter search user executing the command path
eDITOR user's default text editor
Linux pipe character is, in the environment variables redirection
by export variable promoted to global variables
Linux pipe character is, in the environment variables redirection

Guess you like

Origin blog.51cto.com/11019782/2482944