Home Man
Search
Today's Posts
Register

BSD, Linux, and UNIX shell scripting — Post awk, bash, csh, ksh, perl, php, python, sed, sh, shell scripts, and other shell scripting languages questions here.

Script to find the user of a file and permissions

Tags
shell scripts

Login to Reply

 
Thread Tools Search this Thread
# 1  
Old 08-12-2010
Script to find the user of a file and permissions

I have a list of files in a.txt file. For each of the files listed in that file, I would like to obtain the owner of the file and also, the permissions associated with that file.
If possible, the group the owner belongs to as well.
Can someone help me with a script to find that out.
# 2  
Old 08-12-2010
Assuming you use a Bourne-type shell and that a.txt is a normal unix format text file with each line containing only a filename.

Code:
cat a.txt | while read filename
do
       ls -lad "${filename}"
done

Or

Code:
while read filename
do
      ls -lad "${filename}"
done < a.txt

Login to Reply

« Previous Thread | Next Thread »
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Script without execute permissions will work for a user? MSK_1990 UNIX for Dummies Questions & Answers 2 07-21-2015 07:56 AM
Script for adding users to file permissions Stu Loventhal Shell Programming and Scripting 2 04-09-2014 05:39 PM
Script for adding users to file permissions Stu Loventhal Windows & DOS: Issues & Discussions 2 04-09-2014 02:23 PM
Script to give a user sudo permissions Revanth547 Shell Programming and Scripting 6 06-21-2013 01:09 AM
Changing file permissions of a file created by another user qwertyu Shell Programming and Scripting 3 01-09-2013 09:40 AM
File permissions for particular user karumudi7 Shell Programming and Scripting 4 08-06-2012 03:47 PM
How to check file permissions from a script. rajkumar_g Shell Programming and Scripting 1 11-11-2010 04:08 AM
permissions to create log file from script cesarNZ Shell Programming and Scripting 3 06-09-2009 11:43 AM
How to find a user's file permissions ram123 UNIX for Dummies Questions & Answers 9 03-19-2009 02:29 PM
How to find permissions/roles/priveleges of User hardesh UNIX for Advanced & Expert Users 1 09-27-2005 09:22 AM


All times are GMT -4. The time now is 06:58 PM.

Unix & Linux Forums Content Copyright©1993-2018. All Rights Reserved.
UNIX.COM Login
Username:
Password:  
Show Password