Modern operating systems have no shortage of feature-rich applications. The problem: Sometimes feature-rich turns into flat-out bloat. From email to music to Twitter and beyond, put your system on a serious diet with these command line alternatives.命令行应用几乎可以做任何事情
Command Line Applications for Almost Any Task
You may have thought that that the command line was only useful for manipulating files and directories or executing obscure commands that were better left to wise Linux beards. We won’t argue with you (obscure commands wielded by wise Linux beards are awesome), but we do want to point out that you can run all kinds of robust, feature-rich applications from the command line. Even better-they’re extremely lightweight and capable replacements for desktop counterparts. Here’s a look at some of the best command-line apps out there.
Note: For the purposes of this post, we’re assuming you’re using a terminal running the Bash shell on Linux or Mac OS X, and if you’re on Windows, we’re assuming that you’re running the powerful Cygwin command line tool rather than the anemic Windows command prompt. The majority of these examples should work on any platform, though some of the utilities might require extra steps to install under Cygwin. For more on Cygwin, see parts one, two, and three of our series on using Bash under Cygwin (the tips apply to Linux and OS X as well).
Read Email with Mutt
You can use the powerful mutt email client to check your Gmail account, or any email account if you choose. It’ll take a bit of work to get it setup and running, but once you have done so, you’ll have a fast command-line email client with shortcuts very similar to Gmail itself.
Listen to Music with cmus
You can listen to music through your terminal shell with a command-line application called cmus, which lets you easily browse through and play your music, and there’s even a few patches that will send your current song to Last.fm. Hat tip to One Thing Well.
If you’re a Mac user, you can also create a script that will let you play your music without having to select a particular song, or even know the full name—you can just type a command like fplay muse to play every Muse song in your collection.
Get Your Tweeting on with TTYtter
While the terminal is generally a powerful way to get things done, you can also use it to waste loads of time if you want. While you’ll read many tutorials that tell you about using the curl command to connect to Twitter, they are shutting off basic authentication in a couple of days, so you can’t use that method anymore.
Never fear, you can continue to waste time on Twitter by using the ttytter command-line twitter client, which has full-featured support for reading, replying, searching—and it supports OAuth.
Take IM to the Terminal with Finch
You can use the command-line Finch client to connect to any number of instant messenger protocols, and since it works off the same configuration file as Pidgin, you could use all your accounts from either the GUI or the shell.
Manage Your To-Do List with todo.sh
You can create and use your own to-do list from the command line using Gina’s own Todo.txt CLI utility, which has support for easily entering tasks, including projects, colors for priorities, and a lot more (there’s even an add-on to push or pull to Remember the Milk). For basic usage, check out our guide on managing your tasks from the command line.
irssi Brings IRC to the Terminal
There’s loads of command-line IRC clients, but if you’re looking for one that’s powerful, flexible, and fairly easy to use, check out irssi. You can install it through most repositories.
Browse the Web with Lynx
You can easily browse the web using the command-line Lynx web browser, and while it’s not really suitable for any kind of serious browsing when you want more than plain text, you can combine it with bash aliases to let you do quick Wikipedia lookups or browsing simple sites—the mobile versions of some web sites work fairly well in Lynx. Lynx is still included in many Linux distributions out of the box, but you can also download a version for OS X or Windows (with Cygwin).
Manage Google Calendar with gcacli
You can view your agenda or even add events directly to Google Calendar using the gcalcli utility, which supports listing calendars, showing the agenda, displaying the calendar in a graphical display, searching, or even using as a reminder service. If you simply want to add events to Google Calendar using natural language syntax or grab your daily schedule with less fancy formatting, you can check out our guide to using GoogleCL instead.
Write and Edit Google Documents with GoogleCL
You can edit Google Docs documents in vim from the command line using the GoogleCL utility, which interfaces with Google Docs using the API and allows you to easily edit documents, or create new ones.
Take Quick Notes
If you don’t need a full-blown document repository and just want a place to store simple notes, you can turn your command line into a fast note-taking tool with a simple script that lets you store notes by name.
Control Another Windows PC Using Dropbox and Akira
You can use a combination of the Akira command-line application and Dropbox to remotely control one Windows PC from another one, allowing you to grab screenshots, run applications, kill processes, or perform any number of other tasks.
Use bc as a Command-Line Calculator
While you can setup an alias that turns awk into a command-line calculator, your best bet is to simply use the bc command to perform just about any calculation. If you don’t want to use interactive mode, you can use a command like this to put it all on a single line:
echo "2 ^ 3" | bc
Batch-Convert Images with ImageMagick
Whether you want to convert a whole bunch of images from one format to another, resize them, or create a set of thumbnails, the command-line ImageMagick tools are your best bet. You can even use these extremely powerful commands to draw new images or add text on top of an existing image. For instance, to convert an image from PNG to JPG and resize it to half size, you’d use a command like this:
convert file.png –resize 50% file.jpg
Use the Terminal as a Stopwatch
You can use a simple command from the shell as a stopwatch if you need to see how long it takes to do something—just type the following command into your terminal, and then hit Ctrl+C when the time is up.
Create a Simple Ad-hoc Web Server to Share Files
You can quickly share files from one machine to another with the built-in web server included in your Python distribution (assuming you have Python installed). Just start this command from any folder, which will start a simple web server—you could then use the wget command (or, you know, use your web browser if you must) to grab a file off this directory from a second computer.
python -m SimpleHTTPServer
Search Wikipedia with a Command-Line Trick
You can use the dig command from the terminal to perform quick lookups on Wikipedia for definitions. For instance, to see the short description for Futurama, you could use the following command:
dig +short txt futurama.wp.dg.cx
Watch Star Wars
Who needs fancy CG? You can have some fun watching an ASCII version of Star Wars in your terminal with this simple command:
What are some of your favorite command-line tricks? Share your advice with your fellow readers in the comments.
Send an email to How-To Geek, the author of this post, at firstname.lastname@example.org.