LoginSignup
0
2

More than 5 years have passed since last update.

findでマウント先のファイルシステムを検索しない方法

Last updated at Posted at 2017-07-12

はじめに

ファイルのパスがわからないときよくfindを使うのだが大きなディスクがマウントされていると実行に時間がかかる。そんな時にマウント先のディスクは検索しないでローカルディスクだけ検索する方法。

以下のように-xdevをつけるだけ

find 検索パス -xdev -name 検索ファイル名

-xdevオプションを指定しない場合

[root@server01 ~]# find / -name log
/script/log
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.20.3/lib/chef/log
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.20.3/spec/unit/log
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/mixlib-log-1.7.1/lib/mixlib/log
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/mixlib-log-1.7.1/spec/mixlib/log
/run/log
/run/initramfs/log
/var/log
^C    ←ここで待たされるのでCtrl+cでキャンセル
[root@server01 ~]#

-xdevオプションを指定した場合

[root@server01 ~]# find / -xdev -name log
/script/log
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.20.3/lib/chef/log
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.20.3/spec/unit/log
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/mixlib-log-1.7.1/lib/mixlib/log
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/mixlib-log-1.7.1/spec/mixlib/log
/var/log
[root@server01 ~]#   ←待たされないで完了する
0
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
0
2