WebHosting

Showing posts with label sort file on basis of type. Show all posts
Showing posts with label sort file on basis of type. Show all posts

Thursday, December 21, 2023

How to i see list of only file and sort by type and see count of each type of files

find . -type f -printf "%f\n" | awk -F. '{print $NF}' | sort | uniq -c

  • find . -type f -printf "%f\n": This finds all files (-type f) in the current directory (.) and prints only their names (%f) followed by a newline.
  • awk -F. '{print $NF}': This uses awk to extract the file extensions by splitting each filename at the dot (.) and printing the last field ($NF).
  • sort: This sorts the file extensions alphabetically.
  • uniq -c: This counts the occurrences of each unique file extension.

This command will output a list showing the count of each file type in the current directory. Adjust the starting directory in the find command (. in this example) if you want to search in a different directory.

Featured Posts

How to Enable and Configure Remote Desktop (RDP) on Ubuntu 24.04.4 LTS

Remote Desktop Protocol (RDP) support in Ubuntu has become considerably easier with the GNOME Remote Desktop stack included in modern Ubuntu...