LoginSignup
0
0

More than 1 year has passed since last update.

【Linux】指定ディレクトリ配下にあるファイルの拡張子の一覧および数を表示する

Posted at

概要

指定ディレクトリ配下にあるファイルの拡張子の一覧および数を表示するコマンドを記載する

コマンド

find <検索するディレクトリ> -type f -print | sed -e 's/^.*\///' | grep '\.' | sed -e 's/^.*\.//' | sort | uniq -c | sort -nr

カレントディレクトリ配下全てを検索する場合は以下のように指定する。

$ find ./ -type f -print | sed -e 's/^.*\///' | grep '\.' | sed -e 's/^.*\.//' | sort | uniq -c | sort -nr
     82 py
     28 png
     25 html
     15 yml
     15 json
     11 txt
      8 sh
      8 js
      7 jpg
      6 md
      5 ini
      4 yaml
      3 gitignore
      3 dockerignore
      3 conf
      2 tmpl
      2 css
      1 tar
      1 pem
      1 pdf
      1 go
      1 env
      1 cfg
      1 bin
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0