How can I list all user names and/or home directories?
20
votes
4
answers
66721
views
I want to list all the users’ directories on the machine. Usually, I will do:
ls -l /home
But I use it in a script that will be deployed on others’ machines and maybe on those machines they don't call it home (e.g. myHome).
So I want to generalize it to
ls -l ~
. But it just lists my user’s home directory instead of all users’ home directories (basically I want to get a list of the users’ names on the machine).
How can I generalize it?
Asked by lakerda
(355 rep)
Dec 7, 2017, 07:50 AM
Last activity: Sep 5, 2022, 03:13 PM
Last activity: Sep 5, 2022, 03:13 PM