1

How do I create a shortcut/alias in fedora? For example this is the path to my netbeans IDE

netbeans-8.2/bin/netbeans

I am a lazy person, and I don't want to type all this out in the terminal, is there a way so I can type something else and it "equals" whatever I want? Example If I type

SOMECOMMAND = netbeans-8.2/bin/netbeans

Whatever somecommand actually is, it will act as though I actually typed out the full

netbeans-8.2/bin/netbeans
1
alias nb='netbeans-8.2/bin/netbeans'

will probably do what you want.

Then nb gets expanded to the full command.

To see all the aliases you have set, type alias. To unset the alias, you want unalias nb.

This alias won't be saved permanently. To do that you will need to edit your shell configuration. For bash, which is the default shell under Fedora, that's .bashrc in your home directory.

  • Unfortunately this does not work – bit.con Feb 7 '17 at 0:14
  • You need to give more information. Does netbeans-8.2/bin/netbeans on its own actually do what you want? – SauceCode Feb 7 '17 at 0:16
  • yes, when I type that in the terminal it runs netbeans like it should – bit.con Feb 7 '17 at 0:17
  • 1
    Did you add an extra space by mistake? – SauceCode Feb 7 '17 at 0:24
  • 1
    @bit.con Note that this alias will only work in a specific directory, the one containing netbeans-8.2. It would probably make more sense to put a full path there. But in fact what would make the most sense would be to add …/netbeans-8.2/bin to your PATH. – Gilles Feb 7 '17 at 22:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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