Tag Archives: inverse wildcards

bash inverse wildcards

If you want to ls all BUT the .sh files:


ls !(*.sh)

Example:

tatico@tortuguita:~/codigo/python/files_keeper/random_files$ ls *.sh
random_file-clean.sh  random_file_generator.sh  random_file_spread.sh
tatico@tortuguita:~/codigo/python/files_keeper/random_files$ ls !(*.sh)
file4ShdNk  filea6uHLm  fileB4sRgx  filecdQQzj  fileLYvbHv  fileo4TKHj  fileoKaCVj  fileSxbv0v  fileTlphlz  fileYLJ43w
tatico@tortuguita:~/codigo/python/files_keeper/random_files$ ls
file4ShdNk  fileB4sRgx  fileLYvbHv  fileoKaCVj  fileTlphlz  random_file-clean.sh      random_file_spread.sh
filea6uHLm  filecdQQzj  fileo4TKHj  fileSxbv0v  fileYLJ43w  random_file_generator.sh