Get file permissions
Moderator: General Moderators
-
alex.barylski
- DevNet Evangelist
- Posts: 6267
- Joined: Tue Dec 21, 2004 5:00 pm
- Location: Winnipeg
Get file permissions
Is there a linux command which return just that? Or do I have to rely soley on "ls"?
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
Code: Select all
ls -l filename | cut -f 1 -d" "
# or
stat -c"%A" filename
-
alex.barylski
- DevNet Evangelist
- Posts: 6267
- Joined: Tue Dec 21, 2004 5:00 pm
- Location: Winnipeg
Maybe I'm missing something...but
I don't want to use 'ls' because I am calling these programatically from within PHP and I need the permissions ONLY. When you use ls -a you get a hodge podge of other stuff. I don't want to rely on parsing the listings because my research tells me the format varies from machine to machine...
Thus the reason I wanted to know if there was a command which I could use which would return nothing but permissions...
Perhaps stat would work.
Thanks anyways
I don't want to use 'ls' because I am calling these programatically from within PHP and I need the permissions ONLY. When you use ls -a you get a hodge podge of other stuff. I don't want to rely on parsing the listings because my research tells me the format varies from machine to machine...
Thus the reason I wanted to know if there was a command which I could use which would return nothing but permissions...
Perhaps stat would work.
Thanks anyways