Linux

Linux命令备忘

2017-05-19  本文已影响0人  iamsea

1. 系统相关

man

du --max-depth=1 -h

ps -ef | grep prog | grep -v grep
pgrep prog

free -m

top
ps:根据内存或者CPU占用对进程排序

  • 内存排序:执行top,然后按“shift + m”,这时进程就会按照内存占用从大到小排序。
  • CPU排序:执行top即可,top默认是按照CPU占用排序,也可以执行“shift + p”从内存大小排序转换为CPU排序。

mpstat -P ALL 2

vmstat 2

netstat -anpt

2. 进程相关

killall program

kill -9 pid

pidof program

cat /proc/pid/environ | tr -s '\0' '\n'

lsof -p pid | grep txt

pmap -x pid

nm file
readelf -s file

pstree -p pid

lsof -p pid

pstack pid

strace -p pid

ltrace -p pid

ldd program

3. 运营调试

find ./ -type f -name ".c" -o -name ".h" | xargs grep "strings"

fuser -v filename
lsof filename

echo -n "abcde123" | md5sum
echo -n "abcde123" | sha1sum

ctrl + r

export HISTTIMEFORMAT="%F %T whoami "
history

c++filt

set print element 0

scp src user@host:dest

ssh user@host

cd
cd ~

cd -

ctrl + u

ctrl + c

ctrl + \

tail -20f /home/xxx/log/yy.log

curl

wget

tar -zcvf test.tar ./*

tar -zxvf test.tar

4.其它

查看所有历史记录

查询历史记录

上一篇 下一篇

猜你喜欢

热点阅读