Monday, December 28, 2009

Using pushd, popd and dirs

Since I have a bit of time on my hands, I thought I might share a trick or two.  Well, not really 'tricks,' but good information to know. I will cover the shell builtins, pushd, popd, and dirs for bash and zsh. Additionally, I will demonstrate how to use some shell aliases, in order to make the use of these handy builtins even more convenient, and time saving.

Monday, December 21, 2009

How to delete the 'Desktop' folder in Gnome...

...and not have the contents of your home directory displayed on your desktop.

Maybe its just me, but I really don't like the way that a fresh Gnome install sets up a user's home directory with a bunch of empty directories, like 'Video', 'Documents', and the totally evil 'Desktop' folder.  If you are like me, you want to decide what is in the home folder, which does not include all the extra directories they offer.  A reasonable person would expect that the quick and easy solution would be to delete the unwanted directories, but not so fast my friend.  All of the directories can be safely deleted, but one.  If you remove the 'Desktop' folder, you will end up with all the contents of your home directory (not including hidden files) displayed on your desktop.   Of course fixing your 'mistake' of deleting the Desktop folder is not as easy as doing a

mkdir ~/Desktop

No no, the wonderful people at Gnome must have thought that would be too easy.  No, first you must search around on the internet and find a post like this one.  Then you have to fire up your editor and do some editing, as well as replacing the folder 'Desktop.'  Then all will be well. Except for the fact that your home directory still has a folder in it that YOU DON'T WANT!!!1!

Anyway, the solution is pretty simple.

Friday, December 18, 2009

ps headers and grep

GNU ps(1) has a plethora of options.  One of the more useful features of ps is the header label which is printed at the top of the ps output, such as in the following snippet:


Listing 1.1
char $ ps
  PID TTY       TIME CMD
15705 pts/1 00:00:00 bash
16345 pts/1 00:00:00 ps


As you can see, each column has a label on the top.  In this example (Listing 1.1), the columns are labelled PID, TTY, TIME and CMD.  This is the most basic invocation of the ps command, and the output is minimal.  If you start adding options, such as doing ps aux, (where you will get you a listing of all the processes on the system using BSD style syntax) you will get quite a bit more text to sift through.  But what if you are only after a certain term, such as tty, for example in the ps aux listing?