Getting git status on multiple directories

At any given time, I have a handful of git repositories that I work on. While typing in the command-line is great, it getting tiring when you have a several directories that you have to manually change to and check. The “git status” command can take the git repo and the working directory as input. That, and a little bash programming to the rescue. The following command, executes git status in every subdirectory that is a git repository. ...

March 31, 2014 · 1 min · Shivanand Velmurugan

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

February 17, 2013 · 1 min · Shivanand Velmurugan

More unix goodness

Ohh the unix command prompt, I love thee! Can you guess what these commands do? 1 2 # grep -l <regex> # find . -name <regex> -delete

May 21, 2012 · 1 min · Shivanand Velmurugan

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. ...

August 28, 2011 · 1 min · Shivanand Velmurugan

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. ...

June 21, 2011 · 1 min · Shivanand Velmurugan

Job Control on \*NIX systems

If you are not a UNIX user/not a geek, please turn away right now. Every year, I either chance upon something new, or remind myself of something interesting that I’ve forgotten. This is the latter case. On a *NIX shell, you can push a foreground process to background (obviously without terminating it): $ ./someprocess ... ... ... Ctrl-Z [1]+ Stopped ./someprocess $ bg [1]+ ./someprocess & To bring the process into foreground: ...

January 31, 2011 · 1 min · Shivanand Velmurugan

Unix: removing duplicates from a file

Over the last few months, I have re-discovered some unix commands (it’s been such a long time) Eliminate duplicate lines from a file #sort -u filename > filename.new List all lines that do not match a condition #grep -v ajsk filename Copy contents of two files to one #cat file1 file2 > file3 Append output of a command to a file #cat file1 >> file2

September 9, 2008 · 1 min · Shivanand Velmurugan

cvs - Getting list of files changed in the current tree

The simple way to retreive the list of changed files would be to update the tree, which would then list the files updated. #cvs update . > filelist.dat The problem with this, is that if there have been changes to other files after your last update, you will have to manually glean the files that you have changed. I tend face this, particularly during the last couple of weeks before a release, since you don’t want to risk updating your tree everyday, but still have to make 2/3 checkins. I did some googling today, and found how to find the list of files changed without updating your tree. ...

June 23, 2008 · 1 min · Shivanand Velmurugan

Unix: how to check system configuration on solaris

I had to compare machine hardware today, and found information on that here. **#prtdiag -v - **Gives hardware information about FSB, Sparc Model, CPU speed, RAM, Harddisks, USB drives (ie. PCI and networking slots) etc. Click on the image below, for a detailed overview of prtdiag’s output #psrinfo -p - lists number of physical processors . #psrinfo -p -v - list number of virtual processors (cores) per physical processor. #psrinfo -v - detailed information for each virtual processor. ...

September 8, 2007 · 1 min · Shivanand Velmurugan