Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

centos see file permissions

Posted on 2011-09-30
9
Medium Priority
?
493 Views
Last Modified: 2013-12-15
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        
0
Comment
Question by:XK8ER
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
9 Comments
 
LVL 88

Expert Comment

by:rindi
ID: 36893029
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.
0
 
LVL 11

Expert Comment

by:jgiordano
ID: 36893092
stat -c "%a %n" /folder/*
0
 
LVL 38

Expert Comment

by:Gerwin Jansen, EE MVE
ID: 36894589
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

0
NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

 
LVL 1

Author Comment

by:XK8ER
ID: 36894930
gerwinjansen, that works nicely..
what is the number 1 right next to the permissions and how can I display the size in human readable
0
 
LVL 38

Expert Comment

by:Gerwin Jansen, EE MVE
ID: 36895689
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?
0
 
LVL 1

Author Comment

by:XK8ER
ID: 36895704
when you do
du -h /root
you can see KB or MB or GB in bytes its hard to know the size
0
 
LVL 38

Expert Comment

by:Gerwin Jansen, EE MVE
ID: 36896180
I understand, do you want to see the size of the files in KB? du -h is showing file size in KB.
0
 
LVL 1

Author Comment

by:XK8ER
ID: 36897106
yes KB is fine
0
 
LVL 38

Accepted Solution

by:
Gerwin Jansen, EE MVE earned 2000 total points
ID: 36897482
awk will do the trick, please test this on your system:

stat -c "%a %h %G %U %s %n" * | awk '{ $5=sprintf ( "%.0fK", $5/1024);print $0 }'

Open in new window

If it works, you can create a shell script like ~/bin/lstat containing the above command line.
0

Featured Post

Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Over the last ten+ years I have seen Linux configuration tools come and go. In the early days there was the tried-and-true, all-powerful linuxconf that many thought would remain the one and only Linux configuration tool until the end of times. Well,…
Setting up Secure Ubuntu server on VMware 1.      Insert the Ubuntu Server distribution CD or attach the ISO of the CD which is in the “Datastore”. Note that it is important to install the x64 edition on servers, not the X86 editions. 2.      Power on th…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Suggested Courses

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question