1. Basic command skills of Linux

1. Basic command skills of Linux

1. Kernel: The kernel is the most basic part of the operating system, equivalent to the human brain, used to control, coordinate, and schedule system software and hardware. Common kernel versions are: linux windows unix (mac, ios, etc.).

2.linux: One of many kernel versions, the main feature is open source (open source code), therefore, its degree of freedom and customization is high.

3. Shell: equivalent to the protection layer of the kernel. Internally, it prevents the kernel from being tampered with by third-party software, protects the kernel, and provides an interface for communication and connection between the hardware and the system externally.

4. Summary of basic
shell operation knowledge: (1) The format of command execution in the shell: command name-parameter + operation object (- means parameter abbreviation,-11- means parameter complete spelling)

(2) The meaning of the command line prompt in the Insert picture description hereshell : 1. lin represents the user name of the user running the shell; 2. @ is the separator; 3. westoslinux represents the short name of the host where the system is located; 4. ~ user represents the current directory; 5. Identity prompt, # indicates that the current user is a super user, and the current user is a normal user.

(3) Common shortcut keys in the shell:
"ctrl"+"shift"+"c"-----copy (the mouse is selected in the shell to copy)
"ctrl"+"shift"+"v"--- --Paste (click the mouse wheel to paste)
"ctrl"+"shift"+"T"-----Open multiple windows in one terminal (as shown below:) Insert picture description here
"ctrl"+"shift"+"N "----Open a new terminal again after opening a terminal
"ctrl"+"c"-------------Cancel the execution of the current command (usually used when the command line is occupied)
"ctrl "+"d"-------------Close the shell (equivalent to "exit", it cannot be forced to close, it will be blocked when there is a process in the background, as shown below:)
Insert picture description here"ctrl"+" l"---------------Clear the current shell screen
"Tab"-----------------Complete the existing commands and files in the system , And some command parameters, when pressing tab once has no effect, it means that the information starting with this character is not unique. Pressing twice continuously will display all the content starting with this character. If it is pressed twice, it still does not display. The instruction at the beginning of this character. (The picture shows the result displayed by pressing the "tab" key twice after inputting ma)
Insert picture description here

  1. View the help of each command in the shell (the use of the man command)
    (1) Whatis + command name indicates the basic purpose of viewing the command. Insert picture description here"Note: When executing the whatis command, there is nothing appropriate in most cases because the help database of the system is not updated. At this time, you need to execute the mandb command under the root user. If the problem is still not resolved, the query command may not exist."

    (2) Command name + --help means to view the basic usage of the command.
    Insert picture description hereUsage: means how to use it. The content in "[...]" can be added or not, and does not affect the normal use of the command. "..." means how much content is The content in "<>" must be added.
    Directory: a directory of achievable functions,-letters: parameters and explanations of specific commands.

    (3) man + command name means detailed explanation of command usage, where man is the abbreviation of manual
    Insert picture description hereand the difference between "whatis and –help" is that the "man" command will occupy the shell command line, and you need to press "q" when you continue to enter other commands Exit the "man" command.

Corresponding shortcut keys also exist in the man command:
(1) "/keyword" means to search for keywords and highlight them. (2). After successful display, "N" means page up matching, "n" means page down matching; (the highlighting effect is shown in the figure:). (3). "G" means quickly move to the end of the man, "g" means quickly move to the front of the man.
Insert picture description here
man -k + command name indicates the command level of the command (as shown in the figure, gedit only appears as a command in bash, and passwd exists as a command and file)
Insert picture description here
Insert picture description here
. The man level corresponding to the specific number:
man---- -1 Command
man-----2 System call
man-----3 Function library call
man-----4 Special files (device files, etc.)
man-----5 File
man----- 6 Game
man-----7 Special package
man-----8 System management commands
man-----9 Kernel information rules

  1.  shell中的历史命令查看和调用(history)
    

history: indicates to view the history commands in the shell (the history records 1000 by default, and will be overwritten one by one after exceeding)

history -c: Clear the history of the current shell (the history still exists in the new shell). Open all files in the user's home directory, find the hidden file .bash_history and delete it to completely delete the history commands.

Use the "up" and "down" keys to call the historical commands you want to use line by line; "!number" means to call the specified line of historical commands; "! character" means to call the most recent historical command beginning with this character; "ctrl+r" means Enable the history search mode, after entering a keyword on the command line, the most recent history command containing this keyword will be displayed. (The picture shows the history of calling 20 lines)
Insert picture description here
7. Practice exercise
1. By viewing the detailed usage of the date command, output the year, month and day after n days in the shell (output example: 2020-01-01).
Insert picture description here
Use the man command to filter out the parameter "-d" that may be used, and enter "date-for the first time." After d 80", the system reported an error. After adjusting the input, I tried several times and got the correct command format. After listening to the man command, I found the required output format (format) "%m, %d, %Y", and finally got the standard output : 2020-11-18

Guess you like

Origin blog.csdn.net/lb1331/article/details/109160593