Page 1 of 1 [ 4 posts ] 

amboxer21
Deinonychus
Deinonychus

User avatar

Joined: 23 Jun 2011
Age: 39
Gender: Male
Posts: 350
Location: New Jersey

29 Jul 2012, 1:49 am

Prints just the name of all currently running process and is piped to the less command to control the output.

Code:
ps axf  | awk '{print "PROC -> "$5}' | awk '!x[$0]++' | less



amboxer21
Deinonychus
Deinonychus

User avatar

Joined: 23 Jun 2011
Age: 39
Gender: Male
Posts: 350
Location: New Jersey

29 Jul 2012, 4:53 am

here's another

echo -e "\n\033[1;41;1;37mPort\t\t\t\033[0m\033[1;43;1;37m\t\tProcess\033[0m\n" && netstat -antp | awk 'NF="7" {print $5"\t""\t""\t""\t""\t"$7}' | awk 'FS=":" {print $2}' | awk '!x[$0]++' | sed '/^$/d' >&1

[img][800:452]http://i1236.photobucket.com/albums/ff455/amboxer21/screenshot-SunJul29023030EDT2012.png[/img]



Foxface
Raven
Raven

User avatar

Joined: 31 Jul 2012
Age: 37
Gender: Male
Posts: 111

01 Aug 2012, 1:55 am

I put the code into the terminal, and I get this:

Quote:
PROC -> COMMAND
PROC -> [kthreadd]
PROC -> \_
PROC -> /sbin/init
PROC -> upstart-udev-bridge
PROC -> /sbin/udevd
PROC -> upstart-socket-bridge
PROC -> smbd
PROC -> dbus-daemon
PROC -> /usr/sbin/modem-manager
PROC -> /usr/sbin/bluetoothd
PROC -> NetworkManager
PROC -> rsyslogd
PROC -> avahi-daemon:
PROC -> /usr/lib/policykit-1/polkitd
PROC -> /usr/sbin/cupsd
PROC -> /usr/lib/i386-linux-gnu/colord/colord
PROC -> /sbin/wpa_supplicant
PROC -> /sbin/getty
PROC -> whoopsie
PROC -> acpid
PROC -> gdm-binary
PROC -> |



amboxer21
Deinonychus
Deinonychus

User avatar

Joined: 23 Jun 2011
Age: 39
Gender: Male
Posts: 350
Location: New Jersey

01 Aug 2012, 2:15 am

Thats a parsed ps axf command. It lists running processes. A better command is top or htop. It runs in real time. Try it.

if you want to list processes entirely
ps axf -eo pid,ppid,sid,uid,args

give pstree a try too.