当前位置:网站首页>I'm here to hand in my homework (week 2)

I'm here to hand in my homework (week 2)

2020-12-08 09:34:28 osc_ 3byfn0lk

The first 2 Zhou Homework

 

1. describe Linux System directory name naming rules and uses of the distribution .

 
Linux System directory name naming rules :
1) The file system starts at the root , use "/" Express
2) File names are case sensitive
3) With "." The file at the beginning is a hidden file
4) The file name is the longest 255 Bytes , The file name is the longest, including the path 4095 Bytes
5) File name except slash and NUL, All characters are valid
  
 Here comes my homework ( The first 2 Zhou )
Linux The purpose of each catalog in the system :








/boot   System boot file storage directory , The kernel files and bootloader are stored in this directory 
/bin   Store the basic commands used by all users , The directory cannot be partitioned independently , The files in this directory will be used when the system starts 
/sbin   Store the basic commands of the management class , The directory cannot be partitioned independently , The files in this directory will be used when the system starts 
/lib   It stores the basic shared library files and kernel module files that the program depends on when the system starts (/lib/modules)
/lib64   Dedicated to x86_64 The location of the secondary shared library files on the system 
/etc   Profile directory 
/home   Home directory for ordinary users 
/root   Administrator user's home directory 
/media   Portable mobile device mount point 
/mnt   Temporary file system mount point 
/dev   Storage location of equipment files and special files 
/opt   The installation location of the third party reference program 
/srv   Data used by services running on the system 
/tmp   Temporary file storage location 
/usr   Global shared read-only data path 
/var   A directory that stores frequently changing databases 
/proc   Virtual file system used to output kernel and process information 
/sys   It is used to output information about hardware devices on the current system virtual file system 

  

2. Describe the metadata information of the file , What do they mean respectively , How to view ? How to modify the time stamp information of a file ?

  
The information contained in the metadata of the file :

File: file name 
Size: file size ( Company :B)
Blocks: The number of blocks occupied by the file 
IO Block: The size of each block ( Company :B)
regular file: Ordinary documents ( The type of file is shown here )
Inode: Of documents Inode Number , The index node number of the file 
Links: Number of hard links 
Access: jurisdiction 
Uid:( Belong to id/ The name of the owner )
Gid:( Generic group id/ Group name )
Context: The environment in which the document is located 
Access: Last visit time access time (atime)
Modify: Data change time modification time (mtime)
Change: Metadata change time status time (ctime)
Creat: File creation time  

  
How to view file metadata :stat + file name
 Here comes my homework ( The first 2 Zhou )

