how to obtain list of users
Category: UNIX-Unix Beginner
how to obtain list of users ?
how to obtain list of users found in /home/ and append it to a file.
in case your machine is not an network, you can get the list of users from /etc/passwd file
in case of nfs,try ypcat passwd
also try ls -ld /home/*/
thanks,
nagarajan ganesan
thanks nagarajan but i cannot append it to file .is it because am using putty.i want the users append to a file.
you use putty to connect to the unix box from the windows client? if so then shouldn't be a problem.
what is the error you get when u try to output the results to a file?
thanks
nagarajan ganesan
it gives me the followin error msg
-bash : permission denied
am using
ls -l >>
ls-l and ls -ld/home/*/ r giving the same output so used ls-l
kind regards
it seems that you dont permisson to the directory where you are creating the outfile.
check if the current directory from which you tried to run the command,has the write access or create the output to the some other directory to which you have write access.
you could try writing it to either some directory under your home or use /tmp
ls -ld /home/*/ > /tmp/outfile
(or)
ls -ld /home/*/ > /home/
thanks
nagarajan ganesan.
hi ganeshan,
i'm appending the list of users to a file which i have created and the list of users
donot have permission to group and others.so i guess becoz of tht i'm not able to accomplish it.
thanks for ur time ganeshan
at this system that i am using, this gives me the list of users appended in a file:
code:
ls -ld /home/* | cut -c 17-24 | sort | uniq >> filename
columns 17 to 24 may vary depending on the output of ls -ld at your system
