Please write me a one line bash script to print all files of the directory with a certain suffix in the terminal?

You can use the following one-liner bash command to print all files with a specific suffix in the current directory. Replace your_suffix with the actual suffix you're interested in (e.g., .txt, .jpg, etc.):

ls *your_suffix

For example, to print all .txt files, you would use:

ls *.txt

If you want to include a detailed view, you can use:

ls -l *.your_suffix

Remember that this will print an error message if no files match the pattern. To suppress the error message, you can redirect stderr to /dev/null like this:

ls *your_suffix 2>/dev/null

Have your own question?

Ask the AI now