Skip to content

Instantly share code, notes, and snippets.

@macintoshhelper
Last active January 2, 2022 13:29
Show Gist options
  • Save macintoshhelper/d982cb8fd0fd0af81b5f52ee26bf56e5 to your computer and use it in GitHub Desktop.
Save macintoshhelper/d982cb8fd0fd0af81b5f52ee26bf56e5 to your computer and use it in GitHub Desktop.
SSH Cheatsheet

ssh-cheatsheet

Bash SSH command cheatsheet

Connecting to Remote Host From Local Client

SSH

SSH into a remote server.

MY_USERNAME=root # Root user is bad! For educational purposes only.
MY_HOST=192.168.1.100 # Change this to the remote host IP

ssh $MY_USERNAME@$MY_HOST 

SCP

Copy a file from local host to remote host.

INPUT_FILE_PATH=/Users/me/Code/out/my-project # Drag a file into Terminal after the =
OUTPUT_FILE_PATH=/home/myusername/my-project # Do `echo $(pwd)` while SSH'd into the remote host and cd'ed into the desired folder, to find the absolute path

scp $INPUT_FILE_PATH $MY_USERNAME@$MY_HOST:$OUTPUT_FILE_PATH;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment