linux disk compression and packaging information

View disk information command
  fdisk -l 

  Disk capacity = * cylinder size cylinder number
  Cylinder size minimum unit of sector = sector number * * barbed heads Number

  Disk capacity = the minimum unit of sector sector number * * * Number thorn cylinder number
            512632551305 

   The current system disk capacity:   10733990400    
   
centos directory structure
   LS /    which files or directories under the root directory view
        Bin directory of the executable file
        sbin root user to store executable directory
        etc Profile
        Boot boot file
        Ordinary home users home directory
        The core lib file system
        Lib64 core file system
        dev directory device
        mnt temporary directory mount point  
        root root user's home directory
        tmp temporary directory (not the more important documents to which this method)
        var variable var repository of files or directories often change A =. 1
        usr shared resource directory (usually software installation, the default directory)
Document Management
   linux command classification
      Internal command cd pwd ... external command ls mkdir ...
   Help command
      Internal Command: help command name
      External command: man command name
                man mkdir
        After entering help document, point q to quit
   Create a directory
      mkdir = make directories
      grammar:
      mkdir [options] directory name
      Example:
      mkdir  qy97
      Create multi-level directory instance:
      mkdir -p  spring/springmvc/config  
      mkdir -p  aaa/bbb/ccc  

          Learn to see help documentation
          - the p-explanation:
           -p, - Parents
              no error if existing, make parent directories as needed
   Remove directory
      rmdir= remove  directory
      Syntax (only delete empty directories)
      rmdir directory name
      Example:
      rmdir aaa/bbb/ccc
      rmdir aaa/bbb
      rmdir aaa
   Modify the directory name
      mv = move 
      grammar:
      mv To modify the name of the directory after directory name changes (does not exist)
      Example:
      etc. qy97 qy971
   Copy directory
      cp = copy
      grammar:
      cp - r directory name
      Example:
      cp -r qy971  spring

      ls /tmp
      ls / can
      cp -r / var / db / / tmp
      ls /tmp
      ls / can
   Look under directory
       ls = list
       grammar:
       ls [directory name]
       Example:
       ls to view all the contents of the current directory
       LS   / etc view all content (absolute path) etc directory
       LS   / etc / sysconfig / Network-scripts to see / etc / sysconfig / network- all files in the scripts directory
       LS spring / current directory exists relative path may be used to view the spring
       the Spring LS / SpringMVC  
          - all the files in a directory view, including hidden files
          -a, - All
               do not Starting with the ignore entries It.
      - L displays all files in a directory in long format (Show Details file or directory)
     LS - L can be simplified as LL
      - T flashback sorted by update display contents of the directory
      ls -a  /etc
      ls -l  /etc
      LS -l -t / etc -LT-equivalent to the LS / etc
     
   Change directory
      cd = change directory
      grammar:
      cd directory name
      Example:
      cd What parameters should be switched to the current user's home directory

      switching ordinary users su admin
      cd into the general user's home directory
      The output of pwd / Home / ADMIN

      Switch to the parent directory cd ..
      CD .. /../    switch to the parent directory superordinate
      cd spring relative path switch
      cd  spring/springmvc
      CD / etc /      switching absolute path
      cd /etc/sysconfig

   Create a file
     touch the file name 
     Example:
     touch spring.xml
     touch spring/springmvc/config/springmvc.xml
     touch /tmp/spring.xml
   Copy files
     cp file name of the target position (target position does not exist, equivalent to rename the copy)
     Example:
     cp spring.xml spring
     cp spring.xml springmvc.xml
     cp springmvc.xml spring / springmvc / 
     cp /root/spring.xml / var / log /   
     ls / var / log
     If cp is a directory, then, you need to add - r
   Shear file (file moving)
     mv file name of the destination location
     Example:
     spring.xml qy971 Music Videos /   moved to qy971 directory spring.xml
     mkdir  /tmp/mydir
     mv /root/qy971/spring.xml  /tmp/mydir/
     ls /tmp/mydir/
   Delete Files
      rm =remove 
      Example:
      touch a.txt b.txt c.txt create multiple files
      Delete rm a.txt with a prompt
      RM -f b.txt -f = Force forced to delete without a prompt
      RM -rf qy971 -r = resursive forced to delete recursive
        to sum up:
          Whether it is a file or directory, you can use
          RM -rf file / directory  
     
   Modify the file name
       mv qy97.txt qy97.log qy97.log certainly not a directory
   View the file contents
     View the entire contents of the file
       grammar:
       cat file name 
       Example:
       cat install.log
       cat /etc/hosts
     Paged view file contents
       less file name
       more file name
       Example:
       less install.log
       more install.log
         enter key line by line to see
     Spacebar to view the content page by page
     Ctrl + f Next
     Ctrl + b Previous
         less and more little different, less use / view can not be more specific content
         q quit
      N front row view files
        grammar:
    head [ - n-] File Name
    Example:
    head HelloWorld.java default view the first 10 lines of HelloWorld.java
    head -1 HelloWorld.java
    head -11 HelloWorld.java
      After n rows view files
        grammar:
    tail [ - the n-] file name
    Example:
    tail HelloWorld.java
    tail -1 HelloWorld.java
    tail -5 HelloWorld.java
    Key uses - f HelloWorld.java real-time monitoring of the tail:
        Use the following command in a window, resulting in obstruction, has been monitoring HelloWorld.java tail:
          tail -f HelloWorld.java
         A link in a new window, execute the following command to observe the changes in the first window:
         date >> HelloWord.java 
           
       
   Write to a file or additional content
        echo 'Hello World' corresponds to the console Linux print the java System.out.println ( "Hello World" );
                         js print Alert 'Hello World' Oracle print dbms_output.putline ( 'Hello World' );
      >> Representative be appended to the original content to continue adding> representative of the original content written cover
        echo 'hello world' >> HelloWord.java hello world appended to the tail of HelloWord.java
    DATE >> HelloWord.java the current time is appended to the tail of HelloWord.java

