nixCraft Linux Forum

nixCraft

Linux Tech Support Forum

find out info. reg. files for each user in the system

This is a discussion on find out info. reg. files for each user in the system within the Solaris/OpenSolaris forums, part of the UNIX operating systems category; 1) I have a requirement where in I need to find and sort files user wise in a folder. The ...


Go Back   nixCraft Linux Forum > UNIX operating systems > Solaris/OpenSolaris

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 09-12-2005, 03:14 PM
ganes
Guest
 
Posts: n/a
Default find out info. reg. files for each user in the system

1) I have a requirement where in I need to find and sort files user wise in a folder. The files can be situated in any subfolder that may also be hidden.
The files then need to be sorted according to size and date of creation.

2) Can we find out files for users who's entry is not there in /etc/passwd.
Reply With Quote
  #2 (permalink)  
Old 09-13-2005, 02:09 PM
monk's Avatar
Senior Member
User
 
Join Date: Jan 2005
Location: Tibet
My distro: Debian GNU/Linux
Posts: 479
monk is an unknown quantity at this point
Default Re: find out info. reg. files for each user in the system

Quote:
1) I have a requirement where in I need to find and sort files user wise in a folder. The files can be situated in any subfolder that may also be hidden. The files then need to be sorted according to size and date of creation.
You can use sort and ls command to do the task. Are you on solaris or linux? Then I can give you command

Quote:
2) Can we find out files for users who's entry is not there in /etc/passwd.
All users must have entry in /etc/passwd.. then users can login in and create files. So some sort of user always needed to create file ownership.
Reply With Quote
  #3 (permalink)  
Old 09-14-2005, 10:54 AM
ganes
Guest
 
Posts: n/a
Default

I am working on Solaris 9.0
Can I use sort for the any field.
I have seen many files that are situated somewhere on the system and are owned by users who's IDs are either deleted or suspended. Can we find out these files by comparing the user validity in /etc/passwd.
Reply With Quote
  #4 (permalink)  
Old 09-15-2005, 12:53 AM
monk's Avatar
Senior Member
User
 
Join Date: Jan 2005
Location: Tibet
My distro: Debian GNU/Linux
Posts: 479
monk is an unknown quantity at this point
Default

Quote:
Originally Posted by ganes
I am working on Solaris 9.0
Can I use sort for the any field.
I have seen many files that are situated somewhere on the system and are owned by users who's IDs are either deleted or suspended. Can we find out these files by comparing the user validity in /etc/passwd.
Oh ok I got it your question, here is what you need to do:
You can pass the -nouser -nogroup option to find command:

Display list of files/dirs where user/group does not exists in (user) /etc/passwd (group) /etc/group file
Code:
find / -nouser -nogroup -print
Or better find out all files/dirs and save all such files to nouser.txt file
Code:
find /home -nouser -nogroup  >nousers.txt
Let us come to sorting question
Use ls command, under solaris the output is sorted alphabetically by default.
No UNIX and Linux OS stores the date of creation. They only stores the access/modification time so you cannot find out date of creation, however you can get the last accessed/modification date/time stamp via ls -c command.

If you have a GNU find command then you can also try following else use above command on Solaris:
Code:
find /home -nouser -nogroup  -fprint nousers.txt
Reply With Quote
  #5 (permalink)  
Old 09-15-2005, 06:54 PM
ganes
Guest
 
Posts: n/a
Default

thanks,
agreed...but can I sort ...say ...the output of ls -al, user wise and then save file entries for every user in a seperate file..so I can have disk usage status of every user in that folder.

this would be a great help....

ganesh.
Reply With Quote
  #6 (permalink)  
Old 09-20-2005, 06:45 PM
rockdalinux's Avatar
Contributors
User
 
Join Date: May 2005
Location: Bangalore
My distro: RHEL, HP-UX, Solaris, FreeBSD, Ubuntu
Posts: 521
rockdalinux is on a distinguished road
Default

cant u use ls command?

ls -al | sort -n +{FIELD}
__________________
Rocky Jr.
You may have my body & soul, but you will never touch my pride!

If you have knowledge, let others light their candles at it.

Certified to work on HP-UX / Sun Solaris / RedHat
Reply With Quote
  #7 (permalink)  
Old 09-20-2005, 06:49 PM
rockdalinux's Avatar
Contributors
User
 
Join Date: May 2005
Location: Bangalore
My distro: RHEL, HP-UX, Solaris, FreeBSD, Ubuntu
Posts: 521
rockdalinux is on a distinguished road
Default

Just read man pages of ls and sort. Do u wanna output sorted just home dir wise or what?
__________________
Rocky Jr.
You may have my body & soul, but you will never touch my pride!

If you have knowledge, let others light their candles at it.

Certified to work on HP-UX / Sun Solaris / RedHat
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

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
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads

Thread Thread Starter Forum Replies Last Post
howto get my cpu info on linux system? chiku Linux software 4 05-20-2008 08:06 PM
UNIX command to find out whether particular process of a particular user is running Santosh Sharma Shell scripting 1 01-17-2008 03:26 PM
can not find user name in /etc/passwd file subrata1in Linux software 2 03-26-2007 10:44 AM
Linux find and delete files cbzee Linux software 4 12-20-2006 12:01 PM
USER INFO asim.mcp Linux software 1 08-09-2006 03:18 AM


All times are GMT +5.5. The time now is 12:43 AM.


Powered by vBulletin® Version 3.7.2 - Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO 3.1.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30