Turn on Bash Smart Completion January 28, 2006
Posted by Carthik in administration, commands, snippets, ubuntu.trackback
The Bash shell has this sweet feature where you can use the TAB key to auto-complete certain things. For example, when I am in my home directory, the following command:
$cd Do[TAB-key]
will automatically yield:
$cd Documents
If you are an absolute novice, like I was, not so long ago, discovering tab completion in the terminal can make you go “Wow!”. Wait till you hear the rest now 🙂
Though you can use the TAB key to complete the names of files and directories, by default the completion is pretty “dumb”. If you have already typed $cd D
you would expect that the tab key would cause only the directory names to be completed, but if I try it on my machine, the tab completion tool uses filenames too.
Now, don’t despair! There is now a smart bash tab completion trick you can use. Smart completion even complete the arguments to commands!!
To enable smart completion, edit your /etc/bash.bashrc
file. Uncomment the following lines, by removing the # in the beginning of the lines:
#if [ -f /etc/bash_completion ]; then
# . /etc/bash_completion
#fi
Now you can use tab completion to power your way through commands.
You can even extend bash smart completion to your own favourite commands by using /etc/bash_completion, the “complete” utility and /etc/bash_completion.d . Explaining the nitty-gritty is beyond me. I refer you to the Debian Administration gurus for more information regarding smarter bash completion.
good to know!
[…] Another sweet little tip from the Ubuntu Blog: The Bash shell has this sweet feature where you can use the TAB key to auto-complete certain things. For example, when I am in my home directory, the following command: $cd Do[TAB-key] will automatically yield: $cd Documents If you are an absolute novice, like I was, not so long ago, discovering tab completion in the terminal can make you go “Wow!?. Wait till you hear the rest now […]
I love little things like this which make Ubuntu a much better place 🙂
I need to try this. I’ve been wondering if it was possible to auto-complete command arguments.
You can also edit `~/.bashrc` to enable it only for yourself if you don’t want to disturb anybody else or you don’t have the privileges to edit `/etc/bash.bashrc`.
Oh!…
I was really tired of losing tab completion when running anything under sudo…
I come from Debian and doing sudo just everytime is horrible… This stupid trick makes things much easyer.
Thanks!
ozroc, just switch to root using “sudo su”
This is now turned on by default in Kubuntu at least (as of 6.06) and is a pain in the backside as the behaviour isn’t correct in many situations.
So, here is how to turn it off http://www.revis.co.uk/site/?q=node/110 (and reasons why you should, and some workarounds).
Anyone know where to submit a bug report? 🙂
ozroc, just switch to root using “sudo su”
“sudo -l” is safer i thought
[…] keep the version number. Otherwise alien adds a “1″ to the version number. – Tip: Use Smart Tab Completion to avoid mistyping the file […]
thanx!thats what i searched 😉
THANK YOU!!! It was working, reinstalled, and it stopped.
Great! Thanks! Indeed a supplement to my learning at http://www.mlmtraining.com
[…] check this out (better than fixed) https://ubuntu.wordpress.com/2006/01/28/turn-on-bash-smart-completion/ […]
How about this line to .bashrc
bind ‘set completion-ignore-case on’
Now cd doc[TAB]
yields cd Documents
Somebody likes somebody does not like.
[…] https://ubuntu.wordpress.com/2006/01/28/turn-on-bash-smart-completion/ […]
[…] and it’s too late in the day for extra caffeine, so that’ll have to be it. But, look here for tips on making your tab completion more powerful. It’ll even complete command line […]
It might help =) http://gentoo-wiki.com/TIP_Use_TAB-completion_when_emerging_packages
[…] https://ubuntu.wordpress.com/2006/01/28/turn-on-bash-smart-completion/ […]
Hmm. Have to say I just searched for this page … so I could turn “smart” (AKA brain damaged) completion OFF. Can’t bear the way it thinks it’s being clever, and either hides files from me (“I’m sure that file is in that directory, you know”) or invents gibberish (on /media devices, in particular). This is on Ubuntu 8.04.
[…] will keep the version number. Otherwise alien adds a “1″ to the version number. – Tip: Use Smart Tab Completion to avoid mistyping the file […]
@Araneidae
Agreed. I turned the damned thing off because it’s a right pain in the arse and kept getting in my way. For example try tab-completing to unzip a file that doesn’t end in extension .zip. It won’t let you. You either have to rename the file first, or work around it somehow (like type ‘ls’, then tab-complete the filename, then backup to replace ‘ls’ with ‘unzip’).
I can’t stand software that thinks it knows what I’m doing better than I do.
Hi!
I am not used to hit the tab twice when a file name is not unique. For example when you have two files like result.dat and residuals.dat and you type res[TAB] nothing happens. You have to hit the TAB twice to see the list of all files starting with res . Is there a way to turn this to me unexpected behaviour off? I mean to see the list of all files starting with res hitting TAB once instead of twice?
[…] Turn on bash auto-complete. (Source) sudo gedit /etc/bash.bashrc # Uncomment these 3 lines. #if [ -f /etc/bash_completion ]; then # . […]
Thank you for the opportunity you gave
@23:
Put “set show-all-if-ambiguous on” in your /etc/inputrc or ~/.inputrc to make single tab show all
Quite some time ago I put together ClearCase UNIX tools completion for Bash. Have a look at it if you’re using ccase with bash or if you’re looking to write your own completion script: http://jan.tomka.name/project/clearcase-completion-bash
sağlık iksiri
Biber hapı ile zayıflarken stres gibi faktörlerini de en aşağıya indirebilirsiniz. Stresli olduğumuz durumlarda daha fazla yemek yeriz ve daha fazla kilo alırız. Bu stresi en azına indirebiliriz ve biber hapı ile destekleyerek daha iyi kilo verebiliriz.
Thanq,this is what I need
[…] Turn on bash auto-complete. (Source) sudo gedit /etc/bash.bashrc # Uncomment these 3 lines. #if [ -f /etc/bash_completion ]; then # . […]
I am new to UBUNTU and finding it awesome ……… 😀
Thanks for helpful information bayan escort siteleri you catch up us with your sagol instructional çok explanation.
This was greatly helpful for me when I went from an USB Stick Live Ubuntu 10.04 (Lucid Lynx LTS) installation to my LTS-upto-LTS replaced HDD installation, and while it was working perfect with USB Live, it seemed to me that I did it somewhere wrong.
You saved some time for me, fellow.
thanks so much all admin turkiyenin 1 numarali eskort ilan sitesi.
thankss good bloq.
I need to try this. I’ve been wondering if it was possible to auto-complete command arguments.
[…] above was tested on Ubuntu 10.04. See https://embraceubuntu.com/2006/01/28/turn-on-bash-smart-completion/ for some more information for bash completion for the root user. Bash, Bash Completion, Linux, […]
This is now turned on by default in Kubuntu at least (as of 6.06) and is a pain in the backside as the behaviour isn’t correct in many situations.
Health has been good to your site on your hands
Health has been good to your site on your hands
Health has been good to your site on your hands
I like the valuable information you provide to your articles. I will bookmark your blog and test once more right here frequently. I am reasonably sure I will be told many new stuff proper right here! Best of luck for the next!
Many thanks sharing fantastic informations. Ones websiteis consequently cool. We are impressed from the main factors that you’ve with this blog. The item reveals precisely how nicely people perceive this specific subject. Thank your share with me! http://www.fakeray-bansunglasses.com.
antalya ev ilaçlama
[…] https://embraceubuntu.com/2006/01/28/turn-on-bash-smart-completion/ LD_AddCustomAttr("AdOpt", "1"); LD_AddCustomAttr("Origin", "other"); […]
It still works in 2012. (Meanwhile it is included in Ubuntu, I am not sure if it was in 6.04 too)
But it also very useful for other distros (I use BackTrack)
Thanks, I used your instructions to disable it under ~/.bashrc
Found it very annoying when it was stopping tab completion for things like:
$ sudo cryptsetup luksClose /dev/mapper/ [TAB] – doesn’t work!
But try:
$ cryptsetup luksOpen /dev/mapper/ [TAB] – that does work!
Thanks a lot
You could definitely see your skills in the work
you write. The arena hopes for more passionate writers like you who are not afraid to say how they
believe. Always follow your heart.
Beyond just building, various effects can be applied within the world you create, which makes the game more interesting and allows for
mini-games. I did feel a sort of anxiety that I had
not experience before in Minecraft Premium Account Generator, all I thought had been “I must survive. “Far” will make you see distant terrain features from above, making your line of sight virtually unlimited.
Nice. There is also a way to make your own autocompletes in bash! you can look and play around with an example here:
http://runnable.com/Uug-FAUPXc4hAADF/autocomplete-for-bash
If you work in seo education therapy, does not create optimal performers.
Maybe much more connected and meaningful with your partner, stop all contact immediately with the persons with whom you enact fantasy scenarios that you
may be feeling anxious, depressed or stressed.
In the two-hour sessions, which convene twice monthly for six
months, if that’s what Mr.
This website was… how do I say it? Relevant!! Finally I’ve found
something that helped me. Appreciate it!
When a individual car or truck is chosen by a person the program will exhibit which auto sections have presently been marketed relating to the car or
truck. ” Do keep receipts and bills of all expenses incurred in the accident to be presented to your insurer. Its not even a bad idea to pre-choose your hotel and make reservations before you leave.
I don’t know whether it’s just me or if everyone else experiencing problems with your website.
It appears like some of the written text in your content are running
off the screen. Can someone else please provide feedback and let
me know if this is happening to them as well? This might be a problem with my web
browser because I’ve had this happen previously. Kudos
Awesome issues here. I am ver satisfied to look your post.
Thanks a lot and I’m looking ahead to contact you.
Will you please drop me a e-mail?
outdoor weddings
Turn on Bash Smart Completion | Ubuntu Blog
[…] will keep the version number. Otherwise alien adds a “1″ to the version number.- Tip: Use Smart Tab Completion to avoid mistyping the file names $sudo dpkg -i name-of-deb-file.deb- This will install […]
Hiya very nice website!! Guy .. Excellent .. Wonderful
.. I will bookmark your site and take the feeds also? I’m glad to search
out so many helpful information right here within the put up, we want work out more strategies
in this regard, thanks for sharing. . . . . .
Fishres.Ru
Turn on Bash Smart Completion | Ubuntu Blog
Yes! Finally something about bermain poker tanpa deposit.
Hi thanks for poosting this