Common Linux Commands for Tomcat Application Deployment

1. Check the thread: ps -ef|grep tomcat name (check whether your current project is running)
2. Kill the thread: kill process id kill the process (close a currently running tomcat)
3. Start tomcat: ./startup.sh (must be under bin to start)
4. Enter the folder: cd folder name                               
5. Go back to the previous level: cd ../
6. View the console output: tail -f catalina.out (enter the logs folder in tomcat)
7. Open the file chooser to upload the local file to the server: rz   
8. Download the file from the server to the local: sz filename   
9. Unzip the zip file: unzip filename.zip   
10. Compress the folder in the server into a tar.gz format file: tar -zcvf compressed file name.tar.gz compressed file name     
11. Extract the tar.gz file: tar -zxvf file.tar.gz 
12. Delete files/folders: rm -rf folder (-rf has no recycle bin, once you delete it, you can't find it back, so be careful when deleting)
13. Switch from ordinary user to root user: su root (when the permission is insufficient and root permission is required, in SSH connection mode, enter su root, press Enter, and then enter the root password entered during Linux installation, press Enter, the password is correct to switch to root account)
14. Nohup needs to be run in the background during deployment, and & refers to running nohup in the background java -jar rpcServer.jar > nohup.out 2>&1 &

View file contents 
cat file1 View the contents of the file forward from the first byte 
tac file1 View the contents of a file in reverse from the last line 
more file1 View the contents of a long file 
less file1 is similar to the 'more' command, but it allows the same reverse operation in the file as the forward operation 
head -2 file1 View the first two lines of a file 
tail -2 file1 to view the last two lines of a file 
tail -f /var/log/messages see in real time what is being added to a file

Guess you like

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