Must Know Commands to Increase Your Productivity
“Education is experience, and the essence of experience is self-reliance” – Merlin in T.H White, The Once and Future King.
Accpomlishing tasks independently can often be very rewarding. Knowing you can do something on your own without other people’s help reassures you that if you had nobody out to assist you, you could solve similar problems again in the future. Unfortunately, it’s pretty challenging to be self-reliant with computers, otherwise websites like stackoverflow wouldn’t exist, and you wouldn’t get so many duplicate questions on there either. What I find frustrating is that in other areas it’s much easier to be self reliant when aiming to achieve your goals. For example, on a trip to Iceland our rental car needed maintenance, but we were in the middle of nowhere. I don’t own a car, so you can imagine my anxiety when I see lights flash on the dashboard without knowing what they meant. Not having cell signal meant I also didn’t have my trusty search engine available to help me.
I learned that day just how useful the car owner manual is. Sitting in the glove box was a concise library of procedures to do for each light that went off. A team of engineers at Toyota enumerated everything that could go wrong in a car that a consumer could address, and documented what to do in each scenario. In our case, one of the indicators was innocuous and would go away on its own after a couple of miles of driving, and the other light meant that our tire pressure was low -probably because of the 30 km of driving we had done on a dirt hill road. As a cyclist I know the importance of filling your tires to the correct tire pressure, and I know the correct pressure is highly dependent on what tire you have. You really don’t want to fill your tire to the wrong pressure, especially when you have 4 more hours of driving to do until you get to your destination, and another 12 hours in your trip overall. Luckily the PSI for each tire (front and back tires each require different PSI) was listed right outside the driver’s chair, right under the door. I learned two things that day. First, not only is self reliance fulfilling, but it’s often nessecary when access to our contemporary toolbelts is restricted. Second, the tools built into our computers that empower us with independence aren’t as easy to find as looking through your glove box.
This post is meant to help with that. After reading this, you will learn about two
commands that will help you answer many questions without relying on the internet
(think wikipedia + stackoverflow existing natively on your computer). You should
already know about
man (if not… rtm), so
here I will tell you
info which will help you find tools, and will help you
Computers have hundreds of tools available to you, but often it is hard to figure out what
tools are available, and what utility they provide. Unlike a traditional toolbox, it’s hard
to find what tools are available. On the bright side, also unlike a toolbox, once you find
a tool you have many ways to figure out how to use it (see Mastering Commands). For
computers, the trouble is finding the tool. This is where the command
apropos comes to save
the day. Let’s use
apropos to find out what
apropos does (note you can do the same using
whatis, but recursion is more fun):
apl@LAPTOP-7OLOKT3C:/mnt/c/Users/andres/code/www$ apropos apropos apropos (1) - search the manual page names and descriptions
In other words apropos is your search engine for finding what tools exist on your computer
apropos is a command that is native to most linux systems I’ve worked with.
If you’re on a Mac you can use this guide
apropos. This tool is insanely powerful, and honestly I can’t believe
I haven’t heard more people talk about it. Say you know how to do performance
tuning in one computer system, but not another. Say you know the general idea but
you don’t know what tools are available to (many people I know are used to doing this with GUIs
that came along with their development toolchains.) You can explore what tools
are available by running
apropos perf or
apropos stat or
apropos report. You
can get pretty creative with
apropos. In fact in writing this article I was
curious what commands existed that dealt with text, and I learned that
another version of
vim but read-only (I guess for those who prefer easy syntax
Once you find a new command, sometimes it can be unclear how to use it just by reading
the man page. Some commands come with an info page, which gives a more in detail explanation
of how to use it. You can think of the man page as providing a spec to the command, while
the info page provididng documentation and examples as to how to use it. Compare
the man and info page for the command
man truncated description
DESCRIPTION Write lines consisting of the sequentially corresponding lines from each FILE, separated by TABs, to standard output. With no FILE, or when FILE is -, read standard input. Mandatory arguments to long options are mandatory for short options too.
info truncated description
8.2 ‘paste’: Merge lines of files ================================= ‘paste’ writes to standard output lines consisting of sequentially corresponding lines of each given file, separated by a TAB character. Standard input is used for a file name of ‘-’ or if no input files are given. Synopsis: paste [OPTION]... [FILE]... For example, with: $ cat num2 1 2 $ cat let3 a b c Take lines sequentially from each file: $ paste num2 let3 1 a 2 b c Duplicate lines from a file: $ paste num2 let3 num2 1 a 1 2 b 2 c
Both pages serve a completely different purpose. Man pages are meant to be used to look
at flags and understand how the tool behaves under each parameter, but it assumes a base
knowledge in what the tool does. I think we can both agree that going from zero knowledge
to master understanding is much easier with the info page than with the man page. Yet, for
some reason, I often see colleagues exclusively use man pages to learn about commands
when an info page would have been much more educational.
info is such a highly underrated command
because it isn’t just limited to cli commands. You can also use
info to learn about
your computer system.
Take this opportunity to learn more about your computer system
info initrd to see just how powerful of a tool
info is. Next time you come across a term your unfamiliar with, your first instinct
should be to run it through
info. You’ll be amazed by what you’ll find and learn, and
by how much you reduce your Google footprint.
These tools alone won’t make you 100% self reliant, and I think if you work with computers for a living, it’s probably impossible to become that independent, but it’s good to know computers offer great self service tools to help you learn about tools that can help you solve your problems. While I’m grateful for the internet and its cornicopia of resources, I’m much more comfortable knowing that tools exist that can in help me in the event of a catastrophic zombie apopaclypse, or the next internet partition. If you want to learn more about the amazing tools on your computer, I highly encourage you to read The Linux Documentation Project, because that’s where I found all of this information.