6 Useful Command Line Tools You Should Know
From file syncing to internet speed monitoring, these tools make your life easier
As developers, we regularly make use of the terminal to accomplish all kinds of tasks of varying complexity. As such, in day to day usage, there exist quite a number of utilities and tools that are designed specifically for a certain task that saves a little bit of our time.
Let’s look at some of them in this article.
For every tool, I will make sure to give the Ubuntu (with sudo-apt) and MacOS (with Homebrew) instructions for installing them. For other Linux distros, you should probably consult the documentation pages, which I will also link with each tool.
rsync
Rsync stands for remote sync, and is a remote and local file synchronization utility. It uses an algorithm to minimize the amount of data copied by only moving the portions of files that have changed in between given two locations.
This tool also comes pre-installed with most Linux distros and MacOS.
For instance, you might want to copy all of your photos located in a Desktop folder to a remote server that you use for backups. Rsync helps you do that efficiently and with minimal manual interventions.
Running with this example, if you have a Photos directory on your Desktop, this is the command for r-syncing between these two locations:
rsync -aP ~/Desktop/Photos username@remote_host:destination_directory
You’ll notice the -aP
flag mentioned here. Let’s break it down:
The
a
flag stands for archive, and it facilitates the sync to run recursively in the directory and also preserves symbolic links, modification times, groups, owners, permissions, etc about the files.The
P
flag shows a nice progress bar as the sync progresses
Another great flag is the z
flag. If you are syncing text files or in this case, photos, you might be able to reduce the network transfer by adding compression with the -z
 option.
So your modified command looks like this now:
rsync -azP ~/Desktop/Photos username@remote_host:destination_directory
Here is one nice little cheatsheet of options you can consult for running rsyncs.
rclone
Rclone is a tool similar in functionality to rsync, however it also enables you to backup/sync/copy/move files in between your local disk and any popular cloud storage providers.
It supports a variety of cloud providers such as Google Drive, Amazon S3, Google Cloud Storage, Backblaze B2, Dropbox, and many more!
Install it via:
brew install rclone
# or
sudo -v ; curl https://rclone.org/install.sh | sudo bash
Moreover, it can also sync your data in between different cloud providers. So you can keep a backup of your important data in a few different places with little effort.
Rclone has different configurations you can setup with different providers. This is, for instance, a step by step guide for setting up a remote config with Amazon S3.
bat
bat is a clone of the cat
utility command to display file contents in the terminal, but the difference here being the added formatting to make it easier to read and scroll through.
Install it like this:
brew install bat
# or
sudo apt install bat
Now, let’s use it to display a file:
bat run_bot.py
You’ll see an output like this:
Looks very neat, doesn’t it? Now, scroll through to find the code you want, and if you want to exit the read mode, just press Ctrl Z.
youtube-dl
Downloading YouTube videos has long since been a tedious task, many online tools offering the service with varying amounts of competency. Nevertheless, none of them have ever reached the level of competency of youtube-dl.
This is also an open source GitHub project and it works beautifully with videos, playlists, and much more.
Install it:
sudo curl -L https://yt-dl.org/downloads/latest/youtube-dl -o /usr/local/bin/youtube-dl
sudo chmod a+rx /usr/local/bin/youtube-dl
# or
brew install youtube-dl
Here’s a small cheatsheet I’ve made for my own downloading needs, feel free to use it:
a. To download a video with best quality and audio:
youtube-dl -f bestvideo+bestaudio URL
b. To download an entire playlist of videos:
youtube-dl -f bestvideo+bestaudio -i PLAYLISTID
c. To download audio only from a video:
youtube-dl --extract-audio --audio-format mp3 <video URL>
I recommend you to explore the docs to get an idea of other commands you can use as well.
speedtest-cli
Monitoring your internet speed within the terminal itself is a great way to save those precious seconds from visiting the browser and loading up websites.
Install the tool:
brew tap teamookla/speedtest
brew update
brew install speedtest --force
# or
curl -s https://packagecloud.io/install/repositories/ookla/speedtest-cli/script.deb.sh | sudo bash
sudo apt-get install speedtest
Then use it:
Very convenient indeed!
btop
This is a newer tool that can be used for processor, memory, disk, and network resource monitoring, all from the command line.
It has a slightly complicated set of installation instructions, which you can follow from here.
Using the tool is simply typing and entering:
btop
and you get the output:
Parting words
I hope this was a useful bunch of tools that you can quickly get up and running in no time. There are a large number of command line utilities released every single day for various niche purposes. If I come across more useful ones for day to day usage, I will definitely make an updated version of this post.
Until then, thanks for reading and happy learning!