How to use the SSH pwd command
Learning how to use the SSH pwd command is one of the first steps to feeling comfortable in the Linux terminal. The pwd command prints your current location in the file system, so you always know exactly where you are before running other commands. In this article, we will show you how to use the SSH pwd command with clear, practical examples.
How to use the SSH pwd command
In short, pwd stands for “print working directory”. To get started, connect to your account over SSH, then run the examples below to confirm your current path.
Basic pwd usage
First, run the command on its own. It returns the full path of the folder you are currently in:
pwdFor example, the output might look like /home/user/public_html. This is helpful right after you log in or move between folders with cd.
Physical vs. logical path
Next, if your current folder is reached through a symbolic link, two flags give you different results. Use -L to show the logical path (the default) or -P to show the real, physical path:
pwd -L
pwd -PUse pwd in scripts
Finally, pwd is handy inside shell scripts when you need to store or display the current directory. You can capture it in a variable and reuse it later:
current=$(pwd)
echo "You are in: $current"Because pwd only reads information and never changes anything, it is completely safe to run at any time. It pairs naturally with cd and ls as you navigate your server, and it is often the quickest way to get your bearings when a command does not behave as expected.
Need more help?
Master the basic Linux commands with examples on a SSH shared hosting account, or get full root control with a JetHost VPS. Both include free SSH access and full Linux terminal support, so you can run the SSH pwd command directly on your server today.


