Find Files
find / -name filename.txt
According filename.txt file name lookup / directory
Check if a program running
ps –ef|grep tomcat
View all processes related to the tomcat
Terminate the thread
kill -9 19979
Terminate the thread number of the thread-bit 19979
View files, containing hidden files
ls -al
The current working directory
pwd
Copy the file, including its subfolders to a custom directory
cp -r sourceFolder targetFolder
Create a directory
mkdir newfolder
Delete the directory (this directory is an empty directory)
rmdir deleteEmptyFolder
Delete a file, including its subfolders
rm -rf deleteFile
Moving Files
mv /temp/movefile /targetFolder
Extended rename mv oldNameFile newNameFile
Switch User
su -username
Modify file permissions
chmod 777 file.java
//file.java的权限-rwxrwxrwx,r表示读、w表示写、x表示可执行
Compressed file
tar -czf test.tar.gz /test1 /test2
Lists the compressed files list
tar -tzf test.tar.gz
unzip files
tar -xvzf test.tar.gz
View the first 10 lines of the file
head -n 10 example.txt
10 lines to see the end of file
tail -n 10 example.txt
View Log File
tail -f exmaple.log
//这个命令会自动显示新增内容,屏幕只显示10行内容的(可设置)。
Start Vi editor
vi
Display the current time
date
Jiji command output cycle time and day of the month and year time display format
Sat Jan 20 04:39:49 CST 2018
date +"%Y-%m-%d"
It is shown below:
[root@ming xxx]# date +"%Y-%m-%d" 2018-01-20
Note: If you are unsure that we can to help;
Extract the zip file
unzip -oq
View the number of threads (for easy viewing program is wrong)
ps -Lf 端口号|wc -l