Zde můžete vidět rozdíly mezi vybranou verzí a aktuální verzí dané stránky.
| Následující verze | Předchozí verze | ||
|
software:linux:commands [2018/12/07 12:35] root vytvořeno |
software:linux:commands [2021/11/23 13:27] (aktuální) mwk |
||
|---|---|---|---|
| Řádek 1: | Řádek 1: | ||
| - | ===== 1 tail ===== | + | ====== Commands ====== |
| + | ===== badblocks ===== | ||
| + | <code bash> | ||
| + | * verbose | ||
| + | * force | ||
| + | * write | ||
| + | * show progress | ||
| + | |||
| + | ===== tail ===== | ||
| vypis logu v realnem case | vypis logu v realnem case | ||
| - | | + | <code bash>tail -f /soubor</ |
| vyber ze souboru | vyber ze souboru | ||
| - | | + | <code bash>tail -f /soubor | grep --line-buffered hledaneslovo</ |
| - | tail -f /soubor | stdbuf -o0 grep hledaneslovo | + | <code bash>tail -f /soubor | stdbuf -o0 grep hledaneslovo</ |
| - | ===== 2 ssh key pro vzdalene prihlasovani klientu pres ssh ===== | + | ===== ssh key pro vzdalene prihlasovani klientu pres ssh ===== |
| - | ssh rsa key generovani - nezadavat passphrase | + | ssh rsa key generovani - nezadavat passphrase |
| - | ssh-keygen -t rsa | + | <code bash>ssh-keygen -t rsa</ |
| prekopirovani na server | prekopirovani na server | ||
| - | | + | <code bash>ssh-copy-id user@ip_srv</ |
| - | ===== 3 ssh klice 2 ===== | + | ===== ssh klice 2 ===== |
| **server**: jako root | **server**: jako root | ||
| - | | + | <code bash>ssh-keygen -t rsa</ |
| heslo nechame prazdne | heslo nechame prazdne | ||
| - | | + | <code bash>scp / |
| **cilovy stroj** | **cilovy stroj** | ||
| - | | + | <code bash>mkdir / |
| - | touch / | + | touch / |
| - | chmod 700 ~/.ssh | + | chmod 700 ~/.ssh |
| - | chmod 600 ~/ | + | chmod 600 ~/ |
| - | cat / | + | cat / |
| + | |||
| + | ===== symlink zmena targetu bez smazani ===== | ||
| + | <code bash>ln -f -s /home/zdroj / | ||
| + | |||
| + | ===== SED ===== | ||
| + | <code bash>sed -i ' | ||
| + | -i = in-place (i.e. save back to the original file) | ||
| + | s = the substitute command | ||
| + | g = global (i.e. replace all and not just the first occurrence) | ||
| + | |||
| + | ===== awk ===== | ||
| + | <code bash> | ||
| + | najde numericke hodnoty za " | ||
| + | |||
| + | ===== OPENSSL na Debianu ===== | ||
| + | |||
| + | <code bash>apt install certbot python-certbot-apache</ | ||
| + | |||
| + | zkontrolovat /etc/hosts, jestli je cele jmeno na lokalni IP a generujeme: | ||
| + | |||
| + | <code bash> | ||
| + | |||
| + | Pak to chce zkusit na automatickou obnovu udelat skript a dat do cronu pomoci | ||
| + | |||
| + | <code bash> | ||
| + | |||
| + | |||
| + | ===== Rdiff-backup ===== | ||
| + | **backup - server** a nasledne i klient jako root | ||
| + | |||
| + | <code bash> | ||
| + | rdiff-backup --version</ | ||
| + | |||
| + | * verze server - klient by se mely shodovat | ||
| + | * vygenerujeme klice pro roota, dle ssh klic 2 a budeme distribuovat na klienty nasledne | ||
| + | |||
| + | <code bash> | ||
| + | |||
| + | **priklad zalohy** | ||
| + | |||
| + | <code bash> | ||
| + | |||
| + | takhle s tim do cronu | ||
| + | <file bash gpiobackup.sh> | ||
| + | !/ | ||
| + | ## gpiobackup script | ||
| + | # Backup | ||
| + | rdiff-backup --exclude /tmp --exclude /mnt --exclude /proc --exclude /sys --exclude /run --exclude /dev --exclude /var/backup -v5 root@10.133.$ | ||
| + | sleep 5 | ||
| + | rdiff-backup --exclude /tmp --exclude /mnt --exclude /proc --exclude /sys --exclude /run --exclude /dev --exclude /var/backup -v5 root@10.133.$ | ||
| + | sleep 5 | ||
| + | rdiff-backup --exclude /tmp --exclude /mnt --exclude /proc --exclude /sys --exclude /run --exclude /dev --exclude /var/backup -v5 root@10.133.$ | ||
| + | # Clean Increments | ||
| + | rdiff-backup --force --remove-older-than 4B / | ||
| + | rdiff-backup --force --remove-older-than 4B / | ||
| + | rdiff-backup --force --remove-older-than 4B / | ||
| + | </ | ||
| + | vypis logu v realnem case | ||
| + | <code bash> | ||
| + | vyber ze souboru | ||
| + | <code bash> | ||
| + | <code bash> | ||
| + | |||
| + | |||
| - | ===== 4 symlink zmena targetu bez smazani ===== | ||
| - | ln -f -s /home/zdroj / | ||
| - | ===== 5 SED ===== | ||
| - | sed -i ' | ||
| - | -i = in-place (i.e. save back to the original file) | ||
| - | s = the substitute command | ||
| - | g = global (i.e. replace all and not just the first occurrence) | ||