Saturday, 26 Jan, 2013 Top is an historic monitoring tool to get a fast overview of a running Linux system. It is especially useful when you're at limited linux consoles and terminals (i.e.: busybox and the like). By default it doesn't look so great, but there's always fast ways to customize it and use it fruitfully. Custom top Color Scheme. Edit ~/.toprc, paste the following then Save: RCfile for "top with windows" # shameless braggin' Id:a, Mode_altscr=0, Mode_irixps=1, Delay_time=3.000, Curwin=0 Def fieldscur=AEHIOQTWKNMbcdfgjplrsuvyzX winflags=63800, sortindx=10, maxtasks=0 summclr=2, msgsclr=1, headclr=3, taskclr=1 Job fieldscur=ABcefgjlrstuvyzMKNHIWOPQDX winflags=62777, sortindx=0, maxtasks=0 summclr=6, msgsclr=6, headclr=7, taskclr=6 Mem fieldscur=ANOPQRSTUVbcdefgjlmyzWHIKX winflags=62777, sortindx=13, maxtasks=0 summclr=5, msgsclr=5, headclr=4, taskclr=5 Usr fieldscur=ABDECGfhijlopqrstuvyzMKNWX winflags=62777, sortindx=4, maxtasks=0 summclr=3, msgsclr=3, headclr=2, taskclr=3 top running with the previous color scheme applied to it (green|white|red is not casual): My favourite top options. Some of my top tricks... top -cSb n 1 > running.log Shows you the full top text output, very useful to take a snapshot of a running system to analyze afterwards. Please note the output of the previous command is very similar to the ps command. top -cSb n 1 -p PID Useful to monitor a process (check also my fav ps options to know how to get the PID of a daemon). top -cSb -p PID n 1 | tail -n+8 | sort -rn -k5 | awk 'NR > 0 { s +=$9 }; END {print "cpu %",s}' To monitor the CPU usage (in percent) of a single process, identified by a PID, with top. What's the difference between the previous 2 commands? Check this screenshot: As you can see by the previous screenshot, the two commands above differ by the full top header output. The second one is very useful on bash scripts. Also, some of the previous commands are extremely useful when used in conjunction with the watch command. Rate this post Andrea MatesiSenior Professional Network and Computer Systems Engineer during work hours and father when home. Andrea strives to deliver outstanding customer service and heaps of love towards his family. In this Ad-sponsored space, Andrea shares his quest for "ultimate" IT knowledge, meticulously brought to you in an easy to read format. Share this:LinkedIn Related