ABC with Linux Shell Commands- Part 2

An Introduction to Essential Shell Commands

Jaishnoor Bajwa
5 min read12 hours ago

Welcome to the second, and last, part of ABC with shell commands!

Meme of the character Maui from Moana saying “What can I say except you’re welcome?”

To recap, Part-1 covered the letters A through K. Thus, this part begins with the letter L.

Here too, I present a summarized list of commands as well as a link to a longer list.

            A is for apt                     L is for ls
B is for bg M is for man
C is for cat N is for nestat
D is for df O is for open
E is for echo P is for pwd
F is for file Q is for queso
G is for grep R is for rm
H is for history S is for sudo
I is for ip T is for top
J is for jobs U is for users
K is for kill V is for vi

W is for whoami

XYZ!!

Let’s get straight to the details once again!

AI generated image of a hacker sitting in front of their PC, with the English alphabet on the screen

L is for ls: As mentioned in Part-1, ls is used to list the contents of a directory. The results are alphabetically sorted by default.

Some examples to try out:

ls 
ls -la
ls dirname

Honorable mention:

less: Opposite of more. (It’s not me, it’s the man pages.)

GIF of woman raising hands in surrender saying “I’m just an innocent bystander”

M is for man: The perceptive may have noticed that the most frequently occurring reference (in fact, the only one) throughout Part-1 and the rest of this part too, has been something called the “man pages”, short for “Manual Pages”.

The man command provides “an interface to the system reference manual” (Man pages).

It is one of the most useful commands in any user’s repertoire, especially a beginner’s. In fact, I would recommend to learners to always check out the man page for any new commands you try to get a better understanding of them.

Some examples:

man ls
man man

Another useful command to access documentation is info.

Honorable mentions:

mv: Command to move files. Commonly utilized for renaming files.

mkdir: Used to create new directories.

N is for netstat: This command can be used to find information about the networking subsystem, including “network connections, routing tables, interface statistics, masquerade connections, and multicast memberships” (Man pages).

Example:

netstat
netstat -tulpn

O is for open: opens a file in it’s default application. For example:

open foo.txt

opens the file in a text editor.

P is for pwd: Sounds like something to with passwords? Well it isn’t.

This command is used to print the name of the working (current) directory.

Honorable mention:

passwd: Sounds like something to with passwords? Why yes, yes it is.

This command is used to change passwords for user accounts.

Q is for queso: This is a very special command whose usage is best understood with a demo. You can find a really great demo video here.

R is for rm: This command is used to remove files and directories. Removing directories requires the usage of the -r option to recursively remove all its contents.

Examples:

rm foo.txt
rm -rf dirname

An interesting thing to note is that the manual page states something like “Remove (unlink) the FILE(s)”. Pay attention to the “unlink” in the parenthesis as it is key to understanding how files get deleted. For those interested in learning more, this is a good introductory article explaining hard and soft links.

Also check out shred.

Honorable mention:

reboot: Used to reboot or stop system.

S is for sudo: This command “allows a permitted user to execute a command as the superuser or another user” (Man pages).

It is commonly used to run commands with root privileges. Examples:

apt-get update
sudo apt-get update

The first command would not work, but the second would.

Also check out su.

Honorable mentions:

sed: This is a stream editor. Commonly used for filtering text.

setfacl: ACLs! ACLs! If you didn’t read about them with getfacl, here’s another chance.

Meme of a baby in a tux, with the text “This stuff is very important”

strace: Used to trace syscalls and signals.

T is for touch: This command is used to change files’ access and modification timestamps to the current time. The common usage of this command is to create new files.

Honorable mention:

top: Used to get a real-time view of the system. It can “display system summary information as well as a list of processes or threads currently being managed by the Linux kernel” (Man pages).

U is for user: This command is used to find users logged in to the current host.

GIF of woman in courtroom saying “I have a confession to make”

The commands I actually want to introduce here are: useradd, userdel, and usermod.

There are also corresponding commands for groups.

V is for vi: But check out vim.

W is for whoami: Self explanatory, really.

Black & white meme of Sherlock Homes & Dr. Watson, with the text “Elementary, my dear Watson, purely elementary.”

The whoami command is used to print the effective username “associated with the current effective user ID” (Man pages).

Honorable mentions:

wc: Used to find the word count of a file, plus a few other things.

whereis: Used to find the “binary, source, and manual page file” of the specified command.

And XYZ!!

With this we reach the end of the alphabet and the commands listed at the beginning.

There are, of course, some commands for x, y, and z as well, including xz, which had infamously been at the center of a security incident early in 2024 (read about that here); however, these commands aren’t that fundamental so I skipped them in this list.

Here is a summary list of commands covered in Part-2 of ABC with Linux Shell Commands:

L is for ls

M is for man

N is for netstat

O is for open

P is for pwd

Q is for queso

R is for rm

S is for sudo

T is for touch

U is for user

V is for vi

W is for whoami

This was simply an introductory list. How adept you get at utilizing these commands depends entirely on you.

Remember also that the journey of learning commands and how to use them isn’t over quite yet, for there is much much more to explore.

Happy learning!

GIF of snail getting to finish line but the finish line moves a bit forward

The End!

--

--