OpenSUSE Linux Rants

OpenSUSE Linux Tips, tricks, how-tos, opinions, and news

My Resume  -  My LinkedIn Profile

January 21, 2009

Linux Tells Us What’s Up (new version of ‘sup’ tool!)

by @ 9:44 am. Filed under bash, sweet tools

I have updated the ‘sup’ bash script so that you can see some useful stats about your Linux box at a glance. Here is some output:

  User:         scott (uid:1000)
  Groups:       users dialout video
  Working dir:  /home/scott
  Home dir:     /home/scott
  Hostname:     suse-linux
  IP (lo):      127.0.0.1/8
  IP (lo):      127.0.0.2/8
  IP (eth0):    192.168.12.144/24
  Gateway:      192.168.12.2
  Name Server:  192.168.12.1
  Date:         Wed Jan 21 09:38:57 MST 2009
  Uptime:        9:38am  up 15 days 23:36,  6 users,  load average: 0.22, 0.22, 0.24
  Kernel:       Linux suse-linux 2.6.25.18-0.2-pae #1 SMP 2008-10-21 16:30:26 +0200 i686 i686 i386 GNU/Linux
  Memory:       Total: 2016Mb   Used: 972Mb     Free: 1044Mb
  Swap:         Total: 4102Mb   Used: 150Mb     Free: 3952Mb
  Architecture: i686
  Processor:    0 : Intel(R) Pentium(R) Dual CPU E2160 @ 1.80GHz
  Processor:    1 : Intel(R) Pentium(R) Dual CPU E2160 @ 1.80GHz

I’ve added the processor info and gateway and nameserver info. I’ve commented out some other stuff that will give you your sound card info, video card info, and basically everything you can get with “lspci -v”. That would be why it’s commented out. Anyway, take a look at the new version:

Linux ‘sup’ bash script

12 Responses to “Linux Tells Us What’s Up (new version of ‘sup’ tool!)”

  1. Emmanuel Briot Says:

    I suggest you also add the temperature of the processor. I find this quite useful on a laptop. The basic solution is

    cat /proc/acpi/thermal_zone/THM/temperature

    which displays:

    temperature: 57 C

  2. Lonnie Olson Says:

    Just some simple comments about your script:
    1. In many of your printf statements you close the quoted string to print a variable. This is unnecessary. Bash will expand all variables that are inside double-quotes.

    So this:
    printf ” Groups:\t”$MYGROUPS”\n”
    Can become this:
    printf ” Groups:\t$MYGROUPS\n”

    Slightly more readable, and 2 fewer characters.

    2. You use “cat” twice, and neither time is necessary. Most GNU commands can take filenames as arguments, or you can simply use the “< filename” to input content on stdin. http://sial.org/howto/shell/useless-cat/

    So this:
    cat /etc/resolv.conf | tail -n 4 …
    Becomes this:
    tail -n 4 /etc/resolv.conf …

    and this:
    cat /proc/cpuinfo | grep “model name\|processor” …
    becomes this:
    grep “model name\|processor” /proc/cpuinfo …

    This saves additional command forking and keeps code succinct.

    Other than these two extremely minor points, you are doing a great job. It’s really cool. I might just use it in a .bashrc or something like that.

  3. Scott Morris Says:

    Lonnie,

    Again, thanks for the suggestions! I appreciate it. Helps make it better for anyone else who may find it useful. Thanks again for stopping by.

  4. Scott Morris Says:

    I’ll have to take a look at that…. that sounds like a cool idea. Thanks for the suggestion!

  5. Espank Me Says:

    Is your cubicle filled with pics of Type-O Negative?

  6. David McGuire Says:

    I’m downloading 11.1 Live CD right now. I’ve already (accidentally) made the DVD installation disk. But, I want to try out the Live CD version 1st.

    I live in Layton.

  7. Scott Morris Says:

    Jeremy? Is that you? 🙂

  8. Espank Me Says:

    Era tan obvio? pense en mencionar algo de El tigrito o Las Gemelas, pero decidi que algo de Espankear seria mas chistoso. 🙂 Eres alguien bien dificil de encontrar sabes?

  9. Scott Morris Says:

    o Charo en Puerto La Cruz. 🙂 Mira, tienes profil en linkedin o facebook?

  10. Scott Morris Says:

    Tambien, me puedes enviar un email o contactarme por el “Contact Me” al lado izquierdo.

  11. Patrick Says:

    Hello, I’m just new here but I’ve been intrested in Scott’s books

  12. Scott Morris Says:

    Patrick,
    Well thanks for coming by! Glad I could be of help to you with the books. Have a good one, and enjoy OpenSUSE Linux!

OpenSUSE Linux Rants
Official OpenSUSE Linux Site

internal links:

categories:

SUSE Resources

search blog:

archives:

March 2022
S M T W T F S
« Feb    
 12345
6789101112
13141516171819
20212223242526
2728293031  

64 queries. 1.248 seconds