I was wondering whether it is possible to create abbreviations that can be used in terminal. I know about alias
command, but am not sure whether that can be used for what I am looking for.
Example: Say I often need to copy stuff from folder ~/Dropbox/thisfolder
. I know that I can create a shortcut to switch to this folder by creating an alias, such as,
alias tf="cd ~/Dropbox/thisfolder"
However, if I do
alias justpath="~/Dropbox/thisfolder"
then, I cannot use commands such as cp justpath/blahfile ./
. Is it possible to do something like this using some other way to abbreviate the path ~/Dropbox/thisfolder
?
justpath=~/Dropbox/thisfolder
thencp $justpath...
– Mikel May 18 '12 at 01:29~/Desktop
. This way the short paths are shell-agnostic. The only caveat is to be careful running recursive commands on the symlink dir (tell them to not follow symlinks). – jw013 May 18 '12 at 01:36zsh
– Michael Mrozek May 18 '12 at 01:41