Skip to content

Instantly share code, notes, and snippets.

@andramalech
Forked from macintoshhelper/ssh-cheatsheet.md
Created January 2, 2022 13:29
Show Gist options
  • Save andramalech/695638149d0b5d1e1e8a3d72443c7cf4 to your computer and use it in GitHub Desktop.
Save andramalech/695638149d0b5d1e1e8a3d72443c7cf4 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