Reverse *

when I do
$ ls z*
List of all files begining with 'z'. But what if I want to do a reverse lookup. Just for interest sake :wink:
$ ls ztr
should be same as
$ ls ztr*
$ ls zt*
$ ls z*

You could create a function, e.g...

function myls {
  ls $(echo $1 | awk '{for(x=length;x>=1;x--)print substr($0,1,x) "*"}')
}

Then you can use...

$ myls ztr
ls: ztr*: No such file or directory
ls: zt*: No such file or directory
ls: z*: No such file or directory

for listing files NOT begining with a 'z':
ls [!z]*