Latest LQ Deal: Linux Power User Bundle
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 06-03-2010, 06:44 AM   #1
Registered: Nov 2006
Posts: 47

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


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


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

Rep: Reputation: 92

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, 06:20 PM   #3
Registered: Mar 2008
Location: N. W. England
Distribution: Mandriva
Posts: 346

Rep: Reputation: 152Reputation: 152
The output of GNU Coreutils 'stat' can be formated using the '-c' option.
stat -c '%a' file.ext

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


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 10:36 AM
show line numbers in vi swamprat Linux - Newbie 1 12-28-2008 05:55 PM
laptop keyboard annoying numlock making letters become numbers linuxmandrake Linux - Hardware 5 10-13-2007 11:36 AM
LXer: Google mixes up letters and numbers LXer Syndicated Linux News 0 10-12-2006 12:54 PM
Numbers instead of letters on IBM TrackPoint Keyboard / FC3 kalico Linux - Hardware 0 09-12-2006 05:13 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:52 AM.

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