command line - I am trying to create an alias to run an application. Is there away to bypass creating an alias just to change directories? - Ask Ubuntu
this question has answer here:
i new linux , want create alias run application.
currently, access via terminal typing:
cd /usr/local/bin packettracer
is there way can pass creating alias change directories? want able type pt
example terminal , instantly run, rather typing 2 separate commands.
thank in advance!
when type echo $path
should see /usr/local/bin
in path , there no need change directory in first place. can run executable typing packettracer
- there no need cd
it.
even if not in path, don't need change program's / script's directory separate command; can run prefixing executable's name full path, in case:
/usr/local/bin/packettracer
therefore alias can be:
alias pt='/usr/local/bin/packettracer'
or even
alias pt='packettracer'
before setting alias, check command want use doesn't exist using type
command. see not in use:
$ type pt bash: type: pt: not found
once have suitable alias, make permanent can add end of ~/.bashrc
file (use favourite text editor; example, open terminal , type nano .bashrc
add alias, save , exit, , alias available open new shell).
Comments
Post a Comment