DEV Community

William Lake
William Lake

Posted on β€’ Edited on

19 7

Create a linux alias to list all available commands

Infomercial-style qualifier: These instructions were created on Ubuntu 18.04. Your mileage may vary.

I find myself constantly Googling Linux commands and then promptly forgetting them. This morning I decided to find a better way, and after creating my own process I thought I'd share. Hopefully it's useful to someone in the future.

Bonus: Found something useful along the way: https://www.commandlinefu.com/commands/browse


How To

Create an alias named allcomm and save it in your .bashrc.
echo "alias allcomm=\"compgen -A function -abck\"" >> ~/.bashrc

Reload your .bashrc so the changes will take effect.
source ~/.bashrc

Usage

Searching results:
allcomm search_string_here

E.g.

allcomm zip

zip
zipnote
zipcloak
zipgrep
zipinfo
zipsplit
zipdetails
Enter fullscreen mode Exit fullscreen mode

Searching via grep:
allcomm | grep search_string_here

E.g.

allcomm | grep zip

zip
preunzip
unzip
zipnote
unzipsfx
zipcloak
zipgrep
zipinfo
funzip
prezip-bin
mzip
zipsplit
zipdetails
gpg-zip
prezip
bzip2recover
bunzip2
gunzip
gzip
bzip2
Enter fullscreen mode Exit fullscreen mode

Source: https://stackoverflow.com/a/949006

AWS GenAI LIVE image

How is generative AI increasing efficiency?

Join AWS GenAI LIVE! to find out how gen AI is reshaping productivity, streamlining processes, and driving innovation.

Learn more

Top comments (3)

Collapse
 
jmfayard profile image
Jean-Michel πŸ•΅πŸ»β€β™‚οΈ Fayard β€’

Combine with the too long didn't read tool

tldr.sh/

Because man pages are only useful as a reference, not as tutorials for common use cases

Collapse
 
jmfayard profile image
Jean-Michel πŸ•΅πŸ»β€β™‚οΈ Fayard β€’

How to do this with zsh?

Collapse
 
moopet profile image
Ben Sinclair β€’

Zsh supports bash completion, if you tell it to:

autoload bashcompinit && bashcompinit

will tell it to load the compatibility "built-ins" which include compgen. It's not 100% compatible, but that should get you started.

Eliminate Context Switching and Maximize Productivity

Pieces.app

Pieces Copilot is your personalized workflow assistant, working alongside your favorite apps. Ask questions about entire repositories, generate contextualized code, save and reuse useful snippets, and streamline your development process.

Learn more

πŸ‘‹ Kindness is contagious

Please leave a ❀️ or a friendly comment on this post if you found it helpful!

Okay