- Published on
Skilled Web Dev: Essential Terminal Commands - Part 1
- Authors

- Name
- Rakesh Tembhurne
- @tembhurnerakesh

Knowing terminal commands on Linux or Mac saves web developers a lot of time. Whether you are starting out or already writing code, it pays to be comfortable in the Mac terminal or Linux command prompt.
Important Terminal Commands in Linux / Unix / Mac / Ubuntu
It doesn't matter whether you use Windows, Linux or Mac. What matters is knowing the terminal on your system. Mac and Ubuntu ship with one; on Windows you may need to install a third-party terminal.
Which Commands Should You Learn?
Many programs run in the terminal, but as a web developer you need a core set first. I cover that set here.
The skills you need are: create and edit files, navigate and move folders on the same or different machines, connect to another machine and run commands, install or remove software, and start or shut down machines.
Understanding the File System of Linux
Linux files are organized in a tree-like structure where "/" is called the root folder and all other folders/file resides somewhere in that root folder.

So it means, every file or folder has a path relative to the root directory. For example, every user that gets created commonly has a home directory path as /home/rakesh like name where rakesh is my username. This is called a full path. The home path in the case of Mac OS is /Users/rakesh, the concept is still the same.
Absolute and Relative Paths
To use commands properly, one needs to be aware of how we use the path of files/folders. There are two important ways how a path of file/folder can be written.
The absolute path is the path from the root directory "/". For example, the path of my Documents folder on the Mac OS would be /Users/rakesh/Documents. The same Documents folder on the Ubuntu OS will be /home/rakesh/Documents. Both of them are absolute path because they start with the root folder and goes up to the given folder.
The relative path is a path with respect to another folder (generally the current working directory). For example, let's consider that there are two folders in the home directory Documents and Pictures. Now if we want to go Pictures directory from the Documents, the command would be:
cd ../Pictures
The "." and ".." are two special folders that mean current directory and parent directory respectively. The above command says that change directory to parent directory and then go to Pictures directory.
Basics of Running Terminal Commands
First, you need to start the terminal by searching "terminal" in Spotlight Search if you are on Mac OS or in Ubuntu's search panel.
$ command [--param1 param1Value -param2 -param3]

Terminal commands for navigating between the folders
The pwd command:

The ls command
The first command is ls. This command basically shows files and folders present in a particular directory. the ls command accepts multiple parameters but let's talk about a handful of them that I find to be using regularly.
Commonly used parameters are -l which is used to show contents in a long listing format. It shows extra information such as file/folder permissions, owner, group, size, and date, etc.
In the *nix systems, the files start with "." (dot) are considered to be hidden and not shown by default. To view hidden files we use param -a with the ls command.

The cd command
The cd command is used to change the directory. The structure that follows is cd [path/to/directory]. Once changed, you can see the path with pwd command.
The mkdir command
To create a new folder mkdir command is used. The syntax for the command is mkdir [options] path/to/folder. As the syntax says, we can create a folder from anywhere, as long as you have given a correct path.
An important parameter that mkdir command takes is -pparameter. If you want to create folders inside folders, you need to pass -p parameter to create all the folders till the last folder.
mkdir -p one/two/three

To know more commands, please visit Part 2 of the article.
Related Posts
How to Create a Single Video from Your Favorite Instagram Videos
How to find, download, and combine Instagram videos into one compilation, with answers to common questions about Instagram favourites and video downloads.
Most Essential Terminal Commands Every Developer Should Know
A reference list of terminal commands for Linux, covering file management, system info, networking, and a few fun ones to try.