Welcome to the 1st installment of Command Line Quickie here on Medium.

This beginner's series explores powerful Unix commands, giving you simple yet real-world examples that can help you get organized and boost your tech confidence. Be sure to follow me to be updated every time I release a Command Line Quickie!

Whether you need to find something, destroy something, create something, or edit and update something, these commands can be used on both Mac and Linux operating systems.

In the spirit of starting off strong, let's talk about the most dangerous, powerful, and perhaps even most exciting command of them all: rm.

rm is shorthand for "remove." At its core, rm allows you to delete things with unmatched precision and speed.

OK, great — so it removes things. Big deal, right? Can't you just do the same thing with the trash can button? Why yes… yes you can. What makes rm terrifying, however, is that once you run that command, there is no "undo" button.

It's gone forever.

None

When you read forum posts involving the rm command, battle-hardened nerds will wisely open up their posts with sage, stern, and bold words of warning: never run this command unless you know exactly what you're doing with it.

I usually don't listen to them, because I learn things the hard way.

Let's experiment a little with this two-letter command and see how far we can get.

None

Now, to give my own sage and stern word of warning before I start this demo, never run this command unless you know exactly what you're doing with it.

Seriously.

(For this demo, we're in a controlled environment; I also understand the risks involved, so we will proceed.)

Let's say I want to remove one of these stubborn apps that insists it needs to stay on my machine because it's an integral part of my operating system. Chess.app, really? Why don't I believe you? I can't drag and drop you to the trash — why? You've got to go.

None
Wait…What?

No worries, rm is here to save the day.

Navigating to the Applications folder on the command line, we'll then just type: sudo rm -rf Chess.app/

Voila!

Here is what each command stands for:

Sudo= superuser do (gives you read/write/superpower abilities)

rm= remove

-rf= two flags smashed into each other for efficiency, r = "recursive" and f = "force."

With -rf, we're telling it to delete everything starting at that directory, working all the way down into its subfolders, subfolder subfolders, subfolder subfolder subfolders, and alllllllllll the way down until everything is nuked into oblivion (recursive) without prompting for confirmation (force).

Let's do another one.

Say I have a bunch of files in a directory that contain the word "dorkasaurus" that are no longer needed. We will type rm, then pass in our keyword contained by asterisks: rm *dorkasaurus*

Bye bye, all you dorkasaurus (but not "dorkasarus") files.

None

This command can be much faster than deleting files and directories manually. As you can imagine, this command and its assorted flags can also really mess up your system and ruin your week.

Remember, there's no undo button with rm.

If you ever want to know what each flag does, you can summon something called manpages using the man command followed by the command you're curious about. For example:

man pwd

man ls

man rm

None
None

rm is probably the most powerful command-line command that exists.

Whether you use "vanilla rm" or you use it in combination with flags such as -rf, it should always be used with caution rather than reckless abandon. If you're going to experiment with it, consider using a Virtual Machine or some other computer where it's OK to break things forever.

Happy hacking! RTC

You can also watch the video version here (be sure to subscribe to the channel for more vids!):

Consider supporting my work on Patreon to ensure more quality, real-world material (and score some sweet swag): www.patreon.com/realtoughcandy

You can also sponsor a kombucha or coffee with a one-time donation: paypal.me/toughcandy