LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Closed Thread
 
Search this Thread
Old 03-14-2008, 06:41 PM   #1
linux_linux
Member
 
Registered: Mar 2008
Posts: 52

Rep: Reputation: 15
BASH (Linux) - View file permission


Making a simple script

I know how to change file permissions - but how do I view them (what command)?
 
Old 03-14-2008, 06:45 PM   #2
jailbait
Guru
 
Registered: Feb 2003
Location: Blue Ridge Mountain
Distribution: Debian Wheezy, Debian Jessie
Posts: 7,476

Rep: Reputation: 156Reputation: 156
Quote:
Originally Posted by linuxexpert View Post
Making a simple script

I know how to change file permissions - but how do I view them (what command)?
ls -l /path/filename

------------------
Steve Stites
 
Old 03-15-2008, 12:20 AM   #3
konsolebox
Senior Member
 
Registered: Oct 2005
Distribution: Gentoo, Slackware, LFS
Posts: 2,245
Blog Entries: 15

Rep: Reputation: 233Reputation: 233Reputation: 233
some of the commands to check file permissions using the test command are:
if [ opt "file" ]; then
echo "file is what opt tells it is"
fi

where opt can be
-r (readable)
-x (executable)
-w (writable)

do man bash for other options
 
Old 03-15-2008, 01:50 AM   #4
matthewg42
Senior Member
 
Registered: Oct 2003
Location: UK
Distribution: Kubuntu 12.10 (using awesome wm though)
Posts: 3,530

Rep: Reputation: 62
If the permissions are for a directory, you will want to add the -d option to the ls command above (else ls will look at all the contents of the directory, not the directory itself), e.g. to look at the permissions on the /etc directory:
Code:
ls -ld /etc
 
Old 03-15-2008, 09:42 PM   #5
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,965
Blog Entries: 11

Rep: Reputation: 865Reputation: 865Reputation: 865Reputation: 865Reputation: 865Reputation: 865Reputation: 865
I'd like to discourage members to respond to these posts.
This is the product of a SPAM bot.
 
  


Closed Thread


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
command to view permission of directories babu198649 Linux - Newbie 9 10-27-2007 07:56 AM
LXer: Decompile .chm file to view as html file under Linux LXer Syndicated Linux News 0 01-28-2007 01:03 AM
You dont have permission to view this server! Alexander.s Linux - Software 2 04-25-2005 04:45 PM
view the linux file system... cyberfox1234 Linux - General 2 12-22-2004 08:30 AM


All times are GMT -5. The time now is 06:19 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