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
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 |
- Setup DNS Server On openSUSE 13.1 : What is DNS Server? As you might know, DNS, Domain Name System, is a system that resolves Domain ...0 comments |
- How To Upgrade From Ubuntu 13.04 Raring To Ubuntu 13.10 Saucy Salamander : Ubuntu 13.10 Saucy will be released on October 17th. Hope it will come with lot of improvements and ...0 comments |
- Install lamp with 1 command in Ubuntu 12.10, 13.04 Raring Ringtail & LinuxMint13 : Updated: 10/09/2012 :LAMP (Linux, Apache, MySQL and PHP) is an open source Web development platform ...1 comment |
- Configure Your Browser To Use Tor On Ubuntu/Debian/Linux Mint : Tor, The Onion Router, is a network of Virtual Tunnels that allows users to communicate securely and...1 comment |
- Twelve Vulnerabilities Have Been Fixed In Ubuntu 12.04, Time To Update : Canonical has released security updates for Ubuntu 12.04 LTS and advices to update your system as so...0 comments |
- Setup DNS Server On openSUSE 13.1
- TeamViewer 9 Final Has Been Released!
- Twelve Vulnerabilities Have Been Fixed In Ubuntu 12.04, Time To Update
- OpenLDAP Installation and Configuration in Ubuntu 12.10/13.04/13.10 And Debian 6/7
- Configure Your Browser To Use Tor On Ubuntu/Debian/Linux Mint
- Setup A Full Featured ITIL Management System Using Integria IMS On CentOS 6
- Install LibreOffice 4.1.3 in Elementary OS ‘Luna’
- How To Install Simple Scan in Crunchbang ‘Waldorf’
- Selene Media Encoder: Convert Audio, Video Files To Most Popular Formats
- Linux Kernel 3.12.2 Is Available For Download! Install / Upgrade Instructions
This work by unixmen.com is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
Copyright © 2008-2013 Unixmen.com .