Linux Spick

apache2
  • sudo /etc/init.d/apache2 stop oder start
  • logs sieht man mit tail /var/log/apache2/error.log
  • /etc/apache2/httpd.conf enthält die primäre Config
diff: diff -Z a b compare (show differences) between the files a and b. -Z = ignore trailing space (at end of line)
Disk Cleanup
  1. synaptic package manager → settings → files: delete cached package files (und Anpassen, dass er nicht mehr solange cache'd) ⇒ 1GB
  2. update manager → view → linux kernels: alte löschen (ausser letzem und aktivem) ⇒ 4GB (400MB pro Kernel)
  3. ~/.gimp2-8/swap.. gelöscht &rARR; 1.1GB
find
  • sudo find ! -user walter -exec ls -l {} \; find all files with user not walter and do an ls -l on it
  • sudo find ! -user walter -exec chmod 775 {} \; find all files with user not walter and chmod it
  • sudo find ! -user walter -exec chown walter:walter {} \; find all files with user not walter and chown it
hardware
  • sudo lshw -html > hardware.html ganze config
interrupts statistic: while true ; do { { date; cat /proc/interrupts ; } >>int.txt ; sleep 60 ; } done
log tail /var/log/syslog
mount
  • mount | grep windows
  • cat /etc/fstab
  • sudo mount -o remount,rw /windows windows rw mounten (oder ro
  • mount wlkl.ch ftps sftp://wlkl.ch@wlkl.ch:5544/
    • sshfs 'wlkl.ch@login-97.hoststar.ch:' /media/walter/wlklSftp -p 5544 -o sshfs_debug -o reconnect,ServerAliveInterval=15,ServerAliveCountMax=3 -d -d=debug switches to foreground mode
    • ftp curlftpfs ftp://web15:pw@wlkl.ch/ /wlklFtp
  • mount spwallisellen ftps
    • sshfs 'spwallisellen.ch@login-2.hoststar.ch/:' /media/walter/spwSftp -p 5544 -o sshfs_debug -d -d=debug switches to foreground mode
      • sudo umount /media/walter/spwSftp
      • mkdir /media/walter/spwSftp
    • ftp: curlftpfs 'ftp://spwallisellen.ch:pw@login-2.hoststar.ch/' /spwFtp
NTFS flicken
  • sudo fdisk -l und device Namen merken
  • sudo ntfsfix /dev/<device name>!
rdiff-backup
  • rdiff-backup -l /wkArchive/backupData/pc/cmp.php list increment (timestamps) for given file/directory
  • sudo rdiff-backup --remove-older-than 2Y backupArchive remove increments older 2 years
  • sudo rdiff-backup -r 2019-02-19T11:11:28+01:00 /wkArchive/backupData/pc tmp restore source dir/file from given time to tmp
release anzeigen mint, ubuntu) cat /etc/*-release
rsync
  • sudo rsync -rlptD --del /media/walter/Seagate1805/fromElements/backupAll/ /media/walter/Element0805/backupAll/
    • -a abbreviates -rlptgoD however gives chown or chgrp Operation not permitted (1) errors (although sudo, but reason is probably that destination is Fat32, which has neither owner nor group), thus without -og
  • test to synchronize directories (only files and directories, ignore links) ==> cd /wkData/pc; rm -r tstC/*; cp -ar tstOri/cmp1 tstOri/cmp2 tstC/
    • update cmp1 to equal cmp2 rsync -niir --del tstC/cmp2/ tstC/cmp1/ (-n == --dry-run)
  • test to create a directory cmpD, with only the updates from cmp1 to cmp2 rm -r tstC/cmpD
    • rsync -ndiir --prune-empty-dirs --del --compare-dest=../cmp1/ tstC/cmp2/ tstC/cmpD/ but we get two problems
      • the things to delete art not even mentioned
      • empty dirs are created, inspite of --prune-empty-dirs
scp scp -rp * scp://wlkl.ch@lx13.hoststar.hosting:5544/files/tmp; echo exitStatus $? copy from/to/between remote using sftp und ssh
  • sshpass -f /wkData/wk/extra/wlklsftp scp -rp scp://wlkl.ch@lx13.hoststar.hosting:5544/files/tmp . ; echo exitStatus $? um Passwort aus script mitzugeben oder mit -p...
shell
  • Man:bash
  • fc -e xed -999 0 edit history - contents of file will be executed at exit! (or set FCEDIT=xed in bash .profile)
sudo sysctl vm.swappiness=0 swap ausschalten
top display of current system usage, cpu% per task etc, with many configuration and manipulation commands
  • top -b -d5 > top5 batchmode, delay=5sec ouput to file
USB
  • lsusb nur USBs anzeigen
  • ssh ssh://ch45859@lx13.hoststar.hosting:22888 # [user@]hostname[:port]. nachdem im mypanel ssh für eine Stunde aktiviert und Angaben inkl. Paswort von dort benutzen
  • sudo lshw -html > hardware.html ganze config
  • seatools auf windows für Seagate USB External drive diagnostics
wget wget brauchen um Homepage zu archivieren, wiki zu synchronisieren etc.
wk13
uname -a current kernel version etc.
zip create zipfile Docu zip unzip
  • zip -r www ttt create www.zip by recursively adding file from directory ttt
  • zip -FSr www.zip ttt /wkData/www recursively file sync archive www.zip (add new, update changed, delete nolonger existing files) from the two given directories
  • unzip -l www list files in www.zip