进程相关
查进程:
1、
jps 显示进程id和名称
2、
ps aux |grep 进程名
3、
pgrep 进程名
4、
ps -ef |grep 进程名 |grep -v grep | awk '{print $2}' 输出所查进程的id
杀进程: 1、
kill -s 9 进程ID
2、
ps -ef | grep firefox | grep -v grep | awk '{print $2}' | xargs kill -s 9 杀死查到的进程
注:1、即可以:查询命令 | xargs kill -s 9 来杀死进程
2、也可以kill -s 9 '查进程命令'
文件相关
机器之间传输文件:
scp:1、
scp local_file remote_username@remote_ip:remote_folder,制定目录,不修改文件名
2、
scp local_file remote_username@remote_ip:remote_file
指定文件名,修改远程文件名
3、
scp -r local_file remote_username@remote_ip:remote_folder 远程复制目录
-----------------------------------------从本地到远程----------------------------------------------------
-----------------------------------------从远程到本地--------------------------------------------------
4、
scp remote_username@remote_ip:remote_folder local_file(与从本地到远程有所变化)
find :
find / -name file_name
文件夹删除: rm -rf 文件名
远程其他机器
ssh username@host
读取文件:
head -n 200 fileName //前多少行
- more fileName //从头开始
linux三剑客:grep命令、sed命令、awk命令
awk 文档格式化输出
test文档
1111
aaa
bbbb
ccc
awk '{if($0=="aaa"){ count++;print $0;}} END{print "user count is ",count}' test
输出:
aaa
user count is 1