zoukankan      html  css  js  c++  java
  • Linux常用命令

    一般用过linux的人都知道ps -ef|grep XXX
    可是用ps看到的不是全路径,
    ps -ef|grep http
    500       5948 15608  0 18:09 pts/0    00:00:00 grep http
    root     31723     1  0 Mar06 ?        00:00:01 httpd
    500      31725 31723  0 Mar06 ?        00:00:01 httpd

    那如何查看进程的全路径呢?
    其实每个进程启动之后在 /proc下面有一个于pid对应的路径

    例如上面的
    ps -ef|grep http

    显示:root     31723     1  0 Mar06 ?        00:00:01 httpd

    31723就是进程号

    到/proc/31723下,ll(或者ls -l)会看到:

    # ll /proc/31723
    总用量 0
    dr-xr-xr-x 2 root root 0  3月 19 18:13 attr
    -r-------- 1 root root 0  3月 19 18:13 auxv
    -r--r--r-- 1 root root 0  3月 19 18:04 cmdline
    -rw-r--r-- 1 root root 0  3月 19 18:13 coredump_filter
    -r--r--r-- 1 root root 0  3月 19 18:13 cpuset
    lrwxrwxrwx 1 root root 0  3月 19 18:13 cwd -> /
    -r-------- 1 root root 0  3月 19 18:13 environ
    lrwxrwxrwx 1 root root 0  3月 19 18:13 exe -> /usr/sbin/httpd
    dr-x------ 2 root root 0  3月 19 18:13 fd
    ......

    其中的exe,就是你要查找的进程所在路径了。

    Linux查看已知的进程对应目录

    解决方法:pwdx pid(pid为你想查看的进程的pid)
  • 相关阅读:
    关于多态
    关于lock锁
    wait()和notify()
    多线程之间的通讯
    多线程的异步请求模式
    合理配置线程池
    自定义线程池
    Curl的毫秒超时的一个”Bug”
    Nginx正确记录post日志的方法
    NGINX的奇淫技巧 —— 5. NGINX实现金盾防火墙的功能(防CC)
  • 原文地址:https://www.cnblogs.com/litaiqing/p/5755401.html
Copyright © 2011-2022 走看看