How to modify the file timestamp information :touch command
Format :
touch [OPTION] FILE
Option description :


  • -a Just change atime and ctime
  • -m Just change mtime and ctime
  • -t [[CC]YY]MMDDhhmm[.ss] Appoint atime and mtime The timestamp
  • -c If the file doesn't exist , Do not create
     Here comes my homework ( The first 2 Zhou )
      

    3. Summarize the difference between soft link and hard link , And use examples to explain .

      
    1) The essence
    Hard links : The essence is the same document
    Soft link : The essence is not the same document
    2) Cross device
    Hard links : I won't support it
    Soft link : Support
    3)inode
    Hard links : identical
    Soft link : Different
    4) Link number
    Hard links : Create new hard links , The number of links will increase , Remove hard link , Reduced number of links
    Soft link : Create or delete , The number of links doesn't change
    5) Folder
    Hard links : I won't support it
    Soft link : Support
    6) Relative paths
    Hard links : The relative path of the original file is relative to the current working directory
    Soft link : The relative path of the original file is relative to the linked file
    7) Delete source file
    Hard links : It's just the number of links minus one , But access to linked files is not affected
    Soft link : Linked files will not be accessible
    8) file type
    Hard links : Same as source file
    Soft link : Link to the file , It has nothing to do with the source file
      
    Example operation description
    1) It's quite right f1.txt File information before and after hard link establishment :
    The hard link and the original file point to the same file , Have the same inode Number , When creating hard links, the number of links increases
     Here comes my homework ( The first 2 Zhou )
    2) It's quite right f2.txt File information before and after establishing soft link :
    Soft link is different from the original file , With different inode Number , The number of links does not change when creating soft links
     Here comes my homework ( The first 2 Zhou )
    3) It's quite right f1.txt Create hard link and soft link file information for different directories :
    When creating a hard link , The path of the original file is relative to the current working directory
    When creating a soft link , The path of the original file is relative to the file path of the soft link
     Here comes my homework ( The first 2 Zhou )
    4) Compare and delete f1.txt After source file , Whether the created hard links and soft links are available
    Hard links : The number of links minus one , Documents are available
    Soft link : File not accessible
     Here comes my homework ( The first 2 Zhou )
      








































    4. Linux What are the file management commands on , Its common use method and related examples demonstrate .

      



  • ls: List the content formats in the specified directory
    Usage method
    ls [OPTION]... [FILE]...   
    -a: Show all files including hidden files    
    -A: Show division . and .. All other files    
    -l,--long: Display the detailed attribute information of the file    
    -h: Unit conversion for file size , May affect accuracy    
    -d: Look at the directory itself, not its internal files    
    -r: Show files in reverse order    
    -R: Recursive display file
    Examples demonstrate
    ls -lah / --- Show in detail / All the files in the directory ( Including hidden files )
     Here comes my homework ( The first 2 Zhou )
    ls -ldh /etc --- Show in detail /etc Catalog
     Here comes my homework ( The first 2 Zhou )
    ls -lhv / --- Inverted display / All files in the directory ( Including hidden files )
     Here comes my homework ( The first 2 Zhou )
    ls -R /etc --- Recursive display /etc All the files
     Here comes my homework ( The first 2 Zhou )
      


















  • mkdir
  • Create a directory format :
    mkdir [OPTION]... DIRECTORY...  
    -p: Automatically create parent directories on demand    
    -m: Give permission when creating Directory
    Examples demonstrate
    mkdir -p /data/test/A/B --- stay /data Directory recursively create /test/A/B Three directories    
     Here comes my homework ( The first 2 Zhou )
    mkdir -m 711 -p /data/mode/A --- stay /data Directory recursively create mode/A Both directories specify the directory at the same time A The authority of is 711
     Here comes my homework ( The first 2 Zhou )







  • Delete directory format :
    rmdir [OPTION]... DIRECTORY...   
    -p: After deleting a directory, if its parent directory is empty , Then delete it together
    Examples demonstrate
    rmdir -p /data/mode/A --- Delete A After the directory ,mode The directory is empty , Delete
     Here comes my homework ( The first 2 Zhou )
      





  • cd: Toggle directory
    Examples demonstrate
    cd ..: Switch to the parent directory    
    cd ~: Switch back to your home directory    
    cd -: Switch back and forth between the last directory and the current directory
     Here comes my homework ( The first 2 Zhou )
      





  • pwd: Show current directory
    Examples demonstrate
     Here comes my homework ( The first 2 Zhou )
      


  • cp: Copy
    Usage method
    Single source replication :cp [OPTION]... [-T] SOURCE DEST( If DEST Create if it does not exist , Existence covers )
    Multi source replication :cp [OPTION]... SOURCE... DIRECTORY(DEST It has to be for directory)
    -i: Interactive replication , That is to remind the user to confirm before covering    
    -f: Force overwrite of target file   
    -r,-R: Recursively copying directories
    Examples demonstrate
    cp -if /data/[1-3].txt /data/test --- test Must be a catalog , Copy three files together to test in  
     Here comes my homework ( The first 2 Zhou )
    cp -r /data /home --- hold data Copy the contents of the table of contents to home in
     Here comes my homework ( The first 2 Zhou )
      











  • mv: shear
    Usage method
    Single source replication :mv [OPTION]... [-T] SOURCE DEST( If DEST Create if it does not exist , Existence covers )   
    Multi source replication :mv [OPTION]... SOURCE... DIRECTORY(DEST It has to be for directory)   
    -i: Interactive replication , That is to remind the user to confirm before covering    
    -f: Force overwrite of target file
    Examples demonstrate
    mv -i /data/[1-3].txt /home --- hold /data Three in the catalog txt Cut the file to /home Next
     Here comes my homework ( The first 2 Zhou )
      








  • rm: Delete
    Usage method
    rm [OPTION]... FILE...   
    -i: Interactive replication , That is to remind the user to confirm before covering    
    -f: Force overwrite of target file    
    -r,-R: Recursive processing , Delete all files under the specified directory, including the directory
    Examples demonstrate
    rm -rf /date/test --- Recursive delete /date/test Catalog
     Here comes my homework ( The first 2 Zhou )
      








  • cat: Forward looking at text content
    Usage method
    cat [OPTION]... [FILE]...   
    -n: Number the displayed lines of text    
    -E: Show line end symbol $
    Examples demonstrate
    cat -n /etc/fstab --- see /etc/fatab Content and display line number
     Here comes my homework ( The first 2 Zhou )
      







  • tac: Flashback to see the text
    Usage method
    tac [OPTION]... [FILE]...
    Examples demonstrate
    tac /etc/passwd --- Flashback to see the text
     Here comes my homework ( The first 2 Zhou )
      





  • head: Show text content , Default display header 10 That's ok
    Usage method
    head [OPTION]... [FILE]...   
    -n #: Show text header # Row content
    Examples demonstrate
    head -5 /etc/passwd --- Show /etc/passwd The file header 5 Row content
     Here comes my homework ( The first 2 Zhou )
      






  • tail: Show text content , After default display 10 That's ok
    Usage method
    tail [OPTION]... [FILE]...   
    -n #: After displaying the text # Row content    
    -f: Do not exit after viewing the end of the file , Follow the new line
    Examples demonstrate
    tail -8 /etc/passwd --- Show /etc/passwd After the document 8 Row content
     Here comes my homework ( The first 2 Zhou )
      







  • more: Split screen display text content , One screen at a time, stop after the display
    Usage method
    more [options] file [...]   
    Space key : Display text next screen content    
    Enter key : Show only the next line of text    
    b key : Display the content of the previous screen of text    
    q key : sign out





  

5. Copy /etc/profile to /tmp/ Catalog , Delete... With find replace command /tmp/profile The white space at the beginning of a line in a file .

 Here comes my homework ( The first 2 Zhou )
   

6. stay vim Set in tab Indent to 4 Characters .

1) Provisional entry into force
Use vim The editor opens any file , Direct input in command mode :set tabstop=4 You can set tab The bond is reduced to 4 Characters .
 Here comes my homework ( The first 2 Zhou )
 Here comes my homework ( The first 2 Zhou )
2) permanent
The current user's home directory , Input vim .vimrc command , stay vimrc Enter... In the file set tabstop=4 Set up tab Indent four characters , Save and exit to run source .vimrc Command to make the profile effective .
 Here comes my homework ( The first 2 Zhou )
 Here comes my homework ( The first 2 Zhou )






版权声明
本文为[osc_ 3byfn0lk]所创,转载请带上原文链接,感谢
https://chowdera.com/2020/12/202012080933298834.html