The most commonly used commands in Linux (must see in 2022)

Table of contents

1. View the gpu model:

2. pwd command

3. cd command

4. ls command

 5. mkdir command

6. rm command

7. mv command

8. cp command

9. cat command

10. find command

11. df command

1. View the gpu model:

nvidia-smi

2. pwd command

view current directory

3. cd command

Return to the previous directory:

cd ..

to the root directory:

cd /

Return to the last directory:

cd -

4. ls command

View the files contained in the linux folder, and you can view file permissions

ls -a lists all files in the directory, including hidden files starting with .

ls -A lists other files except . and ..

ls -r sort in reverse order

ls -t Sort files by modification time

ls -S sort by file size

ls -h display in human readable size

ls -l In addition to the file name, it also lists the file permissions, owner, file size and other information in detail

 5. mkdir command

The mkdir command is used to create folders.

  • -m : Set access permissions for the newly created directory, and can also be set with the chmod command;
  • -p : Can be a path name. At this time, if some directories in the path do not exist yet, after adding this option, the system will automatically create those directories that do not yet exist, that is, multiple directories can be created at one time.

6. rm command

Delete one or more files or directories in a directory rm -- help view parameters

 

rm -r is used to delete a directory and files under the directory

rm -d is used to delete an empty directory

rm -rf deletes all files in the current directory and cannot be restored

7. mv command

Move files or change filenames

8. cp command

9. cat command

 cat has three main functions:

1. Display the entire file at once: cat filename

2. Create a file from the keyboard: cat > filename (only new files can be created, existing files cannot be edited.) ctrl + D to stop input

3. Merge several files into one file:

cat file1 file2 > file

10. find command

Used to find files in the file tree and process them accordingly.

-name Find files by file name 
-perm Find files by file permissions 
-user Find files by file owner 
-group Find files by the group the file belongs to. 
-type Find files of a certain type, such as: 
   b - block device file 
   d - directory 
   c - character device file 
   p - pipe file 
   f - normal file 
-size n :[c] Find file length n block files with c Time table file byte size 
-amin n Find the files accessed in the last N minutes in the system 
-atime n Find the files accessed in the system in the last n*24 hours 
-cmin n Find the files whose file status has been changed in the last N minutes in the system
find ./ -name '*.log' Find files ending with .log in the current directory. . represents the current directory

11. df command

Displays disk space usage. Obtain information such as how much space the hard disk is occupied, how much space is left, etc.

Guess you like

Origin blog.csdn.net/candice5566/article/details/122413810