Search code examples
regexls

"ls" with regex multiple times


I am trying to do next two commands on one line:

ls -lh  /etc/pki/tls/certs/dom*
ls -lh  /etc/pki/tls/certs/cen*

I tried something like next but it does not work:

ls -lh  /etc/pki/tls/certs/cen*|dom*
ls -lh  /etc/pki/tls/certs/[cen*|dom*]
ls -lh  /etc/pki/tls/certs/{cen*|dom*}

Is next the only way?:

ls -lh  /etc/pki/tls/certs/cen*  &&  ls -lh  /etc/pki/tls/certs/dom*

Solution

  • These two are equivalent:

    ls -lh /etc/pki/tls/certs/dom* /etc/pki/tls/certs/cen*
    
    ls -lh /etc/pki/tls/certs/{dom,cen}*