Server Snippets

FTP Operations

Server to Desktop

scp -P 22 {Username}@{IP}:~/{Server Location}/{Filename} ~/Desktop/
Without prefixed ~/
Include extension
Without prefixed ~/

Machine to Server

scp -P 22 {filename} {Username}@{IP}:~
Local directory path (e.g., Downloads/)
File name or folder to upload
Destination path on server

File & Folder Operations

Zip/Unzip Operations

Common Flags:

File Operations

cp -r /path/to/source /path/to/destination

Common Flags:

SSH Key Management

Key Management

~/
ssh-keygen -f ~/.ssh/known_hosts -R 'bitbucket.org'

Removes the old SSH key for the specified host from your known_hosts file.

When to use these commands:

  • Remove Host Key: When getting "Host key verification failed" errors
  • Generate SSH Key: When setting up a new server or need new SSH keys
  • Install OpenSSH: If you get "ssh: command not found" errors

Agent Management

eval `ssh-agent`
ssh-add /home/site/.ssh/

When to use this:

  • When you need to authenticate with a private key on a remote server
  • Before running Git operations that require SSH authentication
  • When working with deployment scripts that need SSH access
  • After server restarts when the SSH agent needs to be restarted