Write in front: the blogger is a real combat development after training into the cause of the “hill pig”, nickname from the cartoon “Lion King” in “Peng Peng”, always optimistic, positive attitude towards things around. My technical path from Java full stack engineer all the way to big data development, data mining field, now there are small achievements, I would like to share with you what I have learned in the past, I hope to help you on the way of learning. At the same time, the blogger also wants to build a perfect technical library through this attempt. Any anomalies, errors and matters needing attention related to the technical points of the article will be listed at the end, and everyone is welcome to provide materials in various ways.

  • Please criticize any mistakes in the article and revise them in time.
  • If you have any questions you would like to discuss or learn, please contact me at [email protected].
  • The style of the published article varies from column to column, and all are self-contained. Please correct the deficiencies.

Beginners will be Linux command – basic operations

Key words: Linux, common commands, basic operations \

The article directories

  • PWD: displays the full path of the current working directory
  • CD: Switch to the current working directory
  • Ls: displays directory and file information
  • Touch: create or modify file time
  • Mkdir: creates a directory
  • Cp: copies files and directories
  • Rm: Deletes a file or directory
  • Mv: Move (rename) a file or directory
  • Find: Searches for files or directories
  • Du: calculates the space occupied by files or directories

A, the PWD

Displays the full path to the current working directory

Second, the CD

Switch the current working directory

  • Usage: CD path

    • CD. : Switch to the current directory
    • CD… : Switches to the upper-level directory
    • CD – : go back to the directory of the previous step.
    • CD [] : switch to the current user’s home directory, which can be omitted
    • CD/XXX/XXX: Switch to a path (absolute path)
    • CD XXX/XXX: Switch to a path (relative path)



Third, the ls

Display directory and file information

  • Usage: ls [option] [file/directory]

    • -a: Displays all information, including hidden files and directories (starting with a dot)
    • -d: displays information about the directory itself rather than information in the directory
    • -h: User-friendly display (easy-to-read) capacity information
    • -l: Displays detailed information in long format
    • -c: displays the last modification time of a file or directory. This parameter is used together with L
    • -u: displays the last access time of a file or directory. This parameter is used with l
    • -t: Sort by modified time (default sort by file name)

Four, touch

Create or change the file time

  • Usage: Touch file/directory

    • If the file does not exist, create it
    • If the file exists, update the file all time to the current system time

Five, the mkdir

Create a directory

  • Usage: mkdir [option] [directory]

    • -p: creates a multi-level directory

Sixth, the cp

Copy files and directories

  • Usage: cp [option] source destination

    • -r: indicates the recursive function for copying files and subdirectories. It is generally used for copying directories

Seven, the rm

Delete a file or directory

  • Usage: rm [option] file/directory

    • -f: Deletes the vm forcibly without prompting
    • -i: Prompts you whether to delete the vm
    • -r: deletes a directory and all contents in the directory

Eight, mv

Move files or directories. Move files or directories in the same directory to rename them

  • Usage: MV source target

Nine, the find

Search for files or directories

  • Find [command option] [path] [expression option]

    • -empty: searches for empty files or directories
    • -group: searches by group
    • -name: Searches by name
    • -iname: searches by name, case insensitive
    • -mtime: searches by modification time
    • -size: Searches by capacity
    • -type: search by file type (file: f, directory: D, device: B/C, link: l)
    • -user: searches by user
    • -exec: executes the command on the found file
    • – a: and
    • O: or

Ten, du

Calculate the space occupied by a file or directory

  • Usage: du [option] [file/directory]

    • -h: Displays user-friendly space information (easy to read)
    • -s: Displays the total occupied space

\