The content of this article is about 58 commonly used commands in Linux. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to you.
Quick start terminal: ctr alt t
Enlarge terminal font: ctr shift ' '
Terminal font reduction: ctr '-'
ls: View the file information of the current directory
pwd: View the path of the current directory
touch: Create file
mkdir: Create folder
rmdir: Delete empty folder
rm: Files are deleted by default. -r means to recursively delete all file information in the folder and finally delete the folder
cd Switch directory 10.1 cd directory name: Switch to the specified directory 10.2 cd ..: Switch to the upper level directory 10.3 cd .: Switch to the current directory 10.4 cd ~: Switch to the user's working directory 10.5 cd -=> cd ~ : Switch to the user's working directory 10.6 cd -: Switch to the last directory
clear :Clear screen->window : cls
Absolute path: The path starting from the root directory is called an absolute path -> cd /home/python
Relative path: The path starting from the current directory is called a relative path -> cd ../test cd ./test
Summary on the use of absolute paths and relative paths: If the directory being switched is close to the root directory, use the absolute path. If the directory being switched is close to the current directory, use the relative path. , if the directory being switched is not close to the current directory and the root directory, use the absolute path
cp: copy 15.1 cp file name path: copy the file to the specified directory 15.2 cp file name Path/new file name: Copy the file to the specified path and then modify it to the new file name 15.3 cp file name new file name: Copy the file to the current directory and modify it to the new file name 15.3 cp Folder path -r : Copy the folder to the specified path -r: Copy all the files in the folder recursively
mv: Move (cut) 16.1 mv file name path : Move the file to the specified directory 16.2 mv file name path/new file name: Move the file to the specified path and modify it to the new file name 16.3 mv file name new file name: Rename the 16.4 mv folder path: Move the folder to the specified path
tree: View directory information in the form of a directory tree 17.1 tree path: View directory tree information in the specified path
cal: View the current month calendar 18.1 cal -y: View the full year calendar information
date: View the current time 19.1 Time format: date " %Y-%m-%d %H:%M:%S": Year, month, day and ten seconds
history: View historical command 20.1! Historical command number: Execute the corresponding historical command
Command format: 21.1 Command name options parameters, prompt options can sometimes be placed after the parameters, but if an error is reported, you can consider placing them after the command, such as: scp -r 21.2 Options: For example: -r, The options may have 0 or more 21.3 Parameters: file name or path, the parameters may have 0 or more
Command name --help: View help information
man Command name: View help information 23.1 f Space: View next page 23.2 b: View previous page 23.3 Enter: View next line 23.4 q: Exit
rm: Option 24.1 -i: Reminder before deletion 24.2 -r: Recursively delete all file information in the folder 24.3 -f: If the file does not exist, no error message is displayed when deleting 24.4 -v: Display deletion description information 24.5 -d: Delete empty directory
ls option 25.1 -l: Display in list form 25.2 -a: Display hidden files 25.3 - h: Display file size unit
Link: Soft link: Just like a shortcut, note: deleting the original file soft link is invalid, creating a soft link will not increase the number of hard links by 1, you can create a soft link in a directory. Very important note Point: If the soft link is not in the same directory as the original file, then the original file needs to use the absolute path of the soft link: ln -s 1.txt 1-s.txt, ln -s /home/python/Desktop/AAA /1.txt ../1-s.txt By default, search
in the current directory
Hard link: Just like a person can have multiple names, deleting the original file will not affect the hard link file. File data can still be obtained using hard link files. Note: Hard links cannot be created for directories. Creating a hard link can only be created for files. Creating a hard link will increase the number of hard links by 1. Use of hard links: ln 1.txt 1-h.txt
grep: Find data based on search content 38.1 -n: Display line number 38.2 -v: Negate based on search content 38.3 -i: Ignore case
find: Search for files based on the specified path 39.1 -name: Search based on the file name 39.2 -size: Search based on the file size, please note that it is not accurate and generally not used 39.3 -perm: Search based on permissions r:4 w:2 x:1 find . -name "*.txt" -> Search for files with .txt suffix. Wildcard: plays the role of fuzzy query, * means matching 0 or more characters, ?: can only match any character, Tip: Wildcards have nothing to do with regular expressions
ls. Use it in combination with wildcards. For example: ls *.txt
The above is the detailed content of Programmers must master 59 commonly used Linux commands. For more information, please follow other related articles on the PHP Chinese website!