Use CDPATH to define the base directory for cd command

If you are frequently performing cd to subdirectories of a specific parent directory, you can set the CDPATH to the parent directory and perform cd to the subdirectories without giving the parent directory path as explained below.

[STEALTH@HACKER-db ~]# pwd
/home/stealth
[ramesh@dev-db ~]# cd mail

-bash: cd: mail: No such file or directory


[Note: This is looking for mail directory under current directory]

[STEALTH@HACKER-db ~]# export CDPATH=/etc
[STEALTH@HACKER ~]# cd mail
/etc/mail


[Note: This is looking for mail under /etc and not under current directory]

[STEALTH@HACKER-db /etc/mail]# pwd
/etc/mail 


To make this change permanent, add export CDPATH=/etc to your ~/.bash_profile

Similar to the PATH variable, you can add more than one directory entry in the CDPATH variable, separating them with : , as shown below.

export CDPATH=.:~:/etc:/var
This hack can be very helpful under the following situations:

o Oracle DBAs frequently working under $ORACLE_HOME, can set the CDPATH variable to the oracle home
o Unix sysadmins frequently working under /etc, can set the CDPATH variable to /etc
o Developers frequently working under project directory /home/projects, can set the CDPATH variable to /home/projects
o End-users frequently accessing the subdirectories under their home directory, can set the CDPATH variable to ~ (home directory)

1 comments:

jane holly said...

CONTACT: onlineghosthacker247 @gmail. com
-Find Out If Your Husband/Wife or Boyfriend/Girlfriend Is Cheating On You
-Let them Help You Hack Any Website Or Database
-Hack Into Any University Portal; To Change Your Grades Or Upgrade Any Personal Information/Examination Questions
-Hack Email; Mobile Phones; Whatsapp; Text Messages; Call Logs; Facebook And Other Social Media Accounts
-And All Related Services
onlineghosthacker Will Get The Job Done For You
onlineghosthacker247 @gmail. com
TESTED AND TRUSTED!!!

Post a Comment

STEALTH HACKER

Sponsers