常用Linux命令备忘
------------------------------------------------------------------------------
1.加压gz 文件的命令:
tar -zxvf nginx-1.9.4.tar.gz
把linux文件夹压缩成tar.gz的命令
解压 tar zxvf 文件名.tar.gz
压缩 tar zcvf 文件名.tar.gz 目标名
------------------------------------------------------------------------------
2.复制命令:
cp yisa/zlib-1.2.7.tar.gz /yisa_oe/
------------------------------------------------------------------------------
3.使用vi 编辑器:
vi nginx.conf
------------------------------------------------------------------------------
4.杀死进程命令:
kill -9 28666
------------------------------------------------------------------------------
5.查看tomcat进程命令:
ps -ef|grep tomcat
ps -ef|grep nginx
------------------------------------------------------------------------------
6.Linux 下ping Ip地址:
ping 219.146.246.130
ping yisa6
------------------------------------------------------------------------------
7.telnet命令:
telnet 219.146.130. 33066
------------------------------------------------------------------------------
8.cat 命令
cat anaconda-ks.cfg
------------------------------------------------------------------------------
9.拷贝命令:
cp -r apache-tomcat-8.0.24 tomcat-8.0.24_omnieye_pbd
cp -r apache-tomcat-8.0.24 tomcat-8.0.24_omnieye_ws
cp -r apache-tomcat-8.0.24 tomcat-8.0.24_cpa
cp -r apache-tomcat-8.0.24 tomcat-8.0.24_omnieye_cpa
------------------------------------------------------------------------------
10.删除命令:
rm -rf tomcat-8.0.24_cpa/
rm apache-tomcat-8.0.24
rm -rf apache-tomcat-8.0.24
------------------------------------------------------------------------------
11.剪切命令:
mv tomcat-8.0.24_omnieye_cpa tomcat-8.0.24_omnieye_cpa_8081
mv tomcat-8.0.24_omnieye_cpaws/ tomcat-8.0.24_omnieye_cpaws_8082
------------------------------------------------------------------------------
12.执行启动 tomcat 命令:
./startup.sh
------------------------------------------------------------------------------
13.查看tomcat控制台:
tail -300f tomcat-8.0.24_cpa_8180/logs/catalina.out
------------------------------------------------------------------------------
14.rpm命令
rpm -ivh *.rpm
rpm -ivh autogen-libopts-5.18-5.el7.x86_64.rpm
rpm -ivh ntp-4.2.6p5-22.el7.centos.x86_64.rpm
rpm -ivh ntpdate-4.2.6p5-22.el7.centos.x86_64.rpm
------------------------------------------------------------------------------
15. 强制删除
rm -rf omnieye_cpa
------------------------------------------------------------------------------
16. 查看mysql 进程
ps -ef | grep mysql
------------------------------------------------------------------------------
17. 关闭Linux的防火墙
systemctl stop firewalld
------------------------------------------------------------------------------
18.查看指定端口被那些程序占用(例如81被谁在占用)
netstat -pan |grep 81
path=`pwd`
pid=`ps -ef|grep java|grep $path|awk '${print $2}'`
echo "$pid"
kill -9 $pid
dat=`date + '%Y%m%d%H%M%S'`
echo "$date"
cp webapps/omnieye_cpa.war omnieye_cap_war.$date
cp webapps/omnieye_ws_cpa.war omnieye_ws_cpa.war.$date
rm -rf conf/Catalina/*
rm -rf webapps/omnieye_ws_cpa
nohup ./binstartup.sh &
tail -f logs/catalina.out -n200
========================================
1.压缩命令:
命令格式:tar -zcvf 压缩文件名.tar.gz 被压缩文件名
可先切换到当前目录下。压缩文件名和被压缩文件名都可加入路径。
2.解压缩命令:
命令格式:tar -zxvf 压缩文件名.tar.gz
解压缩后的文件只能放在当前的目录。
====================================
远程拷贝命令:
scp /data1.tar.gz root@192.168.1.20:/yisa_oe/