LoginSignup
4
4

More than 5 years have passed since last update.

OSXのTerminal.appのlsの設定

Last updated at Posted at 2014-06-10

最近は下記のような感じでllllllllllという名前でエイリアスを貼って使い分けてる。

~/.bashrc
export CLICOLOR=1
export LSCOLORS=DxGxcxdxCxegedabagacad

alias    l='/bin/ls -F'
alias   ll='/bin/ls -FlThSr'
alias  lll='/bin/ls -FlThSra'
alias llll='/bin/ls -FlcThSrae@'

ちなみに1行目と2行目は色の設定。DxGxcxdxCxegedabagacadという設定はググる(DxGxcxdxCxegedabagacad - Google 検索)と山のように出てくるが、もはや原典が分からない。

さて各オプションの意味は以下の通り。(man lsより。)

  • l
    • F: ファイルの種類に応じて/とか*とか@とか付ける
  • ll
    • l: 横長リスト表示
    • T: 日時をフルで表示
    • h: ファイルサイズに単位を付けて表示
    • S: ファイルサイズでソートして表示
    • r: ソートの向きを逆にして表示
  • lll
    • a: ドットファイルも表示
  • llll
    • e: 拡張ファイル属性も表示
    • @: アクセス制御リストも表示

用途はこんな感じ。

  • l: 普段使い。
  • ll: 普段使い+ちょい詳しく。
  • lll: 凝ったことをし始めたとき。
  • llll: ややこしいことが始まったとき。

以下は表示例です。

l

$ l /
Applications/ Users/        dev/          net/          tmp@
Library/      Volumes/      etc@          opt/          usr/
Network/      bin/          home/         private/      var@
System/       cores/        mach_kernel*  sbin/

ll

$ ll /
total 16437
dr-xr-xr-x    2 root  wheel     1B  6 10 17:28:46 2014 net/
dr-xr-xr-x    2 root  wheel     1B  6 10 17:28:46 2014 home/
lrwxr-xr-x@   1 root  wheel    11B 11 29 02:19:17 2013 var@ -> private/var
lrwxr-xr-x@   1 root  wheel    11B 11 29 02:19:16 2013 tmp@ -> private/tmp
lrwxr-xr-x@   1 root  wheel    11B 11 29 02:18:58 2013 etc@ -> private/etc
drwxrwxr-t@   2 root  admin    68B  8 25 09:15:53 2013 cores/
drwxr-xr-x@   2 root  wheel    68B  8 25 09:15:59 2013 Network/
drwxrwxrwt@   3 root  admin   102B  6 10 11:47:15 2014 Volumes/
drwxr-xr-x    4 root  wheel   136B  1  9 12:17:34 2014 opt/
drwxr-xr-x+   4 root  wheel   136B 11 29 02:59:57 2013 System/
drwxr-xr-x    5 root  admin   170B  4 29 01:10:27 2014 Users/
drwxr-xr-x@   6 root  wheel   204B 11 29 02:29:03 2013 private/
drwxr-xr-x@  13 root  wheel   442B  1  9 12:20:55 2014 usr/
drwxr-xr-x@  39 root  wheel   1.3K  2 26 22:51:08 2014 bin/
drwxr-xr-x@  62 root  wheel   2.1K  6  1 19:00:35 2014 sbin/
drwxr-xr-x+  68 root  wheel   2.3K  3 27 11:39:42 2014 Library/
drwxrwxr-x+ 102 root  admin   3.4K  6  6 15:33:28 2014 Applications/
dr-xr-xr-x    3 root  wheel   4.4K  6  9 10:46:29 2014 dev/
-rwxr-xr-x@   1 root  wheel   8.0M  4 18 15:03:34 2014 mach_kernel*

lll

$ lll /
total 16485
----------    1 root  admin     0B  8 25 09:16:29 2013 .file
srwxrwxrwx    1 root  wheel     0B  6  9 10:47:10 2014 .dbfseventsd=
dr-xr-xr-x    2 root  wheel     1B  6 10 17:28:46 2014 net/
dr-xr-xr-x    2 root  wheel     1B  6 10 17:28:46 2014 home/
lrwxr-xr-x@   1 root  wheel    11B 11 29 02:19:17 2013 var@ -> private/var
lrwxr-xr-x@   1 root  wheel    11B 11 29 02:19:16 2013 tmp@ -> private/tmp
lrwxr-xr-x@   1 root  wheel    11B 11 29 02:18:58 2013 etc@ -> private/etc
drwxrwxr-t@   2 root  admin    68B  8 25 09:15:53 2013 cores/
drwxr-xr-x@   2 root  wheel    68B  8 25 09:15:59 2013 Network/
drwxr-xr-x@   2 root  wheel    68B  8 25 10:48:39 2013 .vol/
d-wx-wx-wt    2 root  wheel    68B 11 29 01:51:35 2013 .Trashes/
drwxrwxrwt@   3 root  admin   102B  6 10 11:47:15 2014 Volumes/
drwxr-xr-x    4 root  wheel   136B  1  9 12:17:34 2014 opt/
drwxr-xr-x+   4 root  wheel   136B 11 29 02:59:57 2013 System/
drwxr-xr-x    5 root  admin   170B  4 29 01:10:27 2014 Users/
drwx------    5 root  wheel   170B 11 29 02:34:14 2013 .Spotlight-V100/
drwxr-xr-x@   6 root  wheel   204B 11 29 02:29:03 2013 private/
d--x--x--x    8 root  wheel   272B 11 29 08:52:44 2013 .DocumentRevisions-V100/
drwxr-xr-x@  13 root  wheel   442B  1  9 12:20:55 2014 usr/
drwxr-xr-x   31 root  wheel   1.1K  6  9 10:47:10 2014 ../
drwxr-xr-x   31 root  wheel   1.1K  6  9 10:47:10 2014 ./
drwxr-xr-x@  39 root  wheel   1.3K  2 26 22:51:08 2014 bin/
drwx------   58 root  wheel   1.9K  6 10 23:29:34 2014 .fseventsd/
drwxr-xr-x@  62 root  wheel   2.1K  6  1 19:00:35 2014 sbin/
drwxr-xr-x+  68 root  wheel   2.3K  3 27 11:39:42 2014 Library/
drwxrwxr-x+ 102 root  admin   3.4K  6  6 15:33:28 2014 Applications/
dr-xr-xr-x    3 root  wheel   4.4K  6  9 10:46:29 2014 dev/
-rw-rw-r--@   1 root  admin    21K  6  1 00:43:59 2014 .DS_Store
-rwxr-xr-x@   1 root  wheel   8.0M  4 18 15:03:34 2014 mach_kernel*

