Easy Navigation Through Your Folders
Tired of typing long path names? Me too. I have a very good solution that will save you time and energy. Type less, be more productive.
Forget the parent directory, if you want to go to a sub-directory just type ‘cd subdirectory’ in the terminal (without quotation marks). But how does this work?
The trick here is the CDPATH environment variable, which is a variable that works only with the cd command. It is just like PATH environment variable, but the difference between PATH and CDPATH is that PATH is usable with every command. Before using the CDPATH variable, you have to give values to it because it is empty by default.
How do you display the value of the CDPATH environment variable? Type ‘echo $CDPATH‘ exactly as shown in Figure 1.
My current CDPATH is /home/oltjano/Desktop/blog. Now, if I want to navigate to a sub-directory inside blog, I just type the cd command followed by the name of the subdirectory in the blog directory. Ok, if you are new to this and you still don’t believe this cool hack will work, let me show you my working directory by typing ‘pwd‘ in the terminal like shown in Figure 2.
Figure 2 shows my working directory. It is /home/oltjano. Now if I want to cd to any sub-directory inside blog directory I have to type the full path name like shown in Figure 3.
It took me 2.5 seconds to type the full pathname so I can change directory to mail. I have to perform this task often and it is really boring and time consuming, so CDPATH hack is my solution. What if I make mistakes while typing the all path name? The mistake will take my precious time and I will get nervous if this happens to many times. Now let me perform the hack. Watch geeks! It is very easy and very beautiful. I just type ‘cd mail‘ as shown in Figure 4 and it works like a charm.
If I type ‘pwd‘ in terminal it will show that /home/oltjano is not anymore my working directory, it is replaced by /home/oltjano/Desktop/blog/mail.
Did you see me type the full path-name? No, you did not. I suggest everyone to use this cool hack to navigate easily through folders. You can add other path names to CDPATH variable by separating each path name with colon.
Like us on Facebook
We need your assistance to stay live
This week Top Posts
- Top Things To Do After Installing Ubuntu 13.10 'Saucy Salamander' : Ubuntu 13.10 Saucy Salamander will be released on coming October 17th with many new salient featur...0 comments |
- Install Fail2Ban On Ubuntu Server 13.04/13.10 : Introduction Fail2Ban is an intrusion prevention framework written in the Python programming l...0 comments |
- 5 Android Apps that’s Going to Make Running Your Business Less Stressful : Running a business can be very stressful. You have to think about team collaboration, making sure th...0 comments |
- install Git in Ubuntu : Git is a distributed revision control system with an emphasis on speed. Git was initially designed a...0 comments |
- Install Crashplan backup tool in Linux : CashPlan is an automated backup solution that either uses the CrashPlan Central server or any other ...0 comments |
- Install Corosync and Pacemaker On CentOS 6.5 : I will show you in this tutorial how to install your first cluster Corosync and the Linux Cluster Ma...0 comments |
- Install Uget Download Manager In Ubuntu, Fedora, Debian
- Download Elementary OS ‘Luna’ Official Wallpapers
- Install Power Commands 0.1.5 On Ubuntu 14.04/13.10/12.10/12.04
- 5 Android Apps that’s Going to Make Running Your Business Less Stressful
- Puppet agent Install Using Script
- Install Corosync and Pacemaker On CentOS 6.5
- Install Fail2Ban On Ubuntu Server 13.04/13.10
- How To Install Google Chrome in Fedora 20, 19, 18
- How to surf using Tor Browser Bundle
- New Games got Greenlit on Linux by Steam Today!
This work by unixmen.com is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
Copyright © 2008-2013 Unixmen.com .