<?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>Pario TechnoBlob &#187; sort</title>
	<atom:link href="http://pario.no/tag/sort/feed/" rel="self" type="application/rss+xml" />
	<link>http://pario.no</link>
	<description>A cronological documentation test project, nothing serious, really!</description>
	<lastBuildDate>Thu, 26 Apr 2012 08:18:54 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>My 10 most used linux commands</title>
		<link>http://pario.no/2008/02/25/my-10-most-used-linux-commands/</link>
		<comments>http://pario.no/2008/02/25/my-10-most-used-linux-commands/#comments</comments>
		<pubDate>Mon, 25 Feb 2008 07:49:40 +0000</pubDate>
		<dc:creator>Hans-Henry Jakobsen</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[awk]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[count]]></category>
		<category><![CDATA[grep]]></category>
		<category><![CDATA[head]]></category>
		<category><![CDATA[nl]]></category>
		<category><![CDATA[sort]]></category>

		<guid isPermaLink="false">http://pario.no/2008/02/25/my-10-most-used-linux-commands/</guid>
		<description><![CDATA[This is a oneliner bash command to determine my 10 most used linux commands according to my history file history &#124; awk '{CMD[$2]++;count++;}END { for (a in CMD)print CMD[a] " " CMD[a]/count*100 "% " a;}' &#124; grep -v "./" &#124; column -c3 -s " " -t &#124; sort -nr &#124; nl &#124; head -n10 The [...]]]></description>
			<content:encoded><![CDATA[<p>This is a oneliner bash command to determine my 10 most used linux commands according to my history file</p>
<pre>history | awk '{CMD[$2]++;count++;}END { for (a in CMD)print CMD[a] " " CMD[a]/count*100 "% " a;}' | grep -v "./" | column -c3 -s " " -t | sort -nr | nl |  head -n10</pre>
<p>The result</p>
<pre>
     1  188  37.6%  vi
     2  38   7.6%   ls
     3  24   4.8%   cat
     4  22   4.4%   apt-get
     5  12   2.4%   date
     6  11   2.2%   tail
     7  11   2.2%   cd
     8  10   2%     rm
     9  10   2%     man
    10  9    1.8%   basename</pre>
<p>It looks like i use <strong>vim</strong> a lot on my home server. You should try it yourself and see what commands you use the most.</p>
<p>Source: <a href="http://linux.byexamples.com/archives/332/what-is-your-10-common-linux-commands/">http://linux.byexamples.com</a></p>
<script type="text/javascript">var wordpress_toolbar_urls = ["http:\/\/linux.byexamples.com\/archives\/332\/what-is-your-10-common-linux-commands\/"];var wordpress_toolbar_url = "http://pario.no/wp-content/plugins/wordpress-toolbar/toolbar.php";var wordpress_toolbar_oinw = "n";var wordpress_toolbar_hash = "aHR0cDovL3BhcmlvLm5vLzIwMDgvMDIvMjUvbXktMTAtbW9zdC11c2VkLWxpbnV4LWNvbW1hbmRzLzx3cHRiPk15IDEwIG1vc3QgdXNlZCBsaW51eCBjb21tYW5kczx3cHRiPmh0dHA6Ly9wYXJpby5ubzx3cHRiPlBhcmlvIFRlY2hub0Jsb2I%3D";</script>]]></content:encoded>
			<wfw:commentRss>http://pario.no/2008/02/25/my-10-most-used-linux-commands/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Allow NFS through iptables</title>
		<link>http://pario.no/2007/12/20/allow-nfs-through-iptables/</link>
		<comments>http://pario.no/2007/12/20/allow-nfs-through-iptables/#comments</comments>
		<pubDate>Thu, 20 Dec 2007 09:50:41 +0000</pubDate>
		<dc:creator>Hans-Henry Jakobsen</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Network]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[awk]]></category>
		<category><![CDATA[iptables]]></category>
		<category><![CDATA[nmap]]></category>
		<category><![CDATA[rpcinfo]]></category>
		<category><![CDATA[sort]]></category>

		<guid isPermaLink="false">http://pario.no/2007/12/20/allow-nfs-through-iptables/</guid>
		<description><![CDATA[This is one way to determine the ports needed to open in your iptables rules to get NFS to work properly. First we need to determine the ports NFS uses rpcinfo -p &#124; awk -F " " '{print $3 ", " $4 ", " $5}' &#124; sort &#124; uniq Notice! Since portmap assigns ports on [...]]]></description>
			<content:encoded><![CDATA[<p>This is one way to determine the ports needed to open in your iptables rules to get NFS to work properly. First we need to determine the ports NFS uses</p>
<pre>
rpcinfo -p | awk -F " " '{print $3 ", " $4 ", " $5}' | sort | uniq</pre>
<p><strong>Notice!</strong><br />
Since portmap assigns ports on random this example is only valid as long as you don&#8217;t restart your NFS.</p>
<p>On my system, a RedHat Enterprise Linux WS 4, the result was</p>
<pre>
proto, port,
tcp, 111, portmapper
tcp, 2049, nfs
tcp, 32771, nlockmgr
tcp, 768, rquotad
tcp, 782, mountd
udp, 111, portmapper
udp, 2049, nfs
udp, 32768, nlockmgr
udp, 765, rquotad
udp, 779, mountd</pre>
<p>This gave me  a nice overview of protocols (tcp/udp) and ports used.</p>
<p>Now the rules</p>
<pre>
iptables -A RH-Firewall-1-INPUT -s 192.168.0.0/255.255.255.0 -i eth0 -p tcp -m state --state NEW -m multiport --dports 111,2049,32771,768,782 -j ACCEPT
iptables -A RH-Firewall-1-INPUT -s 192.168.0.0/255.255.255.0 -i eth0 -p udp -m state --state NEW -m multiport --dports 111,2049,32768,765,779 -j ACCEPT</pre>
<p>You see that the multiport statement is just like the result of my rpcinfo command above.</p>
<p>Remember to save your new rules, othervise they will disappear the next time the iptables rules are being loaded.</p>
<p>In addition to this rule you should add the <a href="http://pario.no/2007/05/08/ssh-dictionary-attack-prevention-with-iptables/">iptables rule for ssh access</a> I wrote about earlier.</p>
<p>Another way to determine the ports</p>
<pre>
nmap -sC -p 111 localhost</pre>
<p><strong>Notice!</strong><br />
This solution won&#8217;t work after a reboot of the server since NFS changes ports. One way to overcome this problem is to follow the instructions in a newer post I&#8217;ve made about <a href="http://pario.no/2008/01/15/allow-nfs-through-iptables-on-a-redhat-system/">RedHat and NFS</a>.</p>
<script type="text/javascript">var wordpress_toolbar_urls = [];var wordpress_toolbar_url = "http://pario.no/wp-content/plugins/wordpress-toolbar/toolbar.php";var wordpress_toolbar_oinw = "n";var wordpress_toolbar_hash = "aHR0cDovL3BhcmlvLm5vLzIwMDcvMTIvMjAvYWxsb3ctbmZzLXRocm91Z2gtaXB0YWJsZXMvPHdwdGI%2BQWxsb3cgTkZTIHRocm91Z2ggaXB0YWJsZXM8d3B0Yj5odHRwOi8vcGFyaW8ubm88d3B0Yj5QYXJpbyBUZWNobm9CbG9i";</script>]]></content:encoded>
			<wfw:commentRss>http://pario.no/2007/12/20/allow-nfs-through-iptables/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Query RPM database/packages and list their architecture</title>
		<link>http://pario.no/2007/11/26/query-rpm-databasepackages-and-list-their-architecture/</link>
		<comments>http://pario.no/2007/11/26/query-rpm-databasepackages-and-list-their-architecture/#comments</comments>
		<pubDate>Mon, 26 Nov 2007 13:07:11 +0000</pubDate>
		<dc:creator>Hans-Henry Jakobsen</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Fedora]]></category>
		<category><![CDATA[RedHat]]></category>
		<category><![CDATA[rpm]]></category>
		<category><![CDATA[sort]]></category>

		<guid isPermaLink="false">http://pario.no/2007/11/26/query-rpm-databasepackages-and-list-their-architecture/</guid>
		<description><![CDATA[If you use the &#8211;queryformat argument with rpm it is possible to query RPMs for different architectures installed # rpm -qa --queryformat %{NAME}-%{VERSION}-%{ARCH}\\n &#124; grep dbus-glib &#124; sort Result dbus-glib-0.22-12.EL.5-i386 dbus-glib-0.22-12.EL.5-x86_64 This can also be used in one of my previous posts: Remove duplicate packages when querying the rpm database.]]></description>
			<content:encoded><![CDATA[<p>If you use the &#8211;queryformat argument with <strong>rpm</strong> it is possible to query RPMs for different architectures installed<br />
<code><br />
# rpm -qa --queryformat %{NAME}-%{VERSION}-%{ARCH}\\n | grep dbus-glib | sort</code></p>
<p>Result<br />
<code><br />
dbus-glib-0.22-12.EL.5-i386<br />
dbus-glib-0.22-12.EL.5-x86_64</code></p>
<p>This can also be used in one of my previous posts: <a href="http://pario.no/2007/11/23/remove-duplicate-packages-when-querying-the-rpm-database/">Remove duplicate packages when querying the rpm database</a>.</p>
<script type="text/javascript">var wordpress_toolbar_urls = [];var wordpress_toolbar_url = "http://pario.no/wp-content/plugins/wordpress-toolbar/toolbar.php";var wordpress_toolbar_oinw = "n";var wordpress_toolbar_hash = "aHR0cDovL3BhcmlvLm5vLzIwMDcvMTEvMjYvcXVlcnktcnBtLWRhdGFiYXNlcGFja2FnZXMtYW5kLWxpc3QtdGhlaXItYXJjaGl0ZWN0dXJlLzx3cHRiPlF1ZXJ5IFJQTSBkYXRhYmFzZS9wYWNrYWdlcyBhbmQgbGlzdCB0aGVpciBhcmNoaXRlY3R1cmU8d3B0Yj5odHRwOi8vcGFyaW8ubm88d3B0Yj5QYXJpbyBUZWNobm9CbG9i";</script>]]></content:encoded>
			<wfw:commentRss>http://pario.no/2007/11/26/query-rpm-databasepackages-and-list-their-architecture/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sort IP address</title>
		<link>http://pario.no/2007/11/12/sort-ip-address/</link>
		<comments>http://pario.no/2007/11/12/sort-ip-address/#comments</comments>
		<pubDate>Mon, 12 Nov 2007 09:56:47 +0000</pubDate>
		<dc:creator>Hans-Henry Jakobsen</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Network]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[ip]]></category>
		<category><![CDATA[sort]]></category>

		<guid isPermaLink="false">http://pario.no/2007/11/12/sort-ip-address/</guid>
		<description><![CDATA[Sorting IP addresses using sort is not easy because the dot confuses sort. This line makes it possible to sort by the whole value of the address sort -n -t . -k 1,1 -k 2,2 -k 3,3 -k 4,4 ipaddresses.txt You can also sort by the last octet sort -r. -n +3.0 ipaddresses.txt]]></description>
			<content:encoded><![CDATA[<p>Sorting IP addresses using <strong>sort</strong> is not easy because the dot confuses sort.<br />
This line makes it possible to sort by the whole value of the address</p>
<pre>
sort -n -t . -k 1,1 -k 2,2 -k 3,3 -k 4,4 ipaddresses.txt</pre>
<p>You can also sort by the last octet </p>
<pre>
sort -r. -n +3.0 ipaddresses.txt</pre>
<script type="text/javascript">var wordpress_toolbar_urls = [];var wordpress_toolbar_url = "http://pario.no/wp-content/plugins/wordpress-toolbar/toolbar.php";var wordpress_toolbar_oinw = "n";var wordpress_toolbar_hash = "aHR0cDovL3BhcmlvLm5vLzIwMDcvMTEvMTIvc29ydC1pcC1hZGRyZXNzLzx3cHRiPlNvcnQgSVAgYWRkcmVzczx3cHRiPmh0dHA6Ly9wYXJpby5ubzx3cHRiPlBhcmlvIFRlY2hub0Jsb2I%3D";</script>]]></content:encoded>
			<wfw:commentRss>http://pario.no/2007/11/12/sort-ip-address/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>List processes in a hierarchy</title>
		<link>http://pario.no/2007/06/09/list-processes-in-a-hierarchy/</link>
		<comments>http://pario.no/2007/06/09/list-processes-in-a-hierarchy/#comments</comments>
		<pubDate>Sat, 09 Jun 2007 00:04:32 +0000</pubDate>
		<dc:creator>Hans-Henry Jakobsen</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[sed]]></category>
		<category><![CDATA[sort]]></category>

		<guid isPermaLink="false">http://hhj.no/wordpress/2007/06/09/list-processes-in-a-hierarchy/</guid>
		<description><![CDATA[ps -e -o pid,args --forest List processes by % cpu usage ps -e -o pcpu,cpu,nice,state,cputime,args --sort pcpu &#124; sed '/^ 0.0 /d' List processes by mem usage ps -e -orss=,args= &#124; sort -b -k1,1n &#124; pr -TW$COLUMNS List info for particular process IDs ps -p 1,2]]></description>
			<content:encoded><![CDATA[<pre>
ps -e -o pid,args --forest</pre>
<p>List processes by % cpu usage</p>
<pre>
ps -e -o pcpu,cpu,nice,state,cputime,args --sort pcpu | sed '/^ 0.0 /d'</pre>
<p>List processes by mem usage</p>
<pre>
ps -e -orss=,args= | sort -b -k1,1n | pr -TW$COLUMNS</pre>
<p>List info for particular process IDs</p>
<pre>
ps -p 1,2</pre>
<script type="text/javascript">var wordpress_toolbar_urls = [];var wordpress_toolbar_url = "http://pario.no/wp-content/plugins/wordpress-toolbar/toolbar.php";var wordpress_toolbar_oinw = "n";var wordpress_toolbar_hash = "aHR0cDovL3BhcmlvLm5vLzIwMDcvMDYvMDkvbGlzdC1wcm9jZXNzZXMtaW4tYS1oaWVyYXJjaHkvPHdwdGI%2BTGlzdCBwcm9jZXNzZXMgaW4gYSBoaWVyYXJjaHk8d3B0Yj5odHRwOi8vcGFyaW8ubm88d3B0Yj5QYXJpbyBUZWNobm9CbG9i";</script>]]></content:encoded>
			<wfw:commentRss>http://pario.no/2007/06/09/list-processes-in-a-hierarchy/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

