Linux delete, backup, compression and other commands

to sum up:

ls View all files under the current directory
    -a Display all files (including hidden files)
    -l Display all files (including detailed information of files)
        ls Parameter directory path (absolute path / relative path)
        
    cd
    pwd Display current location

touch create file
    touch create common file
    format:
        touch common file name
    mkdir create directory file
        format:
        mkdir directory file name
        
vim edit file
    three modes:
        unedited mode
        edit mode
        command line mode
        
        enter edit mode: a 
        exit edit mode: esc
        enter command Mode::
        Exit command mode: backspace (backspace key)
        
    editing skills:
    yy copy
    p paste
    dd delete 
    u undo
    Ctrl + r undo undo
    
    Note: all operations in this part are in unedited mode
    
    Command line mode:
    / keyword search keyword
    wq Save
    q! Forced exit
    
    anchor symbol:
    ^ current first line position
    $ current line end position
    gg current document first line first character position
    G The first character position of the last line of the current document
    

cat View file
        -n While viewing the file, display the line number
    
mv move file
        mv move file, or file name
            move format: mv source file destination location
            Rename format: mv source file new file name
                Note: The new file name must be unique in the current file
            
        rm delete file
            -f delete ordinary file
            -rf delete directory file
                format: rm parameter file to be deleted
                
        cp file copy
            -f copy directory
                copy file format:
                    cp source file destination location
                    cp source file new file name (in current directory)
                
                Copy directory file format
                    cp -r source file destination location
                    cp -r source file new file name (in the current directory)
file decompression
    tar file decompression
        compressed file format: 
            tar zcvf compressed package name file to be compressed
        Decompressed file format:
            tar xf compressed package name
    unzip Decompressed zip file
        format:
            unzip compressed package name
            
Link file:
    ln 
        format:
            ln -s source file soft link file
Download file:
    wget 
        format:
            wget url
        

rm -rf

r: recursive, delete layer by layer f: file

Delete a file under a folder

rm -f nihaoma / 11 (nihaoma / 11 file name, previous file name / deleted file name)

 

Relative path and absolute path:

Absolute path: starting from the root

relative path:

Absolute path:

 

 

Backup:

Command: cp file name 1 file name 2

 

 

Compressed file:

 

Published 29 original articles · Like1 · Visits 579

Guess you like

Origin blog.csdn.net/wennie11/article/details/105225469