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.
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.
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 .
Usingpwd
andls
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 usecd ..
. To move up two levels usecd ../..
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, usehistory
That's all you need to get started in order to navigate and edit your filesystem. Doesn't seem that scary now does it?
Discussion (21)
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.
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
Thank you !
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!😀
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
Thanks for adding that information about Windows! :)
which name-of-the-command
--> display the path
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!?!,😢
I am still learning about it ,thank you
Good post! Very straightforward for a newbie like me. Thank you :)
You are so welcome, really glad it could be of help to you! :)
Probably the most helpful command,
help
That was a really helpful and nice round-up, Dionysia! A great entry point to get started with the command line! =)
Thank you, Dionysia! This is such an informative and well-written article. Great start for sure. Looking forward to your future posts!
Thank you so much Alex for the encouragement it means a lot! :)
I had a fear of that.
Nice Post.
Ctrl+r for reverse search.
Great first post!!! Keep going @deniselemonaki .
Thank you so much!
So u must feel like a hacker now.... Just kidding...It's really a good start.