<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
<title>Snipplr</title>
<link>http://snipplr.com/language/bash/tags/one-liners</link>
<description>Recent snippets posted on Snipplr.com</description>
<language>en-us</language>
<pubDate>Thu, 23 May 2013 01:43:02 GMT</pubDate>
<item>
<title>(Bash) test that pwgen does not produce duplicate words - noah</title>
<link>http://snipplr.com/view/45623/test-that-pwgen-does-not-produce-duplicate-words/</link>
<description><![CDATA[ <p></p> ]]></description>
<pubDate>Sat, 11 Dec 2010 15:20:34 GMT</pubDate>
<guid>http://snipplr.com/view/45623/test-that-pwgen-does-not-produce-duplicate-words/</guid>
</item>
<item>
<title>(Bash) kill zombie processes - noah</title>
<link>http://snipplr.com/view/41095/kill-zombie-processes/</link>
<description><![CDATA[ <p>Thanks to [Kastner](http://metaatem.net/) for these snippets.</p> ]]></description>
<pubDate>Tue, 28 Sep 2010 07:14:38 GMT</pubDate>
<guid>http://snipplr.com/view/41095/kill-zombie-processes/</guid>
</item>
<item>
<title>(Bash) delete files older than 1 day - noah</title>
<link>http://snipplr.com/view/40798/delete-files-older-than-1-day/</link>
<description><![CDATA[ <p>Finds and *removes* files older than 2 days.\r\n\r\n*Use with caution* obviously, as if you fuck up, you\'ll certainly delete files you want to keep, possibly *destroying your entire computer.*\r\n\r\nEnjoy!</p> ]]></description>
<pubDate>Tue, 21 Sep 2010 03:20:55 GMT</pubDate>
<guid>http://snipplr.com/view/40798/delete-files-older-than-1-day/</guid>
</item>
<item>
<title>(Bash) Howto run Tidy from the command line - noah</title>
<link>http://snipplr.com/view/27758/howto-run-tidy-from-the-command-line/</link>
<description><![CDATA[ <p>This shell command will retrieve a Web page and validate the HTML with [Tidy, the HTML linter from the W3](http://tidy.sourceforge.net/).  You can get an **XHTML validation** report right in your shell prompt, just like you'd get from the [Firefox extension](https://addons.mozilla.org/en-US/firefox/addon/249) or the [Web service.](validator.w3.org/).  It's especially helpful when you need to **validate HTML on your intranet, or behind a firewall.**

### **NOTE: Curl does not follow redirects by default!**

By default, Curl retrieves *exactly* the URL you specify. The `-L` option causes Curl to follow redirects just like a Web browser would.

### **NOTE: Tidy produces a lot of output!**


Windows users should make sure their [command prompt screen buffer height is set to 9999](http://www.codinghorror.com/blog/archives/000334.html 'command prompt tips from Coding Horror') so that you don't "lose" any output.


### **Explanation of the command line options**

`curl -L` tells Curl to fo**LL**ow HTTP redirects

`curl -s` **S**uppresses Curl's annoying progress bar

`tidy -e` tells Tidy not to **E**mit the tidied HTML to the console

`tidy -q` tells Tidy to be **Q**uiet, instead of printing extra crap at the bottom of the report

### **Dependencies**

Curl and Tidy are installed via the [Cygwin setup.exe](http://cygwin.com/)

Alternately, Perl hackers could use [lwp-request](http://search.cpan.org/~gaas/libwww-perl-5.808/bin/lwp-request).

### **Doing more**

[Validate HTML with a stricter algorithm,](http://snipplr.com/view/4130/check-linked-pages-for-tidy-validation-errors-on-the-command-line/) using the OpenJade SGML parser.

[Validate linked pages](http://snipplr.com/view/4130/check-linked-pages-for-tidy-validation-errors-on-the-command-line/) with Tidy and lwp-request.</p> ]]></description>
<pubDate>Fri, 05 Feb 2010 12:41:54 GMT</pubDate>
<guid>http://snipplr.com/view/27758/howto-run-tidy-from-the-command-line/</guid>
</item>
<item>
<title>(Bash) preview Markdown in the shell, without launching Firefox - noah</title>
<link>http://snipplr.com/view/15687/preview-markdown-in-the-shell-without-launching-firefox/</link>
<description><![CDATA[ <p>You may need to first `sudo gem install maruku` and install Lynx using your favorite package manager [or just download Lynx by itself](http://www.google.com/search?q=download+lynx)</p> ]]></description>
<pubDate>Mon, 08 Jun 2009 00:27:33 GMT</pubDate>
<guid>http://snipplr.com/view/15687/preview-markdown-in-the-shell-without-launching-firefox/</guid>
</item>
<item>
<title>(Bash) Delicious ego boost from the command line - noah</title>
<link>http://snipplr.com/view/9964/delicious-ego-boost-from-the-command-line/</link>
<description><![CDATA[ <p>This one-liner counts how many of the links to onemorebug.com there are on http://delicous.com/tag/noahsussman.

Basically it prints a number, and that number is the percentage of the top 100 links for that tag in delicious that point to your URL. 

Requires Grep, Lynx and Wc.</p> ]]></description>
<pubDate>Fri, 21 Nov 2008 22:29:39 GMT</pubDate>
<guid>http://snipplr.com/view/9964/delicious-ego-boost-from-the-command-line/</guid>
</item>
<item>
<title>(Bash) List commands in history, sorted by usage - noah</title>
<link>http://snipplr.com/view/6135/list-commands-in-history-sorted-by-usage/</link>
<description><![CDATA[ <p>Lists the top 10 commands in your history file.

Thanks Ben!

Here's an example session:

    May12 10:39:18 book> ~/Documents/n_s/tools/command-history.sh
    162 quite
    110 svn
    107 ruby
    61 curl
    39 rwget
    34 grep
    33 cd
    21 lwp-request
    19 fg
    17 ls</p> ]]></description>
<pubDate>Tue, 06 May 2008 15:24:05 GMT</pubDate>
<guid>http://snipplr.com/view/6135/list-commands-in-history-sorted-by-usage/</guid>
</item>
<item>
<title>(Bash) Download an entire site with wget -pkr - noah</title>
<link>http://snipplr.com/view/5094/download-an-entire-site-with-wget-pkr/</link>
<description><![CDATA[ <p>## Where to Get Even More WGet Hacks
See also these killer `wget` [hacks by Jeff Veen.](http://www.veen.com/jeff/archives/000573.html)

## The WGet Hacks
Here are a couple of recipes to **download and archive an entire Web site,** starting with the given page and recursing down 1 level.   Adjust how many levels deep by changing the numeric argument given after -l


## Pitfalls
As of 2008, WGet doesn't follow @import links in CSS.</p> ]]></description>
<pubDate>Sat, 16 Feb 2008 21:42:46 GMT</pubDate>
<guid>http://snipplr.com/view/5094/download-an-entire-site-with-wget-pkr/</guid>
</item>
<item>
<title>(Bash) Scrape Google from the command line - noah</title>
<link>http://snipplr.com/view/4299/scrape-google-from-the-command-line/</link>
<description><![CDATA[ <p>This code is POC only -- actually using it would violate Google's TOS, which forbids scraping.  It is published here for educational value only.

Hypothetically, the following command should return a list of the top 500 or so hits in Google for onemorebug.com.

The results will be prepended with digits, followed by a dot and some whitespace (Lynx adds these).

_You must have Lynx and Wget installed on your system for this to work._

Keep in mind that *nix shells don't like it when you double-quote strings, see the comments.</p> ]]></description>
<pubDate>Sun, 09 Dec 2007 21:16:58 GMT</pubDate>
<guid>http://snipplr.com/view/4299/scrape-google-from-the-command-line/</guid>
</item>
<item>
<title>(Bash) check linked pages for Tidy validation errors, on the command line - noah</title>
<link>http://snipplr.com/view/4130/check-linked-pages-for-tidy-validation-errors-on-the-command-line/</link>
<description><![CDATA[ <p>Given a list of HTML links (for example, a Google results page that has been saved locally) check each link that points to a page on a given domain, and report if Tidy complains that its doctype declaration is missing.

Besides DOCTYPE, other strings to search for include "discarding", "lacks value" and "Error:"

Remember to replace MY_DOMAIN with the actual domain you want to validate against.</p> ]]></description>
<pubDate>Tue, 13 Nov 2007 23:47:28 GMT</pubDate>
<guid>http://snipplr.com/view/4130/check-linked-pages-for-tidy-validation-errors-on-the-command-line/</guid>
</item>
<item>
<title>(Bash) Validate a list of Web pages with Tidy, on the command line - noah</title>
<link>http://snipplr.com/view/4129/validate-a-list-of-web-pages-with-tidy-on-the-command-line/</link>
<description><![CDATA[ <p></p> ]]></description>
<pubDate>Tue, 13 Nov 2007 22:54:37 GMT</pubDate>
<guid>http://snipplr.com/view/4129/validate-a-list-of-web-pages-with-tidy-on-the-command-line/</guid>
</item>
<item>
<title>(Bash) Tail requests for HTML files - noah</title>
<link>http://snipplr.com/view/4069/tail-requests-for-html-files/</link>
<description><![CDATA[ <p>This command will tail an Apache access log, but only print lines where an HTML file was requested.</p> ]]></description>
<pubDate>Mon, 05 Nov 2007 12:40:54 GMT</pubDate>
<guid>http://snipplr.com/view/4069/tail-requests-for-html-files/</guid>
</item>
<item>
<title>(Bash) Download linked JPEGs from a Web page, on the command line - noah</title>
<link>http://snipplr.com/view/4063/download-linked-jpegs-from-a-web-page-on-the-command-line/</link>
<description><![CDATA[ <p>The following command will download all the files with a JPG extension that are linked from http://flickr.com.

_Requires the LWP and HTML::Tree Perl modules.  You must also have Wget installed on your system for this to work._</p> ]]></description>
<pubDate>Fri, 02 Nov 2007 22:57:45 GMT</pubDate>
<guid>http://snipplr.com/view/4063/download-linked-jpegs-from-a-web-page-on-the-command-line/</guid>
</item>
<item>
<title>(Bash) rsync backup directory - noah</title>
<link>http://snipplr.com/view/2798/rsync-backup-directory/</link>
<description><![CDATA[ <p>The --delete switch causes files that have been deleted from the source directory, to also be deleted from the target directory.</p> ]]></description>
<pubDate>Mon, 04 Jun 2007 07:37:02 GMT</pubDate>
<guid>http://snipplr.com/view/2798/rsync-backup-directory/</guid>
</item>
<item>
<title>(Bash) wget with username and password - noah</title>
<link>http://snipplr.com/view/2687/wget-with-username-and-password/</link>
<description><![CDATA[ <p>This is how to connect to a secure site with wget.  The Cygwin manpage is quite confusing on this issue.</p> ]]></description>
<pubDate>Tue, 22 May 2007 11:08:00 GMT</pubDate>
<guid>http://snipplr.com/view/2687/wget-with-username-and-password/</guid>
</item>
</channel>
</rss>