访问手机版  

Linux常用命令|Linux培训学习|考试认证|工资待遇与招聘,认准超级网工!

招聘|合作 登陆|注册

网络工程师培训

当前位置:网络工程师 > 技术课程 > linux > 热点关注 > linux常用命令

linux常用命令ps , lsof ,netstat 整理

时间:2019-07-12

常用dos命令_常用dos命令大全及其用法_linux常用命令

ps 命令:

执行man ps 命令,可以查询命令使用和描述

NAME

ps - report a snapshot of the current processes. (为展示打印当前进程快照)

携带参数linux常用命令,常用命令有:

EXAMPLES

To see every process on the system using standard syntax:

ps -e

ps -ef (我一般使用这个较多,主要用来查询进程是否存储,进程号信息等)

ps -eF

ps -ely

常用dos命令大全及其用法_常用dos命令_linux常用命令

To see every process on the system using BSD syntax:

ps ax

ps axu

To print a process tree:

ps -ejH

ps axjf

To get info about threads:

ps -eLf

ps axms

To get security info:

ps -eo euser,ruser,suser,fuser,f,comm,label

linux常用命令_常用dos命令_常用dos命令大全及其用法

ps axZ

ps -eM

To see every process running as root (real & effective ID) in user format:

ps -U root -u root u

To see every process with a user-defined format:

ps -eo pid,tid,class,rtprio,ni,pri,psr,pcpu,stat,wchan:14,comm

ps axo stat,euid,ruid,tty,tpgid,sess,pgrp,ppid,pid,pcpu,comm

ps -eopid,tt,user,fname,tmout,f,wchan

Print only the process IDs of syslogd:

ps -C syslogd -o pid=

Print only the name of PID 42:

常用dos命令_常用dos命令大全及其用法_linux常用命令

ps -p 42 -o comm=

lsof命令:

NAME

lsof - list open files (列出打开的文件)

直接lsof 打开的命令显示如下:

COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME

init 1 root cwd dir 104,2 4096 2 /。init 1 root rtd dir 104,2 4096 2 /。crontab 20641 root cwd dir 253,0 4096 130818 /root。

init 1 root rtd DIR 253,0 4096 2 /

init 1 root txt REG 253,0 43496 524298 /sbin/init

crontab 20641 root mem reg 253,0 65928 261663 /lib64/libnss_files-2.12.so。crontab 20641 root mem reg 253,0 113432 261657 /lib64/libnsl-2.12.so。crontab 20641 root mem reg 253,0 99158576 397021 /usr/lib/locale/locale-archive。