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


Closed Thread
  Search this Thread
Old 03-14-2008, 06:41 PM   #1
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
LQ Guru
Registered: Feb 2003
Location: Blue Ridge Mountain
Distribution: Linux Mint 17, Debian 8
Posts: 7,863

Rep: Reputation: 311Reputation: 311Reputation: 311Reputation: 311
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
Senior Member
Registered: Oct 2005
Distribution: Gentoo, Slackware, LFS
Posts: 2,248
Blog Entries: 8

Rep: Reputation: 235Reputation: 235Reputation: 235
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"

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

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

Rep: Reputation: 63
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:
ls -ld /etc
Old 03-15-2008, 09:42 PM   #5
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
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 > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 09:54 PM.

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