list files linux code example

Example 1: display all files in a directory linux

ls command list computer files in a directory in Unix OS with next structure:
ls [OPTION]... [FILE]...
Examples:
ls -l #display all files in current directory with  (-l) long format.
ls -a /directory #display all hidden files in given directory that start with .

Example 2: linux list files onlr

ls -p | grep -v /

Example 3: list all files in a directory and subdirectory linux

find . -type f -follow -print

Example 4: how to list files starting with a in linux

find . -type f -name "abc*"

Example 5: linux wc list of files

find ./ -type f -name "*work*" -exec wc -w {} +

Tags:

Misc Example