<?xml version="1.0"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
	<channel>
		<title>SlackWiki - User contributions [en]</title>
		<link>https://www.slackwiki.com/Special:Contributions/Cwilling</link>
		<description>User contributions</description>
		<language>en</language>
		<generator>MediaWiki 1.40.0</generator>
		<lastBuildDate>Wed, 22 Apr 2026 18:00:16 GMT</lastBuildDate>
		<item>
			<title>Bash Autocompletion</title>
			<link>https://www.slackwiki.com/index.php?title=Bash_Autocompletion&amp;diff=3172</link>
			<guid isPermaLink="false">https://www.slackwiki.com/index.php?title=Bash_Autocompletion&amp;diff=3172</guid>
			<description>&lt;p&gt;Cwilling: typo&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Tips]]&lt;br /&gt;
&lt;br /&gt;
Did you know that Bash has a really powerful autocompletion system, which can and usually will make your life easier? If you have used ZSH, you probably know what I'm talking about.&lt;br /&gt;
&lt;br /&gt;
For example, you can type&lt;br /&gt;
&lt;br /&gt;
   svn co''&amp;lt;TAB&amp;gt;&amp;lt;TAB&amp;gt;''&lt;br /&gt;
&lt;br /&gt;
and bash will attempt to auto complete as it does normally with paths and variables, but instead it will output:&lt;br /&gt;
&lt;br /&gt;
  ismael@damned_02:~/src/chkout$ svn co''&amp;lt;TAB&amp;gt;&amp;lt;TAB&amp;gt;''&lt;br /&gt;
  co      commit  copy    &lt;br /&gt;
  ismael@damned_02:~/src/chkout$ svn co&lt;br /&gt;
&lt;br /&gt;
Then you can type:&lt;br /&gt;
&lt;br /&gt;
  ismael@damned_02:~/src/chkout$ svn com''&amp;lt;TAB&amp;gt;''&lt;br /&gt;
&lt;br /&gt;
and BASH will auto complete to:&lt;br /&gt;
&lt;br /&gt;
  ismael@damned_02:~/src/chkout$ svn commit&lt;br /&gt;
&lt;br /&gt;
Or if you're running as root and want to get rid of that *$@&amp;amp; module wich keeps crashing your machine:&lt;br /&gt;
&lt;br /&gt;
   root@damned_02:~# rmmod n''&amp;lt;TAB&amp;gt;''&lt;br /&gt;
   root@damned_02:~# rmmod nvidia&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you think all that is neat, all that you have to do to enable this kind of auto completion in Slackware is to install the bash-completion package, which can be found under [http://slackware.osuosl.org/slackware-11.0/extra/bash-completion/bash-completion-20060301-noarch-1.tgz /extra]:&lt;br /&gt;
&lt;br /&gt;
   root@damned_02:~# mount /mnt/cdrom&lt;br /&gt;
   root@damned_02:~# installpkg /mnt/cdrom/extra/bash-completion/bash-completion-20060301-noarch-1.tgz&lt;br /&gt;
   ...&lt;br /&gt;
&lt;br /&gt;
(BTW, bash-completion also autocompletes ''installpkg, upgradepkg'' and ''removepkg'' with .tgz files and installed packages for ''removepkg''. It can also fill mount commands with data from fstab).&lt;br /&gt;
&lt;br /&gt;
Then you can just logout and login again or&lt;br /&gt;
&lt;br /&gt;
   source /usr/share/bash-completion/bash_completion&lt;br /&gt;
&lt;br /&gt;
and ''voila''!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You can see which commands have autocompletion by issuing:&lt;br /&gt;
&lt;br /&gt;
  complete -p | sed -e's/.* \([^ ]\+\)/\1/' | sort | less&lt;br /&gt;
&lt;br /&gt;
You can also add your own commands at /etc/bash_completion.d/ You may want to see the available completions to understand how they work.&lt;br /&gt;
&lt;br /&gt;
For your own personal user account you can edit your ~/.bash_completion file.&lt;br /&gt;
&lt;br /&gt;
Here is a sample BASH completion function I made to give the script 'test' 3 completion&lt;br /&gt;
options:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
_test ()&lt;br /&gt;
{&lt;br /&gt;
         local cur&lt;br /&gt;
         cur=${COMP_WORDS[COMP_CWORD]}&lt;br /&gt;
&lt;br /&gt;
         if [[ &amp;quot;$cur&amp;quot; == -* ]]; then&lt;br /&gt;
         COMPREPLY=( $( compgen -W '-option -test -foobar' -- $cur ))&lt;br /&gt;
&lt;br /&gt;
         else&lt;br /&gt;
             _filedir&lt;br /&gt;
         fi&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
complete -F _test test&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I put that into my ~/.bash_completion file and now&lt;br /&gt;
&lt;br /&gt;
  $ test -&amp;lt;tab&amp;gt;&lt;br /&gt;
  -foobar  -option  -test&lt;br /&gt;
&lt;br /&gt;
brings up those three options (-option,-test and -foobar). You have to reload your terminal first to see the changes or re-source /etc/bash_completion&lt;br /&gt;
&lt;br /&gt;
  $ . /usr/share/bash-completion/bash_completion&lt;br /&gt;
&lt;br /&gt;
or just re-source your ~/.bash_completion&lt;br /&gt;
&lt;br /&gt;
  $ . ./.bash_completion&lt;/div&gt;</description>
			<pubDate>Mon, 04 Jun 2018 06:04:49 GMT</pubDate>
			<dc:creator>Cwilling</dc:creator>
			<comments>https://www.slackwiki.com/Talk:Bash_Autocompletion</comments>
		</item>
		<item>
			<title>Bash Autocompletion</title>
			<link>https://www.slackwiki.com/index.php?title=Bash_Autocompletion&amp;diff=3171</link>
			<guid isPermaLink="false">https://www.slackwiki.com/index.php?title=Bash_Autocompletion&amp;diff=3171</guid>
			<description>&lt;p&gt;Cwilling: Recent bash-completion packages now have system files in /usr/share/bash-completion (not /etc as previously).&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Tips]]&lt;br /&gt;
