Linux-- commonly used commands

file: 

    touch: create an empty file: touch a (filename): a touch ../ create a file path: Cross-created file touch ab: Create multiple files

    echo: add to the text:>: Before adding content, covering content >>: additional content, does not cover the echo content> filename

    mv: move, rename: Move: mv renamed the file name path: mv file name modified name

    cp: Copy, Backup: copy: cp filename path of the backup: cp filename backup name

    scp: remote transfer files: scp user @ip: path / filename scp [email protected]: /root/a.txt [email protected]: / home / mars / b

                              : The Host transmits to the a.txt 192.168.31.29 192.168.31.20 host of Mars, and renamed b

    rm: Delete: -r: delete all content -f: Force delete -i: prompted to remove -rf: forced to delete all content   

    rename: Rename:?: any character *: any string rename 3.txt (filename) 1 (to be modified as the file name) 3.txt (file name)  

    seq: generating a series of integer in the range: seq 1 50> a.txt (file name): the one to fifty inputted to the a.txt

    stat: display file status: stat filename: Show all file attributes    

    file: detect the file type: file filename: View file types

table of Contents:

    mkdir Create a directory: mkdir a (folder name): Create a folder a mkdir -p path: create multi-level directory mkdir ../ path: Cross-create the folder mkdir ab: create multiple folders

    ls: view the contents of the directory: -a: show hidden files or directories -l: -h display all the contents of the current directory: human display 

    pwd: Display the current path cd: Change directory cd .. : return to parent directory cd: return to the main directory cd path: to enter the corresponding

Permissions:

    chmod: modify the file permissions: r: Read (4) w: Write (2) x: performing (1) u: file owner g: group member o: other members of a: All members

               +: Increase permission -: = delete permissions: assign permissions chmod 777 1.txt: Add read and write execute permissions chmod u + rwx 1.txt for all members: add read and write execute permissions for the file owner

    chown: owner permissions to modify the file: chown user: group file name -R: recursively change file owner and group -v: Displays detailed implementation process 

Find:

     Content grep: grep filename parameter keywords 

            -a: The binary file to text file the way search data -c: the number of calculations to find the 'search string' of -n: output line number -i: case considered the same

            -v: Reverse output -H: output file name -R: recursive search -w: complete match

            |: While meeting multiple conditions grep a (keyword) | grep b (keyword) file name -E: meet any of the conditions egrep "a / b" (keyword) grep -E "a | b | c" file name

     find attributes: find path argument keywords 

            -name: File name Find -user: user name lookup -uid: User id Find -gid: user group id find -size: File Size

            -type: b: block device d: directory c: character p: links l: pipe f: common file

 

View:   

     cat: once to load all files

     head: the head start from the file view -n: display the first n rows

     more: split-screen support page down load the file contents

     less: split screen load, allowing up, page down by exit q

     tail: From the end of the file start viewing -n: display the tail of line n -f: real-time view the latest number of rows Ctrl + c end

replace:  

    sed: replace the contents of the file: -is # a # b 1.txt: All the 1.txt a replaced b -n '20, 30p '2.txt: 2.txt see only the rows 20 to 30

The internet:

    netstat: -a: View all interface information -n: the domain name is displayed with -t ip: show tcp agreement -u: display udp protocol -p: display interface identifier and program name -r: display routing table information

    ifconfig: Information query ip ping: Test connectivity

Shortcut: Ctrl + l: clear screen (clear) Ctrl + c: to stop a foreground process Ctrl + d: Exit the current account (exit) Ctrl + r: command executed searches

Process: ps -ef | grep a (process name, port number): Query process information kill -9 pid (process id): terminate the process

Archive:

    gzip: -l: fast compression -g: Best compression -r: compression Include subdirectories -d: Unzip

          -S: Version information is displayed: Specify the compressed file suffix -t: check the correctness of the compressed file -v: displays detailed execution of -V

    tar: -c (create): Create a package file -x (extract): unzip the package file -v (verbose): Packaging show detailed procedure -f: Specifies the tar package file name -t: display tar package folder list

         -z: gzip make tar file having a function instruction -Z: make tar file compress instruction having function -j: tar file to make the function instruction having bzip2 -p: preserving the original properties of the original file -P: when packed file absolute path

rpm: -ivh: Installation -e: Uninstall -qa: List all installed packages rpm -qa | grep a (filename): View a package installation

Firewall: close, start, query firewall status: systemctl stop | start | status firewalld.service

Memory: top: general operating information display system free: display memory usage du: view the file share size df -h: display in a humane way of disk space usage information

 

Guess you like

Origin www.cnblogs.com/szwlycw/p/11535753.html