Q. I know the subject is not quite what I want to know, but there is a command to list running processes and I can't remember what it is? There are many commands to accomplish this. Here is the list.
To see all the process running on a system
#ps -A
Example output :
PID TTY TIME CMD
1 ? 00:00:01 init
2 ? 00:00:00 kthreadd
3 ? 00:00:00 migration/0
4 ? 00:00:00 ksoftirqd/0
5 ? 00:00:00 watchdog/0
6 ? 00:00:00 migration/1
7 ? 00:00:01 ksoftirqd/1
8 ? 00:00:00 watchdog/1
9 ? 00:00:00 events/0
10 ? 00:00:00 events/1
To see all the process running on a system with some more information about the executed files location.
#ps -ef
Example output :
UID PID PPID C STIME TTY TIME CMD
root 1 0 0 20:42 ? 00:00:01 /sbin/init
root 2 0 0 20:42 ? 00:00:00 [kthreadd]
root 3 2 0 20:42 ? 00:00:00 [migration/0]
root 4 2 0 20:42 ? 00:00:00 [ksoftirqd/0]
root 5 2 0 20:42 ? 00:00:00 [watchdog/0]
root 6 2 0 20:42 ? 00:00:00 [migration/1]
root 7 2 0 20:42 ? 00:00:01 [ksoftirqd/1]
To see all the process in a "tree structure"
#pstree
Example output :
│ └─{NetworkManager}
├─acpid
├─apache2───6*[apache2]
├─atd
├─avahi-daemon───avahi-daemon
├─bonobo-activati───{bonobo-activati}
├─console-kit-dae───63*[{console-kit-dae}]
├─cron
├─2*[dbus-daemon]
├─2*[dbus-launch]
To see all the files opened
#lsof
hald-addo 2384 root txt REG 8,8 22236 135896 /usr/lib/hal/hald-addon-storage
hald-addo 2384 root mem REG 8,8 117152 5754 /usr/lib/libdbus-glib-1.so.2.1.0
hald-addo 2384 root mem REG 8,8 30684 2537 /lib/tls/i686/cmov/librt-2.10.1.so
hald-addo 2384 root mem REG 8,8 743912 1332 /lib/libglib-2.0.so.0.2200.2
hald-addo 2384 root mem REG 8,8 1319364 2507 /lib/tls/i686/cmov/libc-2.10.1.so
hald-addo 2384 root mem REG 8,8 247788 5986 /usr/lib/libgobject-2.0.so.0.2200.2
hald-addo 2384 root mem REG 8,8 116920 2533 /lib/tls/i686/cmov/libpthread-2.10.1.so
hald-addo 2384 root mem REG 8,8 113320 1278 /lib/ld-2.10.1.so
hald-addo 2384 root mem REG 8,8 227000 1314 /lib/libdbus-1.so.3.4.0
hald-addo 2384 root mem REG 8,8 193860 1383 /lib/libpcre.so.3.12.1
hald-addo 2384 root mem REG 8,8 71144 6123 /usr/lib/libhal.so.1.0.0
To see the process in dynamic way
#top
#atop
#htop
My favorate one is htop. But by default its not there. You have to install it.
0 comments:
Post a Comment