Linux Shell SCP VPS - omartek/linux_variePerLaboratorio GitHub Wiki

Table of Contents

Impostazione tastiera italiana

Per impostare al volo la tastiera italiana da shell, eseguire da root o col comando sudo

 $ sudo loadkeys it

Pulire da file inutili

 sudo apt-get autoremove
 sudo apt-get autoclean ''or'' sudo apt-get autoclean

Consigliato ma non testato ancora.

 sudo apt-get install localepurge (file per traduzioni)
 sudo apt-get install bleachbit

Leggere dimensioni di file e cartelle

Per listare le dimensioni dei singoli file,

 ls -la
 ls -lh /boot
 du -sh /var/tmp/

o di intere cartelle,

 sudo du -h /var/log

o cercarne di superiori a tot dimensione.

 find / -type f -size +1024k

Accedere collegandosi come si farebbe con ssh ma sostituendo il comando sftp use@IP_ADDRESS. Usare i seguenti comandi per leggere la cartella remota

 pwd    ls    cd   etc...

e i seguenti per quella locale

 lpwd   lls   lcd  etc... 

e per prelevare get o inviare put

 get FileRemoto
 get -r CartellaRemota
 put FileLocale
 put -r CartellaLocale

SCP

The syntax for scp is:

If you are on the computer from which you want to send file to a remote computer:

 scp /file/to/send username@remote:/where/to/put

Here the remote can be a FQDN or an IP address.

On the other hand if you are on the computer wanting to receive file from a remote computer:

 scp username@remote:/file/to/send /where/to/put

scp can also send files between two remote hosts:

 scp username@remote_1:/file/to/send username@remote_2:/where/to/put

So the basic syntax is:

 scp username@source:/location/to/file username@destination:/where/to/put

You can read man scp to get more ideas on this.

 scp -r

will copy recursively.

Scaricare da VPS avendo chiavi .pem

 scp -r -i nome-keys.pem [email protected]:/percorso/ ./

rsync

La struttura del comando è simile:

 # rsync options source destination

-v : verbose -r : copies data recursively (but don’t preserve timestamps and permission while transferring data -a : archive mode, archive mode allows copying files recursively and it also preserves symbolic links, file permissions, user & group ownerships and timestamps -z : compress file data -h : human-readable, output numbers in a human-readable format --progress and --stats are useful for real-time display of transfer.

You can use rsync as an alternative. It is mainly for syncing files.. but you can use it for this purpose as well.

 rsync -avzh --stats --progress remoteuser@remoteip:/path/  localpath 

to add ssh options:

 rsync -e ssh remoteuser@remoteip:/path/  localpath
 rsync -e "ssh -P $port_value" remoteuser@remoteip:/path/  localpath
 rsync -avhe ssh --progress /home/folder1 [email protected]:/root/folder2

I think it a better option then SCP, since it skips already transferred files, which is noticeable when you're copy-ing lot of files.

Category:Aiuto

⚠️ **GitHub.com Fallback** ⚠️