//View Tip #481
Similar Tips
» Remove empty directories
» Find occurrences of a string in a large code base without firing
» List non-system users
» Filter stderr for cron jobs
» Bash

 

Latest tips by RSS
Click here to subscribe
Follow Shell-Fu on Twitter
Click here to follow
Follow Shell-Fu on identi.ca
Click here to follow
Like <TAB> expands a filename given a prefix you can also expand a file name given the middle part of a file name using escape and then 'g'.

$ ls
abc1def  abc2def  abc3def  abc4def  abc5def
$ ls *2*<ESC>g


Which will expand to:

$ ls abc2def


View Comments »




Comments 

Add your comment

Comments are currently disabled
Mitzekotze
Hey thanks for sharing this hint.
Posted 2009-01-13 16:53:24
pirata
cool, thanks for sharing
Posted 2009-01-14 09:18:59
But it only expand if there is one file in the regex, for example:

$ touch test1.txt test2.txt test3.txt

$ ls test*txt<ESC>g

It doesn't expand nothing :-/

$ ls test1*txt

This example works.. Tested on BASH 2 and 3.. --Santi
Posted 2009-01-15 09:38:04

Home Latest Browse Top 25 Random Hall Of Fame Contact Submit