OpenWRT One: List all available commands

Under Ubuntu Linux, there’s a command which lists all available commands:

bash -norc

Under OpenWRT, we can do the same, with limitation and the procedure a bit changed:

ash -no

… that’ll output something like:

errexit         on
noglob          on
ignoreeof       on
monitor         on
noexec          on
xtrace          on
verbose         on
noclobber       on
allexport       on
notify          on
nounset         on
errtrace        on
vi              on
pipefail        on

Now press the Tab key twice. It’ll output something like:

.                     date                  fstrim                jffs2reset            mount                 read sync                  uhubctl
.config/              dbclient              fsync                 jobs                  mount_root            readlink              sysctl                ujail
:                     dbus-cleanup-sockets  fw3                   jshn                  mpris-proxy           readonly              sysupgrade            ulimit
[                     dbus-daemon           fw4                   jsonfilter            mpstat                reboot                tail                  umask
[[                    dbus-launch           fw_loadenv            kill                  mtd                   reload_config         tar                   umount
alias                 dbus-launch.real      fw_printenv           killall               mv                    reset                 taskset               unalias
apk                   dbus-uuidgen          fw_printsys           kmodloader            nc                    resize                tc                    uname
ash                   dd                    fw_setenv             ksmbd.addshare        netifd                resolveip             tcpdump               uniq
askfirst              devstatus             fw_setsys             ksmbd.adduser         netmsg                return                tee                   unlzma
awk                   df                    fwtool                ksmbd.control         netstat               rfcomm                test                  unset
basename              diff                  gatttool              ksmbd.mountd          nft                   rm                    time                  unxz
bdaddr                diff3                 getopts               l2ping                nice                  rmdir                 times                 upgraded
bg                    dig                   getrandom             l2test                nmap                  rmmod                 top                   uptime
blkdiscard            dirname               grep                  ldd                   nslookup              route                 touch                 urandom_seed
blkid                 dmesg                 gunzip                led.sh                ntpd                  rpcd                  tr                    urngd
block                 dnsmasq               gzip                  less                  ntpd-hotplug          sadf                  traceroute            usbreset
bluemoon              dnstop                halt                  let                   nvme                  sar                   traceroute6           usign
bluetoothctl          dropbear              hash                  ln                    obexd                 scp                   trap                  utpl
bluetoothd            dropbearkey           hciattach             local                 odhcp6c               sdiff                 true                  utrace
board_detect          du                    hciconfig             lock                  odhcpd                sdptool               ttyd                  validate_data
brctl                 e2fsck                hcidump               logd                  odhcpd-update         seccomp-trace         type                  vi
break                 echo                  hcitool               logger                openssl               sed                   ubiattach             visudo
btattach              egrep                 hd-idle               login                 owut                  seq                   ubiblock              vmstat
btmgmt                env                   head                  logread               parted                service               ubicrc32              wait
btop                  ethtool               hex2hcd               ls                    partprobe             set                   ubidetach             watch
busybox               eval                  hexdump               lsblk                 passwd                setsid                ubiformat             wc
cat                   exec                  history               lsmod                 pgrep                 sh                    ubihealthd            wget
cd                    exit                  hostapd               lsusb                 pidof                 sha256sum             ubimkvol              which
chdir                 export                hotplug-call          luci-bwc              pidstat               shift                 ubinfo                whoami
chgrp                 expr                  https-dns-proxy       lzcat                 ping                  signify               ubinize               wifi
chmod                 factoryreset          hwclock               lzma                  ping6                 slabtop               ubirename             wpa_supplicant
chown                 false                 id                    md5sum                pivot_root            sleep                 ubirmvol              wpad
chroot                fdisk                 ifconfig              mkdir                 pmap                  smartctl              ubirsvol              xargs
ciptool               fg                    ifdown                mke2fs                poweroff              sort                  ubiupdatevol          xz
clear                 fgrep                 ifstatus              mkfifo                pppd                  source                ubus                  xzcat
cmp                   find                  ifup                  mkfs.ext2             printf                ss                    ubusd                 yes
command               firstboot             init                  mkfs.ext3             procd                 ssh                   ucc                   zcat
config_generate       fit_check_sign        insmod                mkfs.ext4             ps                    ssh-keygen            uci
continue              fitblk                iostat                mknod                 pwd                   start-stop-daemon     uclient-fetch
cp                    flock                 ip                    mkswap                px5g                  strings               uclient-fetch.bak
crond                 free                  ipcalc.sh             mktemp                python                sudo                  ucode
crontab               fsck.ext2             iw                    mnt/                  python3               swapoff               udevtrigger
curl                  fsck.ext3             iwinfo                modinfo               python3.13            swapon                udhcpc
cut                   fsck.ext4             jffs2mark             modprobe              rctest                switch_root           uhttpd

As soon as you clear the terminal screen, double-pressing the Tab key no longer lists all the available commands.

If you want to find out what program a command belongs to:

ls -l $(which iostat)

-rwxr-xr-x    1 root     root         57544 Dec 17  2023 /usr/bin/iostat

ls -l $(which ssh)

lrwxrwxrwx    1 root     root            18 Oct 17 16:45 /usr/bin/ssh -> /usr/sbin/dropbear

ls -l $(which echo)

lrwxrwxrwx    1 root     root             7 Oct 17 16:45 /bin/echo -> busybox