Experiment 3

1. Command history in the shell
There are two ways to view the command history, the easiest is to use history

and the other is to view the historical command file, first use the echo command to output the historical command file name

and then use the cat command to view the content

2. Alias
​​aliases are used A string to replace the existing command can simplify the use of the command. Here is an example

3. The usage of
special characters. Special characters are wildcards. Commonly used ones are , ? , [], !
Can it be used to match filenames in general
? It is generally used to replace an arbitrary character
[], which is equivalent to the usage of an array, which can make the command more brief
! Generally means "not" Operation
4. Briefly describe the use of passwd, shadow, group, and gshadow
passwd contains the information of each account, and then there are 7 fields to display these information, such as: login name, password, user digital id, user group number id and so on.
The shadow contains the password information defined by the special account, and has 9 fields to display this information, such as: username, password, the last time the password was changed, and so on.
group contains information about user groups in this system, including group name, password, group id, and user list.
gshadow contains group encryption information, including group name, group password, user list, and more.
5. The id command

The id command displays the real and effective user id and group id.
The UID number of the user ubuntu is 500, the GUD number is 500, and the user ubuntu is a member of the following group
id -u displays the id of the current user, id -root displays the root user id, id -u ubuntu displays the id of the ubuntu user
6. The file command displays file information, mkdir creates a folder, cp copies the file to the specified directory, and cd opens the folder , ls lists file information, gzip decompresses files
7, ls -l /home | grep "^d" | wc -l
This command is understood as: first list the files of /home, and then grab the symbol condition "^d" file, and then output the number of lines in the file
8, sudo add user7
to add a user
9, ls /home | tee users |wc -l

to list home, and then enter it into users, if there is no users file, create one, Then output the number of lines of the file
10.
Find the file

Find the line of BUFSIZ, enter the correct match, and redirect the wrong information to the ~/temp/tmp file.

11. Display the bash user information record

12.
First, follow the delimiter ":" Read out columns 1 and 3, then specify the second column according to the separator ":", and finally arrange them in numerical order

13. Experience awk, sed
awk and sed are both data processing tools





14, curl and wget are both linux The download tools below have a lot of overlapping functions. curl is more used for web requests and interaction with browsers, while wget is more used for downloading files.
15. Scripting 1


16. Scripting 2

Experiment summary:
Generally speaking, the receipt of this experiment is quite large. In the experiment, many commands are used to check the data, and the topics given are also written by myself through continuous attempts, and I have learned a lot of linux. command and understand their role. The most impressive thing is the query of the file, the query of the file content, and the writing of linux scripts, which are also very useful and can simplify many complex operations. I remember that it took a lot of time to find and download the sdk of android under linux. For a long time, if you look for it again today, it may only take a dozen seconds to find it.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324981778&siteId=291194637