How to access other users' files via Terminal in OS X?

I am an admin that wants to access other users' files. How to do this via the Terminal?


As stated by patrix: the personal files of other user's on the same machine are generally stored in the /Users/<username> folder for each user. The permissions on these folders are usually set such that they are private to the individual who owns the files.

This means you need to use sudo to elevate your own access levels in order to see their files. If you are truly an admin, using sudo is something that's ok, but do so with caution. If you are not an admin then you shouldn't have the proper sudo privileges to do any of this and your repeated attempts to use sudo are logged in the system access log.

To simply list files in another user's home directory (let's call them bob) you do:

sudo ls ~bob

The ~ prefix is POSIX shorthand for "home directory of...". To browse freely, you can become that user with sudo like so:

sudo su - bob

This makes you bob, logged in as bob and in bob's home directory. You can now move around, cat files, open files, etc. as bob.


The home folders of all users are stored in /Users. Assuming you have the technical and legal rights to access files of other users, you can do this by changing into their home folder (cd /Users/joe or cd ~joe) and accessing the files there.