Pkgman is to long name = pk

Is possible to change name of pkgman to pk or other short?
for example p

Create an alias in your shell or a symlink in non-packaged/bin folder.

4 Likes

To add, you can also do a reverse-search of commands in your bash history by typing Ctrl-R. Just type a few letters of "pkgman’ and you should see the needed command (I do this for “pkgman full-sync”. Less typing that way.

Hey then it should be pkgm :slight_smile:

1 Like

Aliases are your friend. Yes, we do POSIX. :blush:

3 Likes

Yes, an alias is the answer, and OK, we do POSIX, but some extra instructions may be necessary. The way I remember, I pieced this together partly by sorting through a “strings” on the shell binary, so it’s entirely possible I missed something.

The key is the startup profile, that will always be executed by a login shell - which is what you get with Terminal. That’s normally $HOME/.profile, but on Haiku it’s now $HOME/config/settings/profile (note, no leading period.) The login shell is at the root of a potential hierarchy of subshells, so this is where you set up anything that will be inherited by those subshells, like environment variables. Aliases aren’t inherited, so ideally would go in a separate file that’s used to initialize interactive subshells, $HOME/config/settings/bashrc – but that sadly doesn’t include the login shell, so one thing you put in profile is

# set interactive shell aliases in the login shell
. $HOME/config/settings/bashrc

Now you edit $HOME/config/settings/bashrc and put in the aliases:

alias pk=pkgman
#  Tired of unreadable color highlighting in grep results?
unalias fgrep
# Like the traditional shell prompt?
PS1='$ '

The “alias” command by itself will list current aliases. Most of this is common to other UNIX environments, what’s different is location of files.

1 Like

Pkgman is too long of a name? It’s six letters! What’s next, shortening Haiku to hu?

2 Likes

I’m ok with it, greetings from HUngary. :slight_smile:

2 Likes

copy are 4
cp are 2

terminal uses short commands
mv, ls, etc.

1 Like

By your logic:
packagemanager is 14
pkgman is 6.
This is already a shorter name.

The following shouldn’t be viewed as a tl;dr. You should read it to understand a bit about why things get named the way they do.

“Terminal” uses what ever command name is available in $PATH. This may or may not be a short name. Aliases are way of changing how a command is seen in your path.

mv, ls, etc. are commands that date back to the old Unix days. As time has progressed, command names have lengthened due to a shortage of two character combinations. This is how we ended up with command names such as pkgman. Human readability also played a part. If you’d like to shorten this command, it would be a simple matter of setting up an alias in your bashrc and restarting your terminal. This is left up to the end user for many reasons.

If you would like pkgman to be shortened to pm then add the following to your bashrc and restart your terminal:
alias pm=“pkgman”

See also donn’s explanation above for getting your profile to source your bashrc. Otherwise nothing will happen.

Caveat: you should try your intended alias in the terminal before creating an alias. Say for instance there was already a command called pm, then creating an alias of the same name will cause a conflict. Remember me saying there are many reasons why this is left up to the user? This is one of the them. Another reason would be later installing software that wants to use your alias for something else. This will also be a conflict. There are more reasons, but I think this illustrates the point.

This is, and necessarily remains an end-user defined decision. You should never expect any OS to do this for you. Fortunately, your personal aliases are easily ported to any OS environment in which you use bash or similar shell environment. Just remember the above caveat when transporting your aliases. Every system is different. Not even simply on the OS level. One particular install of an OS can differ from another install of the same OS depending on what other software is installed.

3 Likes