Common Linux Commands for front-end Developers
Linux commands for front-end developers

Last year I decided to do all my personal software development on GNU Linux. I still use windows at work and I have no problems with it, but I just fancied the challenge of developing software on another platform.
Here is a list of some commands I often use, and which you will most likely encounter as a front-end developer.
mkdir (make directory)
We create directories or folders all the time. Be it for our projects or simply to organize documents. To create a directory, use the mkdir command followed by the name of the directory. For example to create a directory named my-app. Run the following command.
$ mkdir my-app
cd (change directory)
Now that we know how to create a directory, it is important to be able to navigate the different directories available. Let’s say you are in a projects directory which contains the my-app directory. To go to into the my-app directory, run the command:
$ cd ./my-app
To move from your current directory to a directory one level up, run the following command.
$ cd ..
To navigate to the root directory, from anywhere, run the command below.
$ cd /
To navigate to the home directory, from anywhere, run the command below.
$ cd ~
ls (list)
Once you are in a directory you might be interested in knowing its content. For that you can use the ls command. To list items in your current directory, run the command:
$ ls
To list all items including hidden items in a human readable format, run the command:
$ ls -ah
touch
As developers we are always creating files. Use the touch command to create a file.For example, to create an index.html in your current directory. Run the command below.
$ touch index.html
rm (remove)
If you create something today, you will most likely want to delete it at some point in time. That is where the rm command comes in. For example, to remove a directory named node_modules and all its content, run the command.
$ rm -rf ./node_modules
To remove a single file, for example styles.css, in your current directory, run the command
$ rm styles.css
Note: The rm command can be dangerous. Exercise caution when using it.
mv (move)
The mv command allows you to move files and directories. In addition, it allows you to rename files.
To move a file you must specify where the file is and where you want it to be moved to. For example, to move a file called app-components.ts
from the “~/Projects/my-app” directory and placing it in the current directory, represented by the single .
character.
mv ~/Projects/my-app/app-component.ts .
sudo
The sudo command allows you to run commands as a superuser or another user. Thereby allowing you to execute some restricted commands. For example, to change your password you need privileges. So, you run the passwd command with sudo as follows:
$ sudo passwd
chmod (change mode)
In brief, the chmod command allows you to control who can read or access files, write to files or execute scripts.
There are three groups of permissions: read, write and execute.
Further, permission access is granted to a specific class of users. Categorized as user(u), user group(g) and other system users(o).
To give full access i.e read, write and execute to user and user group but read only for other users on an executable file name package_tree_shaking.sh. Simply run the command below
$ sudo chmod u=wrx, g=wrx, o=r package_tree_shaking.sh
This is equivalent to the following in octal notation
$ sudo chmod 774 package_tree_shaking.sh
For a detailed explanation of chmod command check out hezekiah243 blog post here.
man (manual)
If you want to learn more about a command you know, then man is your friend. Simply run the man command followed by the command you want to learn about. For example, to learn more about ls command, run:
$ man ls
apropos
With time you get to know many commands, but sometimes you don’t know what command to run for a certain task. Then you can use apropos command followed by a brief description of what you want to do.For example,if you want to know how to install packages. You can run the command.
$ apropos install package
The output will give you several options, when you take a careful look you will find that the apt-get command, highlighted in red, seems to be relevant in this case.
Now you can do a man on the apt-get command as we did in the command above to learn more about the command.

Conclusion
The commands covered here are the same you will use on Unix based systems like Mac and even on Windows (with Windows Subsystem for Linux).
All major operating systems come with some terminal window. Learn how to use the command line and you wont feel strange in other operating systems. As long as you have the terminal you will feel at home.