1. View the file content
1. View line 6 of the /etc/passwd file
2. View the line starting with SELINUX in /etc/selinux/config (use group to operate)
3. Find the line ending with no in /etc/ssh/sshd_config
4. Filter /etc/ssh/sshd_config lines containing numbers (use "group [0,9]" to find numbers from 0 to 9)
2. Text processing commands
1. View the contents of the first column of the /etc/passwd file with: as the separator, and sort them in reverse alphabetical order
"cut" delimiter, "-d:" defines delimiter, here is ":", "-f1" which field needs to be taken, here is "first line". "sort -r" sorts in reverse.
2. Use the cut command to cut and display the ip address of the current host
3. Copy and move
(1) Create a subdirectory dir in the /test directory, copy /etc/passwd to this directory
(2) Copy the /etc/ssh/sshd_config file to the /test directory
(3) Copy /etc/yum.repos. Copy the d/ directory to the /test directory
(4) Copy the /etc/hosts file to the /test directory
(5) Copy the /etc/hostname file to the /test directory
(6) Move the /test/sshd_config file to /test/ dir directory and renamed to sshd.conf
4. File search
1. In the $HOME directory and its subdirectories, find the files that were changed 2 days ago
Through the "find" method, "-mtime" indicates the time when the content was modified, and "-2" indicates the file name within 2 days.
2. Look for files starting with host in the /etc/ directory
3. Find the directory file under /test/
4. In the /test directory and subdirectories, look for files over 2KB
Five, package compression
1. Compress all files and folders in the /test directory into a myfile.zip file