97 lines
No EOL
2 KiB
Markdown
97 lines
No EOL
2 KiB
Markdown
# Linux comandi alla console
|
|
|
|
## Montare disco rigido
|
|
|
|
verificare che dischi ci sono
|
|
```bash
|
|
lsblk
|
|
```
|
|
comando generico per montare disco
|
|
```bash
|
|
sudo mount -t <type> /dev/<device> <directory>
|
|
```
|
|
se manca creare diectory e poi montare
|
|
```bash
|
|
sudo mkdir -p <directory>
|
|
sudo mount -t ext4 /dev/nvme0n1 /home/nvme
|
|
```
|
|
verifica se è stato correttamente montato con
|
|
```bash
|
|
lsblk -f
|
|
```
|
|
per installarlo sempre anche dopo un reboot
|
|
prima smontarlo
|
|
```bash
|
|
sudo umount /dev/nvme0n1
|
|
```
|
|
poi inserirlo in /etc/fstab
|
|
```bash
|
|
sudo nano /etc/fstab
|
|
```
|
|
inserendo
|
|
```bash
|
|
/dev/nvme0n1 /home/nvme ext4 defaults 0 0
|
|
```
|
|
quindi ricaricare tutti i dischi
|
|
```bash
|
|
systemctl daemon-reload
|
|
```
|
|
## Verificare porte utilizzate
|
|
|
|
verificare la porta 80 in TCP
|
|
```bash
|
|
sudo lsof -i tcp:80
|
|
```
|
|
verificare le porte aperte TCP
|
|
```bash
|
|
sudo lsof -nP -iTCP -sTCP:LISTEN
|
|
```
|
|
## File compressi con i permessi e gli owner
|
|
|
|
creare archivio
|
|
```bash
|
|
sudo tar -czvpf <nome>.tar.gz <folder>
|
|
```
|
|
verificare le porte aperte TCP
|
|
```bash
|
|
sudo tar -xzvpf <nome>.tar.gz
|
|
```
|
|
|
|
Options:
|
|
```
|
|
-c : Creates archive
|
|
-x : Extracts the archive
|
|
-f : creates archive with given filename
|
|
-t : displays or lists files in archived file
|
|
-u : archives and adds to an existing archive file
|
|
-v : Displays verbose information
|
|
-A : Concatenates the archive files
|
|
-z : compresses the tar file using gzip
|
|
-j : compresses the tar file using bzip2
|
|
-W : Verifies an archive file
|
|
-r : updates or adds file or directory in already existing .tar file
|
|
-p : with permissions and ownership
|
|
```
|
|
## RSYNC
|
|
|
|
rsync [options] source [destination]
|
|
|
|
se c'è l'accesso con ssh si può sincronizzare su altri server
|
|
|
|
rsync local_file_path user@remote-host:remote_file_path
|
|
rsync user@remote-host:remote_file_path local_file_path
|
|
|
|
|
|
Options:
|
|
```
|
|
-r : recursive
|
|
-a : archive
|
|
-z : compresses reduce transfer time
|
|
-P : display progress
|
|
-v : Displays verbose information
|
|
-p : with permissions and ownership
|
|
```
|
|
|
|
Example:
|
|
|
|
sudo rsync -razPvp calibre orangepi@192.168.1.4:/home/nvme/dockerdata |