shell cmd argument completion

Hello! I'm a new FreeBSD-user.

How can I cmd args completion like this:
Code:
$ pkg i<tab>
$ pkg install

And with what shell can i do this?
Code:
$ cat /etc/shells
/bin/sh
/bin/csh
/bin/tcsh
/usr/local/bin/bash
/usr/local/bin/rbash

Code:
$ uname -a
FreeBSD rpi-b 13.5-STABLE FreeBSD 13.5-STABLE stable/13-n259337-d9a1e54cb037 RPI-B arm
 
Welcome to the FreeBSD Forums. These forums have a search feature. You may learn from​
that tab‑completing non-filenames requires a more feature-rich shell such as bash(1), fish(1), csh(1) ≡ tcsh(1) or zsh(1), all of which use their own method to specify eligible completions.​

I've tried bash and bash-completion because I familiar with it. But it doesn't work.

Code:
$ echo $SHELL
/usr/local/bin/bash

$ cat ~/.bashrc
[[ $PS1 && -f /usr/local/share/bash-completion/bash_completion.sh ]] && \
    source /usr/local/share/bash-completion/bash_completion.sh

$ pkg info | grep bash-completion
bash-completion-2.11,2         Programmable completion library for Bash

I found the solution! I've created the .bash_profile file:
Code:
if [ -f ~/.bashrc ]; then
    . ~/.bashrc
fi

Interesting, there's a difference between a login shell and not a login shell.
 
How can I cmd args completion like this:
$ pkg i<tab> $ pkg install
maybe you can define aliases for pkg(8) instead? that should be easier. like you don't have to type install and i would be sufficient.

Diff:
root@freebsd /usr/home/yusuf % pkg i -n -f neofetch
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
Updating FreeBSD-kmods repository catalogue...
FreeBSD-kmods repository is up to date.
All repositories are up to date.
The following 1 package(s) will be affected (of 0 checked):

Installed packages to be REINSTALLED:
    neofetch-7.1.0_1 [FreeBSD]

Number of packages to be reinstalled: 1

82 KiB to be downloaded.


--- /usr/local/etc/pkg.conf.orig    2025-07-27 12:35:04.599029000 +0300
+++ /usr/local/etc/pkg.conf    2025-08-02 00:26:44.808460000 +0300
@@ -56,6 +56,7 @@
 
 # Sample alias settings
 ALIAS {
+    i = "install";
     ii = "info -x";
     s = "search";
     ar = "autoremove";
 
Back
Top