简体   繁体   中英

how to display files with permission number in mac terminal?

I have tried:

stat -c '%a %n' *

this does display what I want, but this runs in amazon ec2.

Im running on my mac, when I tried to run:

sh-3.2# stat -c '%a %n' *
stat: illegal option -- c
usage: stat [-FlLnqrsx] [-f format] [-t timefmt] [file ...]
sh-3.2# 

The format that I would like to see is:

755 app
644 artisan
755 bootstrap
644 composer.json
644 composer.lock
755 config
755 credentials
755 database
644 package.json
644 package-lock.json
644 phpunit.xml
755 public
755 resources
755 routes
644 server.php
777 storage
755 tests
755 vendor
644 webpack.mix.js
777 worker.log
644 yarn.lock

This displays if I used this command stat -c '%a %n' * in AWS ec2 linux instance.

Hopefully this will work for you:

stat -f "%p %N" * | awk '{$1=substr($1,length($1)-2)}1'
755 Benchmark
755 BoundedBuffer
755 CImgGenerateVideo
755 CImgInterpolate
755 Flask
755 Folder
644 LUT.png
755 Mosquitto
644 MrBean.jpg
755 ThreadSync
644 URLs.txt

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM