Member-only story
Lesser-Known Options of Well-Known Unix/Linux Commands
Use these command-line switches in your terminal and shell scripts to boost your productivity

Programmers typically prefer working with command-line interfaces because of enhanced productivity and CLIs’ similarity with programming. They often automate repetitive commands with shell scripts. Therefore, framework and tooling developers usually offer CLI programs with various sub-commands.
A terminal command may reach different endpoints: the shell interpreter, pre-packaged OS binaries, or third-party binaries. The shell interpreter program usually handles some inbuilt commands. For example, the Bash interpreter handles the well-known cd
command. Meanwhile, operating systems also offer some inbuilt commands via pre-packaged binaries. For example, GNU/Linux and Unix offer the touch
command to create new files. Besides, programmers sometimes install additional external CLIs for various development purposes. So, some terminal commands may trigger third-party binaries.
These commands come with various command-line switches that we can use to speed up our daily tasks. Also, some command-line options help us to fulfill our development requirements during shell scripting. In this story, I will explain some lesser-known command-line options of well-known commands that you frequently use. Use these switches in shell scripts or the terminal to save your time during programming tasks!
Recursive Directory Creation and Saving Permissions with mkdir
We often use the mkdir
command in terminals and shell scripts to create new directories. What if you need to create a new directory inside a non-existing directory? Some developers use mkdir
twice with (or without) the cd
command. As a shortcut, you can easily create multiple directories recursively with the -p
/ --parents
option. Look at the following command:
mkdir -p api/filesystem/impl
The above command creates the entire directory tree at once. Once you enter the above command, you will see the api
directory. Once you open it, you will find filesystem
that contains impl
. What if you need to create impl
and include
directories within filesystem
…