差分
このページの2つのバージョン間の差分を表示します。
両方とも前のリビジョン 前のリビジョン 次のリビジョン | 前のリビジョン | ||
linux:commands:file_directory [2024/01/22 13:34] – [ディレクトリの容量] ともやん | linux:commands:file_directory [2024/04/15 05:35] (現在) – [ファイル検索[find]] ともやん | ||
---|---|---|---|
行 2: | 行 2: | ||
===== ファイル検索[find] ===== | ===== ファイル検索[find] ===== | ||
- | filename.txt というファイルを | + | / (ルートディレクトリ)配下の |
- | <code> | + | <WRAP color_term> |
- | $ find / -name filename.txt | + | <WRAP color_command>< |
+ | <font color="# | ||
+ | </ | ||
+ | <WRAP color_result>< | ||
/ | / | ||
/ | / | ||
- | </code> | + | </pre></ |
+ | </ | ||
+ | |||
+ | . (カレントディレクトリ)配下の *.orig というファイルをすべて検索する...🤔\\ | ||
+ | <WRAP color_term> | ||
+ | <WRAP color_command>< | ||
+ | <font color="# | ||
+ | </ | ||
+ | <WRAP color_result>< | ||
+ | ./ | ||
+ | ./ | ||
+ | ./ | ||
+ | ./ | ||
+ | ./ | ||
+ | ./ | ||
+ | ./ | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | それらを削除する😱\\ | ||
+ | <WRAP color_term> | ||
+ | <WRAP color_command>< | ||
+ | <font color="# | ||
+ | </ | ||
+ | </WRAP> | ||
===== 文字列を含むファイルを検索[grep] ===== | ===== 文字列を含むファイルを検索[grep] ===== | ||
行 214: | 行 241: | ||
===== ディレクトリの容量 [du] ===== | ===== ディレクトリの容量 [du] ===== | ||
- | dir_name の容量表示\\ | ||
- | <WRAP prewrap 100%> | ||
- | < | ||
- | $ du -h -s dir_name | ||
- | 1.6G dir_name | ||
- | </ | ||
- | </ | ||
- | |||
- | dir_name 配下のサブディレクトリ毎の容量表示\\ | ||
- | <WRAP prewrap 100%> | ||
- | < | ||
- | $ du -h -s dir_name/* | ||
- | 1.6G dir1 | ||
- | 0.2G dir2 | ||
- | 0.3G dir3 | ||
- | </ | ||
- | </ | ||
- | |||
- | dir_name 配下のすべてのサブディレクトリとファイル容量表示(降順, | ||
- | ※ファイルのみの表示はできない😅\\ | ||
- | < | ||
- | $ du -kha dir_name/* --exclude={exclude_dir1, | ||
- | </ | ||
- | find コマンドならファイルのみサイズ表示できる🤤\\ | ||
- | < | ||
- | $ find ./dir_name -ls | sort -rh -k 7 | head -50 | ||
- | $ find ./dir_name -printf "%s %M %n %u %g %b %TD %TR %p\n" | sort -hr | head -50 | ||
- | </ | ||
- | |||
- | 容量の昇順ソート\\ | ||
- | <WRAP prewrap 100%> | ||
- | < | ||
- | $ du -h -s dir_name/* | sort -h | ||
- | 0.2G dir2 | ||
- | 0.3G dir3 | ||
- | 1.6G dir1 | ||
- | </ | ||
- | </ | ||
- | |||
- | 容量の降順ソート\\ | ||
- | <WRAP prewrap 100%> | ||
- | < | ||
- | $ du -h -s dir_name/* | sort -hr | ||
- | 1.6G dir1 | ||
- | 0.3G dir3 | ||
- | 0.2G dir2 | ||
- | </ | ||
- | </ | ||
- | |||
du コマンドのヘルプ\\ | du コマンドのヘルプ\\ | ||
- | <panel id="repoquery_help_panel" type=" | + | < |
+ | <panel id="du_help_panel" type=" | ||
<WRAP color_term> | <WRAP color_term> | ||
<WRAP color_command>< | <WRAP color_command>< | ||
行 337: | 行 316: | ||
</ | </ | ||
</ | </ | ||
+ | </ | ||
+ | |||
+ | dir_name の容量表示\\ | ||
+ | <WRAP prewrap 100%> | ||
+ | < | ||
+ | $ du -h -s dir_name | ||
+ | 1.6G dir_name | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | dir_name 配下のサブディレクトリ毎の容量表示\\ | ||
+ | <WRAP prewrap 100%> | ||
+ | < | ||
+ | $ du -h -s dir_name/* | ||
+ | 1.6G dir1 | ||
+ | 0.2G dir2 | ||
+ | 0.3G dir3 | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | dir_name 配下のすべてのサブディレクトリとファイル容量表示(降順, | ||
+ | ※ファイルのみの表示はできない😅\\ | ||
+ | < | ||
+ | $ du -kha dir_name/* --exclude={exclude_dir1, | ||
+ | </ | ||
+ | find コマンドならファイルのみサイズ表示できる🤤\\ | ||
+ | < | ||
+ | $ find ./dir_name -ls | sort -rh -k 7 | head -50 | ||
+ | $ find ./dir_name -printf "%s %M %n %u %g %b %TD %TR %p\n" | sort -hr | head -50 | ||
+ | </ | ||
+ | |||
+ | 容量の昇順ソート\\ | ||
+ | <WRAP prewrap 100%> | ||
+ | < | ||
+ | $ du -h -s dir_name/* | sort -h | ||
+ | 0.2G dir2 | ||
+ | 0.3G dir3 | ||
+ | 1.6G dir1 | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | 容量の降順ソート\\ | ||
+ | <WRAP prewrap 100%> | ||
+ | < | ||
+ | $ du -h -s dir_name/* | sort -hr | ||
+ | 1.6G dir1 | ||
+ | 0.3G dir3 | ||
+ | 0.2G dir2 | ||
+ | </ | ||
+ | </ | ||
[[https:// | [[https:// |