LoginSignup
3
2

More than 5 years have passed since last update.

shellコマンドで色々数える

Posted at

wc

wc hoge
>>> 30 40 150
hogeの行数,単語数,バイト数を表示

ファイルの行数を数える

wc -l hoge.txt

\nの数を数えている

フォルダ内のファイルの数を数える

ファイル&フォルダまとめて

ls -1 | wc -l

ファイルのみ

ls -F | grep -v / | wc -l

特定単語の数を数える

grep -c 検索したい単語 hoge.txt

ファイル内のサイズを数える

その中のファイル全部に対して調べる

du

特定のフォルダに対して調べる

du -s dir/

自分の今いるところのサイズなら

du -s .
3
2
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
3
2