1、 修改权限
chmod 777 demo.java
chmod -R 777 文件夹名字
2、 查看某个文件多大
du -sh catalina.out
du -sh *
df -h /home

3、 systemctl功能
sudo systemctl list-unit-files
sudo systemctl list-unit-files | grep tomcat
sudo systemctl status tomcat.service
sudo systemctl is-enabled tomcat.service
sudo systemctl start tomcat.service
sudo systemctl stop tomcat.service
sudo systemctl restart tomcat.service
sudo systemctl enable tomcat.service
sudo systemctl disable tomcat.service
sudo systemctl daemon-reload
4、 查看cpu、内存等使用情况
top
5、 查看内存和交换分区swap使用情况
free
free -tm
6、 查看进程
ps ux
ps uxwww
ps aux
ps ef
7、 干掉进程
kill -9 1001
kill all -9 apache
8、 回到用户主目录
cd ~
cd -
9、切换到 root 用户
sudo -i
sudo -s
10、模糊批量删除文件
find .:在当前目录及其子目录下查找。
-type f:仅匹配文件类型。
-name "*.tmp":匹配所有.tmp后缀的文件。
-exec rm -f {} \;:对匹配到的文件执行rm -f删除操作。
find . -type f -name "syn2024-07-0*" -exec rm -f {} \;