Five Tools for Beginners to Launch the Command Line
Whether you’re a seasoned veteran or a newbie to the command line, you won’t be able to remember every command, manual page, or tooltip. Luckily for you, we have tools to make the command line less intimidating for newbies, which also help old-timers remember what to do in a number of common circumstances.
Homebrew makes it easy to install apps on Mac
Homebrew is a package installer for Mac that makes it easy to download and install applications right from the command line. You will also need it to install some of the tools we discuss below.
We’ve already talked about using Homebrew as a bulk app installer , so we won’t go into details here, but the main idea is to make it easy to install whatever apps you need. Enter a command like brew install appname
and Homebrew downloads and installs it.
With Homebrew, you can also create an installer script using a tool called Homebrew Cask, which installs all your favorite applications on a new computer in minutes with a single command.
Mac-Cli and Climate simplify your most used commands
While there is a certain prestige that comes when you happily remember a difficult command that takes 30 seconds to enter, most of us don’t have the time or willpower to do it. It was mentioned earlier that Mac-CLI and Climate are tools that simplify some of the more common commands, turning them into regular human language. Climate is built for Linux and Mac-CLI is for Mac. Both do essentially the same thing, but with different commands. The climate requires the Climate
command. Mac-CLI requires Mac
command.
Here are a few of our favorites from the Mac-CLI to give you an idea of what you can do with them:
-
mac update
: Installs software updates, Ruby gems, Homebrew updates, npm updates, and more. -
mac find
: largest-files: Searches for and displays the largest files in the current directory. -
mac system
: Displaysmac system
information to check performance. -
mac xcode:cleanup
: cleans up Xcode files. -
mac git:branch
: Show all Git branches -
mac dev:optimize-images
: Optimize all images in the current directory for the web.
Climate works in a similar way, but with Linux-specific tools:
-
climate update
: Updates your climate setting. -
climate find biggest-files
: Searches for and displays the biggest files in the current directory. -
climate overview
: Displays an overview of our system’s performance. -
climate list-branches
: Displays a list of all your Git branches.
This should give you an idea of what to expect here. Check out the full list of all commands on the Mac-CLI and Climate GitHub pages. The main idea of both is to make the command line less intimidating for newbies by standardizing commands, but in fact it is just as useful for advanced users who cannot remember commands they do not use very often. Mac-CLI is not the only option for Mac, m-cli is basically the same but doesn’t require the same third party dependencies. It’s not as robust a toolkit, but it’s still worth a look if you’re curious.
Cheat shortens manual pages with simple English instructions
The manual pages that you refer to by typing man
at the command line are often very long and can go on and on over the pages. This is useful when you really need to dig in and figure out something, but more often than not, you go through the man page just to find out which commands you can run. Cheat takes these man pages and compresses them.
For example, if you man tar
on the command line right now and type man tar
, you will see several documentation pages. The cheat gives you a much more practical guide. Enter cheat tar
and this is what you get:
# To unpack an uncompressed archive:
tar -xvf /path/to/foo.tar
# To create an uncompressed archive:
tar -cvf /path/to/foo.tar / path / to / foo /
# To unpack a .gz archive:
tar -xzvf /path/to/foo.tgz
# To create a .gz archive:
tar -czvf /path/to/foo.tgz / path / to / foo /
# To view the contents of a .gz archive:
tar -ztvf /path/to/foo.tgz
# To unpack a .bz2 archive:
tar -xjvf /path/to/foo.tgz
# To create a .bz2 archive:
tar -cjvf /path/to/foo.tgz / path / to / foo /
# To view the contents of a .bz2 archive:
tar -jtvf /path/to/foo.tgz
# To create a .gz archive and exclude all jpg, gif, … from tgz
tar czvf /path/to/foo.tgz —exclude = \ *. {jpg, gif, png, wmv, flv, tar.gz, zip} / path / to / foo /
# To use a parallel (multi-threaded) implementation of compression algorithms:
tar -z … -> tar -Ipigz …
tar -j … -> tar -Ipbzip2 …
tar -J … -> tar -Ipixz …
This is much more useful information, isn’t it?
Cheat is not a one-of-a-kind tool. If for some reason you’re not a Cheat fan, take a look at TLDR and Bro Pages . Both are very similar to Cheat, but take a slightly different approach in how they present information to you.
Howdoi seeks answers to common questions
While the shorter, easier-to-read Cheat manual pages should help you sort out most of the questions you have, they can’t help you with everything. Howdoi is a utility that can help with the rest.
Howdoi is structured as a question and answer system. You are asking a question about how to run a command and Howdoi tries to answer it. Let’s go back to the good old TAR for an example. If you enter this on the command line:
Howdoi create tar archive
In return, you will receive a tiny how-to guide:
Tar czf file.tar.gz file.txt
Howdoi isn’t perfect and sometimes you have to tweak the wording a bit to get the answer you’re looking for, but it’s still much easier than opening your browser and searching Google for the answer. You can also add Howdoi to Alfred orSlack .
Fuck fixes your last console command
Fuck does one thing: fix your last command if you messed it up. So, if you entered a command wrong, missed a required sudo, or forgot to use a hyphen, type fuck
to fix that command. While this doesn’t always work for every typo you make, The Fuck is surprisingly smart at finding your mistakes. Here are some examples of how you would use this:
-
apt-get install vim
fuck
sudo apt-get install vim
-
git brndh
fuck
git branch
You get the idea. You don’t have to blindly agree with what The Fuck says. You need to validate the corrected command before running it so you don’t accidentally mess up anything. If you’re like me, you throw typos at the command line all the time, so The Fuck is a lifesaver.
There are many other tools out there for very niche purposes. The Awesome Shell is a carefully curated list on GitHub with tons more to suit a wide variety of needs.