6
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

【小ネタ】ディレクトリの権限を数値化して表示させるコマンド

Posted at

lsコマンドで表示される、ディレクトリの権限をアルファベットだけではなく、数値で表示させたい為の小技コマンド。

find /検索対象ディレクトリ -type d -exec stat --format "%a %U %G %n" {} ;

●--formatのオプションについて
%a:アクセス権の8新表記
%U:オーナー名
%G:グループ名
%n:ファイル名("-type d"を指定しているため、ディレクトリ名が表示される)

●実行結果例
[root@localhost ~]# find /var/ -type d -exec stat --format "%a %U %G %n" {} ;
755 root root /var/
755 root root /var/lib
755 root root /var/lib/yum
755 root root /var/lib/yum/repos
755 root root /var/lib/yum/repos/x86_64
755 root root /var/lib/yum/repos/x86_64/7
755 root root /var/lib/yum/repos/x86_64/7/anaconda
755 root root /var/lib/yum/repos/x86_64/7/base
755 root root /var/lib/yum/repos/x86_64/7/extras
755 root root /var/lib/yum/repos/x86_64/7/updates
755 root root /var/lib/yum/yumdb
…省略…

6
6
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
6
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?