findコマンドには-typeというオプションがある。-typeオプションでlを指定するとシンボリックリンク、dを指定するとディレクトリが検索できる。 例えば、カレントディレクトリ以下のディレクトリからシンボリックリンクを探すには、以下のように行う。
複数あるファイルの中から特定の文字列を検索したいときのLinuxコマンド。 $ find ./ -type f -print | xargs grep 'hoge' 【上記コマンドの説明】 find find の次で指定したディレクトリ以下のファイルを検索する。 ファイル検索の構文は「find [path] [検索条件] [アクション]」 — ./ 今いるディレクトリ以下が検索対象。「~/」とするとホームディレクトリ以下が検索対象となる。 ./ の代わりにフルパスでも可。この場合も指定したディレクトリ以下が検索対象になる。 — -print 検索結果を標準出力する。このとき結果をフルパスで表示する — -type f 指定したファイルタイプを検索する。fが通常ファイルを,cまたはdとするとディレクトリを,lとするとシンボリック・リンクを検索します。 — xargs 標準入力からコマンドライ
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く