I am fairly new to bashrc and am learning about the alias feature.

I am trying to create an alias that will open my java ide without me having to do 2 commands.

This is the commands I usually have to do

>cd idea-IU-143.381.42/bin

When I try to setup an alias

alias idea= 'cd ~/idea-IU-143.381.42/bin; ./idea.sh'

and restart my terminal I get the following error

bash: alias: cd ~/idea-IU-143.381.42/bin; ./idea.sh: not found

Any help?

  • The second answer, the accepted one is wrong. – kos Nov 19 '15 at 16:42
  • Change your alias to a function – Sergiy Kolodyazhnyy Nov 19 '15 at 16:43
  • I don't understand. Add the path to your PATH. There is no need for an alias. – A.B. Nov 19 '15 at 16:51
  • @edwardtorvalds cding into a file? Very funny. – A.B. Nov 19 '15 at 16:52

Got it

I ended up making a function as suggested

   cd ~/idea-IU-143.381.42/bin;
|improve this answer|||||
  • This can work but you can also try this also , alias idea="~/idea-IU-143.381.42/bin/idea.sh" but before that just make sure idea.sh file should have executable permission. You can set executable permission by running this command chmod +x ~/idea-IU-143.381.42/bin/idea.sh from home directory. – Akshay Pratap Singh Nov 19 '15 at 21:13

Not the answer you're looking for? Browse other questions tagged or ask your own question.