1. Know linux and shell
Linux operating system: GNU/Linux. GUN is an open source organization. Linux refers to the Linux kernel
(kernel: system core program, responsible for system program and hardware allocation and scheduling)
shell: provides external operation and system communication interfaces, and internally protects the kernel.
The shell used by default in RHEL8 Is bash; bash=GNU Bourne-Again SHell
2. Shell related knowledge points
(1) How to open the shell
1. Right-click to open: click the right button of the mouse and select open terminal
2. Place the mouse on Application in the upper left corner, select favorite, and then select terminal
3. Enter the command gnome -terminal
4. When the shell is opened, a new one needs to be opened In the shell, you can open it with ++ in the shell
5. You can set any shortcut key in the settings to execute the gnome-terminal
method: settings —> Devices —> Keyboard
(2) Shell command line prompt:
[root@localhost Desktop]
#Meaning:
root: the user who runs the shell
@: separator
localhost: the short name of the system host The short name of the current host with the domain name removed
Desktop: the current directory name
#: identity The prompt # indicates that the current user is a super user, and the current user is a normal user
(3) Shortcut keys in the shell
hot key | Features |
---|---|
< ctrl > + < shift > + < T > | Open multiple windows in one terminal |
< ctrl > + < shift > + < N > | Reopen a terminal |
< ctrl > + < c > | Cancel command execution |
< ctrl > + < d > | Close the shell |
<ctrl >+< shift> +<select by mouse>+< c> | Copy selected characters |
< ctrl > +< shift > + < v > | Paste |
Mark as copy | |
Press the mouse wheel to paste | |
< ctrl > + < 左|右 > | The cursor moves in units of words |
< ctrl > + < a > | Cursor to the beginning of the line |
< ctr l> +< e > | Cursor to the end of the line |
< ctrl > + < u > | Delete the character under the cursor to the beginning of the line |
< ctrl > + < k > | Delete the character under the cursor to the end of the line |
(4) How to execute commands in the shell
1) Command execution format
Command parameter object
Command: program
parameter: the special function of the command
object: operation target
2) command execution method
Some commands can be executed individually
and multiple parameters can be added -a -b -c = -abc = -cba = -acb
parameter -s means the word abbreviation
parameter -size means the word is spelled out The
command must be entered after the line prompt, otherwise the command cannot be executed
when the command line is occupied, usually use + end to occupy the command line Program to release the command line
3. Get help from the command line
- Search command
whatis + command to view the basic purpose of the
command whoami + command to view the current user
whereis + command to view where the command is
① whereis command: commands to find binary, source files and help documents
② Which command: the above two commands can only search for system commands, not search Ordinary file
difference: Whereis command can find the location of the help file
while searching for binary commands. While command is searching for binary commands, if the command has an alias, you can find the alias file.
Note: The #command name: nothing appropriate appears during the viewing process.
①It means that the content to be viewed is not helpful.
②The system help data is not updated, and the mandb command is updated under the root user.
- --Help help command
“[ ]” | The content in can be added or not |
“....” | Any number of contents in |
“<>” | Indicates elements that must be added when the command is executed |
- The help command (basically not used)
can only get help for shell built-in commands
- man command
man -k passwd passwd keyword how many levels of man
1 | command |
2 | System call |
3 | Function library call |
4 | Special files (device files, etc.) |
5 | file |
6 | game |
7 | Special bag |
8 | System management commands |
9 | Kernel Information Rules |
/Keyword | search for the keyword |
n | Match down |
N | Match up |
G | Move quickly to the end of the man |
g | Means to move quickly to the front of man |
q | drop out |
Four, Linux command line history call
1.history view historical commands
2. history -c clear current historical commands
3. To permanently clear the history, you need to clear the file.bash_history
History command call:Up key|Down key | Call line by line |
!digital | Call the specified line history |
!character | Call the most recent history beginning with this character |
< ctrl > + < R > | Turn on the history search mode, the command line display will change to: |
(reverse-i-search): | Enter keyword--display the most recent history containing this keyword |
Five, <TAB> key
Complete the commands, files and parameters of some commands that exist in the system
When pressing tab once has no effect, it means that the information starting with this character is not unique. If you press twice in a row, all content starting with this character will be displayed. If it is still not displayed twice, it means that there is no command starting with this character