Tip : This is my personal IT resource website, you can go in and have a look
I haven’t updated my blog during this period of time. I’m not being lazy. Hahaha. Recently, I developed a website with various resources, including VUE and microservices. I have attached the URL. If you need anything, you can go to the IT Resource Center. , This blog does not plan to write much content, just summarize the few linux commands used recently, you can look at it when you use it in the future, and you can also refer to it.
1. Sometimes the log file is relatively large and needs to be cleaned up, but we also want to keep the most recent log, then we can copy the log of the most recent n lines to a new file, and then clear the larger log file. Refer to the following two commands to
copy n lines to the new file
tail -n n(这个就是行数) catalina.out(这个是原文件) > catalina.out_20200520(这个复制的新文件)
Quickly empty large files
cat /dev/null > catalina.out
2. Get the storage occupied by the current folder
du -sh
3. View logs in real time
tail -f catalina.out
4. View the last few logs in real time
tail -n(行数)f catalina.out
For example: tail -5f catalina.out
5. Query a certain keyword in the log
tail -f catalina.out|grep 关键字
Write these first, and then summarize when you encounter it in the future. I need to add new knowledge in the near future, haha, work hard together, come on!