OpenSUSE Linux Rants

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

My Resume  -  My LinkedIn Profile

May 31, 2008

What’s Up must come Down – and boy did it ever

by @ 6:57 am. Filed under bash

As Linux tools sometimes do, this little script was born out of frustration from the repetitive. And the meniality of the task is directly proportional to one’s desire to replace it with anything that will automate the process. If I have to do something twice on my Linux box, it gets automated.

So a few days ago I put together a bash script which I named “What’s Up?” The abbreviation for this is ‘sup’ which is the command used to invoke the script. I use it to tell me which server I’m on, who I’m logged in as, the memory status of the box, and some other crazy junk.

Originally, this fool was 110 lines of code to display 13 lines of output. Fortunately, an altruistic and knowledgeable Lonnie Olson brought to my attention the fact that there was room for some nice optimizations. Of such coolness were these optimizations that they brought the line count from 110 to a mere 21, not including comments and empty lines.

If you’re just tuning in, the script looks like this:

#!/bin/bash

# ORIGINALLY WRITTEN BY SCOTT MORRIS (http://www.suseblog.com/) on 2008-05-28
# UPDATED AS SUGGESTED BY LONNIE OLSON on 2008-05-30

# COLLECT SOME INFO
IFS=$'\n'
UPTIME=`uptime`
D_UP=${UPTIME:1}
MYGROUPS=`groups`
DATE=`date`
KERNEL=`uname -a`

CPWD=`pwd`

# OUTPUT THE DATA
printf "  user:\t\t"$USER" (uid:"$UID")\n"
printf "  groups:\t"$MYGROUPS"\n"
printf "  working dir:\t"$CPWD"\n"
printf "  home dir:\t"$HOME"\n"
printf "  hostname:\t"$HOSTNAME"\n"
ip -o addr | awk '/inet /{print "  IP (" $2 "):\t" $4}'
printf "  date:\t\t"$DATE"\n"
printf "  uptime:\t"$D_UP"\n"
printf "  kernel:\t"$KERNEL"\n"
printf "  cpu:\t\t"$CPU"\n"
free -mot | awk '
/Mem/{print "  Memory:\tTotal: " $2 "Mb\tUsed: " $3 "Mb\tFree: " $4 "Mb"}
/Swap/{print "  Swap:\t\tTotal: " $2 "Mb\tUsed: " $3 "Mb\tFree: " $4 "Mb"}'

NOTE: If you copy and paste the above code and it does not work, just download it from the link provided above.

And its output looks like this:

[0137][scott@tomahawk:~]$ sup
  user:         scott (uid:1000)
  groups:       users dialout video
  working dir:  /home/scott
  home dir:     /home/scott
  hostname:     tomahawk
  IP (lo):      127.0.0.1/8
  IP (eth0):    192.168.0.110/24
  date:         Sat May 31 01:57:54 MDT 2008
  uptime:        1:57am  up 2 days 21:53,  5 users,  load average: 0.27, 0.23, 0.18
  kernel:       Linux tomahawk 2.6.24-default #1 SMP Sat Jan 26 21:54:20 MST 2008 x86_64 x86_64 x86_64 GNU/Linux
  cpu:          x86_64
  Memory:       Total: 940Mb    Used: 925Mb     Free: 14Mb
  Swap:         Total: 1913Mb   Used: 349Mb     Free: 1564Mb
[0157][scott@tomahawk:~]$

Logging into and out of many Linux servers per day with many different users can cause you to develop aggravated multiple personality disorders unless of course you use a cool script like this to cue the gray matter. I’m thinking about writing another one called ‘whoami’. Oh wait, someone already did that.

May 30, 2008

Linux-powered Google Android demo

by @ 6:54 am. Filed under embedded, Linux News

I can only say, “wow” to this. Heh, is all that even possible? Check out how the guy navigates the web.

Seeing what Android can do really makes me appreciate even more how incredible Linux is. The functionality in this next video is absolutely beautiful:

May 29, 2008

openSUSE.org News : Announcing openSUSE 11.0 RC 1

by @ 3:26 pm. Filed under Linux News, SUSE News, SUSE releases

From the openSUSE News room, an announcement!!!

The openSUSE Project is proud to announce the openSUSE 11.0 Release Candidate 1 (RC1). The good news is that we’re closing in on the final release of 11.0, but it’s not time to relax just yet. We’re getting really close, so we need all hands on deck to help test this release candidate. Since beta 3 we’ve fixed 578 bugs and resolved 1,118 bugs! Read on to see how you can help get 11.0 into top shape.

Digg this story! http://digg.com/linux_unix/Announcing_openSUSE_11_0_RC_1

