Command editing ability (history):
One of the great features of Bash is that "he can remember the commands he used!" "This is a really great feature!" Because I just press "up and down" in the command column to find the front/rear input command! In many distribution, the default command memory function can reach 1000! In other words, almost all of the commands you have issued have been recorded.
Where are all the commands recorded? In your home directory. Bash_history! Note, however, that ~/.bash_history records the commands that were run before the previous login, and that the commands that were run at this time are cached in memory, and the command memory is logged when you successfully log off the system. Bash_history!
What is the function of this? The biggest benefit is the ability to "query the actions that have been done!" "So you can know your running steps, then you can track the commands you have issued as a tool for debugging!" But there is also an annoyance, that is, if hacked, then he just turn over the command you have run, just your command and system-related (such as direct input MySQL password on the command line above), then your host can be nerve-racking! Is it better to record more or less commands? This part is a matter of opinion, there is no definite answer.
Command and file completion features: ([tab] key Benefits)
[Tab] is followed by the first word of a sequence of commands, then the command is complete;
When [Tab] is next to the second word of a string of commands, it is "file completion"!
Command alias Configuration feature: (alias)
You can enter alias in the command column to know what the current command aliases are! You can also configure aliases by issuing commands directly:
Job control, foreground background control: (Jobs control, foreground, background)
The use of pre-and background control can make the work more smoothly! As for job control (jobs), it's more versatile and allows us to throw work into the background at any time! Instead of accidentally using the [Ctrl] + C to stop the program! That's good! In addition, can be in a single sign-on environment, to achieve multi-tasking purposes!
Programmatic scripting: (shell scripts)
In the DOS era, remember the so-called "batch file" that writes a bunch of commands together? The shell scripts under Linux is more powerful, it can write a sequential command that your usual management system needs to release, which can be used to detect the host in interactive way! It can also be designed with environment variables and related commands provided by the shell. Before DOS requires programming language to write things, under Linux using a simple shell scripts can help you reach!
Wildcard character: (Wildcard)
In addition to the complete string, bash supports a number of wildcard characters to help users query and command release. For example, do you want to know how many files with X at the bottom of/usr/bin? Use: "Ls-l/usr/bin/x*" will be able to know ~ In addition, there are other available wildcard characters, which can speed up the user's operation!
Bash Shell built-in command: type
How do you know if this command came from an external command (referring to other commands not provided by bash) or built into bash? Hey! Use the type command to observe! For example:
[Email protected] ~]#type [-TPA] nameoptions and Parameters: when no options and arguments are added, type shows whether name is an external command or bash built-in command-T: When the-t parameter is added, the type displays the name with the word "file:" as an external The command, alias: Indicates the name that the command is configured for the command alias; Builtin: Indicates that the command is a command function built in bash; p: The full file name is displayed if the name that follows is an external command;-A: It is defined by the PATH variable. Path, all commands with name are listed, including the aliasExample one: query ls This command is built in bash? [Email protected] ~]#type lsLS is aliased to ' LS--color=tty '<== does not add any parameters to list the main usage of LS[Email protected] ~]#type-t lsAlias<== lists only the LS run-time basis[Email protected] ~]#type-a lsLS is aliased to ' LS--color=tty '<== First use of AliaseLS Is/bin/ls<== also found an external command in/bin/lsexample two: So what about CDs? [Email protected] ~]#Type cdCD is a shell builtin<==, you see that? The CD is a shell built-in command
|
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Linux-bash shell functionality; built-in command type