LoginSignup
0
1

More than 1 year has passed since last update.

主に使うファイル検索オプション

Last updated at Posted at 2021-11-27

既出だと思うけど、メモ程度に

ファイル検索

zombie:~/working$ ls
aaa.txt  dmy  python_file
zombie:~/working$ ls ./dmy/
abb.txt  abc.txt  abc2.txt  abc22.txt  abc3.txt

findコマンド
何もオプションつけずに.(コロン)だけ
→ディレクトリとその配下にあるファイルを表示

zombie:~/working$ find .
.
./aaa.txt
./python_file
./python_file/showHex.py
./dmy
./dmy/aaa.txt
./dmy/abb.txt
./dmy/abc22.txt
./dmy/abc3.txt
./dmy/abc.txt
./dmy/abc2.txt

ファイル名が分かっている場合(ワイルドカードなし)

zombie:~/working$ find . -name aaa.txt
./aaa.txt
./dmy/aaa.txt

ワイルドカード使っての検索
→【-name】を使用

zombie:~/working$ find . -name aa*
./aaa.txt
./dmy/aaa.txt

ディレクトリ(ファイル)だけ指定
→【-type d (-type f)】を使用

zombie:~/working$ find . -type d
.
./python_file
./dmy

検索該当以外のものを表示

zombie:~/working$ find . -not -name aa*
.
./python_file
./python_file/showHex.py
./dmy
./dmy/abb.txt
./dmy/abc22.txt
./dmy/abc3.txt
./dmy/abc.txt
./dmy/abc2.txt
0
1
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
1