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:
pwdstands 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.
lsThis command looks at the directory you're in, the current working directory, and lists all files and directories inside it .
lstogether comes in handy to see where you are in the filesystem.
cdstands 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
mkdirwhich stands for make directory.
To create a new empty file inside the working directory use
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
clearto clear everything you typed and start fresh. When you want to see all the previous commands you have typed, use
That's all you need to get started in order to navigate and edit your filesystem. Doesn't seem that scary now does it?