linuxファイル検索tips
深さ制限してfindする
find /opt/jboss -maxdepth 4 -type f -name jboss-service.xml
maxdepthのオプションは、-type よりも先に入れないといけないことに注意。 逆にすると以下のエラーが出る
# find /opt/jboss -type f -name jboss-service.xml -maxdepth 4 find: warning: you have specified the -maxdepth option after a non-option argument -type, but options are not positional (-maxdepth affects tests specified before it as well as those specified after it). Please specify options before other arguments.
深さ制限してgrepする
find /opt/jboss -maxdepth 5 -type f -name *.xml -exec grep --with-filename -n "300" {} \;
深さ制限してtree する
tree -L 2 /lib