Sep 27
Do you know the environment variable $CDPATH ? This variable let you define some path where to look for a directories when moving with the command CD. You can define multiple path in this variable. This can be usefull if you have some directories that you access more frequently than the others. As this variable define the order how you move from a directory to another, I suggest you to keep the “.” directory in first position of your variable declaration. Of course, you can set this variable in your .bashrc
nicolas@grimm:~$ export CDPATH=.:/:~/
nicolas@grimm:~$ cd usr
/usr
nicolas@grimm:/usr$ cd Desktop
/home/nicolas/Desktop
Sep 27
You probably have set some personnal alias or function on your box. Most common is probably dir, ls, ll… If you forgot how you define your alias or function, the easiest way for get back the definition isn’t to read your numerous .bashrc but using some bash built-in command : type or command.
type: usage: type [-afptP] name [name ...]
command: usage: command [-pVv] command [arg ...]
Command is generally used for running command with arguments ignoring any shell function named command. Instead of Type that describe a command, for each name, indicate how it would be interpreted if used as a command name. But both can be used, here is some examples :
nicolas@grimm:~$ type dir
dir possède l’alias `ls –color=auto –format=vertical’
nicolas@grimm:~$ command -v ls
alias ls=’ls –color=auto’
nicolas@grimm:~$ command -V ls
ls possède l’alias `ls –color=auto’
nicolas@grimm:~$ command -V dir
dir possède l’alias `ls –color=auto –format=vertical’
nicolas@grimm:~$ command -V rm
rm is /bin/rm
Enjoy ;-)