OpenSUSE Linux Tips, tricks, how-tos, opinions, and news
My Resume - My LinkedIn Profile - twitter: @scottmmorrisI 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:
If you enjoyed this post, make sure you subscribe to my RSS feed!| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
| « Aug | ||||||
| 1 | 2 | 3 | 4 | |||
| 5 | 6 | 7 | 8 | 9 | 10 | 11 |
| 12 | 13 | 14 | 15 | 16 | 17 | 18 |
| 19 | 20 | 21 | 22 | 23 | 24 | 25 |
| 26 | 27 | 28 | 29 | 30 | ||
33 queries. 0.804 seconds
January 21st, 2009 at 10:54 am
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
January 21st, 2009 at 11:32 am
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.
January 21st, 2009 at 12:32 pm
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.
January 21st, 2009 at 12:33 pm
I’ll have to take a look at that…. that sounds like a cool idea. Thanks for the suggestion!
January 28th, 2009 at 4:52 pm
Is your cubicle filled with pics of Type-O Negative?
January 28th, 2009 at 10:03 pm
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.
January 29th, 2009 at 8:36 am
Jeremy? Is that you?
January 29th, 2009 at 11:49 am
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?
January 30th, 2009 at 9:10 am
o Charo en Puerto La Cruz.
Mira, tienes profil en linkedin o facebook?
January 30th, 2009 at 9:24 am
Tambien, me puedes enviar un email o contactarme por el “Contact Me” al lado izquierdo.
February 6th, 2009 at 1:42 am
Hello, I’m just new here but I’ve been intrested in Scott’s books
February 13th, 2009 at 9:52 am
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!