Basic principles of Linux:
1. A small program consisting of a single purpose, combining small procedures to complete complex tasks;
2. All documents;
3. Avoid capturing user interfaces as much as possible: minimizing interaction with users;
4. The configuration file is saved in plain text format;
Bash and its features:
Shell: Shell Program
Gui:gnome,kde,xfce
Cli:sh,csh,ksn,bash,tcsh,zsh
Command prompt, Orimpt,bash (shell)
#: Root
$: Normal User
Command type:
Built-in commands (shell built-in)
External command: There is an executable file corresponding to the command name in a path on the file system
Type: Shows which type the specified command belongs to
Command format: commands [option] [Paremeter]
Option
Short Options:-
Long options:--
Query for command:
which [-A] command
-a lists all found commands
Use of Bash shell:
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 + <-: jumping between words
Ctrl+l: Clear Screen
Command history:
History :
- C: empty command history
-D: Delete the specified command history, offset [n]
-W: Saves the command history of the buffer to the history file/home/username/.bash_history
!n: Executes the nth command in the command history
!-n: Executes the last 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
!$: Referencing the last parameter of the previous command
ESC.
Command aliases:
Alias--View the current command alias
alias command= ' command [option] ... '--Create a command alias
unalias Command--Revoke alias
--aliases defined in the shell are valid only in the current shell life cycle: The valid range of aliases is only the current shell process;
Quotes supported by bash:
": Command substitution
"": weak reference, can implement variable substitution
': Strong reference, do not complete variable substitution
Command substitution:
$ (command)
' Command '
--the process of replacing a subcommand in a command with the result of its execution
Touch./file-$ (Date +%f-%h-%m-%s)
Touch./file-' Date +%f-%h-%m-%s '
File wildcard characters:
Mans 7 Glob
*: Any character of any length
?: any single character
[]: matches any single character in any range
[^]: Exclude a single character from a specified range
[[: Space:]]: white space characters
[[:p UNCT:]]: punctuation
[[: Lower:]]: lowercase letters
[[: Upper:]]: Uppercase
[[: Alpha:]]: Uppercase and lowercase letters
[[:d Igit:]]: Number
[[: Alnum:]]: Numbers and uppercase and lowercase letters
Some of the basics of using Linux and bash