Wednesday 19 November 2008

Print a process tree in UNIX

To print a process tree:

ps -ejH xx (where xx is the pid)
ps axjf xx (where xx is the pid)

or in solaris

pstree xx (where xx is the pid0

Tuesday 18 November 2008

How to read a text file into a command

so you have a text file (users.txt) and you want to read that into a script that prints out the users status using the getent command

while read line
do
getent passwd | $line
done < users.txt

and thats it!