0

alternate command for ls to view permission in linux

what is the alternate command to view the permission for the files or directories in linux other than ls - l command. i.e, i need to view the permission with value

Example:

# ls -l
drwxr-xr-x. 2 root root 4096 Mar 22 12:23  testing

Here, its displayed as drwx but i need 755. Is it possible??

cameron
asked May 15, 2017
1 Answer
0

Possible by using stat command. Its called statistics command which helps to show you the details of files or directories. And also it will show you the values of permission as 755 as required.

Assume if you have test.txt file and test1 directory with 755 permission,

#  stat test.txt
File: `test.txt'
  Size: 14            Blocks: 8          IO Block: 4096   regular file
Device: 802h/2050d    Inode: 422047      Links: 1
Access: (0755/-rwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2017-05-12 15:19:16.783003936 +0530
Modify: 2017-05-12 15:19:14.298004007 +0530
Change: 2017-05-12 15:19:14.298004007 +0530

For directory,

# stat test1
File: `test1'
  Size: 4096          Blocks: 8          IO Block: 4096   directory
Device: 802h/2050d    Inode: 435519      Links: 3
Access: (0755/drwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2017-05-15 16:57:20.651996368 +0530
Modify: 2016-06-27 20:29:55.469998032 +0530
Change: 2016-06-27 20:29:55.469998032 +0530
View More
jagannatharumugam
answered May 15, 2017
Your Answer
||||
x
 
100:0