1、ps 显示进程相关信息
用法了解:
Basic options: 基本操作
-A, -e all processes 所有进程
-a all with tty, except session leaders 所有的终端,除了会话首进程
a all with tty, including other users 所有的终端,包括其他用户
-d all except session leaders 除了session leader 的所有进程
-N, --deselect negate selection
r only running processes 只有运行着的进程
T all processes on this terminal 这个终端的所有进程
x processes without controlling ttys 不受终端控制的进程
Selection by list: 列表选项,即控制ps打印出来的列信息。
-C <command> command name 命令名称
-G, --Group <GID> real group id or name 实际组id或组名称
-p, p, --pid <PID> process id 进程id
Output formats: 输出格式
-f full-format, including command lines 所有格式包括命令行本身
ps命令常常配合“grep ”
列如我想知道redis服务有没有正常启动
ps -ef|grep redis
2 、kill pid
kll -9 pid 强制杀死进程
kill -2 pid 等进程清除资源再结束进程。
需要结束后台程序的时候可以配合 ngrep \ pidof等命令
kill -9 `ngrep 程序名`
kill -9 `pidof 程序名`
3、telnet 连接试探
网络通信试探
telnet 目标ip 目标端口
4、netstat 查看网卡状态
-r, --route display routing table-i, --interfaces display interface table
-g, --groups display multicast group memberships
-s, --statistics display networking statistics (like SNMP)
-M, --masquerade display masqueraded connections
-v, --verbose be verbose
-W, --wide don't truncate IP addresses
-n, --numeric don't resolve names
--numeric-hosts don't resolve host names
--numeric-ports don't resolve port names
--numeric-users don't resolve user names
-N, --symbolic resolve hardware names
-e, --extend display other/more information
-p, --programs display PID/Program name for sockets
-c, --continuous continuous listing
-l, --listening display listening server sockets
-a, --all, --listening display all sockets (default: connected) 所有sock链接
-o, --timers display timers
-F, --fib display Forwarding Information Base (default)
-C, --cache display routing cache instead of FIB
<Socket>={-t|--tcp} {-u|--udp} {-w|--raw} {-x|--unix} --ax25 --ipx --netrom
列如我要查看redis程序监听的是什么端口
netstat -antp |grep redis
........................................................待更新...................................................................