7 ways to remember Linux commands

Linux commands run from the nearly obvious to the very complicated, but there are many ways that you can easily remember and use even the most obscure commands.

bad ideas investigate brain head intelligence
Getty Images

Some Linux commands are very easy to remember. The names may have only a couple letters and they often relate directly to what you want to do – like cd for changing directories or pwd for displaying the present working directory. Others can be very difficult to remember, especially if what you want to do relies on using a series of options.

So, let’s look at some commands and tricks that can help you remember commands that do just what you need them to do and that make issuing those commands so much easier.

Use aliases

The best way to nail down a complicated command is to turn it into an alias. Just take a command that works for you and assign it an easy name. In fact, there is nothing wrong with using the name of the command itself as the alias as long as this doesn’t interfere with other ways you might want to use that command. For example, grep and egrep are often aliased to include using color to highlight your search term.

alias grep=’grep –color=auto’
alias egrep=’egrep –color=auto’

This next alias might not save you a lot of typing, but it might save you from having to remember the particular command syntax:

alias show-installed='apt list --installed'

Creating an alias requires syntax like these examples illustrate. Making an alias permanent, on the other hand, requires that you add the definitions to one of your startup files (e.g., ~/.bashrc).

alias ll=’ls -alF’
alias ls-by-size=’ls -lSrh’

Aliases can also help you not forget when you need to use sudo!

alias upgrade='sudo apt-get upgrade'

They can also keep you from having to memorize a long string of command options.

alias ports='netstat -tulanp'

Here’s an alias for doing some web-server troubleshooting:

$ alias cksite='curl -I'

You would use it by typing something like "cksite somesite.org".

And don’t forget that you can always turn an alias off for a while by using the unalias command:

$ unalias ls

It’s a good idea to keep your alias names as simple and personally meaningful as possible. Otherwise, they may not save you as many neurons as you might hope.

Use apropos

The apropos command will help you find a command by matching your search term with command descriptions found in the man pages. You might just run across some commands that you didn’t realize were available!

$ apropos find
fdupes (1)           - finds duplicate files in a given set of directories
ffs (3)              - find first bit set in a word
ffsl (3)             - find first bit set in a word
ffsll (3)            - find first bit set in a word
find (1)             - search for files in a directory hierarchy
findfs (8)           - find a filesystem by label or UUID
findmnt (8)          - find a filesystem
findrule (1p)        - command line wrapper to File::Find::Rule
glob (3)             - find pathnames matching a pattern, free memory from glob()
globfree (3)         - find pathnames matching a pattern, free memory from glob()
gst-typefind-1.0 (1) - print Media type of file
ippfind (1)          - find internet printing protocol printers
jdb (1)              - Finds and fixes bugs in Java platform programs.
lfind (3)            - linear search of an array
locate (1)           - find files by name
mlocate (1)          - find files by name

Use filename and command completion

Both filename and command completion can help you to specify files and enter commands. For example, type "cale" and press enter and you won't have to remember if calendar ends in an "er" or an "ar". You can also also type "more " followed by the first few letters of a filename and then a tab and likely not have to enter anything more before the complete filename appears. If you hear a little "bing!" and nothing happens, type another letter and try again. That means there's more than one file that matches what you've typed so far.

Use an intuitive shell

Another option for helping recall Linux commands is to use a shell like fish that offers features such as suggesting command completion. You can learn more about the fish shell here.

Use a cheat sheet

You can always resort to a cheat sheet, especially when you’re first learning a series of new commands. Over time, however, you’re better off making the commands that you  frequently use easier to remember.

Use man pages

The man pages are a lot more useful than some of us give them credit for. From time to time, I even surprise myself by finding an option I hadn’t known about that turns out to be very useful. The SYNOPSIS at the top of each man page provides helpful information like this to remind you what the command syntax should be:

find [-H] [-L] [-P] [-D debugopts] [-Olevel] [starting-point...] [expression]


If you’ve got snap available on your system, you can install cheat – a tool for creating and viewing interactive cheat sheets.

$ sudo snap install cheat

Then, you can use cheat to provide command hints such as these:

$ cheat find
# To find files by case-insensitive extension (ex: .jpg, .JPG, .jpG):
find . -iname "*.jpg"

# To find directories:
find . -type d

# To find files:
find . -type f

# To find files by octal permission:
find . -type f -perm 777

Copyright © 2019 IDG Communications, Inc.

The 10 most powerful companies in enterprise networking 2022