Link to home
Start Free TrialLog in
Avatar of XK8ER
XK8ERFlag for United States of America

asked on

centos see file permissions

hello there,
im using centos v5.7 and normally when I try to see the file permission I see
drwxr-xr-x how can I see the number instead? like 0777 or 0600

[(12:26 PM)][(root@alpha)] [(~)] $ ls -alh
total 208K
drwxr-x--- 14 root  root  4.0K Sep 30 03:39 .
drwxr-xr-x 26 root  root  4.0K Sep 14 20:36 ..
-rw-r--r--  1 root  root   315 Sep 30 03:39 a.php
-rw-------  1 root  root  8.4K Sep 30 04:41 .bash_history
-rw-r--r--  1 root  root    24 Jan  6  2007 .bash_logout
-rw-r--r--  1 root  root   276 Feb  1  2009 .bash_profile
-rw-r--r--  1 root  root  5.4K Mar 19  2009 .bashrc        
Avatar of rindi
rindi
Flag of Switzerland image

In my point of view, although it might be a "cheat" or "workaround", would be to start mc (midnight commander), set one panel to "info", and in the other highlight the file or folder you need the info on, and it will be displayed in the panel you have set to "info". This is one of the best tools available in the 'nix world, and I can't understand why it isn't included by default in every Linux distro. If you don't have it, just install it with yum install mc.
stat -c "%a %n" /folder/*
jgiordano is correct, stat will do just that.

To mimic your 'ls' output, you can add a few more colums:

stat -c "%a %h %G %U %s %n" *

Open in new window

Avatar of XK8ER

ASKER

gerwinjansen, that works nicely..
what is the number 1 right next to the permissions and how can I display the size in human readable
The number 1 you mean is the amount of hard links to that file.

I'm not sure what you mean by 'human readable', the file size is displayed in bytes, do you require some other format? You can have a look in the stat man pages (man stat), only field available for size is 'bytes'. You can do some formatting afterwards but what do you want exactly?
Avatar of XK8ER

ASKER

when you do
du -h /root
you can see KB or MB or GB in bytes its hard to know the size
I understand, do you want to see the size of the files in KB? du -h is showing file size in KB.
Avatar of XK8ER

ASKER

yes KB is fine
ASKER CERTIFIED SOLUTION
Avatar of Gerwin Jansen
Gerwin Jansen
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial