Back

Explore Courses Blog Tutorials Interview Questions
0 votes
1 view
in Linux by (18.4k points)

While listing a directory can I view numerical Unix permissions such as 644 rather than the symbolic output 

-rw-rw-r--

1 Answer

0 votes
by (36.8k points)

Use the below code:

 ls -l | awk '{k=0;for(i=0;i<=8;i++)k+=((substr($1,i+2,1)~/[rwx]/) \

             *2^(8-i));if(k)printf("%0o ",k);print}'

To know about Linux join the Linux Course

 Do check out the video below

Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
asked Nov 30, 2020 in Linux by dev_sk2311 (43.2k points)
0 votes
1 answer
asked Nov 30, 2020 in Linux by dev_sk2311 (43.2k points)
0 votes
1 answer
asked Dec 20, 2020 in Linux by blackindya (18.4k points)
Welcome to Intellipaat Community. Get your technical queries answered by top developers!

28.4k questions

29.7k answers

500 comments

94.1k users

Browse Categories

...