Typing commands into a terminal may seem tedious, but with the right tools, the command line can be incredibly powerful. Here are our favourite command line tools that do awesome things you just can’t match in a GUI.
Note: While a lot of the tutorials and videos on this page are Linux-centric, these commands are useful for everyone. Mac users can use all of these commands in their Terminal as well, and Windows users can check out Cygwin for a more UNIX-like terminal experience where these tools come in handy. Also note that not every tool comes preinstalled on every system, so you may need to install some of them separately before you can use them.
When your computer starts to freeze, slow down, or just misbehave, the
top command can help you set things straight. By just typing
top into a terminal, you can get a list of every program running on your system, as well as how much of your system’s resources they’re taking up. Then, if you find one that’s gone a bit haywire, you can kill it and restore your system to its normal, speedy self.
The whole thing takes a few seconds and you don’t need to wait for any windows or fancy graphs to load. Check out this quick introduction to
top for more, and if you want something a bit friendlier, the
htop command is a pretty great replacement.
If you have more than one computer in your house, chances are you’ll need to dig into your network settings from time to time. Knowing your network can help you controlling your HTPC, monitoring your BitTorrent downloads, or sharing files between computers. When that time comes,
ifconfig will be your best friend.
It shows you the IP address of your computer, the MAC address of your Ethernet and Wi-Fi cards, and loads more. Check out this introduction to
ifconfig to see how it’s used.
8. Chmod And Chown
Every once in a while, you’ll come across a “permission denied” error when trying to access a file, and it can be infuriating. Running
chmod will edit the permissions of any file, letting you read, write, and/or execute a given file according to your specifications. You can do this from the GUI, but
chmod is a bit more powerful, especially if you’re working with multiple files. To see how it’s used, check out this guide to
chmod and its brother
chown, which helps you get full ownership of a file.
Why set up a full screen sharing system when all you need to do is check up on one simple thing? SSH connects you to another computer and lets you use its terminal as if you were sitting right in front of it. You can check running processes, change permissions, and access files on your remote machine right from the machine in front of you.
You can can head to a web site and download a file in one click, but if you want serious control over your downloads
wget is the best for the job. With a few keystrokes you can automatically download all the music on a web site, resume downloads that keep flaking out, or even grab the entire archive of NASA’s “Astronomy Picture of the Day”. Check out our guide to mastering
wget to see everything this little tool can do.
5. Vi And Vim
Despite all the fancy writing tools out there plain text is still one of the most useful ways to manage information. It can make for an extremely versatile to-do list, help you tweak settings for your favourite app, or even let you build an entire web site.
And while there are a lot of great text editors out there, a lot of power users swear by Vi and Vim. Vi and Vim are command line text editors that are entirely keyboard-based, letting you navigate large blocks of text with just a few keystrokes. If you’re serious about editing text, these editors are the way to go, despite their learning curve. Thankfully, the web is full of tutorials on how to use them.
Not all command line work is clean and simple. Sometimes, you’ll run a command and get a giant wall of text in return that’s impossible to wade through. Luckily,
grep will help you find what you’re looking for. On its own, it can search through any text within a file on your system for a specific phrase (e.g.
grep Laundry todo.txt), which is useful in and of itself. However,
grep‘s real power comes when used in conjunction with other commands. Can’t find what you’re looking for in the output of
top? You can use
grep to search for the program you’re looking for. Check out this tutorial to learn how to use
grep, and to combine it with other commands, you just need to learn…
Pipes isn’t the name of a specific tool, but rather a class of tools that help you send the output of one command to another command. Take our example from #4, where we wanted to find something specific in the output of
top. To do this, you would run something like
top -l 2 | grep firefox. The
| symbol pipes the output of
grep, which then searches for
firefox and finds you the relevant information.
You can also pipe the output of a command to a text file with the
> symbol, such as:
ifconfig > myip.txt. For more examples of how to use pipes, check out our command line primer for beginners.
grep, which searches for text within files,
find is a tool that helps you find files based on other criteria — like name, filetype, or when they were last edited. It’s much more powerful than the traditional Spotlight search or Windows search, and one of the best way to quickly find files on your system.
Plus, if you want to search for something within a file, you can pipe the output of
grep and figure it out. To see how it’s done, check out this great tutorial for the
1. Apt-Get And Other Package Managers
If you’re tired of opening up a web browser and visiting a web site just to download a program, package managers are a godsend. Package managers — like Ubuntu’s
apt-get, Arch Linux’s
pacman, or OS X’s
homebrew make installation a snap. With them, you can search a large database of applications, as well as download and install them with just a few keystrokes.
All you need to know is the name of the application you’re looking for. It’ll even install any prerequisites you need for that program — like Java — so you don’t have to do that yourself. What package manager you use generally depends on your OS, so Google around to see what managers are available for your system and what apps are available in their repositories.
If you’ve gotten really tired of the GUI, check out our list of unconventional command line apps and if you haven’t done it yet, be sure to read up on how to become a command line ninja with time-saving shortcuts.