Look at Linux like this

1. Shortcut
Tab key for command prompt
Ctrl+c to forcibly terminate the current program without exiting the terminal
Ctrl+d to exit the terminal
Ctrl+s to pause the current program, press any key to resume operation after pause
Ctrl+a to move the cursor to the beginning of the input line, Equivalent to Home key
Ctrl+e to move the cursor to the end of the input line, equivalent to End key
Ctrl+k to delete from the cursor position to the end of the line

2. Shell commonly used wildcard
* matches 0 or more characters
? Match any single character
[list] Match any single character in
list [^list] Match any character except any single character in list
[c1-c2] Match any single character in c1-c2 such as [0-9] [ az]
{String1, String2,...} matches one of String1 or String2 (or more)
{c1...c2} matches all characters in c1-c2 such as {1...10}

3. In the Linux environment, if you encounter difficulties, you can use the man command, which is the abbreviation of Manual Pages.

After querying through the man command, part of the manual content is as follows:
NAME (name)
the name of the function used for the command, followed by a line of introduction
SYNOPSIS (summary)
for the command, formally describe how it runs, and what
command line parameters are required. For functions, introduce the functions required by the function and which
header file contains the definition of the function.
DESCRIPTION
The text description of the command or function function.
SEE ALSO (see)
list of related commands or functions

4. View the username of the currently logged in user: whoami

Create a lilei user: sudo adduser lilei
delete a lilei user: sudo deluser lilei --remove-home

5. User group

In Linux, each user has an attribution (user group). The user group is simply understood as a collection of users,
they share some resources and permissions, and have private resources, just like a home,
your brothers and sisters (Different users) belong to the same home (user group), you can jointly own this home (shared resources), your
parents treat you all the same (sharing permissions), you occasionally write a diary, and others cannot view it without permission ( Private resources and permissions).
Of course, a user can belong to multiple user groups, just as you belong to both a family, a school or a company.

View command: group shiyanlou
where the front of the colon indicates the user, and the back indicates the user group to which the user belongs

6. The ls command lists and displays the files in the current directory. The
ls -l command lists the files in a longer format.
Use the pwd command to get the current path (absolute path).

Insert picture description herePicture from: https://doc.shiyanlou.com/linux_base/3-9.png/wm
Insert picture description here Picture from: https://doc.shiyanlou.com/linux_base/3-10.png/wm

7. Command to change the file owner:
change the file iPhone6 ​​to the user shiyanlou: sudo chown shiyanlou iphone6

8. File directory map

FHS (English: Filesystem Hierarchy Standard Chinese: File System Hierarchy Standard)
FHS defines two levels of specifications. The first level is, what file data should be placed in each directory under
/ , for example, /etc should be placed in the configuration file, /bin and /sbin should place executable files and so on.
The second level is defined for the subdirectories of the two directories /usr and /var.
For example, /var/log holds system log files, /usr/share holds shared data, and so on.

Click the link to view the picture: https://doc.shiyanlou.com/linux_base/4-1.png/wm

9, Linux file operation

Create a directory: use the mkdir (make directories) command to create an empty directory.
Copy files: use the cp (copy) command to copy a file to the specified directory.
Delete a file: use the rm (remove files or directories) command to delete a file.
Delete a directory: follow the copy Like directories, to delete a directory, you also need to add the -r or -R parameter. Such as: rm -r family
move files: use mv (move or rename files) command to move files (cut). Format: mv source directory file destination directory
rename file: format: mv old file name new file name
batch rename: use rename and regular expression to
view files: use cat, tac and nl commands to view files, the first two commands Both are used to print the content of the file to the standard output (terminal), where cat is displayed in positive order and tac is displayed in reverse order.
nl command, add line number and print, this is a more professional line number printing command than cat -n.
View file type: In Linux, the file type is not judged according to the file suffix. We usually use the file command to view the file type

10. Use the vim tutorial command inside Linux: vimtutor

11. To read the value of the variable, use the echo command and the $ symbol. For example: echo $tmp is to view the value of tmp

12. set, env, export. These three commands are very similar, they are all used to print environment variable information, the difference lies in the variable range involved.

command Description
set Display all variables of the current Shell, including its built-in environment variables (related to the appearance of the Shell, etc.), user-defined variables and exported environment variables.
env Display the environment variables related to the current user, and let the command run in the specified environment.
export Display variables exported as environment variables from Shell, and also export custom variables as environment variables through it.

13. Commands related to search are commonly used whereis, which, find and locate.

14. cd /home/shiyanlou
zip -r -q -o shiyanlou.zip /home/shiyanlou/Desktop The
above command will package the directory /home/shiyanlou/Desktop into a file.
In the first command line, the -r parameter indicates recursive packaging, including all the contents of the subdirectory, the -q parameter indicates quiet mode, that is, no information is output to the screen, and -o indicates the output file, which needs to be packaged and output immediately file name.

unzip shiyanlou.zip unzip shiyanlou.zip to the current directory
unzip -q shiyanlou.zip -d ziptest Use quiet mode to unzip the file to the specified directory

Commonly used commands
zip:
pack: zip something.zip something (please add -r parameter to the directory)
unpack: unzip something.zip
specify the path: -d parameter
tar:
pack: tar -cf something.tar something
unpack: tar -xf something .tar
specifies the path: -C parameter

15. Built-in commands and external commands

The built-in commands are actually part of the shell program, which contains some relatively simple Linux system commands. These commands are written in the builtins of the bash source code. They
are recognized by the shell program and run inside the shell program, usually in Linux When the system loads and runs, the shell is loaded and resides in the system memory.
Moreover, it does not need to create a child process to parse internal command shells, so its execution speed is faster than external commands. For example: history, cd, exit, etc.

The external command is the utility program part of the Linux system. Because the utility program is usually more powerful, it contains a large amount of programs. When the system is loaded, it is not loaded into the memory along with the system, but when needed. It is transferred to the memory only when. Although it is not included in the shell, the command execution process is controlled by the shell program. External commands are installed in addition to Bash, usually placed in /bin, /usr/bin, /sbin, /usr/sbin, etc. For example: ls, vi, etc.

Use the type command to see what command it is. For example, type exit, type vim, type ls, etc. #Getting
this result shows that it is a built-in command. As mentioned above, the built-in commands are all builtins in the bash source code.
xxx is a shell builtin #Get
this The result shows that it is an external command, as mentioned above, the external command is in /usr/bin or /usr/sbin, etc.
xxx is /usr/bin/xxx
#If the result of alias is obtained, it means that the command is set by the command alias Given name;
xxx is an alias for xx --xxx

16. When you just know a piece of software and want to download and use it, you need to confirm whether it is in the software warehouse, and you need to use the search function. The command is as follows:
sudo apt-cache search softname1 softname2 softname3…… The
apt-cache command is for A tool for performing related operations on local data, search, as the name implies, searches for information about softname1 softname2 ... related software in the local database

17.
Have fun. Bring up two eyes: xeyes
digital rain: first install sudo apt-get update; sudo apt-get install cmatrix, then enter cmatrix
cmatrix -C red to change the color
stove effect: sudo apt-get install libaa-bin
aafire

sudo apt-get update
sudo apt-get install bb
/usr/games/bb

This is what I compiled after practicing on the laboratory building website. The URL is: https://www.shiyanlou.com/courses/1

Guess you like

Origin blog.csdn.net/qq_42524288/article/details/103727757