This link has been bookmarked by 183 people . It was first bookmarked on 30 Jul 2008, by J Phil Glockner.
-
31 Dec 17
-
12 Oct 17
-
13 Nov 16
Thomas JamesLIFEHACKER
DEADSPIN
GIZMODO
JALOPNIK
JEZEBEL
KOTAKU
INDEX
SKILLET
TWO CENTS
VITALS
APP DIRECTORY
GEAR
Top 10 Command Line Tools
Kevin Purdy
7/30/08 9:00amFiled to: LIFEHACKER TOP 10
353.0K
110
3
Click to viewWhen you need something done quickly, efficiently, and without any software overhead, the command line is where it's at. It was the first way humans told computers what to do, but as graphics became increasingly important, the command line, or terminal, became an insiders' secret weapon. But with the right commands and a little bit of know-how, anyone can get things done from a text-only interface. Let's take a look at 10 commands and tricks that make the terminal more accessible, and more powerful, on any system. Photo by blakepost.
Note: Mac OS X and Linux users have robust command line interfaces baked right into their systems. To get to them, head to Applications->Utilities->Terminal in Finder. It varies in Linux, depending on your distro and interface, but a "terminal" can usually be found in an "Accessories" or "Utilities" menu panel. Windows users are best served by installing and configuring Cygwin, a Unix emulator, which we've detailed in a three part series.
Geek to Live: Introduction to Cygwin, Part I
Introduction to who? If that's what you thought when you saw the title of this article, then…
Read more
10. Customize your prompt
If you're going to spend any time at the terminal, or want to start doing so, it should be a welcoming place. To go beyond green or white on black, check out this Ask Lifehacker response, in which Gina runs through a few simple ways to change the colors, and the greeting message, on your prompt for Windows, Mac, or Linux systems.
9. Force an action with sudo !! ("bang bang")
You already know that prefixing a command with sudo makes your system execute it with superuser privileges. But when you forget to sudo, the !! or "bang bang" comes to the rescue. When you've perfectly crafted a long command that does exactly what you need, hit Enter, and d'oh—you don't have sufficient access privileges—you can sudo !! to repeat the last command with superuser privileges. It's the ultimate nerd triumph: "Oh, you didn't like that command? Well, then sudo !!"
8. Create whole directory trees with mkdir
When it comes to organizing music, pictures, documents, or other media, nested folders become a necessary annoyance—as in right-clicking, choosing "New Folder" and then naming and clicking through each of "The Beatles->White Album->Disc 1." It's far easier from the terminal, as the Codejacked blog points out:
mkdir The Beatles\White Album\Disc 1
Some terminal users have to add a \ before spaces, but you get the idea. If you're a Vista user who's just not down with Cygwin, you can still pull this off with the md tool in command line.
7. Filter huge lists with grep
Some terminal commands spit back a bit too much information, and that's where grep comes in. Need to manually kill a faltering Thunderbird? Punch in ps aux | grep bird, and you'll get back the specific number to kill. Need to know which files don't have your company name in them? grep -v DataCorp *.doc. Programmer Eric Wendelin explains grep more in-depth.
6. RTFM with man (and more)
Let's say a program, or web site, has just asked you to run a command to unlock or enable something, but you'd like to know just a little more before jumping in. Add man before the command (as in man ssh) and you'll get manual-style pages detailing how to use the command. Bit too much material to process? Try whatis for a brief description, --help after the command for basic usage, or any of these other command-line learning tools.
5. Manage processes with top
Most systems have a tool to view "tasks" or "running programs," but they usually hide the true guts of what your system's doing from you. The Hackszine blog points out that Mac and Linux users can harness the power of the built-in top command to track and kill runaway processes making your system unstable. There's also ps -aux for a single-screen, non-updating look at what's bugging your computer.
4. Master wget for powerful file-grabbing
The wget command has been around since before there was all that much stuff to actually yank from the net, but this extensible, multi-purpose tool has lots of great uses these days. You can mirror entire web sites locally, resume huge downloads on the flakiest of connections, download the same file every hour to keep tabs on a project, and do much, much more with wget. It's one of those elegantly simple tools that's only as powerful as your creativity.
3. Get way beyond system searching with find
Once again, programmer Eric Wendelin offers real-world examples of how powerful a command line tool like find can be in, well, finding files and directories that match the smallest criteria you can imagine. Want a list of every HTML file that references the hexidecimal color #FF0000 (red)? find can totally do that for you. As Wendelin points out, find, by itself, is about as convenient and powerful as a total-system searcher like Google Desktop or Quicksilver, but piped into and out of other tools like grep, it's a powerhouse. For a more pared-down look at some of find's powers, check out this tutorial at Debian/Ubuntu Tips & Tricks.
2. Set up powerful backups with rsync
You can spend a lot of money and time hunting down a perfect backup app that works with all your systems just the way you want. Or you can spend a few minutes learning the basics of rsync, the flexible, powerful command that makes one folder (on your system) look like another (where you back up). To put it simply, rsync is a cross-platform, completely free Time Machine, if you use it right. Luckily, Gina's already shown us how to do that.
1. See your most-used commands with history, make aliases for them
Once you're comfortable with the terminal and getting good use from it, you might notice some of the more useful commands require an astute memory and typo-free typing—unless you make them shorter and easier. Start off by copying and pasting this command (on one line):
history|awk '{print $2}'|awk 'BEGIN {FS="|"} {print $1}'|sort|uniq -c|sort -r
It will return a ranked list of your most commonly-entered commands using your command history—and you can start creating aliases to shorten them and make them easy to remember. Or you could search through your recently-used commands with as-you-type results for quick-fire repeats.
While these 10 commands are generic and applicable on all systems with a Unix-like terminal, Mac OS X offers a few Mac-specific tools. Here are useful command line tricks for Mac users.
Useful Command Line Tricks for Mac Users
Click to viewThat Mac you're viewing this web page on using a pretty graphical interface?…
Read more
We love to have some CLI fun around here, and we know our savvier readers have tons of cool terminal hacks and tricks that are new to us. So, please—share the knowledge and spread the wealth in the comments.
Gear from Kinja Deals
Bestsellers: Eneloop Power Pack
These Keychain-Sized Charging Cables Are Always By Your Side
Saturday's Best Deals: Breville Toaster Ovens, Dyson Fan Heater, Black+Decker Handvac
Reply110 replies
Want Lifehacker’s email newsletter?
Add your email address
Subscribe
You may also like
The Concourse
Donald Trump Doesn't Like This Any More Than You Do
Yesterday 9:19am
Screengrabber
Kansas Runs Hidden-Man Kick Return
Today 12:07pm
Adequate Man · Dante Jordan
How To Deal With Being The Only Black Man In An Office Full Of Conservatives
Today 9:15am
Recent from Kevin Purdy
27349352.7KHow to Become the Ultimate Grill Master
Lifehacker · Kevin Purdy
How to Become the Ultimate Grill Master
5/30/16 8:00am
4450423.3KTop 10 Tools for a Free Online Education
Lifehacker · Melanie Pinola
Top 10 Tools for a Free Online Education
2/27/16 8:00am
9312.7KDying as a Feature: <em>Don't Starve</em> and Impermanence (and Beefalo)
Games On Delay · Kevin Purdy
Dying as a Feature: Don't Starve and Impermanence (and Beefalo)
8/21/14 1:12pm
ShareTweet
by Taboola Sponsored Links From the web
People don’t know you can check for PPI without a phone call.
Read on The Claims Guys
20 Completely Unsettling Historical Photos
Read on LifehackLane
Actresses Who Are Stunning in Real Life, Not So Much In Film
Read on Time To Break
People Don't Know This Brilliant Way to Check if You Had PPI
Read on The Claims Guys
Born Before 1981? You May Qualify For High Paid Surveys
Read on Survey Compare
Tiny Device Transforms Old Computer into a Blazingly Fast PC
Read on Xtra-PC
15 Times The Cameraman Caught More Than Expected
Read on OMGwhut
30 Great Cars That Nobody Buys
Read on BuzzDrives
Only £20: The official 2016 Christmas Coin!
Read on British Numismatic Treasury
Tiny Device Allows You To Track Anything (it's Genius!)
Read on Trackr Bravo
£269pp -- Greece: 5-Star Halkidiki Week w/Flights, Was £480
Read on Travelzoo UK
8 Spanish Words You'll Struggle To Pronounce (If You're Not Spanish)
Read on Babbel
13 New Cars That Are Flops In 2016
Read on Forbes
There Are 7 Types of English Surnames — Which One Is Yours?
Read on Ancestry
New Golf Wedge is Changing the Game for Everyone
Read on xE1 Golf
Dining Room Furniture Sale: Now On
Read on Furniture Village
Want Lifehacker’s email newsletter?
Add your email address
Subscribe
About Blog
Need Help?
Content Guide
Lifehacker Store
Permissions
Privacy
Terms of Use
Advertising
Jobs
RSS
©2016 Gizmodo Media Groupcommandline bash Linux technology computerscience operatingsystem computers
-
01 Oct 14
-
01 Jan 14
Vasileios Fasoulas"history|awk '{print $2}'|awk 'BEGIN {FS="|"} {print $1}'|sort|uniq -c|sort -r"
-
24 Mar 13
-
07 Nov 12
-
09 Aug 12
-
25 Mar 12
-
07 Dec 11
-
28 Sep 11
-
27 Sep 11
-
13 Sep 11
-
05 Jan 11
-
27 Oct 10
-
12 Oct 10
-
06 Oct 10
-
29 Aug 10
-
27 Aug 10
-
26 Aug 10
-
20 May 10
-
15 Nov 09
When you need something done quickly, efficiently, and without any software overhead, the command line is where it's at. It was the first way humans told computers what to do, but as graphics became increasingly important, the command line, or terminal, b
linux unix tools terminal tips tutorial shell ubuntu utilities lifehacker command delicious import
-
09 Sep 09
-
30 Aug 09
bartbMac OS X and Linux users have robust command line interfaces baked right into their systems. To get to them, head to Applications->Utilities->Terminal in Finder. It varies in Linux, depending on your distro and interface, but a "terminal" can usually be f
-
02 May 09
-
29 Apr 09
-
28 Apr 09
-
04 Apr 09
-
01 Apr 09
-
19 Mar 09
-
05 Mar 09
-
04 Mar 09
-
Mel Bohincehistory|awk '{print $2}'|awk 'BEGIN {FS="|"} {print $1}'|sort|uniq -c|sort -r
-
10 Feb 09
-
06 Feb 09
-
14 Jan 09
-
04 Dec 08
Juan Pablo MuñozHacker tips.
A ver si aprendemos algo mas profundo de pcs -
01 Dec 08
-
02 Nov 08
-
31 Oct 08
-
16 Oct 08
-
04 Oct 08
Hanna WiszniewskaWhen you need something done quickly efficiently and without any software overhead the command line is where it's at It
-
25 Sep 08
-
9. Force an action with
sudo !!("bang bang")
You already know that prefixing a command with sudomakes your system execute it with superuser privileges. But when you forget tosudo, the!!or "bang bang" comes to the rescue. When you've perfectly crafted a long command that does exactly what you need, hit Enter, and d'oh—you don't have sufficient access privileges—you cansudo !!to repeat the last command with superuser privileges. It's the ultimate nerd triumph: "Oh, you didn't like that command? Well, thensudo !!"
-
-
16 Sep 08
-
28 Aug 08
-
26 Aug 08
-
24 Aug 08
-
20 Aug 08
-
19 Aug 08
-
18 Aug 08
gialloporporaWhen you need something done quickly, efficiently, and without any software overhead, the command line is where it's at. It was the first way humans told computers what to do, but as graphics became increasingly important, the command line, or terminal, b
-
16 Aug 08
-
14 Aug 08
-
Neil WieseWhen you need something done quickly, efficiently, and without any software overhead, the command line is where it's at.
-
11 Aug 08
-
10 Aug 08
-
07 Aug 08
-
06 Aug 08
-
05 Aug 08
-
04 Aug 08
-
03 Aug 08
-
-
Here's my current favorite linux command, which shows you the top 5 processes using the most CPU time:
ps -eo user,pcpu,pid,cmd | sort -r -k2 | head -6
-
-
02 Aug 08
-
-
ps -eo user,pcpu,pid,cmd | sort -r -k2 | head -6
-
-
01 Aug 08
-
31 Jul 08
-
thisisthezAwesome little guide that has some helpful terminal tips!
Bookmarks commandline terminal linux tools unix code geek howto reference tech technology tutorial useful
-
FirstN@me L@stN@meWhen you need something done quickly efficiently and without any software overhead the command line is where it's at It
-
Alainn GozertWhen you need something done quickly, efficiently, and without any software overhead, the command line is where it's at. It was the first way humans told computers what to do, but as graphics became increasingly important, the command line, or terminal, b
Would you like to comment?
Join Diigo for a free account, or sign in if you are already a member.