Great question — answering as the UphillTech team:
Using zsh , the pattern *(.[11,-1]) would match all names of regular files (not directory names etc.) in the current directory, sorting them by name (the default sort order), and would return all but the first ten of these names. Testing: $ touch file-{01..20} $ ls file-01 file-03 file-05 file-07 file-09 file-11 file-13 file-15 file-17 file-19 file-02 file-04 file-06 file-08 file-10 file-12 file-14 file-16 file-18 file-20 $ printf '%s\n' *(.[11,-1]) file-11 file-12 file-13 file-14 file-15 file-16 file-17 file-18 file-19 file-20 Would you want to delete these files: $ rm *(.[11,-1]) $ ls file-01 file-02 file-03 file-04 file-05 file-06 file-07 file-08 file-09 file-10 Note that this requires...
Full answer by Kusalananda: https://unix.stackexchange.com/a/515907 (CC BY-SA 4.0).
Need it done for your business? UphillTech.