Linux deployment commonly used commands

1. Commonly used commands to view logs in development:

 

  1. tail 100 catalina.out //View positive 100 lines of content
  2. tail -200 catalina.out // View the log content of the last 200 lines
  3. tail -f catalina.out //monitor log

2. View a program process command

  1.  netstat -ntuplgrep java //Fake it is a java process, query the pid, kill it
  2. ps aux|grep java

3 Display permissions for all directories

  1. 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

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

 

Some common commands for deploying projects under linux system, record backup
   1. Enter the bin directory under Tomcat
  cd  /data/tomcat/bin
   2. Use the Tomcat stop command
  ./shutdown.sh
   3. Check the running Tomcat process, whether tomcat is closed
  ps -ef|grep  java
  如果显示以下相似信息,说明Tomcat还没有关闭
  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
   4、如果你想直接停掉Tomcat,你可以使用kill命令,直接杀死Tomcat进程
  kill  91051
  kill -9 91051
  下面的这个更强一些,使用命令之后可以使用第三步的命令查看一下是否停掉tomcat,如果出现下面的输出说明tomcat已停掉了
  root      91051     1  0 Apr19 ?        00:30:30 [java] <defunct>
   5、最后,启动Tomcat
  ./startup.sh
   6、启动后查看日志
  cd  /data/tomcat/logs
  tail -f catalina.out
 

几个命令,安装时需要用到:
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/

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326747578&siteId=291194637