A little workaround: in Bash, [Ctrl]+u
deletes from the beginning of the commandline until the cursor, and puts it in memory, [Ctrl]+y
"yanks" (paste) it back.
So assuming you want to run the command ls
and give it as arguments files from the ./deep/below/directory/
, you could:
1) start by entering the long dir name, preceded by a space (this will saves a few keystrokes later):
./deep/below/directory/
(you can use [Tab]
as needed), followed by [Ctrl]+u
, which will delete it and keep it in memory (note: you do have to use './' at the beginning of the directory name if it's a relative path, otherwise bash won't autocomplete the directory names at the beginning of the commandline)
2) then type the command (and its options) followed by a space : ex: ls -alFtr
3) use [Ctrl]+y
to yank the long dir name here, and then type the beginning of the filename you seek, and use [tab]
as you usually do to autocomplete its name (the cut directory name is still in memory, ready to be reused)
4) repeat step 3) as many times as necessary
5) [Enter]
Long to type, but much faster to use ^^, try it!
$BASH_COMPLETION
. But I do not know if this is what you want...BASH_COMPLETION
knowledge is rusty :( Moreover I have to go home in few minutes... I hope someone will answer this question usingBASH_COMPLETION
(I am also interested ;) Cheers.