<?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>System Adm &#187; shell</title>
	<atom:link href="http://www.system.adm.br/tag/shell/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.system.adm.br</link>
	<description>Some IT Tips (Linux, Unix, HP-UX, AIX, Solaris, etc).</description>
	<lastBuildDate>Wed, 30 Nov 2011 17:59:40 +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>Remove files with odd name</title>
		<link>http://www.system.adm.br/2011/11/remove-files-with-odd-name/</link>
		<comments>http://www.system.adm.br/2011/11/remove-files-with-odd-name/#comments</comments>
		<pubDate>Wed, 30 Nov 2011 17:48:28 +0000</pubDate>
		<dc:creator>Lincoln Zuljewic Silva</dc:creator>
				<category><![CDATA[General Unix]]></category>
		<category><![CDATA[find]]></category>
		<category><![CDATA[odd]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[stupid user]]></category>

		<guid isPermaLink="false">http://www.system.adm.br/?p=389</guid>
		<description><![CDATA[Sometimes an user create a file or directory with a odd filename, for example: server@root:/root # touch /tmp/test/^Easasasasa.txt This “^E” is the result of a CTRL+E. With “ls”, we have the following: server@root:/tmp/test # ls -ltr total 0 -rw-r----- 1 root sys 0 Nov 30 15:34 asasasasa.txt Note that you cannot see the ^E in [...]]]></description>
			<content:encoded><![CDATA[<p>Sometimes an user create a file or directory with a odd filename, for example:<br />
<code><span style="font-size: 12px;">server@root:/root # touch /tmp/test/^Easasasasa.txt</span></code></p>
<p>This “^E” is the result of a CTRL+E. With “ls”, we have the following:<code><span style="font-size: 12px;"><br />
server@root:/tmp/test # ls -ltr<br />
total 0<br />
-rw-r----- 1 root sys 0 Nov 30 15:34 asasasasa.txt</span></code></p>
<p>Note that you cannot see the ^E in filename, so the system will not recognize it as “asasasasa.txt”:<code><span style="font-size: 12px;"><br />
server@root:/tmp/test # rm asasasasa.txt<br />
rm: asasasasa.txt non-existent<br />
</span></code></p>
<p>The solution is work with the file’s inode:<code><span style="font-size: 12px;"><br />
server@root:/tmp/test # ls -lia<br />
total 96<br />
11 -rw-r----- 1 root sys 0 Nov 30 15:34 asasasasa.txt<br />
5 drwxr-x--- 2 root sys 96 Nov 30 15:34 .<br />
2 drwxrwxrwt 8 root root 49152 Nov 30 15:33 ..</span></code></p>
<p>The number “11” is the inode of the odd file. Now we can remove it using the find command:<br />
<code><span style="font-size: 12px;">server@root:/tmp/test # find . -inum 11<br />
./asasasasa.txt<br />
server@root:/tmp/test # find . -inum 11 -exec rm -rf {} \;<br />
</span></code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.system.adm.br/2011/11/remove-files-with-odd-name/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Convert a text to/from UPPER to/from lower</title>
		<link>http://www.system.adm.br/2010/11/convert-a-text-tofrom-upper-tofrom-lower/</link>
		<comments>http://www.system.adm.br/2010/11/convert-a-text-tofrom-upper-tofrom-lower/#comments</comments>
		<pubDate>Fri, 05 Nov 2010 13:42:19 +0000</pubDate>
		<dc:creator>Lincoln Zuljewic Silva</dc:creator>
				<category><![CDATA[General Unix]]></category>
		<category><![CDATA[admin]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://www.system.adm.br/?p=343</guid>
		<description><![CDATA[You can use the following command do convert a file content from upper case do lower case: cat /tmp/upper_file.txt &#124;tr '[:upper:]' '[:lower:]' &#62; /tmp/lower_file.txt Or the following command to convert from lower to upper case: cat /tmp/lower_file.txt &#124;tr '[:lower:]' '[:upper:]' &#62; /tmp/upper_file.txt]]></description>
			<content:encoded><![CDATA[<p>You can use the following command do convert a file content from upper case do lower case:</p>
<p><code><span style="font-size: 12px;">cat /tmp/upper_file.txt |tr '[:upper:]' '[:lower:]' &gt; /tmp/lower_file.txt</span></code></p>
<p>Or the following command to convert from lower to upper case:</p>
<p><code><span style="font-size: 12px;">cat /tmp/lower_file.txt |tr '[:lower:]' '[:upper:]' &gt; /tmp/upper_file.txt</span></code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.system.adm.br/2010/11/convert-a-text-tofrom-upper-tofrom-lower/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to remove/move/copy/rename file that has a non-printable name</title>
		<link>http://www.system.adm.br/2010/09/how-to-removemovecopyrename-file-that-has-a-non-printable-name/</link>
		<comments>http://www.system.adm.br/2010/09/how-to-removemovecopyrename-file-that-has-a-non-printable-name/#comments</comments>
		<pubDate>Thu, 23 Sep 2010 19:34:08 +0000</pubDate>
		<dc:creator>Lincoln Zuljewic Silva</dc:creator>
				<category><![CDATA[General Unix]]></category>
		<category><![CDATA[command]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://www.system.adm.br/?p=324</guid>
		<description><![CDATA[How to remove/move/copy/rename file that has a non-printable name, for example: backup@root:/home/userhome/test # ls -la total 2 -rw-rw-rw- 1 root sys 0 Sep 23 15:48 drwxrwxrwx 2 root sys 96 Sep 23 15:50 . drwxr-xr-x 5 userhome adm 1024 Sep 23 16:20 .. -rw-rw-rw- 1 root sys 0 Sep 23 15:47 -test The easiest one [...]]]></description>
			<content:encoded><![CDATA[<p>How to remove/move/copy/rename file that has a non-printable name, for example:<br />
	<span style="font-size: 12px;"><code><br />
	backup@root:/home/userhome/test # ls -la<br />
	total 2<br />
	-rw-rw-rw- 1 root sys 0 Sep 23 15:48<br />
	drwxrwxrwx 2 root sys 96 Sep 23 15:50 .<br />
	drwxr-xr-x 5 userhome adm 1024 Sep 23 16:20 ..<br />
	-rw-rw-rw- 1 root sys 0 Sep 23 15:47 -test<br />
	</code></span><br />
	The easiest one is the file named &quot;-test&quot;, you can do a &quot;<span style="font-size: 12px;"><code>mv -- -test xx</code></span>&quot; to rename it to test, getting rid of the &quot;-&quot;.</p>
<p>	The most annoying is the other file, which apparently has the name &quot;blank&quot;, but not quite.</p>
<p>	There are two ways to find the real file name.,&quot;ls -lq&quot; e &quot;ls -lb&quot;:</p>
<p>	<span style="font-size: 12px;"><code> backup@root:/home/userhome/test # ls -lq<br />
	total 0<br />
	-rw-rw-rw- 1 root sys 0 Sep 23 15:48 ?<br />
	-rw-rw-rw- 1 root sys 0 Sep 23 15:47 xx<br />
	backup@root:/home/userhome/test # ls -lb<br />
	total 0<br />
	-rw-rw-rw- 1 root sys 0 Sep 23 15:48 \002<br />
	-rw-rw-rw- 1 root sys 0 Sep 23 15:47 xx<br />
	backup@root:/home/userhome/test # ls -li<br />
	total 0<br />
	17334 -rw-rw-rw- 1 root sys 0 Sep 23 15:48<br />
	17332 -rw-rw-rw- 1 root sys 0 Sep 23 15:47 xx<br />
	</code></span><br />
	The &quot;ls -lb&quot; shows the non-printable characters with &quot;\ XXX&quot; where XXX is the ASCII representation of the non-printable character.<br />
	The &quot;ls -lq&quot; shows the non-printable characters with &quot;???&quot; (quantity of ? is defined by the amount of non-printable caracters).<br />
	The &quot;ls -li&quot; shows the file inode.</p>
<p>	To handle this file, the best option is to use the &quot;find&quot;.</p>
<p>	- Using the find based on the inode:<br />
	<span style="font-size: 12px;"><code>find . -inum 17334 -exec mv {} asd \;</code></span></p>
<p>	- Using find with &quot;wildcards&quot; (based on the ls-lq returned):<br />
	<span style="font-size: 12px;"><code>find . -type f -name &quot;?&quot; -exec mv {} asd \;</code></span></p>
<p>	Be careful when using the find with &quot;meta character&quot;! If a file whose name has only one character, it will enter the result.<br />
	&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.system.adm.br/2010/09/how-to-removemovecopyrename-file-that-has-a-non-printable-name/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Merge many depots</title>
		<link>http://www.system.adm.br/2009/08/merge-many-depots/</link>
		<comments>http://www.system.adm.br/2009/08/merge-many-depots/#comments</comments>
		<pubDate>Tue, 25 Aug 2009 17:58:23 +0000</pubDate>
		<dc:creator>Lincoln Zuljewic Silva</dc:creator>
				<category><![CDATA[HP-UX]]></category>
		<category><![CDATA[admin]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[shell]]></category>

		<guid isPermaLink="false">http://www.system.adm.br/?p=162</guid>
		<description><![CDATA[When you have many depot files, you can create a single big depot and install it instead of install one by one. Let&#8217;s assume that you need install the following depots, and they are all located in the directory /tmp/install/depots: autoconf-2.64-hppa-11.11.depot bison-2.4.1-hppa-11.11.depot gawk-3.1.7-hppa-11.11.depot sed-4.2.1-hppa-11.11.depot tcltk-8.5.7-hppa-11.11.depot texinfo-4.13-hppa-11.11.depot zip-3.0-hppa-11.11.depot To create a single depot, run the follow [...]]]></description>
			<content:encoded><![CDATA[<p>When you have many depot files, you can create a single big depot and install it instead of install one by one. Let&rsquo;s assume that you need install the following depots, and they are all located in the directory /tmp/install/depots:</p>
<p>	<span style="font-size: 12px;"><code>autoconf-2.64-hppa-11.11.depot bison-2.4.1-hppa-11.11.depot gawk-3.1.7-hppa-11.11.depot sed-4.2.1-hppa-11.11.depot tcltk-8.5.7-hppa-11.11.depot texinfo-4.13-hppa-11.11.depot zip-3.0-hppa-11.11.depot</code></span></p>
<p>	To create a single depot, run the follow commands:<br />
	<span style="font-size: 12px;"><code># cd /tmp/install/ for i in `ls depots/*.depot` ;do swcopy -s /tmp/install/$i \* @/tmp/install/big;done</code></span></p>
<p>	Now, to install it, you can use:<br />
	<span style="font-size: 12px;"><code># swinstall -s /tmp/install/big</code></span></p>
<p>	&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.system.adm.br/2009/08/merge-many-depots/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>rlogin access denied</title>
		<link>http://www.system.adm.br/2009/06/rlogin-access-denied/</link>
		<comments>http://www.system.adm.br/2009/06/rlogin-access-denied/#comments</comments>
		<pubDate>Mon, 15 Jun 2009 13:54:48 +0000</pubDate>
		<dc:creator>Lincoln Zuljewic Silva</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[shell]]></category>

		<guid isPermaLink="false">http://www.system.adm.br/?p=129</guid>
		<description><![CDATA[In some specific situations, you need use rlogin to remote access a server, but you can face the following error: clientServer:~ # rlogin rloginServer Password: Password: Login incorrect login: root Password: Login incorrect login: root Password: Login incorrect login: root Password: Login incorrect rlogin: connection closed. If you check the /var/log/secure log on the &#8220;rloginServer&#8221;, [...]]]></description>
			<content:encoded><![CDATA[<p>In some specific situations, you need use rlogin to remote access a server, but you can face the following error:</p>
<p>	<span style="font-size: 12px;"><code>clientServer:~ # rlogin rloginServer<br />
	Password:<br />
	Password:<br />
	Login incorrect</p>
<p>	login: root<br />
	Password:<br />
	Login incorrect</p>
<p>	login: root<br />
	Password:<br />
	Login incorrect</p>
<p>	login: root<br />
	Password:<br />
	Login incorrect</p>
<p>	rlogin: connection closed.</code></span></p>
<p>
	If you check the /var/log/secure log on the &ldquo;rloginServer&rdquo;, you will find the following messages:<br />
	<span style="font-size: 12px;"><code><br />
	Jun 15 10:44:41 rloginServer rlogind[16640]: pam_securetty(rlogin:auth): access denied: tty &#39;rlogin&#39; is not secure !<br />
	Jun 15 10:44:41 rloginServer rlogind[16640]: pam_rhosts_auth(rlogin:auth): denied to root@10.11.4.9 as root: access not allowed<br />
	Jun 15 10:44:47 rloginServer login: pam_securetty(remote:auth): access denied: tty &#39;pts/0&#39; is not secure !<br />
	Jun 15 10:44:51 rloginServer login: FAILED LOGIN 1 FROM 10.11.4.9 FOR root, Authentication failure<br />
	Jun 15 10:44:53 rloginServer login: pam_securetty(remote:auth): access denied: tty &#39;pts/0&#39; is not secure !<br />
	Jun 15 10:44:58 rloginServer login: FAILED LOGIN 2 FROM 10.11.4.9 FOR root, Authentication failure<br />
	Jun 15 10:44:58 rloginServer login: pam_unix(remote:auth): bad username []<br />
	Jun 15 10:44:58 rloginServer login: pam_succeed_if(remote:auth): error retrieving information about user<br />
	Jun 15 10:44:58 rloginServer login: FAILED LOGIN 3 FROM 10.11.4.9 FOR , User not known to the underlying authentication module<br />
	Jun 15 10:44:59 rloginServer login: pam_unix(remote:auth): bad username []<br />
	Jun 15 10:44:59 rloginServer login: pam_succeed_if(remote:auth): error retrieving information about user<br />
	Jun 15 10:44:59 rloginServer login: FAILED LOGIN SESSION FROM 10.11.4.9 FOR , User not known to the underlying authentication module</code></span></p>
<p>
	The problem here, is that &ldquo;rlogin&rdquo; is not a &ldquo;secure&rdquo; shell. To configure it, you should add &ldquo;rlogin&rdquo; (without the quotes) to /etc/securetty .</p>
<p>	After that, you will be able to access the rlogin server.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.system.adm.br/2009/06/rlogin-access-denied/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Setting session timeout on Linux</title>
		<link>http://www.system.adm.br/2009/05/setting-session-timeout-on-linux/</link>
		<comments>http://www.system.adm.br/2009/05/setting-session-timeout-on-linux/#comments</comments>
		<pubDate>Wed, 27 May 2009 12:41:14 +0000</pubDate>
		<dc:creator>Lincoln Zuljewic Silva</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[shell]]></category>

		<guid isPermaLink="false">http://www.system.adm.br/?p=116</guid>
		<description><![CDATA[To set an automatically shell timeout on Linux (that Will logoff that session after X seconds), you just need setup the following variable (put it in your /etc/profile): # echo &#8220;TMOUT=300; readonly TMOUT; export TMOUT&#8221; &#62;&#62; /etc/profile The &#8220;readonly&#8221; option will not allow an normal user change (ou unset) it.]]></description>
			<content:encoded><![CDATA[<p>To set an automatically shell timeout on Linux (that Will logoff that session after X seconds), you just need setup the following variable (put it in your /etc/profile):</p>
<p>	<span style="font-size: 12px;"><code># echo &ldquo;TMOUT=300; readonly TMOUT; export TMOUT&rdquo; &gt;&gt; /etc/profile</code></span></p>
<p>	The &ldquo;readonly&rdquo; option will not allow an normal user change (ou unset) it.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.system.adm.br/2009/05/setting-session-timeout-on-linux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rotate log files in Linux</title>
		<link>http://www.system.adm.br/2009/05/rotate-log-files-in-linux/</link>
		<comments>http://www.system.adm.br/2009/05/rotate-log-files-in-linux/#comments</comments>
		<pubDate>Fri, 15 May 2009 21:31:43 +0000</pubDate>
		<dc:creator>Lincoln Zuljewic Silva</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[admin]]></category>
		<category><![CDATA[shell]]></category>

		<guid isPermaLink="false">http://www.system.adm.br/?p=105</guid>
		<description><![CDATA[An easy way (shell script) to rotate log files in Linux can be: #!/bin/bash # Include the following line in crontab: #00 5 * * * /bin/rotate_logs.sh &#62; /dev/null 2&#62;&#38;1 # DATE=`date &#34;+%Y%m%d&#34;` cd /var/log/ for i in messages secure cron lastlog do cp ${i} ${i}.${DATE} &#62; ${i} gzip -9 ${i}.${DATE} done /etc/init.d/syslog restart If [...]]]></description>
			<content:encoded><![CDATA[<p>An easy way (shell script) to rotate log files in Linux can be:</p>
<p>	<span style="font-size: 12px;"><code>#!/bin/bash<br />
	# Include the following line in crontab:<br />
	#00 5 * * * /bin/rotate_logs.sh &gt; /dev/null 2&gt;&amp;1<br />
	#</p>
<p>	DATE=`date &quot;+%Y%m%d&quot;`<br />
	cd /var/log/</p>
<p>	for i in messages secure cron lastlog<br />
	do<br />
	cp ${i} ${i}.${DATE}<br />
	&gt; ${i}<br />
	gzip -9 ${i}.${DATE}<br />
	done</p>
<p>	/etc/init.d/syslog restart</code></span></p>
<p>	If you have any other log to rotate, you can change the line 8 and 10.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.system.adm.br/2009/05/rotate-log-files-in-linux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Disable CTRL+C on Linux</title>
		<link>http://www.system.adm.br/2009/04/disable-ctrlc-on-linux/</link>
		<comments>http://www.system.adm.br/2009/04/disable-ctrlc-on-linux/#comments</comments>
		<pubDate>Thu, 30 Apr 2009 18:25:39 +0000</pubDate>
		<dc:creator>Lincoln Zuljewic Silva</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[admin]]></category>
		<category><![CDATA[shell]]></category>

		<guid isPermaLink="false">http://www.system.adm.br/2009/04/disable-ctrlc-on-linux/</guid>
		<description><![CDATA[To disable CTRL+C on Linux, you can use the following command: # stty intr undef &#160;]]></description>
			<content:encoded><![CDATA[<p>To disable CTRL+C on Linux, you can use the following command:</p>
<p>	<span style="font-size: 12px;"><code># stty intr undef</code></span></p>
<p>	&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.system.adm.br/2009/04/disable-ctrlc-on-linux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

