A collection of common Linux commands (unfinished)

 (1) New

New folder: mkdir folder name

New file: touch file path/file name

delete:

rm -f filename delete file

rm –rf filename delete folder

 

(2) Rename

1 Rename a file named abc.txt to 1234.txt

mv abc.txt 1234.txt

2 Rename directory A to B

mv A B

3 Move a.txt to /b and rename it to c.txt

mv a.txt /b/c.txt

4 Batch rename files containing _RINEX.DCB to .DCB

rename _RINEX.DCB .DCB P*

 

(3) Number of statistical files

Count the number of files in the current folder ls -l|grep "^-"|wc -l

Count the number of directories in the current folder ls -l|grep "^d"|wc -l

Count the number of files in the current folder, including ls -lR|grep "^-"|wc -l in subfolders

Count the number of directories in a folder, including ls -lR|grep "^d"|wc -l in subfolders

 

(4) View files and system memory

View system memory usage: df -h

Check the size of the folder: du –sh folder name

 

(5) Compression/Decompression

https://www.cnblogs.com/wxlf/p/8117602.html

 

(6) Front-end/back-end/thread

Front to back: ctrl+z first, then enter bg, refer to https://www.cnblogs.com/itech/archive/2012/04/19/2457499.html

See if the program is running:

ps -ef|grep apoc apoc is the process name

ps aux|grep orbit shows the orbits running in all terminals, refer to http://blog.csdn.net/chen861201/article/details/6980677

End the process: kill -9 process number

 

(7) Users and permissions

1 user switch

Switch to normal user su – wj

Switch to root user sudo -i

2 Modify permissions

su enters root, and executes the modification permission under the specified folder:

chmod -R 777 ./bin/

 

(8) Path switching

cd ../ switch to the upper level cd ../../ switch to the upper level, and so on

./ is under the current directory

Press the tab key to match the current file directory or file name by yourself

pwd shows the current path

ll Display all file information under the current path

 

(9) Network

View address ifconfig

Restart the network: service network restart

 

(10) Historical query

Query the command entered before: history, if there are too many, you can use the history | less page to view

Guess you like

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