Home Linux Commandline Tips How to Find User’s Home Directory in Linux or Unix

How to Find User’s Home Directory in Linux or Unix

Under a Linux operating system distribution environment, a created/existing system user is associated with a Home directory. The configuration of the Home directory ensures that the files belonging to the currently active Linux user are only accessible to that user unless this user switches to another user account where they will access the Home directory of that switched user.

The files under a Linux Home user directory are specific to the currently active users. The base directory of the Linux operating system is the root (/) directory.

It is from the root (/) directory that we should be able to access the Home (/home) directory.

$ cd /
$ cd /home

If you only have a single active user on your Linux operating system environment, dealing with the Home directory is straightforward. The latter statement implies that every created/existing Linux user will have their system username as a directory name under this Linux Home directory.

For instance, listing the directories in the above Home directory lists three other directories to imply that the Linux operating system in question hosts 3 three users.

$ ls -l
View Linux Home Directory
View Linux Home Directory

If we decide to navigate into either of the above Linux user folders, we should first be able to meet the following prerequisite.

  • You are a sudoer/root user of the Linux operating system distribution you are using.

It is only by being a sudoer/root user that we can be able to navigate into other Linux users’ Home directories without bumping into permission/access barriers.

$ ls -l dnyce
View User Home Directory
View User Home Directory

From the above display, we have managed to navigate to the Home directory and list the files, folders, and directories associated with user dnyce whose user directory exists within the Home (/home) directory.

The above screen capture also reveals to us the different file permissions associated with the listed files, folders, and directories. The file permissions starting with – e.g –rw-rw-r--, imply that we are dealing with a file and the file permissions starting with d e.g drwxr-xr-x, imply that we are dealing with a folder or directory.

Ways to Find User’s Home Directory in Linux

Before we look at some viable approaches to finding a user’s home directory in Linux, it is important to understand why the Home directory exists. This directory helps differentiate system-wide data from user data such that we do not have to deal with redundancy. Also, important file backup operation becomes flawless.

Navigating to the Home Directory Traditionally

You first need to be sure that the Linux user exists. This approach is a summary of the above-discussed content.

$ cd /home/username 

The tilde (~) symbol indicates that we are at the home directory of the currently active user.

Find User Home Directory
Find User Home Directory

The Linux user’s home directory contains directories like Documents, Downloads, Music, Pictures, and Public.

Find User’s Home Directory Using Cd Command

Executing the cd (change directory) command alone should take you to the home directory of the current Linux user.

$ cd
Find User Home Directory
Find User Home Directory

Another approach is to use cd + tilde (~) should navigate us to the Home directory of the currently logged-in user.

$ cd ~
Switch to User Home Directory
Switch to User Home Directory

You can also use $HOME command, which takes you to the Home directory as a variable.

$ cd $HOME

Not only do we understand the concept of the Linux user’s home directory, but we can navigate to it from any directory path.

Ravi Saive
I am an Experienced GNU/Linux expert and a full-stack software developer with over a decade in the field of Linux and Open Source technologies. Founder of TecMint.com, LinuxShellTips.com, and Fossmint.com. Over 150+ million people visited my websites.

Each tutorial at UbuntuMint is created by a team of experienced writers so that it meets our high-quality standards.

Was this article helpful? Please add a comment to show your appreciation and support.

Got something to say? Join the discussion.

Thanks for choosing to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and your email address will NOT be published or shared. Please Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.