<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>The Developer</title>
	<atom:link href="http://www.thedeveloper.net/feed" rel="self" type="application/rss+xml" />
	<link>http://www.thedeveloper.net</link>
	<description>examples</description>
	<lastBuildDate>Fri, 16 Mar 2012 00:21:17 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>How to split larger files into smaller parts?</title>
		<link>http://www.thedeveloper.net/linux/how-split-larger-files-into-smaller-parts.html</link>
		<comments>http://www.thedeveloper.net/linux/how-split-larger-files-into-smaller-parts.html#comments</comments>
		<pubDate>Fri, 16 Mar 2012 00:20:30 +0000</pubDate>
		<dc:creator>Amaga</dc:creator>
				<category><![CDATA[Bash]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[text]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://www.thedeveloper.net/?p=114</guid>
		<description><![CDATA[If you are splitting a Text file and want to split it by lines you can do this: split -l 50000 dump.csv newdump Which will split the text file in output files of 50000 lines each. This is another way to split a file and is mostly used for text files like logs, sql dumps, csv files, [...]]]></description>
			<content:encoded><![CDATA[<p>If you are splitting a <strong>Text file</strong> and want to split it by lines you can do this:</p>
<p><code>split -l 50000 dump.csv newdump</code></p>
<p>Which will split the text file in output files of 50000 lines each. This is another way to split a file and is mostly used for text files like logs, sql dumps, csv files, etc.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thedeveloper.net/linux/how-split-larger-files-into-smaller-parts.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Linux commands</title>
		<link>http://www.thedeveloper.net/linux/bash-shell/linux-commands.html</link>
		<comments>http://www.thedeveloper.net/linux/bash-shell/linux-commands.html#comments</comments>
		<pubDate>Wed, 14 Mar 2012 06:10:23 +0000</pubDate>
		<dc:creator>Amaga</dc:creator>
				<category><![CDATA[Bash]]></category>

		<guid isPermaLink="false">http://www.thedeveloper.net/?p=55</guid>
		<description><![CDATA[This is a linux command line reference for common operations. Examples marked with • are valid/safe to paste without modification into a terminal, so you may want to keep a terminal window open while reading this so you can cut &#38; paste. All these commands have been tested both on Fedora and Ubuntu. Command Description [...]]]></description>
			<content:encoded><![CDATA[<p>This is a linux command line reference for common operations.</p>
<p>Examples marked with • are valid/safe to paste without modification into a terminal, so you may want to keep a terminal window open while reading this so you can <strong>cut &amp; paste</strong>.<br />
All these commands have been tested both on Fedora and Ubuntu.</p>
<table class="pixelbeat">
<tbody>
<tr class="pbtitle">
<td colspan="2"><strong>Command</strong></td>
<td><strong>Description</strong></td>
</tr>
<tr>
<td>•</td>
<td class="nw">apropos whatis</td>
<td>Show commands pertinent to string. See also <a href="scripts/threadsafe">threadsafe</a></td>
</tr>
<tr>
<td>•</td>
<td class="nw"><a href="lkdb/less.html">man</a> -t man | ps2pdf &#8211; &gt; man.pdf</td>
<td>make a pdf of a manual page</td>
</tr>
<tr>
<td></td>
<td class="nw">which command</td>
<td>Show full path name of command</td>
</tr>
<tr>
<td></td>
<td class="nw">time command</td>
<td>See how long a command takes</td>
</tr>
<tr>
<td>•</td>
<td class="nw">time cat</td>
<td>Start stopwatch. Ctrl-d to stop. See also <a href="scripts/stopwatch/">sw</a></td>
</tr>
<tr>
<td>•</td>
<td class="nw">nice <a href="lkdb/info.html">info</a></td>
<td>Run a low priority command (The &#8220;info&#8221; reader in this case)</td>
</tr>
<tr>
<td>•</td>
<td class="nw">renice 19 -p $$</td>
<td>Make shell (script) low priority. Use for non interactive tasks</td>
</tr>
<tr class="pbtitle">
<td colspan="3"><strong>dir navigation</strong></td>
</tr>
<tr>
<td>•</td>
<td class="nw">cd -</td>
<td>Go to previous directory</td>
</tr>
<tr>
<td>•</td>
<td class="nw">cd</td>
<td>Go to $HOME directory</td>
</tr>
<tr>
<td></td>
<td class="nw">(cd dir &amp;&amp; command)</td>
<td>Go to dir, execute command and return to current dir</td>
</tr>
<tr>
<td>•</td>
<td class="nw">pushd <strong>.</strong></td>
<td>Put current dir on stack so you can <strong>popd</strong> back to it</td>
</tr>
<tr class="pbtitle">
<td colspan="3"><strong>file searching</strong></td>
</tr>
<tr>
<td>•</td>
<td class="nw"><a href="settings/.bashrc">alias</a> l=&#8217;ls -l &#8211;color=auto&#8217;</td>
<td>quick dir listing</td>
</tr>
<tr>
<td>•</td>
<td class="nw">ls -lrt</td>
<td>List files by date. See also <a href="scripts/newest">newest</a> and <a href="scripts/find_mm_yyyy">find_mm_yyyy</a></td>
</tr>
<tr>
<td>•</td>
<td class="nw">ls /usr/bin | pr -T9 -W$COLUMNS</td>
<td>Print in 9 columns to width of terminal</td>
</tr>
<tr>
<td></td>
<td class="nw">find -name &#8216;*.[ch]&#8216; | xargs grep -E &#8216;expr&#8217;</td>
<td>Search &#8216;expr&#8217; in this dir and below. See also <a href="scripts/findrepo">findrepo</a></td>
</tr>
<tr>
<td></td>
<td class="nw">find -type f -print0 | xargs -r0 grep -F &#8216;example&#8217;</td>
<td>Search all regular files for &#8216;example&#8217; in this dir and below</td>
</tr>
<tr>
<td></td>
<td class="nw">find -maxdepth 1 -type f | xargs grep -F &#8216;example&#8217;</td>
<td>Search all regular files for &#8216;example&#8217; in this dir</td>
</tr>
<tr>
<td></td>
<td class="nw">find -maxdepth 1 -type d | while <a href="programming/readline/">read</a> dir; do echo $dir; echo cmd2; done</td>
<td>Process each item with multiple commands (in while loop)</td>
</tr>
<tr>
<td>•</td>
<td class="nw">find -type f ! -perm -444</td>
<td>Find files not readable by all (useful for web site)</td>
</tr>
<tr>
<td>•</td>
<td class="nw">find -type d ! -perm -111</td>
<td>Find dirs not accessible by all (useful for web site)</td>
</tr>
<tr>
<td>•</td>
<td class="nw">locate -r &#8216;file[^/]*\.txt&#8217;</td>
<td>Search cached index for names. This re is like glob *file*.txt</td>
</tr>
<tr>
<td>•</td>
<td class="nw">look reference</td>
<td>Quickly search (sorted) dictionary for prefix</td>
</tr>
<tr>
<td>•</td>
<td class="nw">grep <a href="settings/.bashrc">&#8211;color</a> reference /usr/share/dict/words</td>
<td>Highlight occurances of regular expression in dictionary</td>
</tr>
<tr class="pbtitle">
<td colspan="3"><strong>archives and compression</strong></td>
</tr>
<tr>
<td></td>
<td class="nw">gpg -c file</td>
<td>Encrypt file</td>
</tr>
<tr>
<td></td>
<td class="nw">gpg file.gpg</td>
<td>Decrypt file</td>
</tr>
<tr>
<td></td>
<td class="nw">tar -c dir/ | bzip2 &gt; dir.tar.bz2</td>
<td>Make compressed archive of dir/</td>
</tr>
<tr>
<td></td>
<td class="nw">bzip2 -dc dir.tar.bz2 | tar -x</td>
<td>Extract archive (use gzip instead of bzip2 for tar.gz files)</td>
</tr>
<tr>
<td></td>
<td class="nw">tar -c dir/ | gzip | gpg -c | ssh user@remote &#8216;dd of=dir.tar.gz.gpg&#8217;</td>
<td>Make encrypted archive of dir/ on remote machine</td>
</tr>
<tr>
<td></td>
<td class="nw">find dir/ -name &#8216;*.txt&#8217; | tar -c &#8211;files-from=- | bzip2 &gt; dir_txt.tar.bz2</td>
<td>Make archive of subset of dir/ and below</td>
</tr>
<tr>
<td></td>
<td class="nw">find dir/ -name &#8216;*.txt&#8217; | xargs cp -a &#8211;target-directory=dir_txt/ &#8211;parents</td>
<td>Make copy of subset of dir/ and below</td>
</tr>
<tr>
<td></td>
<td class="nw">( tar -c /dir/to/copy ) | ( cd /where/to/ &amp;&amp; tar -x -p )</td>
<td>Copy (with permissions) copy/ dir to /where/to/ dir</td>
</tr>
<tr>
<td></td>
<td class="nw">( cd /dir/to/copy &amp;&amp; tar -c <strong>.</strong> ) | ( cd /where/to/ &amp;&amp; tar -x -p )</td>
<td>Copy (with permissions) contents of copy/ dir to /where/to/</td>
</tr>
<tr>
<td></td>
<td class="nw">( tar -c /dir/to/copy ) | ssh -C user@remote &#8216;cd /where/to/ &amp;&amp; tar -x -p&#8217;</td>
<td>Copy (with permissions) copy/ dir to remote:/where/to/ dir</td>
</tr>
<tr>
<td></td>
<td class="nw">dd bs=1M if=/dev/sda | gzip | ssh user@remote &#8216;dd of=sda.gz&#8217;</td>
<td>Backup harddisk to remote machine</td>
</tr>
<tr class="pbtitle">
<td colspan="3"><strong>rsync</strong> (Network efficient file copier: Use the &#8211;dry-run option for testing)</td>
</tr>
<tr>
<td></td>
<td class="nw">rsync -P rsync://rsync.server.com/path/to/file file</td>
<td>Only get diffs. Do multiple times for troublesome downloads</td>
</tr>
<tr>
<td></td>
<td class="nw">rsync &#8211;bwlimit=1000 fromfile tofile</td>
<td>Locally copy with rate limit. It&#8217;s like nice for I/O</td>
</tr>
<tr>
<td></td>
<td class="nw">rsync -az -e ssh &#8211;delete ~/public_html/ remote.com:&#8217;~/public_html&#8217;</td>
<td>Mirror web site (using compression and encryption)</td>
</tr>
<tr>
<td></td>
<td class="nw">rsync -auz -e ssh remote:/dir/ <strong>.</strong> &amp;&amp; rsync -auz -e ssh <strong>.</strong> remote:/dir/</td>
<td>Synchronize current directory with remote one</td>
</tr>
<tr class="pbtitle">
<td colspan="3"><strong>ssh</strong> (Secure SHell)</td>
</tr>
<tr>
<td></td>
<td class="nw">ssh $USER@$HOST command</td>
<td>Run command on $HOST as $USER (default command=shell)</td>
</tr>
<tr>
<td>•</td>
<td class="nw">ssh -f -Y $USER@$HOSTNAME xeyes</td>
<td>Run GUI command on $HOSTNAME as $USER</td>
</tr>
<tr>
<td></td>
<td class="nw">scp -p -r $USER@$HOST: file dir/</td>
<td>Copy with permissions to $USER&#8217;s home directory on $HOST</td>
</tr>
<tr>
<td></td>
<td class="nw">ssh -g -L 8080:localhost:80 root@$HOST</td>
<td>Forward connections to $HOSTNAME:8080 out to $HOST:80</td>
</tr>
<tr>
<td></td>
<td class="nw">ssh -R 1434:imap:143 root@$HOST</td>
<td>Forward connections from $HOST:1434 in to imap:143</td>
</tr>
<tr class="pbtitle">
<td colspan="3"><strong>wget</strong> (multi purpose download tool)</td>
</tr>
<tr>
<td>•</td>
<td class="nw">(cd dir/ &amp;&amp; wget -nd -pHEKk http://www.pixelbeat.org/cmdline.html)</td>
<td>Store local browsable version of a page to the current dir</td>
</tr>
<tr>
<td></td>
<td class="nw">wget -c http://www.example.com/large.file</td>
<td>Continue downloading a partially downloaded file</td>
</tr>
<tr>
<td></td>
<td class="nw">wget -r -nd -np -l1 -A &#8216;*.jpg&#8217; http://www.example.com/dir/</td>
<td>Download a set of files to the current directory</td>
</tr>
<tr>
<td></td>
<td class="nw">wget ftp://remote/file[1-9].iso/</td>
<td>FTP supports globbing directly</td>
</tr>
<tr>
<td>•</td>
<td class="nw">wget -q -O- http://www.pixelbeat.org/timeline.html | grep &#8216;a href&#8217; | head</td>
<td>Process output directly</td>
</tr>
<tr>
<td></td>
<td class="nw">echo &#8216;wget url&#8217; | at 01:00</td>
<td>Download url at 1AM to current dir</td>
</tr>
<tr>
<td></td>
<td class="nw">wget &#8211;limit-rate=20k url</td>
<td>Do a low priority download (limit to 20<a href="speeds.html">KB/s</a> in this case)</td>
</tr>
<tr>
<td></td>
<td class="nw">wget -nv &#8211;spider &#8211;force-html -i bookmarks.html</td>
<td>Check links in a file</td>
</tr>
<tr>
<td></td>
<td class="nw">wget &#8211;mirror http://www.example.com/</td>
<td>Efficiently update a local copy of a site (handy from cron)</td>
</tr>
<tr class="pbtitle">
<td colspan="3"><strong>networking</strong> (Note ifconfig, route, mii-tool, nslookup commands are obsolete)</td>
</tr>
<tr>
<td></td>
<td class="nw"><acronym title="usually in /sbin/">ethtool</acronym> eth0</td>
<td>Show status of ethernet interface eth0</td>
</tr>
<tr>
<td></td>
<td class="nw">ethtool &#8211;change eth0 autoneg off speed 100 duplex full</td>
<td>Manually set ethernet interface speed</td>
</tr>
<tr>
<td></td>
<td class="nw"><acronym title="usually in /sbin/">iwconfig</acronym> eth1</td>
<td>Show status of wireless interface eth1</td>
</tr>
<tr>
<td></td>
<td class="nw">iwconfig eth1 rate 1Mb/s fixed</td>
<td>Manually set wireless interface speed</td>
</tr>
<tr>
<td>•</td>
<td class="nw"><acronym title="usually in /sbin/">iwlist</acronym> scan</td>
<td>List wireless networks in range</td>
</tr>
<tr>
<td>•</td>
<td class="nw"><acronym title="usually in /sbin/">ip</acronym> link show</td>
<td>List network interfaces</td>
</tr>
<tr>
<td></td>
<td class="nw">ip link set dev eth0 name wan</td>
<td>Rename interface eth0 to wan</td>
</tr>
<tr>
<td></td>
<td class="nw">ip link set dev eth0 up</td>
<td>Bring interface eth0 up (or down)</td>
</tr>
<tr>
<td>•</td>
<td class="nw">ip addr show</td>
<td>List addresses for interfaces</td>
</tr>
<tr>
<td></td>
<td class="nw">ip addr add 1.2.3.4/24 brd + dev eth0</td>
<td>Add (or del) ip and mask (255.255.255.0)</td>
</tr>
<tr>
<td>•</td>
<td class="nw">ip route show</td>
<td>List routing table</td>
</tr>
<tr>
<td></td>
<td class="nw">ip route add default via 1.2.3.254</td>
<td>Set default gateway to 1.2.3.254</td>
</tr>
<tr>
<td>•</td>
<td class="nw"><acronym title="usually in /sbin/">tc</acronym> qdisc add dev lo root handle 1:0 netem delay 20msec</td>
<td>Add 20ms latency to loopback device (for testing)</td>
</tr>
<tr>
<td>•</td>
<td class="nw">tc qdisc del dev lo root</td>
<td>Remove latency added above</td>
</tr>
<tr>
<td>•</td>
<td class="nw">host pixelbeat.org</td>
<td>Lookup DNS ip address for name or vice versa</td>
</tr>
<tr>
<td>•</td>
<td class="nw">hostname -i</td>
<td>Lookup local ip address (equivalent to host `hostname`)</td>
</tr>
<tr>
<td>•</td>
<td class="nw">whois pixelbeat.org</td>
<td>Lookup whois info for hostname or ip address</td>
</tr>
<tr>
<td>•</td>
<td class="nw">netstat -tupl</td>
<td>List internet services on a system</td>
</tr>
<tr>
<td>•</td>
<td class="nw">netstat -tup</td>
<td>List active connections to/from system</td>
</tr>
<tr class="pbtitle">
<td colspan="3"><strong>windows networking</strong> (Note samba is the package that provides all this windows specific networking support)</td>
</tr>
<tr>
<td>•</td>
<td class="nw">smbtree</td>
<td>Find windows machines. See also findsmb</td>
</tr>
<tr>
<td></td>
<td class="nw">nmblookup -A 1.2.3.4</td>
<td>Find the windows (netbios) name associated with ip address</td>
</tr>
<tr>
<td></td>
<td class="nw">smbclient -L windows_box</td>
<td>List shares on windows machine or samba server</td>
</tr>
<tr>
<td></td>
<td class="nw">mount -t smbfs -o fmask=666,guest //windows_box/share /mnt/share</td>
<td>Mount a windows share</td>
</tr>
<tr>
<td></td>
<td class="nw">echo &#8216;message&#8217; | smbclient -M windows_box</td>
<td>Send popup to windows machine (off by default in XP sp2)</td>
</tr>
<tr class="pbtitle">
<td colspan="3"><strong>text manipulation</strong> (Note sed uses stdin and stdout. Newer versions support inplace editing with the -i option)</td>
</tr>
<tr>
<td></td>
<td class="nw">sed &#8216;s/string1/string2/g&#8217;</td>
<td>Replace string1 with string2</td>
</tr>
<tr>
<td></td>
<td class="nw">sed &#8216;s/\(.*\)1/\12/g&#8217;</td>
<td>Modify anystring1 to anystring2</td>
</tr>
<tr>
<td></td>
<td class="nw">sed &#8216;/ *#/d; /^ *$/d&#8217;</td>
<td>Remove comments and blank lines</td>
</tr>
<tr>
<td></td>
<td class="nw">sed &#8216;:a; /\\$/N; s/\\\n//; ta&#8217;</td>
<td>Concatenate lines with trailing \</td>
</tr>
<tr>
<td></td>
<td class="nw">sed &#8216;s/[ \t]*$//&#8217;</td>
<td>Remove trailing spaces from lines</td>
</tr>
<tr>
<td></td>
<td class="nw">sed &#8216;s/\([`"$\]\)/\\\1/g&#8217;</td>
<td>Escape shell metacharacters active within double quotes</td>
</tr>
<tr>
<td>•</td>
<td class="nw">seq 10 | sed &#8220;s/^/      /; s/ *\(.\{7,\}\)/\1/&#8221;</td>
<td>Right align numbers</td>
</tr>
<tr>
<td></td>
<td class="nw">sed -n &#8217;1000{p;<acronym title="quit ASAP">q</acronym>}&#8217;</td>
<td>Print 1000th line</td>
</tr>
<tr>
<td></td>
<td class="nw">sed -n &#8217;10,20p;<acronym title="quit ASAP">20q</acronym>&#8216;</td>
<td>Print lines 10 to 20</td>
</tr>
<tr>
<td></td>
<td class="nw">sed -n &#8216;s/.*\(.*\)&lt;\/title&gt;.*/\1/ip;<acronym title="quit after match">T;q</acronym>&#8216;</td>
<td>Extract title from HTML web page</td>
</tr>
<tr>
<td></td>
<td class="nw">sed -i 42d ~/.ssh/known_hosts</td>
<td>Delete a particular line</td>
</tr>
<tr>
<td></td>
<td class="nw">sort -t. -k1,1n -k2,2n -k3,3n -k4,4n</td>
<td>Sort IPV4 ip addresses</td>
</tr>
<tr>
<td>•</td>
<td class="nw">echo &#8216;Test&#8217; | tr &#8216;[:lower:]&#8216; &#8216;[:upper:]&#8216;</td>
<td>Case conversion</td>
</tr>
<tr>
<td>•</td>
<td class="nw">tr -dc &#8216;[:print:]&#8216; &lt; /dev/urandom</td>
<td>Filter non printable characters</td>
</tr>
<tr>
<td>•</td>
<td class="nw">history | wc -l</td>
<td>Count lines</td>
</tr>
<tr class="pbtitle">
<td colspan="3"><strong>set operations</strong> (Note you can <a href="docs/env.html">export LANG=C</a> for speed. Also these assume no duplicate lines within a file)</td>
</tr>
<tr>
<td></td>
<td class="nw">sort file1 file2 | uniq</td>
<td><acronym title="Items in either file1 or file2">Union</acronym> of unsorted files</td>
</tr>
<tr>
<td></td>
<td class="nw">sort file1 file2 | uniq -d</td>
<td><acronym title="Items both in file1 and file2">Intersection</acronym> of unsorted files</td>
</tr>
<tr>
<td></td>
<td class="nw">sort file1 file1 file2 | uniq -u</td>
<td><acronym title="Items in file2 not in file1">Difference</acronym> of unsorted files</td>
</tr>
<tr>
<td></td>
<td class="nw">sort file1 file2 | uniq -u</td>
<td><acronym title="Items in only one file">Symmetric Difference</acronym> of unsorted files</td>
</tr>
<tr>
<td></td>
<td class="nw">join <acronym title="process whole line (assuming no NUL characters present)">-t&#8221;</acronym> -a1 -a2 file1 file2</td>
<td>Union of sorted files</td>
</tr>
<tr>
<td></td>
<td class="nw">join -t&#8221; file1 file2</td>
<td>Intersection of sorted files</td>
</tr>
<tr>
<td></td>
<td class="nw">join -t&#8221; -v2 file1 file2</td>
<td>Difference of sorted files</td>
</tr>
<tr>
<td></td>
<td class="nw">join -t&#8221; -v1 -v2 file1 file2</td>
<td>Symmetric Difference of sorted files</td>
</tr>
<tr class="pbtitle">
<td colspan="3"><strong>math</strong></td>
</tr>
<tr>
<td>•</td>
<td class="nw">echo &#8216;(1 + sqrt(5))/2&#8242; | bc -l</td>
<td>Quick math (Calculate φ). See also <a href="scripts/bc">bc</a></td>
</tr>
<tr>
<td>•</td>
<td class="nw">echo &#8216;pad=20; min=64; (100*10^6)/((pad+min)*8)&#8217; | bc</td>
<td>More complex (int) e.g. This shows max FastE packet rate</td>
</tr>
<tr>
<td>•</td>
<td class="nw">echo &#8216;pad=20; min=64; print (100E6)/((pad+min)*8)&#8217; | python</td>
<td>Python handles scientific notation</td>
</tr>
<tr>
<td>•</td>
<td class="nw">echo &#8216;pad=20; plot [64:1518] (100*10**6)/((pad+x)*8)&#8217; | gnuplot -persist</td>
<td>Plot FastE packet rate vs packet size</td>
</tr>
<tr>
<td>•</td>
<td class="nw">echo &#8216;obase=16; ibase=10; 64206&#8242; | bc</td>
<td>Base conversion (decimal to hexadecimal)</td>
</tr>
<tr>
<td>•</td>
<td class="nw">echo $((0x2dec))</td>
<td>Base conversion (hex to dec) ((shell arithmetic expansion))</td>
</tr>
<tr>
<td>•</td>
<td class="nw">units -t &#8217;100m/<a href="misc/usain_bolt/">9.58s</a>&#8216; &#8216;miles/hour&#8217;</td>
<td>Unit conversion (metric to imperial)</td>
</tr>
<tr>
<td>•</td>
<td class="nw">units -t &#8217;500GB&#8217; &#8216;GiB&#8217;</td>
<td>Unit conversion (<acronym title="powers of 10">SI</acronym> to <acronym title="powers of 2">IEC</acronym> prefixes)</td>
</tr>
<tr>
<td>•</td>
<td class="nw">units -t &#8217;1 googol&#8217;</td>
<td>Definition lookup</td>
</tr>
<tr>
<td>•</td>
<td class="nw">seq 100 | (tr &#8216;\n&#8217; +; echo 0) | bc</td>
<td>Add a column of numbers. See also <a href="scripts/add">add</a> and <a href="scripts/funcpy">funcpy</a></td>
</tr>
<tr class="pbtitle">
<td colspan="3"><strong>calendar</strong></td>
</tr>
<tr>
<td>•</td>
<td class="nw">cal -3</td>
<td>Display a calendar</td>
</tr>
<tr>
<td>•</td>
<td class="nw">cal 9 1752</td>
<td>Display a calendar for a particular month year</td>
</tr>
<tr>
<td>•</td>
<td class="nw">date -d fri</td>
<td>What date is it this friday. See also <a href="scripts/day">day</a></td>
</tr>
<tr>
<td>•</td>
<td class="nw">[ $(date -d "tomorrow" +%d) = "01" ] || exit</td>
<td>exit a script unless it&#8217;s the last day of the month</td>
</tr>
<tr>
<td>•</td>
<td class="nw">date &#8211;date=&#8217;25 Dec&#8217; +%A</td>
<td>What day does xmas fall on, this year</td>
</tr>
<tr>
<td>•</td>
<td class="nw">date &#8211;date=&#8217;@2147483647&#8242;</td>
<td>Convert seconds since the epoch (1970-01-01 UTC) to date</td>
</tr>
<tr>
<td>•</td>
<td class="nw">TZ=&#8217;America/Los_Angeles&#8217; date</td>
<td>What time is it on west coast of US (use tzselect to find TZ)</td>
</tr>
<tr>
<td>•</td>
<td class="nw">date &#8211;date=&#8217;TZ=&#8221;America/Los_Angeles&#8221; 09:00 next Fri&#8217;</td>
<td>What&#8217;s the local time for 9AM next Friday on west coast US</td>
</tr>
<tr>
<td></td>
<td class="nw">echo &#8220;mail -s &#8216;get the train&#8217; P@draigBrady.com &lt; /dev/null&#8221; | at 17:45</td>
<td>Email reminder</td>
</tr>
<tr>
<td>•</td>
<td class="nw">echo &#8220;DISPLAY=$DISPLAY xmessage cooker&#8221; | at &#8220;NOW + 30 minutes&#8221;</td>
<td>Popup reminder</td>
</tr>
<tr class="pbtitle">
<td colspan="3"><strong>locales</strong></td>
</tr>
<tr>
<td>•</td>
<td class="nw">printf &#8220;%&#8217;d\n&#8221; 1234</td>
<td>Print number with thousands grouping appropriate to locale</td>
</tr>
<tr>
<td>•</td>
<td class="nw">BLOCK_SIZE=\&#8217;1 ls -l</td>
<td>get ls to do thousands grouping appropriate to locale</td>
</tr>
<tr>
<td>•</td>
<td class="nw">echo &#8220;I live in `locale territory`&#8221;</td>
<td>Extract info from locale database</td>
</tr>
<tr>
<td>•</td>
<td class="nw">LANG=en_IE.utf8 locale int_prefix</td>
<td>Lookup locale info for specific country. See also <a href="scripts/ccodes">ccodes</a></td>
</tr>
<tr>
<td>•</td>
<td class="nw">locale | cut -d= -f1 | xargs locale -kc | less</td>
<td>List fields available in locale database</td>
</tr>
<tr class="pbtitle">
<td colspan="3"><strong>recode</strong> (Obsoletes iconv, dos2unix, unix2dos)</td>
</tr>
<tr>
<td>•</td>
<td class="nw">recode -l | less</td>
<td>Show available conversions (aliases on each line)</td>
</tr>
<tr>
<td></td>
<td class="nw">recode windows-1252.. file_to_change.txt</td>
<td>Windows &#8220;ansi&#8221; to local charset (auto does CRLF conversion)</td>
</tr>
<tr>
<td></td>
<td class="nw">recode utf-8/CRLF.. file_to_change.txt</td>
<td>Windows utf8 to local charset</td>
</tr>
<tr>
<td></td>
<td class="nw">recode iso-8859-15..utf8 file_to_change.txt</td>
<td>Latin9 (western europe) to utf8</td>
</tr>
<tr>
<td></td>
<td class="nw">recode ../b64 &lt; file.txt &gt; file.b64</td>
<td>Base64 encode</td>
</tr>
<tr>
<td></td>
<td class="nw">recode /qp.. &lt; file.qp &gt; file.txt</td>
<td>Quoted printable decode</td>
</tr>
<tr>
<td></td>
<td class="nw">recode ..HTML &lt; file.txt &gt; file.html</td>
<td>Text to HTML</td>
</tr>
<tr>
<td>•</td>
<td class="nw">recode -lf windows-1252 | grep euro</td>
<td>Lookup <a href="docs/utf8.html">table of characters</a></td>
</tr>
<tr>
<td>•</td>
<td class="nw">echo -n 0&#215;80 | recode latin-9/x1..dump</td>
<td>Show what a code represents in latin-9 charmap</td>
</tr>
<tr>
<td>•</td>
<td class="nw">echo -n 0x20AC | recode ucs-2/x2..latin-9/x</td>
<td>Show latin-9 encoding</td>
</tr>
<tr>
<td>•</td>
<td class="nw">echo -n 0x20AC | recode ucs-2/x2..utf-8/x</td>
<td>Show utf-8 encoding</td>
</tr>
<tr class="pbtitle">
<td colspan="3"><strong><acronym title="Compact Disks">CDs</acronym></strong></td>
</tr>
<tr>
<td></td>
<td class="nw">gzip &lt; /dev/cdrom &gt; cdrom.iso.gz</td>
<td>Save copy of data cdrom</td>
</tr>
<tr>
<td></td>
<td class="nw">mkisofs -V LABEL -r dir | gzip &gt; cdrom.iso.gz</td>
<td>Create cdrom image from contents of dir</td>
</tr>
<tr>
<td></td>
<td class="nw">mount -o loop cdrom.iso /mnt/dir</td>
<td>Mount the cdrom image at /mnt/dir (read only)</td>
</tr>
<tr>
<td></td>
<td class="nw">cdrecord -v dev=/dev/cdrom blank=fast</td>
<td>Clear a CDRW</td>
</tr>
<tr>
<td></td>
<td class="nw">gzip -dc cdrom.iso.gz | cdrecord -v dev=/dev/cdrom -</td>
<td>Burn cdrom image (use dev=ATAPI -scanbus to confirm dev)</td>
</tr>
<tr>
<td></td>
<td class="nw">cdparanoia -B</td>
<td>Rip audio tracks from CD to wav files in current dir</td>
</tr>
<tr>
<td></td>
<td class="nw">cdrecord -v dev=/dev/cdrom -audio -pad *.wav</td>
<td>Make audio CD from all wavs in current dir (see also cdrdao)</td>
</tr>
<tr>
<td></td>
<td class="nw">oggenc &#8211;tracknum=&#8217;track&#8217; track.cdda.wav -o &#8216;track.ogg&#8217;</td>
<td>Make ogg file from wav file</td>
</tr>
<tr class="pbtitle">
<td colspan="3"><strong>disk space</strong> (See also <a href="fslint/">FSlint</a>)</td>
</tr>
<tr>
<td>•</td>
<td class="nw">ls -lSr</td>
<td>Show files by size, biggest last</td>
</tr>
<tr>
<td>•</td>
<td class="nw">du -s * | sort -k1,1rn | head</td>
<td>Show top disk users in current dir. See also <a href="scripts/dutop">dutop</a></td>
</tr>
<tr>
<td>•</td>
<td class="nw">df -h</td>
<td>Show free space on mounted filesystems</td>
</tr>
<tr>
<td>•</td>
<td class="nw">df -i</td>
<td>Show free inodes on mounted filesystems</td>
</tr>
<tr>
<td>•</td>
<td class="nw"><acronym title="usually in /sbin/">fdisk</acronym> -l</td>
<td>Show disks partitions sizes and types (run as root)</td>
</tr>
<tr>
<td>•</td>
<td class="nw"><a href="docs/packaging.html">rpm</a> -q -a &#8211;qf &#8216;%10{SIZE}\t%{NAME}\n&#8217; | sort -k1,1n</td>
<td>List all <a href="docs/packaging.html">packages</a> by installed size (Bytes) on rpm distros</td>
</tr>
<tr>
<td>•</td>
<td class="nw"><a href="docs/packaging.html">dpkg</a>-query -W -f=&#8217;${Installed-Size;10}\t${Package}\n&#8217; | sort -k1,1n</td>
<td>List all <a href="docs/packaging.html">packages</a> by installed size (KBytes) on deb distros</td>
</tr>
<tr>
<td>•</td>
<td class="nw">dd bs=1 seek=2TB if=/dev/null of=ext3.test</td>
<td>Create a large test file (taking no space). See also <a href="scripts/truncate">truncate</a></td>
</tr>
<tr>
<td>•</td>
<td class="nw">&gt; file</td>
<td>truncate data of file or create an empty file</td>
</tr>
<tr class="pbtitle">
<td colspan="3"><strong>monitoring/debugging</strong></td>
</tr>
<tr>
<td>•</td>
<td class="nw">tail -f /var/log/messages</td>
<td><a href="docs/web/access_log/monitoring.html">Monitor messages</a> in a log file</td>
</tr>
<tr>
<td>•</td>
<td class="nw">strace -c ls &gt;/dev/null</td>
<td>Summarise/profile system calls made by command</td>
</tr>
<tr>
<td>•</td>
<td class="nw">strace -f -e open ls &gt;/dev/null</td>
<td>List system calls made by command</td>
</tr>
<tr>
<td>•</td>
<td class="nw">ltrace -f -e getenv ls &gt;/dev/null</td>
<td>List library calls made by command</td>
</tr>
<tr>
<td>•</td>
<td class="nw"><acronym title="usually in /usr/sbin/">lsof</acronym> -p <acronym title="process id of current shell">$$</acronym></td>
<td>List paths that process id has open</td>
</tr>
<tr>
<td>•</td>
<td class="nw">lsof ~</td>
<td>List processes that have specified path open</td>
</tr>
<tr>
<td>•</td>
<td class="nw">tcpdump not port 22</td>
<td>Show network traffic except ssh. See also <a href="scripts/tcpdump_not_me">tcpdump_not_me</a></td>
</tr>
<tr>
<td>•</td>
<td class="nw">ps -e -o pid,args &#8211;forest</td>
<td>List processes in a hierarchy</td>
</tr>
<tr>
<td>•</td>
<td class="nw">ps -e -o pcpu,cpu,nice,state,cputime,args &#8211;sort pcpu | sed &#8216;/^ 0.0 /d&#8217;</td>
<td>List processes by % cpu usage</td>
</tr>
<tr>
<td>•</td>
<td class="nw">ps -e -orss=,args= | sort -b -k1,1n | pr -TW$COLUMNS</td>
<td>List processes by mem (KB) usage. See also <a href="scripts/ps_mem.py">ps_mem.py</a></td>
</tr>
<tr>
<td>•</td>
<td class="nw">ps -C firefox-bin -L -o pid,tid,pcpu,state</td>
<td>List all threads for a particular process</td>
</tr>
<tr>
<td>•</td>
<td class="nw">ps -p 1,2</td>
<td>List info for particular process IDs</td>
</tr>
<tr>
<td>•</td>
<td class="nw">last reboot</td>
<td>Show system reboot history</td>
</tr>
<tr>
<td>•</td>
<td class="nw">free -m</td>
<td>Show amount of (remaining) RAM (-m displays in MB)</td>
</tr>
<tr>
<td>•</td>
<td class="nw">watch -n.1 &#8216;cat /proc/interrupts&#8217;</td>
<td>Watch changeable data continuously</td>
</tr>
<tr class="pbtitle">
<td colspan="3"><strong>system information</strong> (see also <a href="scripts/sysinfo">sysinfo</a>) (&#8216;#&#8217; means root access is required)</td>
</tr>
<tr>
<td>•</td>
<td class="nw">uname -a</td>
<td>Show kernel version and system architecture</td>
</tr>
<tr>
<td>•</td>
<td class="nw">head -n1 /etc/issue</td>
<td>Show name and version of distribution</td>
</tr>
<tr>
<td>•</td>
<td class="nw">cat /proc/partitions</td>
<td>Show all partitions registered on the system</td>
</tr>
<tr>
<td>•</td>
<td class="nw">grep MemTotal /proc/meminfo</td>
<td>Show RAM total seen by the system</td>
</tr>
<tr>
<td>•</td>
<td class="nw">grep &#8220;model name&#8221; /proc/cpuinfo</td>
<td>Show CPU(s) info</td>
</tr>
<tr>
<td>•</td>
<td class="nw"><acronym title="usually in /sbin/">lspci</acronym> -tv</td>
<td>Show PCI info</td>
</tr>
<tr>
<td>•</td>
<td class="nw"><acronym title="usually in /sbin/">lsusb</acronym> -tv</td>
<td>Show USB info</td>
</tr>
<tr>
<td>•</td>
<td class="nw">mount | column -t</td>
<td>List mounted filesystems on the system (and align output)</td>
</tr>
<tr>
<td>•</td>
<td class="nw">grep -F capacity: /proc/acpi/battery/BAT0/info</td>
<td>Show state of cells in laptop battery</td>
</tr>
<tr>
<td>#</td>
<td class="nw">dmidecode -q | less</td>
<td>Display SMBIOS/DMI information</td>
</tr>
<tr>
<td>#</td>
<td class="nw">smartctl -A /dev/sda | grep Power_On_Hours</td>
<td>How long has this disk (system) been powered on in total</td>
</tr>
<tr>
<td>#</td>
<td class="nw">hdparm -i /dev/sda</td>
<td>Show info about disk sda</td>
</tr>
<tr>
<td>#</td>
<td class="nw">hdparm -tT /dev/sda</td>
<td>Do a read speed test on disk sda</td>
</tr>
<tr>
<td>#</td>
<td class="nw">badblocks -s /dev/sda</td>
<td>Test for unreadable blocks on disk sda</td>
</tr>
<tr class="pbtitle">
<td colspan="3"><strong>interactive</strong> (see also <a href="lkdb/">linux keyboard shortcuts)</a></td>
</tr>
<tr>
<td>•</td>
<td class="nw"><a href="lkdb/readline.html">readline</a></td>
<td>Line editor used by bash, python, bc, gnuplot, &#8230;</td>
</tr>
<tr>
<td>•</td>
<td class="nw"><a href="lkdb/screen.html">screen</a></td>
<td>Virtual terminals with detach capability, &#8230;</td>
</tr>
<tr>
<td>•</td>
<td class="nw"><a href="lkdb/mc.html">mc</a></td>
<td>Powerful file manager that can browse rpm, tar, ftp, ssh, &#8230;</td>
</tr>
<tr>
<td>•</td>
<td class="nw"><a href="docs/web/access_log/analyzing.html">gnuplot</a></td>
<td>Interactive/scriptable graphing</td>
</tr>
<tr>
<td>•</td>
<td class="nw">links</td>
<td>Web browser</td>
</tr>
<tr>
<td>•</td>
<td class="nw">xdg-open <strong>.</strong></td>
<td>open a file or url with the registered desktop application</td>
</tr>
<tr class="pbtitle">
<td colspan="3"><strong>miscellaneous</strong></td>
</tr>
<tr>
<td>•</td>
<td class="nw"><a href="settings/.bashrc">alias</a> hd=&#8217;od -Ax -tx1z -v&#8217;</td>
<td>Handy hexdump. (usage e.g.: • hd /proc/self/cmdline | less)</td>
</tr>
<tr>
<td>•</td>
<td class="nw"><a href="settings/.bashrc">alias</a> realpath=&#8217;readlink -f&#8217;</td>
<td>Canonicalize path. (usage e.g.: • realpath ~/../$USER)</td>
</tr>
<tr>
<td>•</td>
<td class="nw">set | grep $USER</td>
<td>Search current <a href="docs/env.html">environment</a></td>
</tr>
<tr>
<td></td>
<td class="nw">touch -c -t 0304050607 file</td>
<td>Set file timestamp (YYMMDDhhmm)</td>
</tr>
<tr>
<td>•</td>
<td class="nw">python -m SimpleHTTPServer</td>
<td>Serve current directory tree at http://$HOSTNAME:8000/</td>
</tr>
</tbody>
</table>
]]></content:encoded>
			<wfw:commentRss>http://www.thedeveloper.net/linux/bash-shell/linux-commands.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Displaying ls in color and howto change a color in  CentOS, Fedora, and Redhat.</title>
		<link>http://www.thedeveloper.net/linux/displaying-ls-color-replace-color.html</link>
		<comments>http://www.thedeveloper.net/linux/displaying-ls-color-replace-color.html#comments</comments>
		<pubDate>Thu, 01 Mar 2012 19:32:28 +0000</pubDate>
		<dc:creator>Amaga</dc:creator>
				<category><![CDATA[Bash]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[colors]]></category>

		<guid isPermaLink="false">http://www.thedeveloper.net/?p=102</guid>
		<description><![CDATA[Display ls in color Open file in bash vi ~/.bashrc Add following line to .bashrc alias ls="ls -al --color" NOTE: log off and login (or run bash) to see the result Replace a colors By default CentOS/RHEL show directorys in ls listing in dark green. With dark color it&#8217;s difficult to read directory names. cp [...]]]></description>
			<content:encoded><![CDATA[<h3>Display ls in color</h3>
<p>Open file in bash<br />
<code>vi ~/.bashrc</code></p>
<p>Add following line to .bashrc<br />
<code>alias ls="ls -al --color"</code></p>
<p><strong>NOTE:</strong> log off and login (or run bash) to see the result</p>
<h3>Replace a colors</h3>
<p>By default CentOS/RHEL show directorys in ls listing in dark green. With dark color it&#8217;s difficult to read directory names.<br />
<a href="http://www.thedeveloper.net/files/2012/03/ls_color_dark_colors.jpg"><img class="aligncenter size-medium wp-image-105" title="ls_color_dark_colors" src="http://www.thedeveloper.net/files/2012/03/ls_color_dark_colors-300x246.jpg" alt="" width="300" height="246" /></a><br />
<code><br />
cp /etc/DIR_COLORS ~/.dir_colors<br />
vi ~/.dir_colors<br />
</code><br />
FIND: <code>DIR 01;34 # directory</code><br />
REPLACE WITH: <code>DIR 01;33 # directory</code></p>
<p><strong>NOTE:</strong> log off and login (or run bash) to see the result.</p>
<p>Everything was tested  CentOS, Fedora, and Redhat.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thedeveloper.net/linux/displaying-ls-color-replace-color.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Wanna  see version of distributive was installed?</title>
		<link>http://www.thedeveloper.net/linux/distributiv-version.html</link>
		<comments>http://www.thedeveloper.net/linux/distributiv-version.html#comments</comments>
		<pubDate>Thu, 01 Mar 2012 07:22:58 +0000</pubDate>
		<dc:creator>Amaga</dc:creator>
				<category><![CDATA[Bash]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[version]]></category>

		<guid isPermaLink="false">http://www.thedeveloper.net/?p=97</guid>
		<description><![CDATA[Often question: how to check the version of centos? Here solution to check what version of CentOS or any other distributive was installed: cat /etc/*release* or specific for centos/redhat: cat /etc/redhat-release]]></description>
			<content:encoded><![CDATA[<pre>Often question: <strong>how to check the version of centos?</strong>
Here solution to check what version of CentOS or any other distributive was installed:</pre>
<p><code>cat /etc/*release*</code></p>
<p>or</p>
<p>specific for centos/redhat: <code>cat /etc/redhat-release</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.thedeveloper.net/linux/distributiv-version.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Easy way to remove files that are not in subversion (svn)</title>
		<link>http://www.thedeveloper.net/linux/bash-shell/remove-not-subversion-svn-files.html</link>
		<comments>http://www.thedeveloper.net/linux/bash-shell/remove-not-subversion-svn-files.html#comments</comments>
		<pubDate>Thu, 01 Mar 2012 06:33:15 +0000</pubDate>
		<dc:creator>Amaga</dc:creator>
				<category><![CDATA[Bash]]></category>
		<category><![CDATA[svn]]></category>

		<guid isPermaLink="false">http://www.thedeveloper.net/?p=90</guid>
		<description><![CDATA[One of the great features of version control is that I can easily revert back to a known good state. I can do this in Subversion with the following command: svn st &#124;grep -e ^\? -e ^I &#124; awk '{print $2}'xargs rm Note 1: Use rm -rf  to delete directions and files without questions  svn [...]]]></description>
			<content:encoded><![CDATA[<p>One of the great features of version control is that I can easily revert back to a known good state. I can do this in Subversion with the following command:</p>
<p><code>svn st |grep -e ^\? -e ^I | awk '{print $2}'xargs rm</code></p>
<p>Note 1: Use rm -rf  to delete directions and files without questions <img src='http://www.thedeveloper.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  svn st |grep -e ^\? -e ^I | awk &#8216;{print $2}&#8217;xargs rm -rf<br />
Note 2: awk fix a problem with white spaces.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thedeveloper.net/linux/bash-shell/remove-not-subversion-svn-files.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How do I get ls to display in color</title>
		<link>http://www.thedeveloper.net/linux/display-colors-linux-ls-command.html</link>
		<comments>http://www.thedeveloper.net/linux/display-colors-linux-ls-command.html#comments</comments>
		<pubDate>Wed, 28 Sep 2011 19:12:16 +0000</pubDate>
		<dc:creator>Amaga</dc:creator>
				<category><![CDATA[Bash]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[color]]></category>
		<category><![CDATA[ls]]></category>

		<guid isPermaLink="false">http://www.thedeveloper.net/?p=88</guid>
		<description><![CDATA[Login as root and add the &#8211;color option to the command. ls -al &#8211;color /etc Open the .bashrc file with your favorite text editor. For example, you could type vi /root/.bashrc at the command line to open the file. Under the line &#8220;# User specific aliases and functions&#8221; type: alias ls=&#8221;ls -alh &#8211;color&#8221; alias ll=&#8221;ls -alh &#8211;color&#8221; [...]]]></description>
			<content:encoded><![CDATA[<p>Login as root and add the &#8211;color option to the command.</p>
<p>ls -al &#8211;color /etc</p>
<p>Open the .bashrc file with your favorite text editor.<br />
For example, you could type <tt><strong>vi /root/.bashrc</strong></tt> at the command line to open the file.</p>
<p>Under the line &#8220;# User specific aliases and functions&#8221; type:</p>
<p>alias ls=&#8221;ls -alh &#8211;color&#8221;<br />
alias ll=&#8221;ls -alh &#8211;color&#8221;</p>
<p>Make sure to write your changes to the file and save them. The changes will not take effect until you close your terminal/session window and re-open a new terminal again.</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thedeveloper.net/linux/display-colors-linux-ls-command.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Install Thawte SSL certificate in nginx</title>
		<link>http://www.thedeveloper.net/nginx/install-thawte-ssl-cert.html</link>
		<comments>http://www.thedeveloper.net/nginx/install-thawte-ssl-cert.html#comments</comments>
		<pubDate>Tue, 27 Sep 2011 06:32:06 +0000</pubDate>
		<dc:creator>Amaga</dc:creator>
				<category><![CDATA[Nginx]]></category>
		<category><![CDATA[certificate]]></category>
		<category><![CDATA[ssl]]></category>

		<guid isPermaLink="false">http://www.thedeveloper.net/?p=80</guid>
		<description><![CDATA[Thawte recently started issuing a new kind of SSL cert. Instead of just taking your crt and key files and dumping them on your server, you need to install Thawte’s intermediate certificates as well. here solution: Download your client certificate from thawte (.crt file thawte sent) Download the primary and secondary intermediate CAs Combine the 3 certificates into one [...]]]></description>
			<content:encoded><![CDATA[<p>Thawte recently started issuing a new kind of SSL cert. Instead of just taking your crt and key files and dumping them on your server, you need to install Thawte’s intermediate certificates as well.</p>
<p><strong>here solution:</strong></p>
<ol>
<li>Download your client certificate from thawte (.crt file thawte sent)</li>
<li>Download the <a href="https://search.thawte.com/support/ssl-digital-certificates/index?page=content&amp;id=AR1482&amp;actp=LIST&amp;viewlocale=en_US" target="_blank">primary and secondary intermediate CAs</a></li>
<li>Combine the 3 certificates into one file, with your certificate first, then the primary and secondary intermediate certificates.</li>
<li>Add: ssl_verify_depth 3; to your configuration file</li>
<li>Restart nginx (/etc/init.d/nginx restart)</li>
</ol>
<p>So in the end, your nginx configuration file should look like the following:</p>
<blockquote><p>ssl_certificate         /path/to/certificate.bundle.cert;<br />
ssl_certificate_key     /path/to/private.key;<br />
ssl_verify_depth 3;</p></blockquote>
<p>Now your browser should say that the certificate was issues by Thawte DV SSL CA.<br />
Test it by visiting <a title="Test SSL" href="https://www.ssllabs.com/ssldb/" target="_blank">https://www.ssllabs.com/ssldb/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.thedeveloper.net/nginx/install-thawte-ssl-cert.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Qmail-Remove</title>
		<link>http://www.thedeveloper.net/linux/qmail-remove.html</link>
		<comments>http://www.thedeveloper.net/linux/qmail-remove.html#comments</comments>
		<pubDate>Sat, 13 Mar 2010 03:00:53 +0000</pubDate>
		<dc:creator>Amaga</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[mail]]></category>

		<guid isPermaLink="false">http://www.thedeveloper.net/?p=68</guid>
		<description><![CDATA[Qmail-Remove will remove messages containing a particular string from your Qmail queue. Mails are *not* deleted from the queue! They are only stored, temporarily, in $qmail-queue/yanked/, where you can view them individually and restore them back to the queue manually. There is currently no support for restoring them automatically. By default, Qmail-Remove assumes that your [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft size-thumbnail wp-image-70" style="margin-left: 10px;margin-right: 10px" title="qmail remove emails" src="http://www.thedeveloper.net/files/2010/03/qmail1-150x150.jpg" alt="" width="115" height="115" />Qmail-Remove will remove messages  containing a particular string from your Qmail queue.</p>
<p>Mails are *not* deleted from the queue! They are only stored,  temporarily, in $qmail-queue/yanked/, where you can view them  individually and restore them back to the queue manually. There is  currently no support for restoring them automatically.</p>
<p>By default, Qmail-Remove assumes that your Qmail queue is stored in  /var/qmail/queue, but this can be changed with a command line option.  Similarly, Qmail-Remove assumes that your queue “split” is 23 by  default, among other things.</p>
<p>If you want to check your qmail queue using the following command</p>
<p>#<span style="color: yellowgreen"> /var/qmail/bin/qmail-qstat</span></p>
<p>Output looks like</p>
<p>messages in queue: 567154<br />
messages in queue but not yet preprocessed: 3</p>
<p>Install Qmail-Remove</p>
<p>First you need to download latest version from here current version is  Qmail-Remove 0.95</p>
<p>Download using the following command</p>
<p>#wget <a href="http://www.linuxmagic.com/opensource/qmail/qmail-remove/qmail-remove-.tar.gz" target="_blank">http://www.linuxmagic.com/opensource&#8230;remove-.tar.gz</a></p>
<p>Now you have qmail-remove-0.95.tar.gz file and now you need to extract  using the following command</p>
<p>#<span style="color: yellowgreen">tar -zxvf qmail-remove-.tar.gz</span></p>
<p>Now you should have qmail-remove-0.95 folder go in to the directory and  run the following commands</p>
<p>#<span style="color: yellowgreen">make</span></p>
<p>#<span style="color: yellowgreen">make install</span></p>
<p>This will complete the installation.</p>
<p>Now you need to create a directory named “yanked” in the qmail queue  directory you intend to use before using this program.</p>
<p>#<span style="color: yellowgreen">mkdir /var/qmail/queue/yanked</span></p>
<p><strong>Examples for qmail-remove</strong></p>
<p>Before doing any thing related to qmail queue you need to stop the qmail  service using the following command:</p>
<p>#<span style="color: yellowgreen">/etc/init.d/qmail stop</span></p>
<p>To delete mails from Que,</p>
<p>#<span style="color: yellowgreen">qmail-remove -r -p</span></p>
<p># <span style="color: yellowgreen">qmail-remove -r -p mega.pack.com</span></p>
<p>This will remove all emails in queue with “mega.pack.com” in it and place  it in /var/qmail/queue/yanked folder.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thedeveloper.net/linux/qmail-remove.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Have a problem with mod_rewrite rules? Debug it !</title>
		<link>http://www.thedeveloper.net/apache/mod_rewrite/mod_rewrite-rules-debug-log.html</link>
		<comments>http://www.thedeveloper.net/apache/mod_rewrite/mod_rewrite-rules-debug-log.html#comments</comments>
		<pubDate>Tue, 09 Mar 2010 23:06:59 +0000</pubDate>
		<dc:creator>Amaga</dc:creator>
				<category><![CDATA[Mod_Rewrite]]></category>
		<category><![CDATA[.htaccess]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[debug]]></category>
		<category><![CDATA[rules]]></category>

		<guid isPermaLink="false">http://www.thedeveloper.net/?p=64</guid>
		<description><![CDATA[Many webmasters run in to mod_rewrite at one time or another and every one of them will have at least a little trouble with it. I just came across the RewriteLog Directive and corresponding RewriteLogLevel Directive. To set up a debugging log for mod_rewrite, you need to add them to your httpd.conf to the appropriate [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft size-thumbnail wp-image-57" style="margin-left: 10px; margin-right: 10px;" title="mod_rewrite logo" src="http://www.thedeveloper.net/files/2010/01/mod_rewrite_logo-150x126.jpg" alt="" width="150" height="126" />Many webmasters run in to <strong>mod_rewrite</strong> at one time or another and every one of them will have at least a little trouble with it.<br />
I just came across the RewriteLog Directive and corresponding RewriteLogLevel Directive.<span id="more-64"></span><br />
To set up a <strong>debugging log</strong> for <strong>mod_rewrite</strong>, you need to add them to your <strong>httpd.conf</strong> to the appropriate VirtualHost section.</p>
<ul>
<li>Add following rules to your httpd.conf
<pre class="brush: bash; title: ; notranslate">
&lt;IfModule mod_rewrite.c&gt;
RewriteLog &quot;/var/log/httpd/rewrite.log&quot;
RewriteLogLevel 3
&lt;/IfModule&gt;
</pre>
<p>to the appropriate VirtualHost section.</li>
<li>Restart Apache by command in your shell (as root)<br />
<strong><em>apachectl graceful</em></strong></li>
</ul>
<p><strong>Note:</strong> You&#8217;re not going to be able to turn above rules with shared hosting, they can&#8217;t be used in .htaccess by default. But you could ask your server-administrator to set AllowOverride to &#8220;All&#8221; instead &#8220;None&#8221;. And you will available to add above rules to .htaccess.</p>
<p>There a trick that&#8217;s helps  debug mod_rewrite on shared hosting even AllowOverride is &#8220;None&#8221;.<br />
Basically what you do is dump some of the info that mod_rewrite is  using back out into the headers then use the <a href="https://addons.mozilla.org/en-US/firefox/addon/1843">Firebug</a> or <a href="http://livehttpheaders.mozdev.org/">LiveHTTP Headers</a> extensions in Firefox to watch the headers and read your debug info.<br />
Add following rules to .htaccess:</p>
<pre class="brush: bash; title: ; notranslate">
RewriteCond %{QUERY_STRING} !vardump
RewriteRule (.*) http://www.your_website.com/$1?vardump&amp;thereq=%{THE_REQUEST}&amp;reqhost=%{HTTP_HOST} [R=301,L,QSA]
</pre>
<p>to dump, for example, the THE_REQUEST and HTTP_HOST into request variables.<br />
The R=301 does a 301 redirect instead of a rewrite &#8211; this is key. A redirect sends information back to the browser but a rewrite happens all inside the server.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thedeveloper.net/apache/mod_rewrite/mod_rewrite-rules-debug-log.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rewrite subdomain to folder</title>
		<link>http://www.thedeveloper.net/apache/mod_rewrite/rewrite-subdomain-to-folder.html</link>
		<comments>http://www.thedeveloper.net/apache/mod_rewrite/rewrite-subdomain-to-folder.html#comments</comments>
		<pubDate>Thu, 18 Feb 2010 05:40:29 +0000</pubDate>
		<dc:creator>Amaga</dc:creator>
				<category><![CDATA[Mod_Rewrite]]></category>
		<category><![CDATA[subdomain]]></category>

		<guid isPermaLink="false">http://www.thedeveloper.net/?p=59</guid>
		<description><![CDATA[You might have noticed some sites having their URLs written as if they were different subdomains of the same domain. Internally rewrite .example.com/ to example.com/subs/&#60;subdomain/ Internally rewrite .example.com/ to example.com/&#60;subdomain/ In both cases, a mechanism is required (and present in the code) to prevent an &#8216;infinite&#8217; rewriting loop. If you use the first method, then [...]]]></description>
			<content:encoded><![CDATA[<p>You might have noticed some sites having their URLs written as if they were different subdomains of the same domain.<span id="more-59"></span></p>
<p>Internally rewrite .example.com/ to example.com/subs/&lt;subdomain/</p>
<pre class="brush: bash; title: ; notranslate">
RewriteCond $1 !^subs/
RewriteCond %{HTTP_HOST} !^www\.example\.com
RewriteCond %{HTTP_HOST} ^([^.]+)\.example\.com
RewriteRule (.*) /subs/%1/$1 [L]
</pre>
<p>Internally rewrite .example.com/ to example.com/&lt;subdomain/</p>
<pre class="brush: bash; title: ; notranslate">
RewriteCond %{ENV:Rewrite-Done} !^Yes$
RewriteCond %{HTTP_HOST} !^www\.example\.com
RewriteCond %{HTTP_HOST} ^([^.]+)\.example\.com
RewriteRule (.*) /%1/$1 [E=Rewrite-Done:Yes,L]
</pre>
<p>In both cases, a mechanism is required (and present in the code) to prevent an &#8216;infinite&#8217; rewriting loop.</p>
<p>If you use the first method, then you can easily externally redirect direct client requests for the subdomain-subdirectories back to the subdomain to avoid duplicate content:</p>
<p>Externally redirect client requests for example.com/subs// to .example.com/</p>
<pre class="brush: bash; title: ; notranslate">
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /subs/
RewriteRule ^subs/([^/]+)/(.*)$ http://$1.example.com/$2 [R=301,L]
</pre>
<p><strong>Here more complex email</strong><br />
The best way to do this is to setup each (or all) subdomain in the sites/{subdomain} directory of domain.com via your control panel. Some hosts will leave well enough alone (so the subdomain remains visible) but others actually force a redirect to the main domain&#8217;s subdirectory (forcing a change of URL). If you do this with mod_rewrite, you are forcing the change of URL.</p>
<pre class="brush: bash; title: ; notranslate">
# Rewrite &lt;subdomain&gt;.example.com/&lt;path&gt; to example.com/SITE/&lt;subdomain&gt;/&lt;path&gt;
#
# Skip rewrite if no hostname or if subdomain is www
# RewriteCond %{HTTP_HOST} .
# there must always be an {HTTP_HOST}
RewriteCond %{HTTP_HOST} !^www\. [NC]

# Extract (required) subdomain (%1), and first path element (%3), discard port number if present (%2)
RewriteCond %{HTTP_HOST}&lt;&gt;%{REQUEST_URI} ^([^.]+)\.domain\.com(:80)?&lt;&gt;/([^/]*) [NC]
# / is not used by Apache 2.x
# ([^/]*) means no subdirectories allowed

# Rewrite only when subdomain not equal to first path element (prevents mod_rewrite recursion)
RewriteCond %1&lt;&gt;%3 !^sites/(.*)&lt;&gt;\1$ [NC]
# Don't forget your sites &quot;marker&quot; subdirectory
# \1$ has no meaning!  All you don't want it sites/ in the URI

RewriteCond %{REQUEST_URI} !^/?sites/
# so you don't need the preceding RewriteCond statement

RewriteRule ^(.*) sites/%1/$1 [R=301,L]
# You might as well make this a 301 redirect
# finis!

    # Rewrite to /subdomain/path
    #RewriteRule ^(.*) /sites/%1/$1 [L]
    #RewriteRule ^(.*) /%1/$1 [L] #root directory
    #RewriteRule ^(.*) sites/%1/$1 [L]
    #RewriteRule ^/products/ index.php?id=$1&amp;todo=
</pre>
<p>To check whether the folder exists is redundant &#8211; Apache will NOT even receive the request if the subdomain doesn&#8217;t exist so this problem can only occur with Dynamic Mass VirtualHosting. In that case, use a RewriteCond statement to check {PHYSICAL path to DocumentRoot}/sites/%1 -d (directory exists).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thedeveloper.net/apache/mod_rewrite/rewrite-subdomain-to-folder.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using memcached
Page Caching using apc
Database Caching using apc
Object Caching 588/823 objects using apc

Served from: www.thedeveloper.net @ 2012-05-20 18:15:38 -->
