bash shell(1)

Transfer from: http: //my.oschina.net/appleliu/blog/14689

 

1, bash shell has a command memory (history), command history recorded in ~ / .bash_history, a total of 1000 commands can be recorded.

However, the current commands entered at login will not be recorded before then log off, because the commands are temporarily stored in memory, the system will be written to the write-off in .bash_history. However, we still have to select the commands entered by the up and down direction!

2, alias: alias lm = 'ls -al' to cancel the alias unalias lm (Note: The next time you log in, the alias will be canceled).

However, alias lm = 'ls -al' write ~ / .bashrc, the command may be saved permanently.

3, type query whether the shell built-in commands.

4, if the command entered is too long, can be used '/ [Enter]' ([Enter] button is followed by slash (/) a) Line:

5, in order to distinguish custom variables and environment variables, environmental variables are generally capital letters, such as: PATH, HOME, MAIL, SHELL like. The echo command can get the actual value of the variable.

6, custom variables: myname = apple (not directly equal on both sides by a space character, the variable contents may be used if a space character in double quotes, "", "or single quotes' '' combines the variable content)

 

7. In a series of instructions, you also need to provide information by other commands, you can use single quotes' `` command 'or' $ (command). " Special attention, that `top of the keyboard are numeric
keys 1 left the keys, rather than single quotes! For example, want to get core version of the set:
"version = $ (uname -r)" and then "echo $ version" available "2.6.18-128.el5"
8. If the variable is amplified variable content, available "variable name $" $ {variable} or accumulating contents, as follows:
"PATH =" $ PATH ": / home / bin "

 

9. If the variables need to perform other routine, you need to export the environment variable to the variable becomes:
"export PATH」
. 10 uppercase characters are usually the default variable, set their own variables can use lower case characters, easy to judge ( purely in accordance with user interests and hobbies);
11 cancellation method is to use variable unset:. "unset variable name" myname for example cancel the setting:
"unset myname"

Reproduced in: https: //my.oschina.net/dake/blog/196738

Guess you like

Origin blog.csdn.net/weixin_33943836/article/details/91508376
Recommended