Linux very common commands (beginners)

Linux shell commands

  1. mkdir
    mkdir test : create a test directory (folder) in the current directory (folder)
    mkdir –p test/aa/bb/cc/dd : create multiple folders at once
  2. rmdir
    rmdir test: delete the test directory (folder)
    rmdir –p test/aa/bb/cc/dd: delete dd recursively, if cc is empty at this time, delete it, and so on
  3. pwd
    pwd: show the current path
  4. cd
    cd: go back to the home directory
    cd /test: enter the test directory
  5. ls
    ls: View files and other information in a directory
  6. cp
    cp file1 file2: Copy the file file1 to file2
    cp file1 dir1: Copy the file file1 to the directory dir1, the file name is still file1
    cp /tmp/file1: Copy the file file1 under the directory /tmp to the current directory, the file The name is still file1
    cp /tmp/file1 file2: Copy the file file1 under the directory /tmp to the current directory, the file name is file2
    cp –r dir1 dir2: Copy the entire directory
  7. mv
    mv file1 file2: rename file file1 to file2
    mv file1 dir1: move filename file1 to directory dir1, filename still asks file1
    mv dir1 dir2: change directory dir1 to directory dir2
  8. rm
    rm file1: delete file
    rm file with filename file1? : delete all files with 5 characters in the file and the first 4 characters are file
    rm f*: delete all files whose file name starts with f
  9. cat
    cat file1.txt: view file1.txt in the current directory
    cat file1.txt file2.txt>file3.txt: merge the contents of files file1.txt and file2.txt, and transfer the contents to file3.txt to save
    using tail - f filename can track file changes in real time
    cat file1.txt file2.txt>"file3.txt: merge the contents of file1.txt and file2.txt, and transfer the contents to file3.txt to save, the contents of file3.txt are not overwritten
  10. help
    cat --help: get branch of cat command
  11. clear
    clear:清屏
  12. chmod
    is used to modify file permissions

Edit text files using vim
vi file: open the file, if there is no file, create it
in the vim editor:
i: change the mode to edit mode
esc: change the mode
: wq: save and exit

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324175308&siteId=291194637