Recently at work, I had to continuously switch between two directories and in one of these directories I had to execute a big ass command. After cd ing between the two directories and typing the huge command a couple of times, I started thinking is there a better way to do this? I solved the huge command problem by using bash’s history look up command(control + r). I thought of using pushd and popd to switch between the two directories but it did not solve the problem to my satisfaction. Did a bit of look up on cd options and came to know of the “cd -” command which takes you to the last directory location. Combination of these two techniques quickened my work flow and increased the productivity.

Work flow using the above approach:
cd –
<ctrl> + r
cd –

Ps: I could not have scripted these operations as there were a couple of other things I had to do along with this.

Advertisements