您的位置:首页 > 运维架构 > Linux

Linux查找进程及端口占用

2013-04-21 01:19 369 查看
Windows的命令是: netstat -ano | findstr "80" (注80是你想要看查看的端口号)

Linux:

法1:

ps aux | grep httpd

netstat -anp | grep httpd

法2:

ps -ef | grep httpd

netstat -tunpl | grep httpd

#######################

附:

[root@bogon bin]# ps --help
********* simple selection *********  ********* selection by list *********
-A all processes                      -C by command name
-N negate selection                   -G by real group ID (supports names)
-a all w/ tty except session leaders  -U by real user ID (supports names)
-d all except session leaders         -g by session OR by effective group name
-e all processes                      -p by process ID
T  all processes on this terminal     -s processes in the sessions given
a  all w/ tty, including other users  -t by tty
g  OBSOLETE -- DO NOT USE             -u by effective user ID (supports names)
r  only running processes             U  processes for specified users
x  processes w/o controlling ttys     t  by tty
*********** output format **********  *********** long options ***********
-o,o user-defined  -f full            --Group --User --pid --cols --ppid
-j,j job control   s  signal          --group --user --sid --rows --info
-O,O preloaded -o  v  virtual memory  --cumulative --format --deselect
-l,l long          u  user-oriented   --sort --tty --forest --version
-F   extra full    X  registers       --heading --no-heading --context
********* misc options *********
-V,V  show version      L  list format codes  f  ASCII art forest
-m,m,-L,-T,H  threads   S  children in sum    -y change -l format
-M,Z  security data     c  true command name  -c scheduling class
-w,w  wide output       n  numeric WCHAN,UID  -H process hierarchy
[root@bogon bin]# netstat --help
usage: netstat [-veenNcCF] [<Af>] -r         netstat {-V|--version|-h|--help}
netstat [-vnNcaeol] [<Socket> ...]
netstat { [-veenNac] -I[<Iface>] | [-veenNac] -i | [-cnNe] -M | -s } [delay]

-r, --route                display routing table
-I, --interfaces=<Iface>   display interface table for <Iface>
-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
-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)
-o, --timers               display timers
-F, --fib                  display Forwarding Information Base (default)
-C, --cache                display routing cache instead of FIB
-T, --notrim               stop trimming long addresses
-Z, --context              display SELinux security context for sockets

<Iface>: Name of interface to monitor/list.
<Socket>={-t|--tcp} {-u|--udp} {-S|--sctp} {-w|--raw} {-x|--unix} --ax25 --ipx --netrom
<AF>=Use '-A <af>' or '--<af>'; default: inet
List of possible address families (which support routing):
inet (DARPA Internet) inet6 (IPv6) ax25 (AMPR AX.25)
netrom (AMPR NET/ROM) ipx (Novell IPX) ddp (Appletalk DDP)
x25 (CCITT X.25)
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: