By Adam Pash Five Really Handy Google Command Line TricksWith the right commands, you can turn your favorite command-line text editor into a distraction-free Google Docs app, add new events to Google Calendar, upload images to Picasa or video to YouTube, backup your Google data, and more. Here's how it works. On Friday, Google released GoogleCL, a saucy command line program that interacts with Google services from any *nix-friendly command-line prompt (on Windows, Mac, or Linux). We spent the weekend playing around with it, and now we're sharing a few of the coolest ways we've been putting it to use. What You'll NeedBefore you can execute any of the cool commands below, you'll need to have installed a few things to get GoogleCL up and running on your system.
Now that you've got everything up and running, let's take a look at some of the coolest tricks you can accomplish. Use Your Command Line as a Distraction-Free, Google-Docs-Backed-Up Text EditorDistraction-free text editors are all the rage these days, but who needs a fancy new application to give you a plain text word processor when GoogleCL can do the same thing—and when you're finished, upload your results to your Google Docs account every time you save. To fire up your own minimalist, distraction-free GoogleCL word processor from the command line, just try something like: google docs edit --title "To-Do List" --editor vim The command above will open and edit an existing document in your Google Docs account if one exists; if not, it'll create one with the title you've provided. The last piece, When you're finished writing and want to upload your results to Google Docs, in nano type Control+X to upload the results to Docs and quit your text editor. (You can fire it back up to edit the same document at any time by just repeating the command above). Quickly Add Any Event to Google Calendar with Plain LanguageYou can quickly add any event to your Google calendar with GoogleCL with one command and plain language. For example, if I were to simply type: google calendar add "Dinner tomorrow at 8pm with Ellen at Figaro" ...and hit Enter, GoogleCL will create the event in Calendar and figure out what I meant about the when and where. It's the same Quick Add feature available on the Google Calendar site, but you don't have to fire up your web browser and wait for Calendar to load to use it. You can enter the who, what, where, and when, and Google Calendar will figure out the rest. Upload a Folder of Images to PicasaSure you could open up the Picasa desktop app, but if you've got a folder full of old pictures you want to upload to Picasa in a jiffy, the GoogleCL upload tool is a great option: google picasa create --title "My Awesome Pool Party" ~/photos/poolpartypics/* As you've probably figured out, —title denotes that "My Awesome Pool Party" is the name of your new album, and the folder directory after that is the folder it's going to upload pictures from. You could upload an individual picture, but if you want to upload the whole folder, make sure you include the asterisk at the end of the path. When it's done, you should see all those pics up and ready to share on your Picasa Web Albums account. Pool photo from lepiaf.geo. Upload a Video to YouTubeI actually hate using YouTube's web-based uploader, so I'm especially keen on this one. You can upload any video to YouTube like so: google youtube post --category Technology ~/Desktop/maddow-talks-lifehacker.mp4 Schedule Backups for Your Google DataPossibly one of the most useful ways you could put GoogleCL to use off the bat—particularly if you're paranoid with the idea of storing all your data online—is to back up the data from your Google services. In a single command for each service, GoogleCL can back up all of your Contacts, Docs, and Picasa photo albums, for example, and I'd guess the backup support will improve for most of the services. Here's how it works for Contacts, Picasa, and Docs. Google Contacts google contacts list > contacts_backup.csv This will pipe all of your contacts to a comma-separated list that can easily be imported to other contact management applications or simply saved to a backup folder, just in case. Picasa Photos google picasa get * Google Docs google docs get * ~/Desktop/Doc_Backup/ Note: Docs backup isn't perfect just yet (spreadsheets aren't supported, and I had to enter the specific folder I wanted downloaded instead of it letting me grab everything at once, but GoogleCL was released on Friday and already updated once this weekend, so I'd expect some of these tools to get a lot better over time. Expanding What GoogleCL Can Do with Other ToolsAs you probably figured out after examining a few of the actions described above, GoogleCL's syntax is pretty simple. To execute a command, you simply type With other tools and tricks, you can do all sorts of fun things stuff with your Google data. Over at Smarterware, Gina suggested using the Calendar tool to display your agenda for the day every time you open a new Terminal window by adding: echo "Next 24 hours:";google calendar today title ...to your google calendar today title > myagenda.txt ...would do the trick nicely. (The greater-than sign pipes the output of any command to a file, so Cron It If you've been toying around with GoogleCL over the weekend—or reading through some of these suggestions gave you some ideas—let's hear how you'd take advantage of GoogleCL in the comments. Adam Pash, editor of Lifehacker, loves to play around with a cool new command line tool. His special feature, Hack Attack, appears regularly on Lifehacker. Subscribe to the Hack Attack RSS feed to get new installments in your newsreader, or follow @adampash on Twitter | June 21st, 2010 Top Stories |
Terms of use
No comments:
Post a Comment