KDE on openSUSE 11.011.0YaST Software ManagementopenSUSE 11.0

Information and Download

The first step is to download the release candidate. Please remember that RC1 is not a stable release. As a release candidate, openSUSE 11.0 RC 1 is almost ready for day to day use, but may still have some interesting bugs that make it unsuitable for running a production system. Be sure to have backups of any important data before using openSUSE 11.0 RC 1 on a system.

Media and Download

You can download openSUSE 11.0 RC 1 for x86, x86_64, and PPC at http://software.opensuse.org/developer. Deltas from Beta 3 are also provided. Note that you will need the latest deltarpm from Factory, or for openSUSE 10.3 you can use the home:coolo repository to grab it.

Most Annoying Bugs

This is a list of the most annoying bugs, that we’re aware of, that still exist in the release candidate.

General

  • GRUB config broken for other partitions. Bug #395085
  • NVIDIA driver doesn’t compile. Workaround: check here for a patch

GNOME

  • GNOME asks for the root password on first login. Bug 390658
  • GNOME has wrong icon theme by default. Bug 391865

See the Bugs:Most_Annoying_Bugs_11.0_dev page on the wiki for an up-to-date list.

Call for Testing

To help testing, take a look at opensuse.org/Testing, and the Feature Test List page. The Feature Test List page includes a definitive list of new features included in openSUSE 11.0.

We need to test these features in particular, so please look through the features on the page, pick one that has not yet had its test completed, and make sure it passes. If not, be sure to file a bug in Bugzilla and mark the test “failed.” See the full instructions on the Feature Test List page.

Comments, Feedback, and Helping

With RC1, openSUSE 11.0 is almost ready for release, but we can still use help with testing before the official release. This is a great chance to contribute to openSUSE, by filing bug reports, testing features, and giving feedback to the openSUSE developers.

Here’s a few ways to help:

  • Report bugs: If you do find a bug, be sure to report it in Bugzilla using the procedure given on bugs.openSUSE.org.
  • Provide feedback: We welcome feedback! Please join us on the opensuse-factory@opensuse.org (subscribe) mailing list. Or in the #opensuse-factory IRC channel.
  • Let the world know! Be sure to spread the word about openSUSE 11.0! Blog about it, tell your Linux User Group, start planning a Launch Party — whatever you can do to let the world know about openSUSE 11.0!

Thanks to all the developers and contributors for all the hard work that’s gone into openSUSE 11.0 so far, we’ve come a long way and only have a little more work to do before we have a final release. Fire up openSUSE 11.0 RC 1 and have a lot of fun!

Linux sporting Beryl annihilates Windows Vista Aero (video)

by @ 12:02 pm. Filed under beryl, General Linux, War

The end of this video rules. 🙂

May 28, 2008

“What’s up?” bash script redone, revised, and mo’ bettah

by @ 12:25 pm. Filed under bash, freebies

A couple of days ago, I put together a .bashrc alias. Well, it won’t work right. The commands in “ marks only execute when the shell opens, and then the variables they’re assigned to stay the same, even when you invoke the alias. Thus, the current working directory and the date and stuff that should change each time you invoke the alias, don’t.

To fix this, I changed it from an alias into a small bash script. To use it, just put it into your ~/bin folder and invoke it like you would any other command.

The contents are thus:

#!/bin/sh

# ORIGINALLY WRITTEN BY SCOTT MORRIS (http://www.suseblog.com/) on 2008-05-28

# DISPLAY THE MEMORY AND SWAP AVAILABLE FOR THE SYSTEM
function memdisp {

IFS=$' '

MEM=`free -mot | head -n 2 | tail -n 1`
COUNT=1

printf "  Memory:"

for ITEM in $MEM
do
        if [ $COUNT -eq 2 ] ; then
                printf "\tTotal: $ITEM Mb"
        fi

        if [ $COUNT -eq 3 ] ; then
                printf "\tUsed: $ITEM Mb"

        fi

        if [ $COUNT -eq 4 ] ; then
                printf "\tFree: $ITEM Mb\n"
        fi

        COUNT=$[COUNT+1]
done

MEM=`free -mot | tail -n 2 | head -n 1`

COUNT=1

printf "  Swap:\t"

for ITEM in $MEM
do
        if [ $COUNT -eq 2 ] ; then
                printf "\tTotal: $ITEM Mb"
        fi

        if [ $COUNT -eq 3 ] ; then
                printf "\tUsed: $ITEM Mb"

        fi

        if [ $COUNT -eq 4 ] ; then
                printf "\tFree: $ITEM Mb\n"
        fi

        COUNT=$[COUNT+1]
done

}

