hi
plz let me know the command to count the files in directory.
thanks in advance
-Bali Reddy
ls -1 | wc -l
This will give you a count of all the files (including directories). If you want just certain files, either change the ls command to look for *.txt (to look for files with .txt extension), or use the find command to look for certain types of files (see the man page for find, look for the -type option).
2 Likes
Can you use this command to count all of the files over a certain size?
Use find. Look at man find for more options.
find /usr/bin/ -size 11k -exec ls {} \;|wc -l
1 Like
use
ls -l |grep ^\- | wc -l
1 Like