Experiment 3

4. Experimental conclusion

1

.

history command to view the command history, ! -3 Re-execute the third-to-last command

 

The command alias sets an alias for ls -l, and unalias cancels it

 

 

The script ex3 is used to output four statements

The characters in double quotation marks are treated as ordinary characters except $,`,\.

 

2.

(1)

/etc/passwd stores the password file, each user in the file has a corresponding record line, which records some basic attributes of the user

 

 The /etc/shadow file is a shadow of the passwd file. The record lines in the /etc/shadow file correspond to those in /etc/passwd, but only the system administrator can modify and view them.

 

 

 /etc/group stores information about local user groups

 

/etc/gshadow is the encrypted information file of /etc/group, such as user group (Group) management password is stored in this file

 

(2)

The id command can view the uid and gid by the user name, and the option -u can view the effective uid

 

(3)

1.

The command which can view the location of the executable file 

whereis to view the location of the file

locate cooperates with the database to view the file location

find actually searches the hard disk to query the file name

 

2.

The grep command can search text through regular expressions and print the matching lines, the option -n can print the line number, and -E can use multiple regular expressions

 

3.

sudo apt install gimp command can install gimp

sudo apt remove gimp command is used to uninstall gimp

which gimp is used to see the location of the file

 

4.

The option -d can customize the delimiter, -f displays the content in the specified field, the above command specifies the space as the delimiter, and displays the content in the 1st and 8th fields

 

5.

-t can sort the results by time, -r means sort in reverse order

 

6.

View the files in the /usr/share/man directory

View the files named man1,man2...man8 in this directory

View the files in the /usr/share/man/man1 directory

The file command can identify the file type, and then creates a new directory temp, copies ls.1.gz to the temp directory, and decompresses it with the gzip command

 

7.

ls -l finds files in the /home directory, grep "^d" filters files whose lines start with d, and wc -l counts the number of lines

 

8.

sudo adduser command added new user user7

 

(4)

1.

 

2.

 

3.

 

4.

 

(5)

/etc/apt/sources.list is the configuration file used by the package management tool  apt to record the location of the package repository

The sed command can be used to replace characters. In the above figure, replace all one in the test file with two

 

(6)

 

 The curl command is a file transfer tool that works from the command line using URL rules. It supports file uploading and downloading, so it is a comprehensive transfer tool, but according to tradition, curl is used to be called a download tool. As a powerful tool, curl supports many protocols including HTTP, HTTPS, ftp, etc. It also supports POST, cookies, authentication, downloading partial files from a specified offset, user agent string, speed limit, file size, progress bar and other features . To automate web page processing and data retrieval, curl can help.

 The wget command is used to download files from the specified URL. wget is very stable. It has strong adaptability in the case of narrow bandwidth and unstable network. If the download fails due to network reasons, wget will keep trying until the entire file is downloaded. If the server interrupts the download process, it will reconnect to the server and resume the download where it left off. This is useful for downloading large files from servers with limited link times.

 

3.

(1)

 

 (2)

1.-n11 means the input ends after 11 characters are entered

2. Search code and filename redirect to t1, then output from t1 to major

 

5. Summary and experience

  Through this experiment, I have mastered the use of special symbols such as wildcards, pipelines, and redirection in the shell, practiced the use of regular expressions in the shell, learned the use of common command tools, and mastered the establishment and operation of shell scripts. method of execution, etc.

 

Guess you like

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