linux-????????????
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了linux-????????????相关的知识,希望对你有一定的参考价值。
?????????HERE pid txt ?????? http word sign ????????? The
????????????????????????
????????????
????????????
???????????????
======================================
ps process snapshot
????????????????????????????????????
#ps
#ps aux
#ps auxf
a ??????????????????????????????
u ?????????????????????
x ???????????????????????????
f ?????????????????????????????????(??????pstree??????????????????????????????)
user ???????????????
pid process identify
TTY ???????????????????????????
??????tty?????????:
#tty
? ???????????????????????????????????????????????????
time ????????????cpu????????????
cmd ????????????
%cpu ???????????????cpu?????????
%mem ????????????memory?????????
VSZ ?????????????????????????????????
RSS ???????????????????????????
STAT ??????????????????
#man ps
R running
S sleep
T stop
Z zombie(???????????????)
D Uninterruptible sleep (usually IO)
R Running or runnable (on run queue)
S Interruptible sleep (waiting for an event to complete)
T Stopped, either by a job control signal or because it is
being traced.
W paging (not valid since the 2.6.xx kernel)
X dead (should never be seen)
Z Defunct ("zombie") process, terminated but not reaped by
its parent.
< high-priority (not nice to other users)
N low-priority (nice to other users)
L has pages locked into memory (for real-time and
custom IO)
s is a session leader
l is multi-threaded (using CLONE_THREAD, like NPTL
pthreads do)
+ is in the foreground process group
?????????????????????:
[[email protected] ~]# ps aux --sort %cpu | less
[[email protected] ~]# ps aux --sort %-cpu | less
??????????????????:
[[email protected] ~]# ps axo user,%cpu,command --sort -%cpu | less
[[email protected] ~]# ps -eo user,%cpu,%mem,command --sort %cpu
#ps -elf
-e ??????????????????
-l ???????????????
-f ????????????
#ps -e ??????
pstree
???????????????
#pstree
-a ????????????
-p ??????pid
-u ???????????????
lsof?????????????????????????????????????????????????????????
lsof -i:80
???????????????80?????????
pidof
#pidof ????????????
pgrep
pgrep -l eyes
1179 xeyes
??????pid??????
#cd /var/run
cat /var/run/httpd/httpd.pid
12265
======================================
w
[[email protected] ~]# w
16:51:43 up 8:30, 7 users, load average: 0.11, 0.27, 0.30
USER TTY FROM [email protected] IDLE JCPU
PCPU WHAT
root :0 :0 08:22 ?xdm? 29:39 0.23s
gdm-session-
root pts/0 :0 14:13 1:43 0.30s 0.30s bash
root pts/1 :0 11:19 5:19 0.62s 0.62s bash
root pts/2 :0 14:13 1:39m 0.06s 0.01s less
root pts/3 :0 14:54 7.00s 0.06s 0.01s w
root pts/4 :0 16:25 25:51 0.06s 0.06s bash
root pts/5 :0 16:40 7:11 0.24s 0.24s bash
======================================
who
[[email protected] ~]# who
root :0 2017-11-27 08:22 (:0)
root pts/0 2017-11-27 14:13 (:0)
root pts/1 2017-11-27 11:19 (:0)
root pts/2 2017-11-27 14:13 (:0)
root pts/3 2017-11-27 14:54 (:0)
root pts/4 2017-11-27 16:25 (:0)
root pts/5 2017-11-27 16:40 (:0)
======================================
users
[[email protected] ~]# users
root root root root root root root
======================================
top
??????????????????????????????
h|? ??????
????????????
< ????????????
M ???????????????
P ???cpu??????
k ??????pid????????????
h ????????????
q ??????
1
f
W
R ????????????
z ????????????
r ???????????????nice?????????
[[email protected] ~]# top -d 2 -p 1068 -bn1
[[email protected] ~]# top -u apache
======================================
????????????
???pid????????????
#kill ??????(signal) pid
-1 HUP ????????????????????????????????????????????????
-9 KILL ????????????
-15 TERM ????????????(??????????????????????????????)
-18 CONT ????????????
-19 STOP ????????????
#kill -HUP pid
#kill -STOP pid
#kill -l
#man 7 signal ?????????????????????
#killall ?????? ????????????
#pkill -9 ????????????
#pkill -t ??????
??????-9??????????????????????????????????????????-9???????????????????????????
#pkill -u ????????????
#xkill
======================================
????????????:
???????????????jobs:
ctrl+z ?????????????????????(????????????????????????????????????)
#fg %1 ????????????????????????%???????????????job number???1??????job number???
#jobs ???????????????
#bg %1 ?????????????????????????????????
#kill -9 %1
#kill -9 pid
???????????????screen:
screen????????????????????????????????????,???????????????????????????????????????
#yum install screen -y
??????:
??????screen??????
[[email protected] ~]#screen -S lala //???screen???????????????lala
[[email protected] ~]# ssh 192.168.245.3 //????????????245.3????????????
[email protected]???s password:
Last login: Sun Nov 26 19:48:39 2017 from 192.168.245.137
[[email protected] ~]# vim aa.txt //??????????????????,??????????????????????????????????????????
??????screen??????:
[[email protected] ~]# screen -list
There are screens on:
39160.lala (Attached)
38966.pts-0.wing (Detached)
2 Sockets in /var/run/screen/S-root.
[[email protected] ~]# screen -r 38966 //38966???screen lala????????????????????????
?????????????????????????????????????????????
======================================
???????????????
??????????????????"??????"???????????????nice?????????????????????
????????????????????????nice?????????????????????
root???????????????
nice??????????????????????????????
nice?????????:-20???19
?????????????????????
# top
# ps axo pid,command,nice --sort=-nice | less
# ps -elf
PR:priority
NI:nice
?????????????????????
#nice --15 firefox &
?????????????????????
# renice 10 7116 nice??????????????????-
netstat
??????????????????
#netstat -auntpl
-a ????????????
-u udp
-t tcp
-n ?????????????????????????????????
-p ????????????????????????PID
-l ?????????????????????????????????
#netstat -auntpl | grep 22
ss ????????????
??????????????????
#netstat -auntpl
-a ????????????
-u udp
-t tcp
-n ?????????????????????????????????
-p ????????????????????????PID
-l ?????????????????????????????????
以上是关于linux-????????????的主要内容,如果未能解决你的问题,请参考以下文章
linux打开终端如何启动scala,如何在终端下运行Scala代码片段?
Android 逆向Linux 文件权限 ( Linux 权限简介 | 系统权限 | 用户权限 | 匿名用户权限 | 读 | 写 | 执行 | 更改组 | 更改用户 | 粘滞 )(代码片段
-bash: /usr/bin/ls: /lib64/ld-linux-x86-64.so.2: bad ELF interpreter: No such file or directory(代码片段