Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

List multiple files in multiple locations?

Status
Not open for further replies.

Stinney

IS-IT--Management
Nov 29, 2004
2,028
0
36
US

I'm just starting out with trying to manage a Sun box.

Is there an easy way I could list all login.profile for all users in the /export/home directory so I can see the last modified date of the file and not have to look at each one individually?

I've gotten an output of all users and when they last logged in, but don't want to manually look at each modification date on the login.profile file to see when it was created. I just want to avoid removing someone's login if it was recently created, but they haven't had a chance to login yet.

- Stinney

Favorite all too common vendor responses: "We've never seen this issue before." AND "No one's ever wanted to use it like that before.
 
From /export/home:

find . -name '.profile' -exec ls -la \;

to see the details you require

I want to be good, is that not enough?
 
Here is my '2-pennyworth'.

>> Is there an easy way I could list all login.profile for all users in the /export/home directory ...

Yes, something like:

find /export/home -name "login.profile" -ls

>> I just want to avoid removing someone's login if it was recently created, but they haven't had a chance to login yet.

Please be careful. 'Creation date' of a file is not recorded on (most) UNIX systems - only latest 'Modification date/time' and 'Access date/time' is kept. Also the login.profile file may not be changed every time a user logs in (I would agree that the file should have its access time updated because it would be run as a script at login).

I hope that helps.

Mike
 

Ken, your suggestion seemed to work, however, it created a never ending loop of the find command and I couldn't abort the process.

Mike, your suggestion worked well. I added a cut statement to narrow down the length of the line returned and have what I need.

I should be okay with what I'm trying to do. I've created a list of every user and when they have last logged into the system, using the following command:

finger `sort /etc/passwd | cut -f1 -d":"` | grep -i log

I have quite a few user names that have never logged in. If the user was just created within the past month the date of the local.login will be a more recent date. For anyone that has never logged in and the file date is 6+ months ago, I'm confident that I can remove their login.

- Stinney

Favorite all too common vendor responses: "We've never seen this issue before." AND "No one's ever wanted to use it like that before.
 
Glad you're getting there. As far as I can see there's no way my version should cause an infinite loop!

I want to be good, is that not enough?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top