34
9
I understand that if you type ls *
it is actually expanded to ls a b c
when the current directly has files a
, b
and c
.
I was wondering if there is a way to expand this before I hit enter. Similar to how Ctrl+X works, or tab complete works.
So to make myself clear
$ ls *
<press magic key>
$ ls a b c
in a similar way to:
$ ls ~/
<press tab>
$ ls /home/username
I thought I'd seen this before but I might have been mistaken.
Well, I know very little but the best I know of is $echo * <ENTER> You could do that before the ls * command. That's not quite hitting tab or a shortcut to expand it of course. – barlop – 2010-11-28T19:24:14.983
But perhaps linux users wouldn't do anything like ls * much 'cos it probably isn't necessary with ls, But also globbing behaves differently on different shells so it's not that portable, but when convenient then fine. But in ls's case, not necessary. ls */ lists directories but not so much what ls is designed to do. – barlop – 2010-11-28T19:27:40.690