Basic Linux Commands to Get You Started.
50 Essential Linux Commands that You Should Know - Community Picks - LinuxCommunity.io
Linux command to list all available commands and aliases - Stack Overflow
What are the essential Linux commands for all users?
Not a power user and I work a lot with files so:
-
man (80% of the times when I use the shell)
-
mv, cp, mkdir, ls -la, cd
-
diff
-
zip, unzip
-
grep, find, whereis
-
file
-
cat, head, tail
Good luck with your list.
More on reddit.comVideos
Many new users probably found Linux after watching a YouTube video. So here are few commands you should be familiar with when starting :)
Navigating the Filesystem
-
cd [folder]β move into a directory -
cd ..β go up one level -
pwdβ show current directory path -
lsβ list files and folders in the current directory -
ls -a,ls -lβ list all files (including hidden), or display details
Creating & Managing Files and Folders
-
mkdir [folder_name]β create a new directory -
touch [file_name]β create an empty file -
rm [file]β delete a file -
rm -r [folder]β delete a directory and its contents -
cp [source] [destination]β copy files or directories -
mv [source] [destination]β move or rename files and folders
Installing & Updating Software (APT-based systems like Linux Mint/Ubuntu)
-
sudo apt updateβ refresh the package list -
sudo apt upgradeβ upgrade all upgradable packages -
sudo apt install [package_name]β install a package -
sudo apt remove [package_name]β uninstall a package -
apt list --upgradableβ list packages that can be upgraded
System Info & Utility Commands
-
clearβ clear the terminal screen -
df -hβ show disk space usage in a human-readable format -
free -hβ display memory usage -
uname -aβ display detailed system information -
historyβ list previously used commands
Extra Tools (Optional but Useful)
Neofetch β Display system information in a clean, visual format
-
Install with:
sudo apt install neofetch -
Run with:
neofetch
Tree β Show directory structure as a tree in the terminal
-
Install with:
sudo apt install tree -
Run with:
tree -
Tip: Running
treefrom the home directory (cd ~) will print the entire file structure under your user.
These are the most basic things you should know when entering the world of Linux. Of course, there are many more useful commands, so feel free to add any that you think would be helpful for beginners in the comments!
You can use the bash(1) built-in compgen
compgen -cwill list all the commands you could run.compgen -awill list all the aliases you could run.compgen -bwill list all the built-ins you could run.compgen -kwill list all the keywords you could run.compgen -A functionwill list all the functions you could run.compgen -A function -abckwill list all the above in one go.
Check the man page for other completions you can generate.
To directly answer your question:
compgen -ac | grep searchstr
should do what you want.
Add to .bashrc
function ListAllCommands
{
echo -n $PATH | xargs -d : -I {} find {} -maxdepth 1 \
-executable -type f -printf '%P\n' | sort -u
}
If you also want aliases, then:
function ListAllCommands
{
COMMANDS=`echo -n $PATH | xargs -d : -I {} find {} -maxdepth 1 \
-executable -type f -printf '%P\n'`
ALIASES=`alias | cut -d '=' -f 1`
echo "$COMMANDS"$'\n'"$ALIASES" | sort -u
}