Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place! |
| Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
01-05-2009, 12:28 AM
|
#1
|
|
Member
Registered: Dec 2008
Location: Iceland
Distribution: Ubuntu, freeBSD
Posts: 110
Rep:
|
Using tab in CLI- auto finish, not displaying hidden files and using less
There are a couple of things I have problem with in CLI: - Auto finishing: I really like using the bash shell but one thing the Windows shell (what ever it's called) does better is to let you switch between every file and folder in your pwd using the <TAB>. So if you have a few files with really long and tedious names (imagine a lot of numbers, where a lot of the filenames start the same) or if you have some files starting with letters which aren't on your keyboard you don't have to type in their name but rather use <TAB> to make the first file appear, and then the second one, and the third.. etc. I have encountered both problems in my short Linux career and they are really annoying.
- Not display hidden files: Is it possible not to display hidden files when you use the <TAB> key to search for files? Using, for example, the command file or ls in a folder which includes a lot of hidden files (like a home directory), is it possible not to display the hidden files and not get a "Display all 151 something possibilities? (y or n)"
- Using something like less: Lastly I was wondering whether it's possible to use something like less to scroll through long results when <TAB> is trying to fill in the gap with something like in problem number 2? Using pipes isn't possible here is it?
 I'm sorry if I didn't make my self understandable, I tried to explain it best I could. Basically I'm trying to control the output of <TAB>. It must be possible 
Last edited by baldurpet; 01-05-2009 at 04:36 PM.
|
|
|
|
01-05-2009, 12:36 AM
|
#2
|
|
Senior Member
Registered: Jul 2003
Location: Wellington, NZ
Distribution: mainly slackware
Posts: 1,288
Rep:
|
Quote:
Originally Posted by baldurpet
There are a couple of things I have problem with in CLI: - Auto finishing: I really like using the bash shell but one thing the Windows shell (what ever it's called) does better is to let you switch between every file and folder in you pwd using the <TAB>. So if you have a few files with really long and tedious names (imagine a lot of numbers, where a lot of the filenames start the same) or if you have some files starting with letters which aren't on your keyboard you don't have to type in their name but rather use <TAB> to make the first file appear, and then the second one, and the third.. etc. I have encountered both problems in my short Linux career and they are really annoying.
|
Interesting, not sure how to do that... FWIW: I've always found the DOS shell to be 10 times more frustrating!
Quote:
Originally Posted by baldurpet
- Not display hidden files: Is it possible not to display hidden files when you use the <TAB> key to search for files? Using, for example, the command file or ls in a folder which includes a lot of hidden files (like a home directory), is it possible not to display the hidden files and not get a "Display all 151 something possibilities? (y or n)"
|
Using the TAB key? Again, not sure... man bash! What's wrong with ls? If you use SHIFT + PGUP afterwards you can scroll up!
Quote:
Originally Posted by baldurpet
- Using something like less: Lastly I was wondering whether it's possible to use something like less to scroll through long results when <TAB> is trying to fill in the gap with something like in problem number 2? Using pipes isn't possible here is it?
 I'm sorry if I didn't make my self understandable, I tried to explain it best I could. Basically I'm trying to control the output of <TAB>. It must be possible 
|
Not with TAB (unless I am mistaken) why are you obsessed with the TAB key? Try ls | less
Have fun! 
Last edited by Tuttle; 01-05-2009 at 12:45 AM.
|
|
|
|
01-05-2009, 12:59 AM
|
#3
|
|
Moderator
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733
|
In windows, tab completion was added only lately. Having to cycle though only 1 alternative at a time can be very tedious. Some distro's do a good job with bash completion. When I used Mandrake linux, I was surprised that it would give the proper completions not just for files, but for arguments as well. Such as for "modprobe", the list consisted of modules.
Suppose that you run mplayer. Entering "mplayer" and using tab completion, you get a list of just video files. This context sensitive nature is what makes it very useful.
Last edited by jschiwal; 01-05-2009 at 01:00 AM.
|
|
|
|
01-05-2009, 04:48 PM
|
#4
|
|
Member
Registered: Dec 2008
Location: Iceland
Distribution: Ubuntu, freeBSD
Posts: 110
Original Poster
Rep:
|
Quote:
Originally Posted by Tuttle
Interesting, not sure how to do that... FWIW: I've always found the DOS shell to be 10 times more frustrating!
|
Yes, but just because it's annoying doesn't mean it can't have good points.  Once I had select a lot of images which had really long file names and I prayed for a function where you could flip between the files without having to type anything at all.
Quote:
Originally Posted by Tuttle
Using the TAB key? Again, not sure... man bash! What's wrong with ls? If you use SHIFT + PGUP afterwards you can scroll up!
|
Of course it's possible to use the ls, but it takes more time to use ls first and then to use the tab auto completion. I'm probably just splitting hairs but sometimes when I'm looking for a file or folder in my home directory I get a list that could stretch over more than four monitors, when I'm only looking for files which aren't hidden- which are like 10-15. I just wanted to ask, because this has been annoying me that there isn't an option not to display the hidden files when you auto complete.
I figure that since once of the reasons to use the command line is agility, I might save myself some scrolling if someone were to know an answer.
Quote:
Originally Posted by Tuttle
Not with TAB (unless I am mistaken) why are you obsessed with the TAB key? Try ls | less
Have fun! 
|
Oh.. must admit I misunderstood something here.. Of course the output of the auto completion is displayed in a less sort-of way. Also, I don't know why I'm obsessed with the tab key. Must've been a childhood trauma  or maybe I've just started using Linux and want to learn all about it 
|
|
|
|
01-06-2009, 01:52 AM
|
#5
|
|
Senior Member
Registered: Jul 2003
Location: Wellington, NZ
Distribution: mainly slackware
Posts: 1,288
Rep:
|
I find midnight commander (mc) a nice tool... it's a bit like xtree gold... so I'm told...
ps. since we are splitting hairs: I think the TAB key output is like more, in that you need to type "q" to quit less whereas more just quits at EOF... more or less... :P
|
|
|
|
01-06-2009, 03:02 AM
|
#6
|
|
Member
Registered: Feb 2006
Distribution: Debian, Maemo
Posts: 341
Rep:
|
Quote:
Originally Posted by baldurpet
[*]Not display hidden files: Is it possible not to display hidden files when you use the <TAB> key to search for files? Using, for example, the command file or ls in a folder which includes a lot of hidden files (like a home directory), is it possible not to display the hidden files and not get a "Display all 151 something possibilities? (y or n)"
|
I've wanted something like this too. I did a quick search and found that adding this to your .bashrc searches only among non-hidden files and folders during completion:
Code:
bind 'set match-hidden-files off'
Tried it, works nice. dotfiles are displayed only when you explicitly enter a period and hit tab.
|
|
|
|
01-06-2009, 03:14 AM
|
#7
|
|
Member
Registered: Feb 2006
Distribution: Debian, Maemo
Posts: 341
Rep:
|
Quote:
Originally Posted by baldurpet
Auto finishing: I really like using the bash shell but one thing the Windows shell (what ever it's called) does better is to let you switch between every file and folder in your pwd using the <TAB>. So if you have a few files with really long and tedious names (imagine a lot of numbers, where a lot of the filenames start the same) or if you have some files starting with letters which aren't on your keyboard you don't have to type in their name but rather use <TAB> to make the first file appear, and then the second one, and the third.. etc. I have encountered both problems in my short Linux career and they are really annoying.
|
Found this one as well, in this link. Good old bash does everything
Code:
"\C-i": menu-complete # Cycle through ambiguous completions instead of list
Adding that in /etc/inputrc or ~/.inputrc does the trick. I didn't like the end result of this, though, because the completion list completely disappears and you have to patiently cycle through each hit.
|
|
|
|
01-06-2009, 03:50 AM
|
#8
|
|
Senior Member
Registered: Jul 2003
Location: Wellington, NZ
Distribution: mainly slackware
Posts: 1,288
Rep:
|
haha! wow! all the answers in one!
Here's some more stuff from another user:
http://www.linuxquestions.org/questi...5/#post3400573
Last edited by Tuttle; 01-07-2009 at 10:32 PM.
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 04:59 AM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|