5 Comments

Disk and Memory Usage Scripts

At times I like to check my levels of disk and memory usage and it’s more convenient for me to do it from the command line. So, I created a couple scripts for them:

devtop 
 Filesystem      Size  Used Avail Use% Mounted on
 /dev/sda5       9.8G  6.4G  2.9G  69% /
 /dev/sda6       166G   38G  121G  24% /home
memtop 
 PROGRAM                   %MEM    #MEM
 firefox                   10.2    352.98 MB
 gnome-shell               4.1     141.76 MB
 Xorg                      1.5     53.60 MB
 nautilus                  1.2     41.52 MB
 gedit                     1.1     40.59 MB
 gnome-settings-           0.7     26.23 MB
 gnome-terminal            0.6     22.31 MB
 nm-applet                 0.6     21.30 MB
 python2                   0.6     20.89 MB

Saves me a lot of time over having to open a program :).

About these ads

About Todd Partridge (Gently)

Good times, good people, good fun.

5 comments on “Disk and Memory Usage Scripts

  1. Hi, thanks for the scripts!

    I’ve modified memtop a little bit — added a header with the overall memory info. Here is my version: https://gist.github.com/3243054

    BTW, there is a similar script to your devtop: http://freecode.com/projects/pydf It does about the same thing, but also adds colors.

    Cheers,
    Anton

    • Nice work on the script, I could see how overall memory usage could be useful.

      Had not heard about pydf before, thanks for bringing that to my information.

      Updated script to a more read able formatting, and output.

  2. Two things regarding ‘memtop’:
    1. I see ‘python2′ in the output – is it some kind of script / app? How do you know which one is it? ;P

    2. ‘head -n 10′ will print the first 10 lines (and it happens to be the default so you can use plain ‘head’). If you want top ten processes, you should use ‘head -n 11′, as did the author. Either way, that script doesn’t print “top five applications” like you say in the comment in the script :-)

    • Good points.

      Yeah, that’s python2 a programming language a lot of programs use :) (see it a lot on GNOME 3 even).

      Yeah, I knew about head by default showing 10 lines; however, I decided to define it because I thought I (or others) may want to change it. The, er, five applications, thing was my bad, oops, thanks for pointing it out.

  3. nice handy scripts you got there :). I have the following alias for getting the top25 most hungry ram proccesses:

    alias top25='while read command percent rss; do if [[ "${command}" != "COMMAND" ]]; then rss="$(bc <<< "scale=2;${rss}/1024")"; fi; printf "%-26s%-8s%s\n" "${command}" "${percent}" "${rss}"; done < <(ps -A --sort -rss -o comm,pmem,rss|head -26)'

    anyhow, just keep up to great work, there are great articles on your blog.

    take care,

    - d

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 51 other followers

%d bloggers like this: