Tag Archives: unix

Working with rpms (extract, list contents)

Unix. I love thee!

Extract an rpm without installing in to the current directory (really, the rpm command should support this):

$ rpm2cpio myrpmfile.rpm | cpio -idmv

*i: Restore archive

*d: Create leading directories where needed

*m: Retain previous file modification times when creating files

*v: Verbose i.e. display progress

List contents of an rpm:

$ rpm -qlp myrpmfile.rpm

source

Life in the BASH universe

If you write a lot of scripts to automate tasks, you probably already know this. However, if you don’t, and you are still reading, you are probably a programmer, in which case, you really should be learning how to script in BASH!

A couple of pointers for you:
1. Using a -x, in the shebang line “echo”s every line before executing. This turns out to be quite useful for debugging shell scripts
2. It’s quite easy to make BASH print a countdown.

Exporting XDisplay

In *nix systems, you can make the display, the GUI of an application, appear on another machine.  This if often required, when the machine you want to run the application on is in a lab, and you have access through a desktop machine that has a monitor.

You can do this, by running an XServer on the desktop machine and configuring the client (the one where you run your app) with the XServer details. By default, the XServer instance on your desktop disallows communication from all machines except localhost. Thus, you will need to add the host in the allowed list using the xhost command.

On your machine,  to disable security checks:

$ xhost +

To allow connections from a single  host:

$ xhost +<hostname/ip>

On the client machine where the application is run, set the X Server to display to (for bash shell):

$ export DISPLAY=<hostname>:<displaynumber>.<screennumber>

If you haven’t changed the display-number or screen-number :

$ export DISPLAY=<hostname>:0.0

For a more detailed description of the

How to export your X Display.