0

Background

Using xfce4-terminal as an example, I want to run the program by just typing term.

When I type which xfce4-terminal it returns /usr/bin/xfce4-terminal.

So, I created a symbolic link: sudo ln -s /usr/bin/xfce4-terminal /usr/bin/term.

Now I can execute the program by typing term.

Question

I've been wondering if this is a reasonable way to achieve the purpose. Asking for the best method (without even researching) may be a subjective question, but here I'm asking for a standard way if any, or any pros and cons my method may has.

I have thought of the following alternatives:

  • Rename the program: mv xfce4-terminal term
  • Use environmental variables (but there are many ways to do this...)
  • Avoid being lazy in the first place

I already know that:

  • I can utilize Tab to auto-complete
  • (In GUI) I can utilize shortcuts like Ctrl+Alt+T
  • Creating symbolic link has risk of conflict if another program was named "term"
  • Renaming has risk of breaking dependency

Environment:

uname --all returns:

  • Linux debian 4.19.0-18-amd64 #1 SMP
  • Debian 4.19.208-1 (2021-09-29)
  • x86_64 GNU/Linux
3
  • 7
    A simple alias? alias term=xfce4-terminal
    – Kusalananda
    Commented Feb 24, 2022 at 7:51
  • 1
    copy to $HOME/bin (often in your $PATH) under name of your choice ?
    – Archemar
    Commented Feb 24, 2022 at 12:49
  • 1
    If you want to go the symlink route, use update-alternatives Commented Feb 24, 2022 at 13:46

1 Answer 1

2

The safest way is to use an alias, as they has already mentioned in the comments.

Symlinking will work as well, but be aware that some programs change their behaviour depending on the name by which they were called.
E.g. bash-scripts checking the content of $0 and calling different functions depending on it.

Renaming the program itself is asking for trouble:
Anything that depends on xfce4-terminal will fall flat on its face after the renaming. And you'll have two versions of the binary on your system with the next update :-/

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .