Linux Shell exercises

1. Enter the directory two levels up from the current directory

Insert picture description here

2. Enter the user's home directory, create a new file file in the directory, a three-level directory fd/fd2/fd3

  • Enter the home directory
    Insert picture description here
  • Create a file
    Insert picture description here
  • Create a multi-level directory
    Insert picture description here

1) The long format information displays the information of the directory fd3 (not the content in the browse directory), indicating the permissions of the directory

Insert picture description here

  • Example result
    Insert picture description here
    • rwx owner user permission to read, write and execute
    • rx group member permissions are readable and executable
    • rx Other user rights are readable and executable

2) Move the fd3 directory to the fd directory

Insert picture description here

3) Pack the contents of the fd2 directory, and the result is named fd2.tar and stored in the fd directory

Insert picture description here

4) Create a new directory fdfile under the fd directory, and extract fd2.tar to the fdfile directory

  • Create the fdfile directory
    Insert picture description here
  • Unzip fd2.tar to the fdfile directory
    Insert picture description here

5) Create a new hidden file .myhide in the fd3 directory, the new file name is 1-9 numbers, and .mp3 is the suffix file

  • Create hidden files
    Insert picture description here
  • Create files in batch
    Insert picture description here

6) Write content in the hidden file .myhide, and create a hard link hfile of the file in the fd subdirectory fd2

  • Write content to hidden files
    Insert picture description here
  • Create hard link
    Insert picture description here

7) Delete all files in the fd3 directory, but do not delete the directory itself

  • Delete all files except hidden files
    Insert picture description here
  • Delete hidden files
    Insert picture description here

3. Save the line containing root in the /etc/passwd file to the test.info file in the home directory

  • Enter the home directory
    Insert picture description here
  • Create test.info file
    Insert picture description here
  • Copy information to test.info
    Insert picture description here

4. Copy /etc/passwd to the current home directory, write your name in the first line, keep the first 5 lines, and delete the other lines. Edit the copy file with the vi editor, and replace the root of the full text with SUPER

  • Copy passwd file to home
    Insert picture description here
  • Edit passwd
    Insert picture description here
  • Show line number
    Insert picture description here
  • Delete rows 6 to 42
    Insert picture description here
  • Replace root in the text with SUPER
    Insert picture description here

Guess you like

Origin blog.csdn.net/L333333333/article/details/102492545