&lt;br /&gt;
Did you know that Bash has a really powerful autocompletion system, which can and usually will make your life easier? If you have used ZSH, you probably know what I'm talking about.&lt;br /&gt;
&lt;br /&gt;
For example, you can type&lt;br /&gt;
&lt;br /&gt;
   svn co''&amp;lt;TAB&amp;gt;&amp;lt;TAB&amp;gt;''&lt;br /&gt;
&lt;br /&gt;
and bash will attempt to auto complete as it does normally with paths and variables, but instead it will output:&lt;br /&gt;
&lt;br /&gt;
  ismael@damned_02:~/src/chkout$ svn co''&amp;lt;TAB&amp;gt;&amp;lt;TAB&amp;gt;''&lt;br /&gt;
  co      commit  copy    &lt;br /&gt;
  ismael@damned_02:~/src/chkout$ svn co&lt;br /&gt;
&lt;br /&gt;
Then you can type:&lt;br /&gt;
&lt;br /&gt;
  ismael@damned_02:~/src/chkout$ svn com''&amp;lt;TAB&amp;gt;''&lt;br /&gt;
&lt;br /&gt;
and BASH will auto complete to:&lt;br /&gt;
&lt;br /&gt;
  ismael@damned_02:~/src/chkout$ svn commit&lt;br /&gt;
&lt;br /&gt;
Or if you're running as root and want to get rid of that *$@&amp;amp; module wich keeps crashing your machine:&lt;br /&gt;
&lt;br /&gt;
   root@damned_02:~# rmmod n''&amp;lt;TAB&amp;gt;''&lt;br /&gt;
   root@damned_02:~# rmmod nvidia&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you think all that is neat, all that you have to do to enable this kind of auto completion in Slackware is to install the bash-completion package, which can be found under [http://slackware.osuosl.org/slackware-11.0/extra/bash-completion/bash-completion-20060301-noarch-1.tgz /extra]:&lt;br /&gt;
&lt;br /&gt;
   root@damned_02:~# mount /mnt/cdrom&lt;br /&gt;
   root@damned_02:~# installpkg /mnt/cdrom/extra/bash-completion/bash-completion-20060301-noarch-1.tgz&lt;br /&gt;
   ...&lt;br /&gt;
&lt;br /&gt;
(BTW, bash-completion also autocompletes ''installpkg, upgradepkg'' and ''removepkg'' with .tgz files and installed packages for ''removepkg''. It can also fill mount commands with data from fstab).&lt;br /&gt;
&lt;br /&gt;
Then you can just logout and login again or&lt;br /&gt;
&lt;br /&gt;
   source /usr/share/bash-completion/bash_completion&lt;br /&gt;
&lt;br /&gt;
and ''voila''!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You can see which commands have autocompletion by issuing:&lt;br /&gt;
&lt;br /&gt;
  complete -p | sed -e's/.* \([^ ]\+\)/\1/' | sort | less&lt;br /&gt;
&lt;br /&gt;
You can also add your own commands at /etc/bash_completion.d/ You may want to see the available completions to understand how they work.&lt;br /&gt;
&lt;br /&gt;
For your own personal user account you can edit your ~/.bash_completion file.&lt;br /&gt;
&lt;br /&gt;
Here is a sample BASH completion function I made to give the script 'test' 3 completion&lt;br /&gt;
options:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
_test ()&lt;br /&gt;
{&lt;br /&gt;
         local cur&lt;br /&gt;
         cur=${COMP_WORDS[COMP_CWORD]}&lt;br /&gt;
&lt;br /&gt;
         if [[ &amp;quot;$cur&amp;quot; == -* ]]; then&lt;br /&gt;
         COMPREPLY=( $( compgen -W '-option -test -foobar' -- $cur ))&lt;br /&gt;
&lt;br /&gt;
         else&lt;br /&gt;
             _filedir&lt;br /&gt;
         fi&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
complete -F _test test&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I put that into my ~/.bash_completion file and now&lt;br /&gt;
&lt;br /&gt;
  $ test -&amp;lt;tab&amp;gt;&lt;br /&gt;
  -foobar  -option  -test&lt;br /&gt;
&lt;br /&gt;
brings up those three options (-option,-test and -foobar). You have to reload your terminal first to see the changes or re-source /etc/bash_completion&lt;br /&gt;
&lt;br /&gt;
  $ . /usr/share/bash-compoletion/bash_completion&lt;br /&gt;
&lt;br /&gt;
or just re-source your ~/.bash_completion&lt;br /&gt;
&lt;br /&gt;
  $ . ./.bash_completion&lt;/div&gt;</description>
			<pubDate>Mon, 04 Jun 2018 06:02:38 GMT</pubDate>
			<dc:creator>Cwilling</dc:creator>
			<comments>https://www.slackwiki.com/Talk:Bash_Autocompletion</comments>
		</item>
</channel></rss>