<?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>bash linux Archives - Linux Windows and android Tutorials</title>
	<atom:link href="https://www.osradar.com/tag/bash-linux/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.osradar.com</link>
	<description>tutorials and news and Seurity</description>
	<lastBuildDate>Fri, 30 Nov 2018 10:00:46 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=5.8.12</generator>
	<item>
		<title>Bash Auto Completion</title>
		<link>https://www.osradar.com/bash-auto-completion/</link>
					<comments>https://www.osradar.com/bash-auto-completion/#respond</comments>
		
		<dc:creator><![CDATA[osradar_editor]]></dc:creator>
		<pubDate>Thu, 29 Nov 2018 18:57:12 +0000</pubDate>
				<category><![CDATA[Featured]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[bash auto completion]]></category>
		<category><![CDATA[bash code]]></category>
		<category><![CDATA[bash completion]]></category>
		<category><![CDATA[bash linux]]></category>
		<category><![CDATA[bash shell]]></category>
		<guid isPermaLink="false">https://www.osradar.com/?p=7810</guid>

					<description><![CDATA[<p>When you’re on Linux, the art of “terminal and commands” is a daily dose. The terminal is a powerful solution for the Linux platform that can perform wonders and tons of tasks. It also provides great versatility and control over the system. In the case of Bash – the most popular shell for Linux, auto [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://www.osradar.com/bash-auto-completion/">Bash Auto Completion</a> appeared first on <a rel="nofollow" href="https://www.osradar.com">Linux  Windows and android  Tutorials</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>When you’re on Linux, the art of “terminal and commands” is a daily dose. The terminal is a powerful solution for the Linux platform that can perform wonders and tons of tasks. It also provides great versatility and control over the system.</p>
<p>In the case of Bash – the most popular shell for Linux, auto code completion isn’t available by default. Bash can run most of the “sh” scripts without any modification. Code auto-completion is a great feature for reducing your load of typing each and every single command as you type. If you’re interested in the code completion, then <a href="https://www.osradar.com/enjoy-fish-shell-on-linux/">Fish shell is the best choice</a>.</p>
<p>Despite default code completion, you can still enjoy the feature, thanks to the great “bash-completion”. This tool will enable the auto-completion feature on Bash shell.</p>
<p>Let’s enjoy “bash-completion” shell right away!</p>
<h1>Getting “bash-completion”</h1>
<p>The “bash-completion” provides all the available pre-built packages for the major Linux distros. <a href="https://github.com/scop/bash-completion">Check bash-completion on GitHub</a>.</p>
<p><img loading="lazy" class="size-full wp-image-7811 aligncenter" src="https://www.osradar.com/wp-content/uploads/2018/11/bash-1.png" alt="" width="928" height="463" srcset="https://www.osradar.com/wp-content/uploads/2018/11/bash-1.png 928w, https://www.osradar.com/wp-content/uploads/2018/11/bash-1-300x150.png 300w, https://www.osradar.com/wp-content/uploads/2018/11/bash-1-768x383.png 768w, https://www.osradar.com/wp-content/uploads/2018/11/bash-1-842x420.png 842w" sizes="(max-width: 928px) 100vw, 928px" /></p>
<p>The following guide will install “bash-completion” from source and it will apply for all the Linux distros.</p>
<p>Grab “bash-completion” –</p>
<pre class="">git clone <a href="https://github.com/scop/bash-completion.git">https://github.com/scop/bash-completion.git

cd bash-completion/</pre>
<p><img loading="lazy" class="size-full wp-image-7812 aligncenter" src="https://www.osradar.com/wp-content/uploads/2018/11/bash-2.png" alt="" width="1082" height="224" srcset="https://www.osradar.com/wp-content/uploads/2018/11/bash-2.png 1082w, https://www.osradar.com/wp-content/uploads/2018/11/bash-2-300x62.png 300w, https://www.osradar.com/wp-content/uploads/2018/11/bash-2-768x159.png 768w, https://www.osradar.com/wp-content/uploads/2018/11/bash-2-1024x212.png 1024w, https://www.osradar.com/wp-content/uploads/2018/11/bash-2-1068x221.png 1068w" sizes="(max-width: 1082px) 100vw, 1082px" /></p>
<p>Build the tool –</p>
<pre>autoreconf -i

./configure

make

make check</pre>
<p><img loading="lazy" class="size-full wp-image-7813 aligncenter" src="https://www.osradar.com/wp-content/uploads/2018/11/bash-3.png" alt="" width="1080" height="413" srcset="https://www.osradar.com/wp-content/uploads/2018/11/bash-3.png 1080w, https://www.osradar.com/wp-content/uploads/2018/11/bash-3-300x115.png 300w, https://www.osradar.com/wp-content/uploads/2018/11/bash-3-768x294.png 768w, https://www.osradar.com/wp-content/uploads/2018/11/bash-3-1024x392.png 1024w, https://www.osradar.com/wp-content/uploads/2018/11/bash-3-1068x408.png 1068w" sizes="(max-width: 1080px) 100vw, 1080px" /></p>
<p><img loading="lazy" class="size-full wp-image-7814 aligncenter" src="https://www.osradar.com/wp-content/uploads/2018/11/bash-4.png" alt="" width="1060" height="734" srcset="https://www.osradar.com/wp-content/uploads/2018/11/bash-4.png 1060w, https://www.osradar.com/wp-content/uploads/2018/11/bash-4-300x208.png 300w, https://www.osradar.com/wp-content/uploads/2018/11/bash-4-768x532.png 768w, https://www.osradar.com/wp-content/uploads/2018/11/bash-4-1024x709.png 1024w, https://www.osradar.com/wp-content/uploads/2018/11/bash-4-100x70.png 100w, https://www.osradar.com/wp-content/uploads/2018/11/bash-4-218x150.png 218w, https://www.osradar.com/wp-content/uploads/2018/11/bash-4-607x420.png 607w" sizes="(max-width: 1060px) 100vw, 1060px" /> <img loading="lazy" class="size-full wp-image-7815 aligncenter" src="https://www.osradar.com/wp-content/uploads/2018/11/bash-5.png" alt="" width="1060" height="734" srcset="https://www.osradar.com/wp-content/uploads/2018/11/bash-5.png 1060w, https://www.osradar.com/wp-content/uploads/2018/11/bash-5-300x208.png 300w, https://www.osradar.com/wp-content/uploads/2018/11/bash-5-768x532.png 768w, https://www.osradar.com/wp-content/uploads/2018/11/bash-5-1024x709.png 1024w, https://www.osradar.com/wp-content/uploads/2018/11/bash-5-100x70.png 100w, https://www.osradar.com/wp-content/uploads/2018/11/bash-5-218x150.png 218w, https://www.osradar.com/wp-content/uploads/2018/11/bash-5-607x420.png 607w" sizes="(max-width: 1060px) 100vw, 1060px" /></p>
<p><img loading="lazy" class="size-full wp-image-7816 aligncenter" src="https://www.osradar.com/wp-content/uploads/2018/11/bash-6.png" alt="" width="1060" height="734" srcset="https://www.osradar.com/wp-content/uploads/2018/11/bash-6.png 1060w, https://www.osradar.com/wp-content/uploads/2018/11/bash-6-300x208.png 300w, https://www.osradar.com/wp-content/uploads/2018/11/bash-6-768x532.png 768w, https://www.osradar.com/wp-content/uploads/2018/11/bash-6-1024x709.png 1024w, https://www.osradar.com/wp-content/uploads/2018/11/bash-6-100x70.png 100w, https://www.osradar.com/wp-content/uploads/2018/11/bash-6-218x150.png 218w, https://www.osradar.com/wp-content/uploads/2018/11/bash-6-607x420.png 607w" sizes="(max-width: 1060px) 100vw, 1060px" /> <img loading="lazy" class="size-full wp-image-7817 aligncenter" src="https://www.osradar.com/wp-content/uploads/2018/11/bash-7.png" alt="" width="1060" height="734" srcset="https://www.osradar.com/wp-content/uploads/2018/11/bash-7.png 1060w, https://www.osradar.com/wp-content/uploads/2018/11/bash-7-300x208.png 300w, https://www.osradar.com/wp-content/uploads/2018/11/bash-7-768x532.png 768w, https://www.osradar.com/wp-content/uploads/2018/11/bash-7-1024x709.png 1024w, https://www.osradar.com/wp-content/uploads/2018/11/bash-7-100x70.png 100w, https://www.osradar.com/wp-content/uploads/2018/11/bash-7-218x150.png 218w, https://www.osradar.com/wp-content/uploads/2018/11/bash-7-607x420.png 607w" sizes="(max-width: 1060px) 100vw, 1060px" /></p>
<p>At this stage, you may find out some dependency issue. For passing this stage, “pytest” &gt;= 3.6, pexpect, tcllib and dejagnu.</p>
<p class="">Install “bash-completion” –</p>
<pre class="">sudo make install</pre>
<h1><img loading="lazy" class="size-full wp-image-7818 aligncenter" src="https://www.osradar.com/wp-content/uploads/2018/11/bash-8.png" alt="" width="1060" height="734" srcset="https://www.osradar.com/wp-content/uploads/2018/11/bash-8.png 1060w, https://www.osradar.com/wp-content/uploads/2018/11/bash-8-300x208.png 300w, https://www.osradar.com/wp-content/uploads/2018/11/bash-8-768x532.png 768w, https://www.osradar.com/wp-content/uploads/2018/11/bash-8-1024x709.png 1024w, https://www.osradar.com/wp-content/uploads/2018/11/bash-8-100x70.png 100w, https://www.osradar.com/wp-content/uploads/2018/11/bash-8-218x150.png 218w, https://www.osradar.com/wp-content/uploads/2018/11/bash-8-607x420.png 607w" sizes="(max-width: 1060px) 100vw, 1060px" /> <img loading="lazy" class="size-full wp-image-7819 aligncenter" src="https://www.osradar.com/wp-content/uploads/2018/11/bash-9.png" alt="" width="1060" height="734" srcset="https://www.osradar.com/wp-content/uploads/2018/11/bash-9.png 1060w, https://www.osradar.com/wp-content/uploads/2018/11/bash-9-300x208.png 300w, https://www.osradar.com/wp-content/uploads/2018/11/bash-9-768x532.png 768w, https://www.osradar.com/wp-content/uploads/2018/11/bash-9-1024x709.png 1024w, https://www.osradar.com/wp-content/uploads/2018/11/bash-9-100x70.png 100w, https://www.osradar.com/wp-content/uploads/2018/11/bash-9-218x150.png 218w, https://www.osradar.com/wp-content/uploads/2018/11/bash-9-607x420.png 607w" sizes="(max-width: 1060px) 100vw, 1060px" /></h1>
<h1>Using “bash-completion”</h1>
<p>It’s actually a bash script by itself. Check out the code of “bash-completion” –</p>
<pre class="">bat /etc/profile.d/bash_completion.sh</pre>
<figure id="attachment_7820" aria-describedby="caption-attachment-7820" style="width: 1085px" class="wp-caption aligncenter"><img loading="lazy" class="wp-image-7820 size-full" src="https://www.osradar.com/wp-content/uploads/2018/11/bash-10.png" alt="" width="1085" height="549" srcset="https://www.osradar.com/wp-content/uploads/2018/11/bash-10.png 1085w, https://www.osradar.com/wp-content/uploads/2018/11/bash-10-300x152.png 300w, https://www.osradar.com/wp-content/uploads/2018/11/bash-10-768x389.png 768w, https://www.osradar.com/wp-content/uploads/2018/11/bash-10-1024x518.png 1024w, https://www.osradar.com/wp-content/uploads/2018/11/bash-10-1068x540.png 1068w, https://www.osradar.com/wp-content/uploads/2018/11/bash-10-830x420.png 830w" sizes="(max-width: 1085px) 100vw, 1085px" /><figcaption id="caption-attachment-7820" class="wp-caption-text">Bat &#8211; a Cat clone https://www.osradar.com/bat-advanced-cat-for-linux/</figcaption></figure>
<p>After the installation is complete, it’s time to enjoy auto code completion. Fire up a terminal –</p>
<pre class="">sudo apt i[TAB]

cat /etc/re[TAB]</pre>
<p><img loading="lazy" class="size-full wp-image-7821 aligncenter" src="https://www.osradar.com/wp-content/uploads/2018/11/bash-11.png" alt="" width="1078" height="127" srcset="https://www.osradar.com/wp-content/uploads/2018/11/bash-11.png 1078w, https://www.osradar.com/wp-content/uploads/2018/11/bash-11-300x35.png 300w, https://www.osradar.com/wp-content/uploads/2018/11/bash-11-768x90.png 768w, https://www.osradar.com/wp-content/uploads/2018/11/bash-11-1024x121.png 1024w, https://www.osradar.com/wp-content/uploads/2018/11/bash-11-1068x126.png 1068w" sizes="(max-width: 1078px) 100vw, 1078px" /></p>
<p>You can also set your simple bash completion code. The method follows the following structure –</p>
<pre class="">complete -W ‘&lt;autocompletion_codes&gt;’ &lt;command_name&gt;</pre>
<p>Let’s see with an example.</p>
<pre class="">complete -W ‘google.com osradar.com’ host</pre>
<p><img loading="lazy" class="size-full wp-image-7822 aligncenter" src="https://www.osradar.com/wp-content/uploads/2018/11/bash-12.png" alt="" width="1083" height="128" srcset="https://www.osradar.com/wp-content/uploads/2018/11/bash-12.png 1083w, https://www.osradar.com/wp-content/uploads/2018/11/bash-12-300x35.png 300w, https://www.osradar.com/wp-content/uploads/2018/11/bash-12-768x91.png 768w, https://www.osradar.com/wp-content/uploads/2018/11/bash-12-1024x121.png 1024w, https://www.osradar.com/wp-content/uploads/2018/11/bash-12-1068x126.png 1068w" sizes="(max-width: 1083px) 100vw, 1083px" /></p>
<p>In the above command, there will be 2 different autocomplete suggestions for “host” (google.com and osradar.com).</p>
<p>Type “host” command –</p>
<pre class="">host [TAB]</pre>
<p><img loading="lazy" class="size-full wp-image-7823 aligncenter" src="https://www.osradar.com/wp-content/uploads/2018/11/bash-13.png" alt="" width="1070" height="132" srcset="https://www.osradar.com/wp-content/uploads/2018/11/bash-13.png 1070w, https://www.osradar.com/wp-content/uploads/2018/11/bash-13-300x37.png 300w, https://www.osradar.com/wp-content/uploads/2018/11/bash-13-768x95.png 768w, https://www.osradar.com/wp-content/uploads/2018/11/bash-13-1024x126.png 1024w, https://www.osradar.com/wp-content/uploads/2018/11/bash-13-1068x132.png 1068w" sizes="(max-width: 1070px) 100vw, 1070px" /></p>
<pre class="">host google.com

host osradar.com</pre>
<p><img loading="lazy" class="size-full wp-image-7824 aligncenter" src="https://www.osradar.com/wp-content/uploads/2018/11/bash-14.png" alt="" width="1075" height="419" srcset="https://www.osradar.com/wp-content/uploads/2018/11/bash-14.png 1075w, https://www.osradar.com/wp-content/uploads/2018/11/bash-14-300x117.png 300w, https://www.osradar.com/wp-content/uploads/2018/11/bash-14-768x299.png 768w, https://www.osradar.com/wp-content/uploads/2018/11/bash-14-1024x399.png 1024w, https://www.osradar.com/wp-content/uploads/2018/11/bash-14-1068x416.png 1068w" sizes="(max-width: 1075px) 100vw, 1075px" /></p>
<p>Enjoy!</p>
<p>The post <a rel="nofollow" href="https://www.osradar.com/bash-auto-completion/">Bash Auto Completion</a> appeared first on <a rel="nofollow" href="https://www.osradar.com">Linux  Windows and android  Tutorials</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.osradar.com/bash-auto-completion/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
