Diese Seite ist nicht editierbar. Sie können den Quelltext sehen, jedoch nicht verändern. Kontaktieren Sie den Administrator, wenn Sie glauben, dass hier ein Fehler vorliegt. ====== Shell Basics ====== [[http://www.gnu.org/software/bash/manual/bashref.html|http://www.gnu.org/software/bash/manual/bashref.html]] [[https://www.shellscript.sh/|https://www.shellscript.sh/]] ===== GB keyboard ===== {{ :kb_united_kingdom.svg }} ===== Screen ===== Siehe auch [[https://www.mattcutts.com/blog/a-quick-tutorial-on-screen/|https://www.mattcutts.com/blog/a-quick-tutorial-on-screen/]] **Screen Arbeitsablauf** Normalerweise im User, nicht mit sudo ''screen -S [name]'' alternativ screen -R (erzeugt neue Session wenn noch keine da oder re-attached an vorhandene) Weitere Screen Session wird mit Ctrl + a eröffnet. Wechseln zwischen den Sessions mit Control-a [Nummer], wobei 0 die erste ist Hilfe: Ctrl A ? Liste aller Fenster in einer Session Ctrl A w Von Session abmelden ''Ctrl-A d'' Danach aus ssh abmelden, die screen session läuft weiter. Von einem anderen Ort wieder per ssh auf die Arbeitsmaschine und dann wieder an die Session binden ''screen -d -R sessionname '' will resume a session that you started in a different location. **Alle Screen Sesions auflisten** screen -ls **Session killen** $ screen -X -S [session # you want to kill] quit ===== Shadow ===== Einfügen eines Passwort hashes <code> thommie@odysseus3:~> python -c "import crypt, getpass, pwd; \> print crypt.crypt('[klartext]', '\$6\$SALTsalt\$')" $6$SALTsalt$0[hashwert] </code> ===== update-alternatives ===== [[https://manpages.ubuntu.com/manpages/trusty/de/man8/update-alternatives.8.html|https://manpages.ubuntu.com/manpages/trusty/de/man8/update-alternatives.8.html]] ===== Random string erzeugen ===== <code> tr -dc A-Za-z0-9 </dev/urandom | head -c 25 ; echo '' </code> ===== Links ===== ''ln -s /Zieldatei /Referenz ===== Find ===== Alle Dateien älter als 365 Tage finden <code> find /mnt/pve/sb_u203461/dump/ -mtime +365 -type f </code> Mit löschen: <code> find /mnt/pve/sb_u203461/dump/ -mtime +365 -type f -delete </code> Luxus Variante mit Backup <code> #!/bin/bash path="/data/backuplog/" timestamp=$(date +%Y%m%d_%H%M%S) filename=log_$timestamp.txt log=$path$filename days=7 START_TIME=$(date +%s) find $path -maxdepth 1 -name "*.txt" -type f -mtime +$days -print -delete >> $log echo "Backup:: Script Start -- $(date +%Y%m%d_%H%M)" >> $log ... code for backup ...or any other operation .... >> $log END_TIME=$(date +%s) ELAPSED_TIME=$(( $END_TIME - $START_TIME )) echo "Backup :: Script End -- $(date +%Y%m%d_%H%M)" >> $log echo "Elapsed Time :: $(date -d 00:00:$ELAPSED_TIME +%Hh:%Mm:%Ss) " >> $log </code> ===== sed ===== replace "-d" with "-d " <code> <font inherit/monospace;;inherit;;#000000background-color:#ffffff;>sed s/-d/'-d '/g domains3.txt> domains4.txt</font> </code> trim string and remove newlines <code> <font inherit/monospace;;inherit;;#000000background-color:#ffffff;>tr --delete '\n' <domains2.csv> domains3.txt</font> </code> ===== Alte Kernels raus schmeissssen ===== <code> uname -mrs = current kernel dpkg --list | egrep -i --color 'linux-image|linux-headers' aptitude purge linux-image-5.10.0-{18,19,20}-amd64 update-grub reboot <code> shell.txt Zuletzt geändert: 25/12/2024 - 17:00von thommie_netzwissen.de