llll

$ llll /
total 16485
----------    1 root  admin     0B 11 29 02:18:54 2013 .file
srwxrwxrwx    1 root  wheel     0B  6  9 10:47:10 2014 .dbfseventsd=
dr-xr-xr-x    2 root  wheel     1B  6  9 10:46:33 2014 net/
dr-xr-xr-x    2 root  wheel     1B  6  9 10:46:33 2014 home/
lrwxr-xr-x@   1 root  wheel    11B 11 29 02:32:33 2013 var@ -> private/var
    com.apple.FinderInfo      32B 
lrwxr-xr-x@   1 root  wheel    11B 11 29 02:32:33 2013 tmp@ -> private/tmp
    com.apple.FinderInfo      32B 
lrwxr-xr-x@   1 root  wheel    11B 11 29 02:32:33 2013 etc@ -> private/etc
    com.apple.FinderInfo      32B 
drwxrwxr-t@   2 root  admin    68B 11 29 02:32:33 2013 cores/
    com.apple.FinderInfo      32B 
drwxr-xr-x@   2 root  wheel    68B 11 29 02:32:33 2013 Network/
    com.apple.FinderInfo      32B 
drwxr-xr-x@   2 root  wheel    68B 11 29 02:32:33 2013 .vol/
    com.apple.FinderInfo      32B 
d-wx-wx-wt    2 root  wheel    68B 11 29 01:51:35 2013 .Trashes/
drwxrwxrwt@   3 root  admin   102B  6 10 11:47:15 2014 Volumes/
    com.apple.FinderInfo      32B 
 0: group:everyone deny add_file,add_subdirectory,directory_inherit,only_inherit
drwxr-xr-x    4 root  wheel   136B  1  9 12:17:34 2014 opt/
drwxr-xr-x+   4 root  wheel   136B 11 29 02:59:57 2013 System/
 0: group:everyone deny delete
drwxr-xr-x    5 root  admin   170B  5 17 23:58:35 2014 Users/
drwx------    5 root  wheel   170B 11 29 02:34:14 2013 .Spotlight-V100/
drwxr-xr-x@   6 root  wheel   204B 11 29 02:32:33 2013 private/
    com.apple.FinderInfo      32B 
d--x--x--x    8 root  wheel   272B 11 29 08:52:44 2013 .DocumentRevisions-V100/
drwxr-xr-x@  13 root  wheel   442B  1  9 12:20:55 2014 usr/
    com.apple.FinderInfo      32B 
drwxr-xr-x   31 root  wheel   1.1K  6  9 10:47:10 2014 ../
drwxr-xr-x   31 root  wheel   1.1K  6  9 10:47:10 2014 ./
drwxr-xr-x@  39 root  wheel   1.3K  2 26 22:51:08 2014 bin/
    com.apple.FinderInfo      32B 
drwx------   58 root  wheel   1.9K  6 10 23:29:34 2014 .fseventsd/
drwxr-xr-x@  62 root  wheel   2.1K  6  1 19:00:35 2014 sbin/
    com.apple.FinderInfo      32B 
drwxr-xr-x+  68 root  wheel   2.3K  3 27 11:39:42 2014 Library/
 0: group:everyone deny delete
drwxrwxr-x+ 102 root  admin   3.4K  6  6 15:33:28 2014 Applications/
 0: group:everyone deny delete
dr-xr-xr-x    3 root  wheel   4.4K  6  9 10:46:29 2014 dev/
-rw-rw-r--@   1 root  admin    21K  6  1 00:43:59 2014 .DS_Store
    com.apple.FinderInfo      32B 
-rwxr-xr-x@   1 root  wheel   8.0M  6  1 19:01:29 2014 mach_kernel*
    com.apple.FinderInfo      32B

ちなみにファイルサイズでソートしたくない場合はlll -fとかすればソート順がデフォルトに戻ります。

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