Discover more from AASAN || Tech by Wajid Khan
📟What is CLI? Stop Being Scared of the CLI: A Beginner's Guide to Using the Terminal
Demystifying the "Scary Black Box": An Introduction to the Command Line
Hi, I’m Wajid Khan. I am trying to explain computer stuff in a simple and engaging manner, so that even non-techies can easily understand, and delivered to your inbox weekly. Join me on an under-the-hood tech journey.
Are you intimidated by the idea of the "scary black box" of the Command Line Interface (CLI)? You know, that ominous-looking thing that tech pros use to make things happen? Well, fear not!
As with the “Jin” in “Jado Ka Charakh” being harmless in the shadows, this article decodes the mystery of the CLI for you.
Sure, there's a lot to learn about how your computer works–but I'm here to prove that you can become confident in using command line tools within minutes.
🚨Say goodbye to your fears of using the CLI and hello to becoming a master in navigating your computer with just a few commands. In this blog post, we'll tackle what it takes to get up and running with the command line interface in no time.
What Is the Command Line Interface (CLI)?
Ever seen a movie scene where the hacker types furiously into a black window filled with text, with an eerie glow illuminating their face? That's the Command Line Interface (CLI) - or, as it's otherwise known, The Scary Black Box.
But contrary to popular belief, The Scary Black Box is actually quite tame. It's essentially a way of typing instructions directly to your computer without using a mouse or any graphic-based commands. You can type out commands that tell your computer to do just about anything you want - and all without leaving your seat!
Now don't let that comforting thought scare you off – the CLI is actually pretty easy to learn and use. After all, computers are just like us humans; they need specific instructions on what we want them to do. The CLI gives you the power to input those instructions as text commands – making it much easier for your computer to get things done quickly and efficiently.
Why Learn the CLI? The Benefits
When it comes to the command line, you may be thinking "what's the big deal?" After all, if you're comfortable with a mouse and click-happy with your keyboard, why bother with something that assaults your eyes with its monochrome demeanor?
Well, because it's a powerful tool that can make your life easier. Think of the command line as a hammer for nails and screws – sure, a screwdriver can do the same thing, but a hammer just does it better.
The same goes for the command line – in certain cases it's way easier to type in couple of commands instead of navigating through tons of menus. Plus, there's something enthralling about lights blinking (or is there just me?).
There are other benefits too: CLI is fast and usually more secure than graphical tools. It also works across different operating systems and allows you to automate tasks (hooray for efficiency!). And last but not least, it demonstrates your tech street cred which I'm sure you already know is invaluable.
Common CLI Commands to Get You Started
Not sure where to start with CLI commands? Don't worry, we've got you covered. Here are some of the basics to get you on your way:
ls command is the gateway drug of CLI commands. It stands for “list”, and it allows you to list the contents of a folder—a bit like peeking inside a box. When used in conjunction with the “-l” flag, you’ll get extra information about each file and folder, so you can really explore what’s inside.
Once you’ve gotten used to peeking around with
ls, it’s time to make your own folders—which is where
mkdir comes in handy. This command stands for “make directory” and it does just that—it makes a new folder for all your goodies.
Now that you have a new blank canvas of a directory, it's time to fill it up! With the help of
touch, you can create empty files that can be filled up with whatever data or information you need. Think of them like frames waiting to be filled up with pictures—it's up to your imagination what they'll contain!
Navigating the File System From the CLI
Let's start demystifying the scary black box by understanding how to move around the file system from the command line. No need to be scared, because it's not as daunting as it seems. Think of it like a map—you're simply navigating your way around the file system.
The most common navigation commands include:
cd: Changes directory and moves around in your computer's folders.
pwd: This stands for "Print Working Directory" and tells you the absolute path of your current directory.
touch: Creates a new file in the current directory if one doesn't already exist, without opening it.
mkdir: Makes a new directory within the current folder (but won't create a folder unless there's something inside).
ls: Stands for "list," which displays all items in your current directory in an alphabetical listing format without any hidden files or folders included in that list.
You can also combine commands using '&&' to create a more powerful command like this:
cd ~/Documents && touch myfile. This navigates to the Documents folder and then creates a file called 'myfile' if it doesn't already exist—simple!
Editing Files Without a GUI
It's time to put a stop to the fear of the editorial world when it comes to the command line. Sure, a graphical user interface (GUI) may seem convenient for editing files, but a command line can do everything a GUI can—and more.
Let's be honest, when it comes to editing text files, a GUI isn't always the most efficient way. After all, how often do you find yourself searching through menus just to find the right command? With the CLI, you can access what you need with just one or two keystrokes—now that's productivity!
So where do you start? By getting familiar with some of these essential editing commands:
pico: a text editor that allows you to create and modify files without any fancy user interface
pico, but with some extra features
vim: text editors for power users who want more options and control over their edits
ed: a powerful line editor that allows you to perform complex operations quickly
cat: displays contents of a file in an abbreviated form
sed: arguably the most powerful command line editor; use this if you need an editor built for speed and flexibility
With so many options, there is sure to be something perfect for your needs! Command line editors may seem scary at first, but they don't have to be—once you start tinkering around, there's no reason why they won't become your best friend.
Useful Tools and Resources for Learning the CLI
Don't be afraid, the Command Line is here to help! Sure, it might look a bit intimidating at first, but that's just because there's a lot of information and knowledge to process before you can really get going.
Thankfully, there are plenty of useful tools and resources out there for learning the CLI. From books to tutorials to courses, you're sure to find something that fits your needs. Let's take a look at some of the best.
Books are great ways to take a deep dive into the Command Line and learn in-depth information about all its features. Options include classic books like Unix Power Tools or Linux in Action, as well as more specialized titles like The Linux Command Line or Linux Shell Scripting Cookbook.
For a quick crash course on the basics of working with the CLI, tutorials are an excellent option. Many online tutorials offer bite-sized lessons that you can work through at your own pace and come away with new knowledge or skills each time.
If you'd like more structure and guidance around learning the Command Line, enrolling in a course is definitely worth considering. From introductory classes for beginners to advanced classes for seasoned pros, there are plenty of options available online and in person (when applicable).
🚨No matter what your level of experience is, there's undoubtedly something out there just waiting for you—it's time to demystify that scary black box once and for all!
In summary, the command line is nothing to be afraid of. It can (and will) provide you with more control and better understanding of your computer and your user system than you could imagine. Knowing how to access and use the command line can open up a world of possibilities, and make mundane tasks so much simpler.
So don’t be scared of the scary black box. Embrace it! You’ll learn how to make computers dance with a few simple commands, feel like a genius in no time, and finally put the fear of the CLI firmly in the past.
Hi, I’m Wajid Khan. I am trying to explain computer stuff in a simple and engaging manner, so that even non-techies can easily understand, and delivered to your inbox weekly.
AASAN || Tech by Wajid Khan is a reader-supported publication. To receive new posts and support my work, consider becoming a free or paid subscriber.