When you connect to your web hosting account via SSH, you usually land in your home directory (~).
If you prefer to start directly in your website folder (~/public_html), you can set it easily by editing your shell profile.
Step-by-step guide
1. Connect via SSH
Log in to your account:
Your prompt will look like:
2. Edit your bash profile
Run these commands to make SSH always start in your public_html folder:
This tells the system to change directory to ~/public_html only for interactive SSH logins.
3. Log out and log back in
Exit and reconnect via SSH:
You should now see:
To confirm:
Expected output:
Why this works
The code checks if your session is interactive (*i*) before running cd ~/public_html, ensuring SCP or non-interactive SSH commands still work normally.
Good. I like this setting