Commands to learn in this section:history,alias,ualias,\cmd
Skills learned in this section:
Features of Bash
Cursor Jump
View command History
The use of command history tips
To alias an order
Command substitution
File name wildcard character
Shell: Shell
Gui:gnome, KDE, XFCE
Cli:sh, CSH, ksh, bash, tcsh, zsh
Process: In each process it appears that only the kernel and the current process exist on the current host
A process is a copy of a program, and a process is a program execution instance
User Working Environment :
Bash:
#: Administrator Command prompt
$: Normal user command prompt
Features of bash:
1. Command history, Command completion
2, Pipeline, redirect
3. Command aliases
4. Command line editing
5. Command line expansion
6. File name Wildcard
7. Variables
8. Programming
command-line editing :
cursor Jump :
Ctrl+ A: Skip to the beginning of the command
ctrl+e: Jump to the end of the command line
ctrl+u: Delete the cursor to the beginning of the command line
ctrl+k: Delete the cursor to the end of the command line
ctrl+l: Clear Screen
Command History :
history: Viewing command Histories
-C: Empty command history
-D OFFSET [n]: Delete command at specified position
-W: Save the Command history to the history file
Environment variables
Path: Command Search Path
Histsize: Command history buffer Size (can be viewed with 'echo $HISTSIZE')
the use of command history tips :
!n: Executes the nth command in the command history;
!-n: Executes the reciprocal nth command in the command history;
!: Executes the previous command;
!string: The most recent command in the command history that starts with a specified string
!$: Reference the last parameter of the previous command, or use "ESC +.";
Text-related commands
View: Cat, TAC, more, less, head, tail
Statistics: WC
Handling: TR, cut, join
Sort by: Sort
Uniq
Command completion, PATH completion
Command completion: The search PATH environment variable specified by each path under the string we give the beginning of the executable file, if more than one, two times tab, you can give a list;
Path completion: Search for each filename under the starting path we give, and try to complement it;
Command Alias
Alias cmdalias= ' COMMAND [options] [arguments] '
Aliases defined in the shell are valid only for the current shell life cycle, and the valid range of aliases is only the current shell process;
Alias: Show commands for all current aliases
ualias cmdalias : Revoke command aliases
Typecommand: see if the commands are binding additional parameters
\cmd: Using the original property of the parameter command
command substitution : $ (command), anti-quote: ' command '
To replace a subcommand in a command with the process of executing the result
quotes supported by bash :
": Command substitution
"": weak reference, can implement variable substitution
': Strong reference, do not complete variable substitution
file name wildcard , globbing
*: Any character of any length
?: any single character
[]: matches any single character within the specified range
[ABC], [A-m], [A-z], [A-z], [0-9], [a-za-z], [0-9a-za-z]
[: Space:]: white space character
[:p UNCT:]: Punctuation
[: Lower:]: lowercase letters
[: Upper:]: Uppercase
[: Alpha:]: Uppercase and lowercase letters
[:d igit:]: Number
[: Alnum:]: Numbers and uppercase and lowercase letters
Ways to get these lists: Man 7 glob (I didn't succeed)
[^]: matches any single character outside the specified range
[[: Alpha:]]*[[:space:]]*[[:alpha:]]: Get a file that starts with a letter, ends with a letter, and has spaces in the middle
[[: Alpha:]]*[[:space:]]*[^[:alpha:]]: Get a file that starts with a letter, does not end with a letter, and has spaces in the middle
Practice:
1, create A123, Cd6, c78m, C1 My, m.z, K, 8yu, 789 and other documents; Note that the above files are separated by commas, and the other symbols are part of the file name;
2. Display all files beginning with a or m;
LS [am]*
3. Display all files containing numbers in the file name;
LS *[0-9]*
LS *[[:d igit:]]*
4. Display all files that end with a number and do not contain a blank in the file name;
LS *[^[:space:]]*[0-9]?????????
5. display files with special symbols of non-letters or numbers in the file name;
LS *[^[:alnum:]]*
Linux Beginner Note five: Bash features in detail! (Video serial number: 03_2,3)