LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 09-21-2009, 09:17 AM   #1
dudepigeon
LQ Newbie
 
Registered: Jul 2009
Posts: 2

Rep: Reputation: 0
Determining a file/directory permissions


I am writing a bash script which will set permissions (chmod/chgrp/chown) on various files and directories on a Linux system. I would ike to be able to determine and save the settings of the file/directory before I change it so I can rollback the changes if there is a problem.

So my question is this - is there a way I can determine the octal setting of a file or directory? Something where I can enter the file in question and get the permissions in numeric form back?

thanks
 
Old 09-21-2009, 10:02 AM   #2
Meson
Member
 
Registered: Oct 2007
Distribution: Arch x86_64
Posts: 606

Rep: Reputation: 67
Code:
stat -c "%a %n" *
 
Old 09-21-2009, 01:23 PM   #3
slakmagik
Senior Member
 
Registered: Feb 2003
Distribution: Slackware
Posts: 4,113

Rep: Reputation: Disabled
You might also be interested in David Ross' script.
 
  


Reply



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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
File permissions v. directory permissions Completely Clueless Linux - Newbie 7 07-09-2009 08:33 AM
File/Directory Permissions waynevnc Debian 1 05-23-2005 04:23 PM
Permissions, File, Directory access tHcnunz Linux - Newbie 3 03-26-2004 09:25 AM
File and Directory permissions plasmapudding Red Hat 3 09-09-2003 10:26 AM
Directory and file permissions ryan Linux - Security 2 12-06-2000 12:46 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

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

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration