Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

List orphans home directories on AIX.

Posted on 2010-11-18
3
Medium Priority
?
671 Views
Last Modified: 2013-11-17
Hi
I want to list the orphans home directories on our AIX's servers. You know when you delete a user but no its home, this directory remains in /home. All these folders are the ones I want to delete. I'd like to compare the home's directories with the stanza home= from lsuser output.

Thanks.
0
Comment
Question by:sminfo
  • 2
3 Comments
 
LVL 68

Expert Comment

by:woolmilkporc
ID: 34163002
Hello again,

A fast way:

for HOME in $(lsuser -a home ALL | cut -f2 -d"="); do [ ! -d $HOME ] && echo "Directory $HOME does not exist"; done

If you want to get the username listed as well please let me know!

wmp

0
 
LVL 68

Accepted Solution

by:
woolmilkporc earned 2000 total points
ID: 34163029
The same check ex negativo:

for HOME in $(ls -d /home/*); do [ $(grep -c $HOME /etc/passwd) -eq 0 ] && echo "User of $HOME does not exist"; done
0
 

Author Closing Comment

by:sminfo
ID: 34163063
The second one. :-)

Thanks!!
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java performance on Solaris - Managing CPUs There are various resource controls in operating system which directly/indirectly influence the performance of application. one of the most important resource controls is "CPU".   In a multithreaded…
Every server (virtual or physical) needs a console: and the console can be provided through hardware directly connected, software for remote connections, local connections, through a KVM, etc. This document explains the different types of consol…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Suggested Courses

972 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question