 




<?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>IT Answers &#187; Bash</title>
	<atom:link href="http://itknowledgeexchange.techtarget.com/itanswers/tag/bash/feed/" rel="self" type="application/rss+xml" />
	<link>http://itknowledgeexchange.techtarget.com/itanswers</link>
	<description></description>
	<lastBuildDate>Wed, 22 May 2013 13:32:09 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>SSH Key Authentication Generator</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/ssh-key-authentication-generator/</link>
		<comments>http://itknowledgeexchange.techtarget.com/itanswers/ssh-key-authentication-generator/#comments</comments>
		<pubDate>Wed, 12 Oct 2011 17:55:43 +0000</pubDate>
		<dc:creator>Eric Hansen</dc:creator>
				<category><![CDATA[Bash]]></category>
		<category><![CDATA[IT Scripts]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[SSH]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[Script Name: SSH Key Authentication Generator Language: Bash Purpose: Automate generation of SSH key files (id_rsa &#038; id_rsa.pub for example), for use with passwordless SSH authentication. Notes: This is a modified version of a script I have on my blog, http://www.itknowledgeexchange.com/security-admin/ (direct link: http://itknowledgeexchange.techtarget.com/security-admin/bash-script-for-ssh-key-generation/ ) as I feel the automated version is a lot more [...]]]></description>
				<content:encoded><![CDATA[<p>Script Name: SSH Key Authentication Generator</p>
<p> Language: Bash</p>
<p> Purpose: Automate generation of SSH key files (id_rsa &#038; id_rsa.pub for example), for use with passwordless SSH authentication.</p>
<p> Notes: This is a modified version of a script I have on my blog, http://www.itknowledgeexchange.com/security-admin/ (direct link: http://itknowledgeexchange.techtarget.com/security-admin/bash-script-for-ssh-key-generation/ ) as I feel the automated version is a lot more resourcesful.</p>
<p> #!/bin/bash</p>
<p> # Make sure input is not printed to screen (since we are typing in a password after all)<br />
 stty -echo<br />
 read -p &#8220;Passphrase: &#8221; pp<br />
 stty echo</p>
<p> # ssh-keygen prohibits passphrases &lt; 4 characters<br />
 if [ "${#pp}" -lt 4 ]; then<br />
     echo -e &#8220;nPassphrase must be greater than 4 characters.&#8221;<br />
     exit 1<br />
 fi</p>
<p> # man ssh-keygen specifies that for RSA, 2048-bit keys are considered efficient.<br />
 bits=2048</p>
<p> # Debatable whether DSA or RSA is really more secure here, but RSA is more of the standard when it comes to this<br />
 enc=&#8221;rsa&#8221;</p>
<p> # Default path where all keys are stored<br />
 kf=&#8221;$HOME/.ssh/id_$enc&#8221;</p>
<p> # Check to see if the file exists first (if so, delete it)<br />
 echo -n &#8220;Checking to see if $kf exists (deleting if so)&#8230;&#8221;</p>
<p> if [ -e "$kf" ]; then<br />
     rm -rf $kf<br />
 fi</p>
<p> echo -e -n &#8220;done.nGenerating a $bits bit $enc key file for SSH ($kf)&#8230;&#8221;</p>
<p> ssh-keygen -q -b $bits -t $enc -N $pp -f &#8220;$kf&#8221;</p>
<p> if [ -e "$kf" ]; then<br />
     echo &#8220;done.&#8221;<br />
 else<br />
     echo &#8220;error.&#8221;<br />
 fi</p>
<p> exit 0<br />
 [/pre]</p>
<!-- wpms-network-global-inserts -->]]></content:encoded>
			<wfw:commentRss>http://itknowledgeexchange.techtarget.com/itanswers/ssh-key-authentication-generator/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>BASH: matching a directory in the middle of a path</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/bash-matching-a-directory-in-the-middle-of-a-path/</link>
		<comments>http://itknowledgeexchange.techtarget.com/itanswers/bash-matching-a-directory-in-the-middle-of-a-path/#comments</comments>
		<pubDate>Sat, 06 Jun 2009 02:39:24 +0000</pubDate>
		<dc:creator>Landocalvinian</dc:creator>
				<category><![CDATA[Bash]]></category>
		<category><![CDATA[Bourne Again SHell]]></category>
		<category><![CDATA[Linux tools]]></category>
		<category><![CDATA[TCSH]]></category>
		<category><![CDATA[Unix shells]]></category>
		<category><![CDATA[Unix tools]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[How can I do this in bash? find . -name &#8216;*\!{*}*&#8217; -ls Cf. UNIX Power Tools, page 175. This works in tcsh, but no in bash. In bash I get this message: ff CH18 find: paths must precede expression Usage: find [-H] [-L] [-P] [expression]]]></description>
				<content:encoded><![CDATA[<p>How can I do this in bash?<br />
find . -name &#8216;*\!{*}*&#8217; -ls</p>
<p>Cf. UNIX Power Tools, page 175.<br />
This works in tcsh, but no in bash.<br />
In bash I get this message:<br />
ff CH18<br />
find: paths must precede expression<br />
Usage: find [-H] [-L] [-P]  [expression]</p>
<!-- wpms-network-global-inserts -->]]></content:encoded>
			<wfw:commentRss>http://itknowledgeexchange.techtarget.com/itanswers/bash-matching-a-directory-in-the-middle-of-a-path/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Command restrictions</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/command-restrictions/</link>
		<comments>http://itknowledgeexchange.techtarget.com/itanswers/command-restrictions/#comments</comments>
		<pubDate>Thu, 19 Jun 2008 14:16:56 +0000</pubDate>
		<dc:creator>Renier</dc:creator>
				<category><![CDATA[Bash]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[A Linux question: Can you restrict a certain command to a specific time range. I don&#8217;t want to be able to run command x between 7 and 8 ? Any assistance would be appreciated. Regards]]></description>
				<content:encoded><![CDATA[<p>A Linux question: Can you restrict a certain command to a specific time range. I don&#8217;t want to be able to run command x between 7 and 8 ?</p>
<p>Any assistance would be appreciated.</p>
<p>Regards</p>
<!-- wpms-network-global-inserts -->]]></content:encoded>
			<wfw:commentRss>http://itknowledgeexchange.techtarget.com/itanswers/command-restrictions/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Auto Load USB Printer Firmware When Printer Turned On &#8211; Linux</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/auto-load-usb-printer-firmware-when-printer-turned-on-linux/</link>
		<comments>http://itknowledgeexchange.techtarget.com/itanswers/auto-load-usb-printer-firmware-when-printer-turned-on-linux/#comments</comments>
		<pubDate>Sun, 09 Mar 2008 20:02:19 +0000</pubDate>
		<dc:creator>Bdika</dc:creator>
				<category><![CDATA[Bash]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Linux desktop environment]]></category>
		<category><![CDATA[Printing]]></category>
		<category><![CDATA[Puppy Linux]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[I am using a derivative of Puppy Linux. I compiled the driver for the HP Laserjet 1020 printer. For the printer to work the firmware has to be loaded every time the printer is turned on. I have added the following command to the rc.local file in Puppy Linux which runs every time Puppy Linux [...]]]></description>
				<content:encoded><![CDATA[<p>I am using a derivative of Puppy Linux. I compiled the driver for the HP Laserjet 1020 printer. For the printer to work the firmware has to be loaded every time the printer is turned on.</p>
<p>I have added the following command to the rc.local file in Puppy Linux which runs every time Puppy Linux boots up:</p>
<pre>
cat /usr/share/foo2zjs/firmware/sihp1020.dl &gt; /dev/usb/lp0
</pre>
<p>This works fine if the printer is on when I boot into Puppy Linux. If the printer is not on when I boot up then I have to run the code in a shell before the printer will print.</p>
<p>This is OK for me but my family members need to be able to just turn on the printer any time and have it print. They do not even know what a shell is and cannot be expected to issue shell commands to get the printer to work.</p>
<p>My question is this:</p>
<p>Can I put the above code in a script that will execute every time the USB printer is turned on?</p>
<p>Knowing the kind of operating system that Linux is, I am sure that there is a way to do this. I&#8217;m just not skilled enough to know how to do it.</p>
<p>Any help would be much appreciated.</p>
<p>bdika</p>
<!-- wpms-network-global-inserts -->]]></content:encoded>
			<wfw:commentRss>http://itknowledgeexchange.techtarget.com/itanswers/auto-load-usb-printer-firmware-when-printer-turned-on-linux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Obtaining an elapsed-time sorted list of Unix processes from a shell</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/obtaining-an-elapsed-time-sorted-list-of-unix-processes-from-a-shell/</link>
		<comments>http://itknowledgeexchange.techtarget.com/itanswers/obtaining-an-elapsed-time-sorted-list-of-unix-processes-from-a-shell/#comments</comments>
		<pubDate>Sun, 28 Oct 2007 13:57:35 +0000</pubDate>
		<dc:creator>Nagendra.gd</dc:creator>
				<category><![CDATA[Bash]]></category>
		<category><![CDATA[CSH]]></category>
		<category><![CDATA[KSH]]></category>
		<category><![CDATA[Unix]]></category>
		<category><![CDATA[Unix shells]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[I would like to obtain a sorted list of processes, sorted by elapsed time. I am aware of ps -o etime etc, but how exactly do i sort by a field with format [[dd]:[hh]]mm:ss ? Or is there a different way altogether to ask the OS to return a sorted list of processes, sorted by [...]]]></description>
				<content:encoded><![CDATA[<p>I would like to obtain a sorted list of processes, sorted by elapsed time. I am aware of ps -o etime etc, but how exactly do i sort by a field with format  [[dd]:[hh]]mm:ss ? Or is there a different way altogether to ask the OS to return a sorted list of processes, sorted by elapsed time?</p>
<p>Thanks.</p>
<!-- wpms-network-global-inserts -->]]></content:encoded>
			<wfw:commentRss>http://itknowledgeexchange.techtarget.com/itanswers/obtaining-an-elapsed-time-sorted-list-of-unix-processes-from-a-shell/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>KILLING OLD UNIX PROCESSES</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/killing-old-unix-processes/</link>
		<comments>http://itknowledgeexchange.techtarget.com/itanswers/killing-old-unix-processes/#comments</comments>
		<pubDate>Wed, 04 Aug 2004 10:39:26 +0000</pubDate>
		<dc:creator>Geoffreyhalleds</dc:creator>
				<category><![CDATA[Awk]]></category>
		<category><![CDATA[Bash]]></category>
		<category><![CDATA[Bison]]></category>
		<category><![CDATA[Bourne]]></category>
		<category><![CDATA[CSH]]></category>
		<category><![CDATA[Grep]]></category>
		<category><![CDATA[KSH]]></category>
		<category><![CDATA[nroff]]></category>
		<category><![CDATA[Procmail]]></category>
		<category><![CDATA[sed]]></category>
		<category><![CDATA[Solaris]]></category>
		<category><![CDATA[Unix]]></category>
		<category><![CDATA[Unix Servers]]></category>
		<category><![CDATA[Unix tools]]></category>
		<category><![CDATA[Unix versions]]></category>
		<category><![CDATA[xargs]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[# I want to be able to extract all the oracleprod processes which are 3 days old and kill them. Are there other date functions or methods can I use? I can make a list of processes but how do I compare the date to kill those processes more than 3 days old. This problem [...]]]></description>
				<content:encoded><![CDATA[<p># I want to be able to extract all the oracleprod processes which are 3 days old and kill them.<br />
Are there other date functions or methods can I use?<br />
I can make a list of processes but how do I compare the date to kill those processes more than 3 days old.<br />
This problem is occurring even though I have a regular cron job which kills sessions older than 2 days old in oracle. I am using 8.1.7.4 and Solaris 8.</p>
<p>This is where I got stuck.<br />
curday=`date +%d`<br />
month=`date|cut -d&#8217; &#8216; -f2`<br />
echo $month $curday<br />
ps -ef|grep oracleprod | tr -s &#8221; &#8221; : | cut -d: -f3,6,7</p>
<!-- wpms-network-global-inserts -->]]></content:encoded>
			<wfw:commentRss>http://itknowledgeexchange.techtarget.com/itanswers/killing-old-unix-processes/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>How to modify external environment variable from 2nd shell script</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/how-to-modify-external-environment-variable-from-2nd-shell-script/</link>
		<comments>http://itknowledgeexchange.techtarget.com/itanswers/how-to-modify-external-environment-variable-from-2nd-shell-script/#comments</comments>
		<pubDate>Wed, 12 May 2004 23:18:19 +0000</pubDate>
		<dc:creator>Smooth</dc:creator>
				<category><![CDATA[Bash]]></category>
		<category><![CDATA[Bourne]]></category>
		<category><![CDATA[KSH]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[Question Edited by AngelaN]]></description>
				<content:encoded><![CDATA[Question Edited by AngelaN]]></content:encoded>
			<wfw:commentRss>http://itknowledgeexchange.techtarget.com/itanswers/how-to-modify-external-environment-variable-from-2nd-shell-script/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using memcached
Database Caching 3/22 queries in 0.025 seconds using memcached
Object Caching 761/861 objects using memcached

Served from: itknowledgeexchange.techtarget.com @ 2013-05-22 14:25:54 -->