This is a draft cheat sheet. It is a work in progress and is not finished yet.
SSH keygen
ssh-keygen -t algo -b bit -f <filename> |
Generate ssh-key |
rsa 4096, ecdsa 521, ed25519 |
Algorithm -t |
ssh-copy-id -i (keyfile) user@host |
Copy file to host |
ssh-keygen -e -f /id_dsa > /id_dsa_com.pub |
Convert sshkey to OpenSSH format |
ssh-add -l |
List ssh-key in ssh-Agent |
ssh-add /file |
Add key to ssh-Agent |
ssh-add -d file |
Removes key from Agent |
ssh-add -D |
Removes all keys from Agent |
ssh-add -x |
lock the ssh-Agent |
ssh-add -X |
unlocks the ssh-Agent |
ssh-add -t 60 /key |
key will auto deletet in 60sec |
ssh -N |
Do not execute a remote command |
SSH Login
ssh user@host -p (Port) |
Standard Login SSH |
ssh user@host -p (Port) -i /key |
Login with key |
ssh -L port:localhost:port user@server |
Local Forwarding |
ssh -R port:localhost:port user@server |
Remote Forwarding |
ssh -X user@host |
X11 Forwarding |
. Let’s say you’re running PostgreSQL on your server, which by default listens on the port 5432.
$ ssh -L 9000:localhost:5432 user@example.com
The part that changed here is the localhost:5432, which says to forward connections from your local port 9000 to localhost:5432 on your server. Now we can simply connect to our database.
scp
scp /path user@host:/path |
copy from locale to remotehost |
scp user@host:/path /path |
copy from remotehost to locale |
scp user1@server1:/path/ user2@server2:/path |
copy file on the remote server to another remote server |
scp jane@host:/home/jane/table.csv pete@host:/home/pete/ |
copy file remote host to the same remote host in another location |
scp /path/*.ext user@server:/path/ |
Copy all files of a specific type |
scp [-12346BCpqrv] [-c cipher] [-F ssh_config] [-i identity_file] [-l limit] [-o ssh_option] [-P port] [-S program] [[user@]host1:]file1 ... [[user@]host2:]file2
|
|
wget
-nv -v -q -t X -P -O -nd -m -A -R -e robots=off |
no-verbose verbose quiet -tries=X /path Outout no-directories mirror ACCLIST REJLIST ignore robots.txt |
wget http://url/file |
Downloading FIle |
wget -P /home/ http//:url |
Dowloading to specific folder |
|
Downloading Files recusively |
wget -N http://url/file |
Downloading only if file is newer |
|
Downloading Files recusively only jpg,png files |
|
Downloading Files recusively everthing except jpg,png |
wget -c http://url/file |
Continue stopped download |
wget -O filename http://url/FILE |
Saves download under other name |
wget -m http://url |
Mirror website |
wget -m -A '*.pdf' -nd -e robots=off http://url |
Download all PDF file from webseite |
wget --ftp-user=USERNAME --ftp-password=PASSWORD ftp://ftp.url.com/filename.tar.gz |
Download via Ftp |
curl
-O -C - -- output -v |
saves file as the orginalname continue where it stopped indivi. filename verbose |
|
Shows file in Terminal (not downloading) |
|
Download file and saves as filename |
|
Starts downloading where it stopped |
curl ftp://url --user myname:mypassword |
Download with Userpassword |
|