# DISPLAY THE IP ADDRESS OF ETH0
function ipaddr {

IFS=$' '
IPINF=`/sbin/ifconfig eth0 | head -n 2 | tail -n 1`
COUNT=1

printf "  IP (eth0):"
for ITEM in $IPINF
do
        if [ $COUNT -eq 2 ] ; then
#                 printf "$ITEM\n"
                
                IFS=$':'
                CT=1
                for DATA in $ITEM
                do
                	if [ $CT -eq 2 ] ; then
                		printf "\t$DATA\n"
                	fi
                	CT=$[CT+1]
                done
                
        fi
        COUNT=$[COUNT+1]
done
IFS=$'\n'

}

# COLLECT SOME INFO
IFS=$'\n'
UPTIME=`uptime`
D_UP=${UPTIME:1}
MYGROUPS=`id`
DATE=`date`
KERNEL=`uname -a`
CPWD=`pwd`

# OUTPUT THE DATA
printf "  user:\t\t"$USER" (uid:"$UID")\n"
printf "  groups:\t"$MYGROUPS"\n"
printf "  working dir:\t"$CPWD"\n"
printf "  home dir:\t"$HOME"\n"
printf "  hostname:\t"$HOSTNAME"\n"
ipaddr
printf "  date:\t\t"$DATE"\n"
printf "  uptime:\t"$D_UP"\n"
printf "  kernel:\t"$KERNEL"\n"
printf "  cpu:\t\t"$CPU"\n"

memdisp

If you copy and paste it, save it as ~/sup, and don’t forget to make it executable with chmod +x ~/sup.

Example output:

[1211][scott@tomahawk:~]$ sup
  user:         scott (uid:1000)
  groups:       uid=1000(scott) gid=100(users) groups=16(dialout),33(video),100(users)
  working dir:  /home/scott
  home dir:     /home/scott
  hostname:     tomahawk
  IP (eth0):    192.168.0.110
  date:         Wed May 28 12:11:58 MDT 2008
  uptime:       12:11pm  up   8:07,  7 users,  load average: 0.46, 0.43, 0.30
  kernel:       Linux tomahawk 2.6.24-default #1 SMP Sat Jan 26 21:54:20 MST 2008 x86_64 x86_64 x86_64 GNU/Linux
  cpu:          x86_64
  Memory:       Total: 940 Mb   Used: 756 Mb    Free: 183 Mb
  Swap:         Total: 1913 Mb  Used: 0 Mb      Free: 1913 Mb
[1211][scott@tomahawk:~]$

Here’s a link to the script: sup.tar.bz2

Download the script.

Run: tar -xvf sup.tar.bz2

Run: mv sup ~/bin

Run: sup

Enjoy.

May 23, 2008

Quick “what’s up?” alias for your .bashrc file

by @ 1:40 pm. Filed under bash, General Linux, SUSE Tips & Tricks

NOTE: Don’t use this, it has been updated. Go here for latest.

I was fooling around with an alias that would help someone know at a glance what machine they are on, who they are logged in as, their current path, the date, uptime, and some memory stats. This is something that I have found helpful when I have several remote servers open and logged into each one with several different accounts. It’s easy to know at a glance where I am doing what.

To implement this alias, pull open your ~/.bashrc file, and paste all of this at the end of it:

function memdisp {

MEM=`free -mot | head -n 2 | tail -n 1`
COUNT=1
for ITEM in $MEM
do
        if [ $COUNT -eq 2 ] ; then
                printf "  Total RAM:\t$ITEM Mb\n"
        fi

        if [ $COUNT -eq 3 ] ; then
                printf "  Used RAM:\t$ITEM Mb\n"

        fi

        if [ $COUNT -eq 4 ] ; then
                printf "  Free RAM:\t$ITEM Mb\n"
        fi

        COUNT=$[COUNT+1]
done

MEM=`free -mot | tail -n 2 | head -n 1`
COUNT=1
for ITEM in $MEM
do
        if [ $COUNT -eq 2 ] ; then
                printf "  Total SWAP:\t$ITEM Mb\n"

        fi

        if [ $COUNT -eq 3 ] ; then
                printf "  Used SWAP:\t$ITEM Mb\n"

        fi

        if [ $COUNT -eq 4 ] ; then
                printf "  Free SWAP:\t$ITEM Mb\n"

        fi

        COUNT=$[COUNT+1]
done

}

UPTIME=`uptime`
D_UP=${UPTIME:2}

alias sup="
printf '  my user:\t`whoami`\n'
printf '  my groups:\t`id`\n'
printf '  hostname:\t`hostname`\n'
printf '  domain:\t`dnsdomainname`\n'
printf '  date:\t\t`date`\n'
printf '  uptime:\t$D_UP\n'
printf '  kernel:\t`uname -a`\n'
memdisp
"

