1. Commonly used commands to view logs in development:
- tail 100 catalina.out //View positive 100 lines of content
- tail -200 catalina.out // View the log content of the last 200 lines
- tail -f catalina.out //monitor log
2. View a program process command
- netstat -ntuplgrep java //Fake it is a java process, query the pid, kill it
- ps aux|grep java
3 Display permissions for all directories
- ls -a -l
4 Create a soft link to the file
Scenario: If there is such a hierarchical directory structure a/b/c/1.txt in the current directory, the content of the 1.txt file changes dynamically, and it is very troublesome to view 1.txt every time. Create a file name 2 in the current directory, so that the file can be easily viewed. This scenario is very symbolic of the maven project.
ln -s a/b/c/1.txt 2
5 Commands to turn off and turn on the firewall under Linux
1) Permanently effective and will not be restored after restarting
: chkconfig iptables on
Close: chkconfig iptables off
2) Immediately effective, restart after restart
: service iptables start
Close: service iptables stop
3) chkconfig iptables --list //Check whether the firewall is closed
root 91051 1 0 Apr19 ? 00:30:13 /data/java/bin/java -Djava.util.logging.config.file=/data/tomcat/conf/logging.properties -Djava.awt.headless=true -Dfile.encoding=UTF-8 -server -Xms1024m -Xmx1024m -XX:NewSize=256m -XX:MaxNewSize=256m -XX:PermSize=256m -XX:MaxPermSize=256m -XX:+DisableExplicitGC -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.endorsed.dirs=/data/tomcat/endorsed -classpath /data/tomcat/bin/bootstrap.jar -Dcatalina.base=/data/tomcat -Dcatalina.home=/data/tomcat -Djava.io.tmpdir=/data/tomcat/temp org.apache.catalina.startup.Bootstrap start |
几个命令,安装时需要用到:
1..下载文件: wget URL
2. 压缩:tar —zxvf 文件名(.tar 或 .tar.gz) tar —jxvf 文件名(.tar.bz2)
3. 拷贝:cp 文件名 或 cp —Rf 文件夹名
4. 删除:rm 文件名 或 rm —Rf 文件夹名
5. 编辑文件命令:vi 文件名 , q!(不保存退出) : wq(保存退出)
6. 授权 chmod 777 * (文件名或者文件夹,支持通配符)
7. 更改用户权属 chown -R 用户 .
8. 更改用户组 chgrp -R 用户 .
9. 切换用户 su 用户
10. 用root执行命令 su -c “命令”
11. 查看mysql进程,如 ps -ef | grep mysqld
解压文件
tar -zxvf /tmp/root.tar.gz
查看进程
ps -ef |grep tomcat
杀掉进程
kill -9 [prot]
1.解压game.war
1
|
jar -xvf game.war
|
2.删除文件夹以及文件夹中所有文件,文件夹
1
|
rm
-rf
/var/log/httpd/test
|
3.杀死tomcat进程。
查看tomcat 进程
1
|
ps
-ef |
grep
tomcat
|
杀死进程 5144
1
|
kill
-9 5144
|
4.查看日志
显示文件 example.txt 的后十行内容并在文件内容增加后,自动显示新增的文件内容。
1
|
tail
-f example.txt
|
5.将 /aaa目录下的所有东西拷到/bbb/下而不拷贝aaa目录本身。
即格式为:cp -Rf 原路径/ 目的路径/
1
|
cp
-Rf
/aaa/
*
/bbb/
|