Soft and hard links
     ln = link  make links between files
     grammar:
      Soft links
      LN - S source file name link
    
     Example:
      LN - S HelloWord.java hw.lnk to HelloWord.java create a shortcut name for hw.lnk
      cat hw.lnk soft links available
      rm -rf HelloWorld.java
      cat hw.lnk soft link is unavailable

      Hard links
      LN - d link source file name
      Example:
      LN - d HW.java hwa.lnk HW.java to create a hard link, named hwa.lnk
      rm -rf  HW.java 
      cat hwa.lnk normal use hard links
Packing compression (decompression)
    Compression and decompression, there are two commands, can only file operations, can not operate directory
      gzip 
      bzip2
   tar package (directory) pressure / solution of the above two options for compression
     tar the option:
     - c compress the Create create
      - t List View compression
      - the X-decompression Extract

     the -Z manner using gzip gzip compression / solution compression
      -j bzip2 manner with bzip2 compression / solution compression

     -v verbose compression / de-compression display compression / decompression of files and directories
      - f File name of the document
     
     - directory path C directory specified decompression

    Compression packing
      grammar:
        tar -c the -z / J -v - the name of the f compression to compress the file or directory
      Example:
       takes - czvf spring.tar.gz spring
       take - czf springa.tar.gz running
       take - cjvf spring.tar.bz2 running
    View archive
      grammar:
        tar -t the -z / J -v - the name of the compression f
      Example:
    tar - tzvf springtargz
    take - tjvf spring.tar.bz2
    unzip
       grammar:
        the tar the -X-the -Z / compressed j -v -f -C name after extracting the directory - C (if omitted, the default current directory)
    Example:
       takes -xzvf springa.tar.gz -C / was
       ls / can
       takes -xjvf spring.tar.bz2 -C / var / run
       ls / var / run

 

Guess you like

Origin www.cnblogs.com/qurui1998/p/11093530.html