Como ya sabemos el comando ls nos permite obtener una lista de los archivos del directorio (Tutorial de Unix) pero aquí hay diferentes casos de como podemos utilizar el comando:

    • ? Se sustituye por un caracter
    • * Se sustituye por cualquier cadena de texto (un caracter o más)
    • [] Para indicar rangos u opciones.

$ ls
archivo1.txt archivo3.txt main.php p_smarbol.php
archivo2.txt grafica.php open_file.php p_style.php

ls con comodín de un caracter ?

$ ls archivo?.txt
archivo1.txt archivo2.txt archivo3.txt

ls con diferentes opciones [ ]

$ ls archivo[1,3].txt
archivo1.txt archivo3.txt

$ ls [am]*
archivo1.txt archivo2.txt archivo3.txt main.php

ls con un rango [ ]

$ ls archivo[1-5].txt
archivo1.txt archivo2.txt archivo3.txt

$ ls [a-g]*
archivo1.txt archivo2.txt archivo3.txt grafica.php