Solved

List orphans home directories on AIX.

Posted on 2010-11-18
3
661 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 500 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Unix Command -- Challenging  question 7 106
UNIX SCP 5 96
Unix Script: Loop over all days of a month 17 132
umask commands 5 15
In tuning file systems on the Solaris Operating System, changing some parameters of a file system usually destroys the data on it. For instance, changing the cache segment block size in the volume of a T3 requires that you delete the existing volu…
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…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
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.

738 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