# Navigating to Your Home Folder on Linux


When you first log in to a Linux system, you are taken to your personal home folder. This folder is specific to your user account and is where you can store all your personal files and directories.

But there may be times when you navigate away from your home folder and want to get back to it quickly. Here are the most common ways to return to your home folder on Linux.

## Use the cd command

The easiest way to get back to your home directory is to use the `cd` command without any arguments:

```plaintext
cd
```

This will immediately take you back to your personal home folder regardless of what directory you are currently in. The `cd` command works for any shell including Bash, Zsh, etc.

## Use the ~ shortcut

Another quick way to return home is to use the `~` shortcut:

```plaintext
cd ~
```

The tilde `~` character is a special symbol that expands to your home directory path. So `cd ~` does the same thing as running `cd` by itself.

This shortcut works in any shell and any directory. It's often faster to type than plain `cd` command.

## Use the $HOME variable

You can also leverage the `$HOME` environment variable that points to your home directory:

```plaintext
cd $HOME
```

This method has the same end result but lets you use the predefined `$HOME` variable rather than a special shortcut.

## Set your home folder as CDPATH

For Bash users, you can set your home directory as your `CDPATH`. This makes Bash look in your home folder first when using shorthand paths:

```plaintext
CDPATH=$HOME
cd Documents
```

Now you can use relative paths and Bash will first look in your home folder before searching systemwide.

## Add shortcuts to config files

Most shells allow you to create custom shortcuts or aliases in your config files.

For example, in your `.bashrc` you could add:

```plaintext
alias hom='cd ~'
```

Then instead of `cd ~` you can simply type `hom` to return home. Create whatever shortcut names you prefer to make navigation easier.

%[https://developnsolve.com/comparing-directories-on-linux]

## Set your prompt to show directories

Rather than memorize shortcuts, you can configure your shell prompt to always display your current directory.

Just adding `\w` to `PS1` will print your working directory at the prompt. You'll always know exactly where you are and can quickly orient yourself.

## Use pushd and popd

Bash also includes a stack system for easily moving back and forth between directories.

The `pushd` command saves your current directory onto a stack list for later, while immediately taking you to a new location.

Then `popd` brings you back to the previous directory that you pushed:

```plaintext
pushd /etc

# do work in /etc

popd # returns to original dir
```

By chaining `pushd` and `popd` you can quickly navigate in and out of folders without worrying about your place.

## Set a keybinding to jump home

If available, you can also set a custom keybinding to instantly snap back home without typing any commands.

Just press the key and immediately jump to your home folder from anywhere in the file system.

%[https://developnsolve.com/deleting-non-empty-directories-in-linux]

## Conclusion

Navigating directories is a core Linux skill. No matter where you wander off to, remembering these tips will swiftly take you back to your familiar home folder.

Whether you leverage shortcuts like `~`, variables like `$HOME`, commands like `pushd/popd`, config tricks for your shell prompt and aliases, or desktop bindings, there are plenty of approaches to ensure quick homeward access.

Master a few favorites and work will proceed smoothly as you effortlessly bounce your terminal back home base.

The key is setting up navigation that fits both your particular workflow and mental model. With the console agility to comfortably get to your files and folders, you can focus energy on the actual tasks instead of just finding your way. Moving between paths is then barely a context switch rather than a distracting roadblock.

And if all else fails, the plain `cd` command has your back, instantly teleporting you home with one quick unadorned call.

