かなり気分的な技術日記

日々の勉強メモです

【Linux#3】ls -lコマンドでサブディレクトリ含めてフルパスで出力する方法

概要

ls -lコマンドの出力結果をサブディレクトリ含めてフルパスで出力したい。

内容

方法

以下のように、コマンド置換を使用して、出力結果の詳細リストを表示することができる。

$ ll -d $(find tmp)
drwxrwxr-x. 4 root root   92  2月 10 10:50 tmp
drwxrwxr-x. 3 root root   18  2月 10 01:13 tmp/hoge
-rwxrwxrwx. 1 root root  283  1月 24 23:06 tmp/my.sh
-rw-rw-r--. 1 root root   43  1月 18 21:40 tmp/aaa.txt
drwxrwxr-x. 4 root root  124  2月 10 02:10 tmp/test
-rw-rw-r--. 2 root root   12  2月 10 00:28 tmp/test/bbb.txt

もしくは、

$ ll -d `find tmp`

参考記事

以下の記事がとても勉強になりました。
ls -lコマンドの結果をサブディレクトリ含めてフルパスで列挙したい #Linux - Qiita
シェルスクリプトのコマンド置換 #Linux - Qiita