# ps -aux
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root         1  0.0  0.0    896   528 ?        Sl   21:18   0:00 /init
root        10  0.0  0.0    896    84 ?        Ss   21:18   0:00 /init
root        11  0.0  0.0    896    84 ?        R    21:18   0:00 /init
root        12  0.0  0.0  10036  4928 pts/0    Ss   21:18   0:00 -bash
root       145  0.0  0.0  10856  3404 pts/0    R+   21:21   0:00 ps -aux

ps 명령어에 실행경로도 같이 출력하는 방법을 찾지 못했다.

/proc# ls
1     buddyinfo  cpuinfo    execdomains  irq        kpagecgroup  meminfo  pagetypeinfo  stat         tty
10    bus        crypto     filesystems  kallsyms   kpagecount   misc     partitions    swaps        uptime
11    cgroups    devices    fs           kcore      kpageflags   modules  sched_debug   sys          version
12    cmdline    diskstats  interrupts   key-users  loadavg      mounts   schedstat     sysvipc      vmallocinfo
149   config.gz  dma        iomem        keys       locks        mtrr     self          thread-self  vmstat
acpi  consoles   driver     ioports      kmsg       mdstat       net      softirqs      timer_list   zoneinfo

/proc 경로에 PID 로 된 폴더들이 있다.

/proc# ls -al 12/exe
lrwxrwxrwx 1 root root 0 Aug 28 21:20 12/exe -> /usr/bin/bash

ls -al /proc/[PID]/exe 로 실행 경로를 확인할 수 있다.

ls -al /proc/[PID]/cmdline 으로 실행 명령어를 확인할 수 있다고 한다.

출처 : https://smilekimna.tistory.com/entry/%ED%94%84%EB%A1%9C%EC%84%B8%EC%8A%A4-%EC%8B%A4%ED%96%89%EA%B2%BD%EB%A1%9C-%EC%B0%BE%EA%B8%B0

728x90

+ Recent posts