LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 06-03-2010, 05:44 AM   #1
tirengarfio
Member
 
Registered: Nov 2006
Posts: 45

Rep: Reputation: 15
Any way to show the permissions with numbers instead of with letters?


Hi,

any way to show the permissions with numbers (777) instead of with letters (drwxrwxrwx) using "ls" command or any other command ?

Regards

Javi
 
Old 06-03-2010, 05:56 AM   #2
alli_yas
Member
 
Registered: Apr 2010
Location: Johannesburg
Distribution: Fedora 14, RHEL 5.5, CentOS 5.5, Ubuntu 10.04
Posts: 559

Rep: Reputation: 91
Hi

Not that I'm aware off.

It's pretty easy to convert though.

Basically think of each triplet (owner is a triplet, group is a triplet and anonymous is a triplet) as an octal number. Then in the triplet you have either a - or one of r, w or x . Think of a - as being a zero and a r, w or x as being a 1.

Lastly, in the triplet, each position represents 421 in that order (so r is a 4, w is a 2 and x is a 1); so rwxrwxrwx is basically 421421421 - to convert to the decimal representation you just add the elements of each triplet.

Thus a listing like rwxr-xr-x translates into a 755. Kinda tricky but you'll get the hang of it
 
Old 06-03-2010, 05:20 PM   #3
Kenhelm
Member
 
Registered: Mar 2008
Location: N. W. England
Distribution: Mandriva
Posts: 329

Rep: Reputation: 140Reputation: 140
The output of GNU Coreutils 'stat' can be formated using the '-c' option.
http://www.gnu.org/software/coreutil...tat-invocation
Code:
stat -c '%a' file.ext
644

stat -c '%n %a' file.ext
file.ext 644

stat -c 'The access rights in octal of %n are %a' file.ext
The access rights in octal of file.ext are 644
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do i make a script that checks that my input is letters or numbers ? ministeren Programming 13 05-20-2010 09:36 AM
show line numbers in vi swamprat Linux - Newbie 1 12-28-2008 04:55 PM
laptop keyboard annoying numlock making letters become numbers linuxmandrake Linux - Hardware 5 10-13-2007 10:36 AM
LXer: Google mixes up letters and numbers LXer Syndicated Linux News 0 10-12-2006 11:54 AM
Numbers instead of letters on IBM TrackPoint Keyboard / FC3 kalico Linux - Hardware 0 09-12-2006 04:13 PM


All times are GMT -5. The time now is 08:38 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration