LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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


Reply
  Search this Thread
Old 01-05-2009, 12:28 AM   #1
baldurpet
Member
 
Registered: Dec 2008
Location: Iceland
Distribution: Ubuntu, freeBSD
Posts: 110

Rep: Reputation: 15
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.
 
Old 01-05-2009, 12:36 AM   #2
Tuttle
Senior Member
 
Registered: Jul 2003
Location: Wellington, NZ
Distribution: mainly slackware
Posts: 1,291

Rep: Reputation: 52
Quote:
Originally Posted by baldurpet View Post
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 View Post
  • 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 View Post
  • 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.
 
Old 01-05-2009, 12:59 AM   #3
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
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.
 
Old 01-05-2009, 04:48 PM   #4
baldurpet
Member
 
Registered: Dec 2008
Location: Iceland
Distribution: Ubuntu, freeBSD
Posts: 110

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by Tuttle View Post
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 View Post
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 View Post
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
 
Old 01-06-2009, 01:52 AM   #5
Tuttle
Senior Member
 
Registered: Jul 2003
Location: Wellington, NZ
Distribution: mainly slackware
Posts: 1,291

Rep: Reputation: 52
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
 
Old 01-06-2009, 03:02 AM   #6
indeliblestamp
Member
 
Registered: Feb 2006
Distribution: Fedora
Posts: 341
Blog Entries: 3

Rep: Reputation: 40
Quote:
Originally Posted by baldurpet View Post
[*]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.
 
Old 01-06-2009, 03:14 AM   #7
indeliblestamp
Member
 
Registered: Feb 2006
Distribution: Fedora
Posts: 341
Blog Entries: 3

Rep: Reputation: 40
Quote:
Originally Posted by baldurpet View Post
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.
 
Old 01-06-2009, 03:50 AM   #8
Tuttle
Senior Member
 
Registered: Jul 2003
Location: Wellington, NZ
Distribution: mainly slackware
Posts: 1,291

Rep: Reputation: 52
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.
 
  


Reply

Tags
cli, hidden, less, tab



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Tab does not auto-complete in terminal General Fedora 8 09-12-2013 01:48 AM
Problems with using tad in command line; auto finishing and displaying baldurpet Linux - Newbie 2 01-07-2009 03:55 PM
TAB Auto Completion rsmccain Linux - Software 6 11-20-2007 09:47 PM
home directory files gone, hidden files remain Grasshopper Linux - Security 12 04-10-2005 08:23 PM
gnuplot 4.0 why wont <tab> finish my words sirclif Linux - Software 1 09-04-2004 08:43 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:43 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration