Unix: Using pushd and popd for faster navigation

Pushing and popping might not be your idea of a good time, but some Unix admins swear that these operations make working in multiple directories as easy as 1, 2, 3, 2, 1.

By  

This same kind of operation on a Unix system might look like this:

#!/bin/bash

if [ $# != 1 ]; then
    echo "try harder"
    exit 1
fi

pushd $1
ls
popd

Manipulating your directory stack might prove to be a new favorite trick or might seem more trouble than it's worth, but many admins find it's a useful way to move between directories with ease.

Read more of Sandra Henry-Stocker's Unix as a Second Language blog and follow the latest IT news at ITworld, Twitter and Facebook.

Photo Credit: 

flickr / Roberto Verzo

Join us:
Facebook

Twitter

Pinterest

Tumblr

LinkedIn

Google+

Answers - Powered by ITworld

Join us:
Facebook

Twitter

Pinterest

Tumblr

LinkedIn

Google+

Ask a Question
randomness