Show Menu
Cheatography

Transfer Cheat Sheet (DRAFT) by

wget,curl,scp,rsynch

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 <fi­len­ame>
Generate ssh-key
rsa 4096, ecdsa 521, ed25519
Algorithm -t
ssh-co­py-id -i (keyfile) user@host
Copy file to host
ssh-keygen -e -f ~/id_dsa > ~/id_d­sa_­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:l­oca­lho­st:port user@s­erver
Local Forwarding
ssh -R port:l­oca­lho­st:port user@s­erver
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:l­oca­lho­st:5432 user@e­xam­ple.com
The part that changed here is the localh­ost­:5432, which says to forward connec­tions from your local port 9000 to localh­ost­:5432 on your server. Now we can simply connect to our database.

scp

scp /path user@h­ost­:/path
copy from locale to remotehost
scp user@h­ost­:/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@h­ost­:/h­ome­/ja­ne/­tab­le.csv
pete@host:/home/pete/
copy file remote host to the same
remote host in another location
scp /path/­*.ext user@s­erv­er:­/path/
Copy all files of a specific type
scp [-1234­6BC­pqrv] [-c cipher] [-F ssh_co­nfig] [-i identi­ty_­file]
[-l limit] [-o ssh_op­tion] [-P port] [-S program]
[[user@]host1:]file1 ... [[user­@]h­ost­2:]­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:/­/ur­l/file
Downlo­ading FIle
wget -P /home/ http//:url
Dowloading to specific folder
Downlo­ading Files recusively
wget -N http:/­/ur­l/file
Downlo­ading only if file is newer
wget -r -A jpg,png http:/­/ur­l.c­om/dir/
Downlo­ading Files recusively only jpg,png files
wget -r -R jpg,png http:/­/ur­l.c­om/dir/
Downlo­ading Files recusively everthing except jpg,png
wget -c http:/­/ur­l/file
Continue stopped download
wget -O filename http:/­/ur­l/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-­use­r=U­SERNAME --ftp-­pas­swo­rd=­PAS­SWORD
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 downlo­ading)
Download file and saves as filename
Starts downlo­ading where it stopped
curl ftp://url --user myname­:my­pas­sword
Download with Userpa­ssword
           

Help Us Go Positive!

We offset our carbon usage with Ecologi. Click the link below to help us!

We offset our carbon footprint via Ecologi