In a Linux environment, if you don't know bash, then you don't have to learn anything else. The core of Linux was the kernel, and our users had to interact with the kernel through something to manipulate Linux. This thing is the shell. The shell is actually a user interface, here we mainly describe the most commonly used bash shell. He is the Linux preset shell.
1. First introduce several instructions:
History: Command modification ability to list the used commands up to 1000.
Tab: Command and file completion ability, previously introduced.
Alias: command alias setting function, alias lm = ' Ls-al ' most commonly used
Shell scripts: Programmatic scripting
Wildcard: Wildcard characters, such as x*, represent files that begin with X
Type: types directive, for example, type name shows whether the name is an external command or a bash built-in instruction
Echo: The use of variables, in addition to the usual Echo $PATH, as well as echo $HOME, etc.
2. Variables are also a very important content, similar to the definition of variables in C, when assigning a variable to the equal sign can not be directly connected to the space, and also the difference between double and single quotation marks, for example:
var= "Lang is $LANG", the echo $var shows Lang is en_US
Var= ' Lang is $LANG ', the echo $var shows Lang is $LANG
3. To execute a variable in another subroutine, use export to change the variable to an environment variable, which is the export PATH
If you want to cancel a variable, use unset, which is unset myname
4. env command to observe environment variables and their contents
5. The set directive allows you to observe all variables, including environment variables and custom variables
6. Prior to the history directive, here is an example:
History 3 is a list of the latest three instructions, you can see is history,history and History3, the front number is number, if the operation! 1019 is the execution of the history of this command,!! is to execute the previous instruction, that is, History 3,! Al will execute the command at the beginning of al.
History-w will write the history to the ~/.bash_history.
7. Okay, here's a formal introduction to bash. We know that when users log on to Linux, they sometimes let you lose passwords and usernames, which is called the login shell, which means that the full login process is required for bash, without losing direct access to the Non_login shell.
In fact, the login shell will read two configuration files:
1)/etc/profile: This is the overall system settings, it is best not to modify
2) ~/.bash_profile: Personal settings belonging to the user
8. The source command reads into the environment configuration file and can read the contents of the configuration file into the current shell environment, using the source filename
9. Prior to the wildcard, I think it is more important to have the following: 1) ll-d/etc/cron* display cron start file 2) ll-d/etc/????? Show????? File 3) ll-d/etc/*[0-9]* display the file name with the number 4) ll-d/etc/[^a-z]* display the first non-lowercase letters
/dev/null is a garbage black hole device, if you want to remove some useless files, just put it in/null, and it is not recoverable, such as Find/home-name. BAHSRC 2>/dev/null is to remove BASHRC
Previously introduced interception, is |, for example LS-AL/ETC | Less means to use LS to display the output of the content, and then use the less function to turn the page processing.
Learn from the learning of Linux (10)--Know and learn bash