DEV Community

Cover image for Don't fear the command line: Navigation

Don't fear the command line: Navigation

deniselemonaki profile image Dionysia Lemonaki Updated on ・2 min read

My goal for this year is to get comfortable with the command line and not panic every time I want to use it. Before starting to learn about it,I thought it was this extremely complex thing, that only hackers used and if I tried to use it I would blow up my computer.
computer on fire

Turns out, the command line is a text-based program on your computer that allows you to create and delete files, run and write programs, navigate through folders and files and run scripts to automate common tasks.

Instead of using the Graphic User Interface of your computer(like Finder on Mac OS) you can pass commands to the terminal.

The terminal is an application on your computer, already installed on your Mac, which passes the commands to the computer's operating system to run.

Since learning some basic commands to navigate through files, create directories(fancy tech jargon for folders) and view the contents of what I created and what was already stored on my computer, I have stopped using GUI because the command line makes me feel like I'm one step closer to becoming my alter-ego : a hacker.

hacking in progress

The commands listed here are for Linux or Mac OS, so if you are using either of them here is what you need to get started:

  • pwd stands for print working directory. Use this command when you are confused about where you've navigated to as it outputs the name of the current directory you're in.

  • ls This command looks at the directory you're in, the current working directory, and lists all files and directories inside it .
    Using pwd and ls together comes in handy to see where you are in the filesystem.

  • cd stands for change directory and it switches you into the directory you specify. When you are levels deep in a certain folder and want to move up one level use cd .. . To move up two levels use cd ../.. and so on.

  • To create a new directory in the working directory use mkdir which stands for make directory.

  • To create a new empty file inside the working directory use touch.

Those are the basic commands to help navigate through files and directories and create new ones. Two handy commands also include :

  • When your terminal gets difficult to read and too crammed up, use clear to clear everything you typed and start fresh. When you want to see all the previous commands you have typed, use history

That's all you need to get started in order to navigate and edit your filesystem. Doesn't seem that scary now does it?

cat on computer

Discussion (21)

Editor guide
waylonwalker profile image
Waylon Walker

The command line is such an amazing interface. You can really combine things and automate so many things that would be impossible with a GUI. Once you get a few plugins and aliases you find that you don't need to type everything out. Its generally a matter of a few keystrokes a few more . Things like rupa/z and fzf make it crazy fast! Your fingers can move so much faster than the mouse with a bit of config and practice.

If your stuck with windows cmd forget about it, upgrade to wsl.

arthurborges profile image
Arthur Borges

I personally use a lot the command ls -la, that list files vertically and with folder permissions and users details. To edit a file using a friendly editor, nano [name_of_the_file] is the way to go.

Great post, by the way! Keep the good work! =D

deniselemonaki profile image
tejsinghrana profile image
Tej-Singh-Rana • Edited

which name-of-the-command

--> display the path

jimmy19742 profile image

Congratulations and thank You for this article.
Mac OS X is not much popular in Europe though I've run Hackintosh on my Windows 7 via virtualization. Much better than Windows though.
Been on Android OS since 2010 which just like Macs and even more is basically with Linux kernel. It requires root access ( like in Linux ) but I can run plenty of shell commands via a terminal emulator.
chmod is on my favourite ones ;cd.. - too ;,chone ;grep - looks for patterns in strings,etc.
Congratulations once again!😀

incrementis profile image
Akin C.

I enjoyed reading your article :)!
I use WIN 10 and
the following commands have often helped me to quickly check certain things:
ping <IP-Address or url> to see if my local PC is connected to certain hardware
ipconfig to check the IP address of my local PC
hostname to check the name of my local PC

deniselemonaki profile image
Dionysia Lemonaki Author

Thanks for adding that information about Windows! :)

beethelueur profile image

I have recently started using Linux and for that I was needed to learn basics of using commandline. Over the course of two months I have learned a lot of commands. Some of them I have mastered. In the beginning, I was really scared but then with time it has become a fun thing to learn.

But tell me how to get the hacker feel!?!,😢

marydee2001 profile image
Mary Dee

Good post! Very straightforward for a newbie like me. Thank you :)

deniselemonaki profile image
Dionysia Lemonaki Author

You are so welcome, really glad it could be of help to you! :)

schlenges profile image

That was a really helpful and nice round-up, Dionysia! A great entry point to get started with the command line! =)

alexcorvin profile image
Alex Corvin

Thank you, Dionysia! This is such an informative and well-written article. Great start for sure. Looking forward to your future posts!

deniselemonaki profile image
Dionysia Lemonaki Author

Thank you so much Alex for the encouragement it means a lot! :)

ryanccn profile image
Ryan Cao

take creates the directory and then cds to it.

So it's basically mkdir + cd.

Just so you know.

deniselemonaki profile image
Dionysia Lemonaki Author

I am still learning about it ,thank you

muhimen123 profile image

Probably the most helpful command, help

h1manshu01 profile image
Himanshu Sharma

So u must feel like a hacker now.... Just kidding...It's really a good start.

waylonwalker profile image
Waylon Walker

Great first post!!! Keep going @deniselemonaki .

deniselemonaki profile image
Dionysia Lemonaki Author

Thank you so much!

gwutama profile image
Galuh Utama

Ctrl+r for reverse search.

arafkarim profile image
Araf Karim

I had a fear of that.
Nice Post.