create a "bookmark" for navigating filesystem from the linux command line
I think I need to use the ln -s command for this but not sure. Could someone give me a good example of a way to make it so I don't have to keep re-typing
cd ~Dropbox/programming/ruby/function_library/pond_design once per hour? I would really like to just type cd pond_design or something else shorter What is the best way to do this kind of thing, in general? |
Code:
alias pond="cd ~Dropbox/programming/ruby/function_library/pond_design" You can add this to your .bash_profile or similar file, so it will remain in effect after reboot or whatever. Sasha |
Hi,
I would like to add to what Sasha posted is that you could setup a .bashrc & .bash_profile for your user; Code:
sample .bash_profile; Code:
sample .bashrc; |
create new .bash_aliases
That is a great idea. Thank you. However, I'm having a hard time understanding everything you are doing with the .bashrc and .bash_profile.
Is there a way to simply create a .bash_aliases and put them in there? I did this: # User defined aliases alias pond="cd ~/Dropbox/programming/ruby/function_library/pond_design" and saved that in .bash_aliases but when I type pond the bash command is not recognized. Can you explain what I have to do so that it is recognized? Thank you! |
Hi,
Quote:
So if you save each sample to the required files for '.bashrc' and '.bash_profile' you would have things set for the next time you enter the console. There after for each time you enter your console you would have things setup this way until you change or remove the files. |
~/.bashrc and ~/.bash_profile are two bash initialization files, ~/.bash_aliases is not, and bash has no means to know that. Bash can't open every single file in your home directory to see what's inside of it.
Bash will source ~/.bashrc when it's launched in a non-login interactive mode, for example, when you use an xterm or a similar terminal emulator. ~/.bash_profile will be read automatically when you use bash as a login shell, for example when you login in command line instead of a graphical login manager. Hence, all the bash related stuff goes either into ~/.bashrc, ~/.bash_profile, or both. Or, if you want to set it globally, into /etc/profile. However, I don't understand what the difficulty is. It isn't any more complicated to create a file called ~/.bashrc than it is to create one named ~/.bash_aliases... |
Well, if you want a separate file for aliases, it's also simple enough to source that interactively or from ~/.bashrc. Just type '. ~/.bash_aliases' or add it to your ~/.bashrc.
You might also look into popd/pushd, cdable_vars, and CDPATH. CDPATH="whatever_you_like:~Dropbox/programming/ruby/function_library/" cd pond_design |
Yes, there are thousands of ways to make it more complicated.
|
onebuck, thank you. I simply copied your scripts - created .bashrc and .bash_profile. It works like a charm.
|
Hi,
I'm glad it worked for you. 'KISS' is always the best! BTW, as the OP you can mark the thread as [SOLVED] via the Thread Tools. Courtesy to others. |
All times are GMT -5. The time now is 06:51 AM. |