Then save the file, and run “source ~/.bashrc”. To use the alias, type ‘sup’ (short for “what’s up?”) and hit ENTER. You should see something like this:

[1457][scott@suse-linux:~]$ sup
  my user:      scott
  my groups:    uid=1000(scott) gid=100(users) groups=16(dialout),33(video),100(users)
  hostname:     suse-linux
  domain:       truenorth.local
  date:         Fri May 23 14:57:23 MDT 2008
  uptime:       2:57pm  up 5 days 18:35,  15 users,  load average: 0.17, 0.12, 0.13
  kernel:       Linux suse-linux 2.6.24-default #1 SMP Sat Jan 26 00:29:01 MST 2008 i686 i686 i386 GNU/Linux
  Total RAM:    1264 Mb
  Used RAM:     1234 Mb
  Free RAM:     30 Mb
  Total SWAP:   2055 Mb
  Used SWAP:    213 Mb
  Free SWAP:    1841 Mb
[1457][scott@suse-linux:~]$

This is great for when you come back to work from a long weekend, have 300 terminal windows open, logged into 32 servers with 43 different accounts.

If you wanted, you could also put this into the /etc/skel/.bashrc file so that all new users on your machine will automatically have this alias. Change to suit your taste.

If you do this, and an FBI satellite crashes into your new Porsche, it’s not my fault.

I am under no delusions of grandeur here. If you know of a better way to output the info, or more info that you’d like to output, or you modify/change it to make it better, please let us know. Suggestions, tips, tricks, comments, and even mild insults are welcome.

May 22, 2008

How do I get one of these shirts?

by @ 6:25 am. Filed under humor, War

I can’t remember where this came from, but I need to know who can help me find where to buy this bad boy. I’d probably even pay a finder’s fee, man. Seriously. So here it is:

-

Where do I get one of these?

May 21, 2008

OpenSUSE 10.3 : Get started with these great resources

by @ 8:14 am. Filed under education, SUSE Tips & Tricks

Just taking the first few steps seems to be one thing that holds people back from doing something new. This is no different with Linux. This morning, I happened to be on the OpenSUSE.org 10.3 Installation Page, and found links to a couple of great “Getting Started” guides for OpenSUSE Linux 10.3. I realize that 11.0 is in it’s third Beta release and will be coming soon. But for a current, stable installation, many people are still using OpenSUSE 10.3.

Without further yammer, here are the links:

Step-by-step installation guide

Official openSUSE 10.3 Start-Up guide

I’d definitely recommend bookmarking those two resources. Great guides for getting started with OpenSUSE.

May 19, 2008

How do you like your eggs, Mr. Ballmer?

by @ 11:52 am. Filed under War

I would have paid dearly to have seen this in person. Adam sent this my way (thanks, bro!). I can’t believe how awesome this is.

Apparently, the guy is saying, “Let Microsoft give back the 25 billion forints (160 forints = 1$) what he stole from the Hungarian taxpayers.” as he launches the eggs at Ballmer.

take a look at this great footage

May 15, 2008

Verizon picks Linux—but not Android—for mobile platform

by @ 11:56 am. Filed under Linux migrations

This is pretty cool… Verizon, my cell carrier, has chosen to use Linux on their cell phones. Here’s an excerpt from the article I saw:

“Mobile carrier Verizon Wireless has joined the Linux Mobile (LiMo) Foundation and has announced plans to adopt the open source software platform. Linux-based phones will be available from Verizon next year, alongside other devices that run competing proprietary operating systems.”

“The LiMo Foundation is an industry group that was founded by leading handset makers. Their goal is to collaboratively develop a comprehensive Linux-based mobile software stack that can be modified easily and used at no cost on a wide range of hardware devices. Key members include Motorola, NEC, NTT DoCoMo, Panasonic, Samsung, and LG.”

“The LiMo platform includes a wide range of infrastructure components and high-level application reference implementations and is designed so that individual parts can be easily modified or replaced. The application user interface framework is built on top of GTK+, the widget toolkit used by the GNOME desktop environment. In addition to supporting native application development, LiMo will also offer a Java SDK and support for building widget-like applications in HTML and JavaScript on top of the WebKit HTML renderer. The first LiMo-based handsets will reach the market later this year. ”

Read the rest of Verizon’s Linux adoption story

OpenSUSE Linux Rants
Official OpenSUSE Linux Site

internal links:

categories:

SUSE Resources

search blog:

archives:

May 2008
S M T W T F S
« Apr   Jun »
 123
45678910
11121314151617
18192021222324
25262728293031

60 queries. 2.269 seconds