One of the basic features of the bash shell
First, the Order history
Bash records the command that the user executed in the shell session in the buffer, and when it exits normally, it is recorded in the current user's home directory. Bash_history;
Environment variables:
Histsize: The number of records in the command history;
Histfile: Command history file path;
Histfilesize:
History command:
-C: Clears the command history;
-D #: Deletes the command specified in the history;
-A: When the history in the buffer is manually appended files;
History #: Shows the number of recent commands;
Invoke commands that have been executed in the past:
!#: Call the # # command in history;
!: Repeat the previous command
!string: Invokes the last command in history that starts with a string;
Call the last parameter of a command that has been executed in the past:
!$:
Esc.
ALT +.
Second, command completion
Command Search mechanism:
Path environment variables: paths separated by colons
Hash: The previous search to the path cache into memory;
Kv:key-value
LS--/bin/ls
Command completion: TAB
Third, Path completion
Starts the current path of the path string given by the user and searches for the file name at the beginning of the specified string, under its specified parent directory;
If only: direct completion;
Otherwise: two times tab, can be listed;
Four, command line expansion of the function
~: Expands to the current user's home directory;
~username: Expands the home directory for the specified user;
{}: Can host a comma-delimited list and expand it to multiple paths;
/var/{log,cache,run} =/var/log/var/cache/var/run
V. Execution result status of the command, tracked and saved by bash
Success: 0
Failed: 1-255
Bash uses a special variable $? To save the status result of the most recent command;
There are two ways to execute a program:
The return value of the program;
The status result of the program;
Six, command aliases
Another reference symbol for the command, maintained by the Bash program;
Alias/unalias
Alias: view all defined aliases;
Alias Name=command: Define aliases;
If the alias is the same as the original command name and you want to execute the original command directly, you need to use \command
Unalias name: Revoke alias;
This article is from the "10,000-hour Law" blog, be sure to keep this source http://daisywei.blog.51cto.com/7837970/1687824
One of the basic features of the bash shell