Linux basic command usage (based on ContOS7)

Liunx catalog management

1. Terminal practical skills

1.1 Tab key auto-completion
1.2 Press the up/down cursor keys to switch back and forth the command used before
1.3 ctrl + c end the command

2.ls(list) list directories

  1. -a Display all subdirectories and files in the specified directory, including hidden files

  2. -l displays the detailed information of the file in a list

  3. -h with -l to display the file size in a humane way

  4. -d lists only the directory itself, not the file data in the directory

3. cd (change directory) to switch directories

  1. cd... Switch to the parent directory
  2. cd-can switch back and forth between the last two working directories
  3. cd xxx into the xxx directory
  4. cd/cd ~ switch to the current user's home directory

4.pwd displays the directory where the directory is located

-p shows the actual path instead of the link path

5.mkdir(make directory) create a directory

  1. -m: the permissions of the configuration file
    Insert picture description here

  2. -p: help you directly recursively create the required directory (including the upper-level directory)!
    Insert picture description here

6.rmdir delete directory

  1. -p is also deleted along with the upper level "empty" directory
    Insert picture description here

Liunx file management commands

1.touch to create a file

2.rm delete files or directories

  1. -f force deletion
  2. -r Recursively delete the contents of the directory, this parameter must be added when deleting the folder

3.mv move files

-f If the target file or directory is duplicated with an existing file or directory, it will directly overwrite the existing file or directory

4.cat view files

5. grep filter text

grep is a powerful text search tool command, used to find strings in a file that meets the specified format, and supports regular expressions.

6. find to find files

The find command is very powerful and is usually used to search for files that meet the conditions in a specific directory.

  1. find. -name "*.c" List all files with extension .c in the current directory and its subdirectories.

LINUX system management

1.history View history

  1. history View history commands
  2. history -c clear history commands

3.date time and date/clear clear the screen

  1. date View system time
  2. The clear command is used to clear the terminal screen, which is equivalent to CTRL+L

4. Disk information

  1. df -h shows the remaining space of the disk
  2. df -h + directory to view the size of the directory

5. Process information

  1. ps aux View the detailed status of the process
  2. top Display the file size in the directory
  3. kill [-9] +process number terminates the process with the specified code number, -9 means forced termination

Liunx other commands

1. Pack and compress tar

c Generate the archive file, create the package file
x
Unpack the archive file v List the detailed process of archive unpacking, display the progress
f Specify the name of the archive file, f must be a .tar file after f, so you must put the option at the end
Insert picture description here

2. Compress/decompress gzip and bzip2

The combination of tar and gzip commands can be used to achieve file packaging and compression.
Tar is only responsible for packaging files, but not compressing
the files packaged by tar with gzip. The extension is generally xxx.tar.gz
gzip syntax:
Insert picture description herebzip2 syntax:Insert picture description here

3. Software installation yum

Insert picture description here

Guess you like

Origin blog.csdn.net/Daoke37/article/details/110086662