Commands and files

Navigate remote directories

Use PWD, CWD, and CDUP while keeping local and remote working directories distinct.

Remote directory commands only change where you are on the server. They do not move your local folder. I still mix them up when I jump between ftp, sftp, and a local shell in three tabs.

The fix is always the same: run pwd on the server, run !pwd locally, then compare. If they disagree with your mental model, stop and fix paths.

pwd asks the server where you are. cd (which sends CWD) changes that directory. cdup moves up one level.

Your local lcd command is a client feature. It never travels over FTP. Your shell can stay in ~/Downloads while the remote session sits in /incoming:

ftp> lcd ~/Downloads
Local directory now /Users/alice/Downloads
ftp> pwd
257 "/incoming" is the current directory

When a relative path fails, run pwd before you chmod anything. Most 550 errors on cd are simply “you are not where you think you are.”

Walk into a nested folder on a test server:

ftp> pwd
257 "/incoming" is the current directory
ftp> cd reports/2026
250 Directory changed
ftp> pwd
257 "/incoming/reports/2026" is the current directory

The path you see may be a virtual root, not a real host path. Many accounts live inside a jail and cannot see anything above it.

When cd fails:

ftp> cd missing-folder
550 Failed to change directory
ftp> pwd
257 "/incoming/reports/2026" is the current directory

Some servers treat cd .. and cdup differently inside a jail. If one works and the other returns 550, use the one the server accepts.

Turn on verbose mode in your client if you use a GUI. You want to see the actual CWD path the server received, not just what you typed in a form field.

Create two nested directories on a test server. Navigate with relative and absolute paths, then run !pwd locally to confirm your local folder did not move.

Lesson completed