[[TableOfContents()]] = System Admin - *nix = * MdAndLvm - Software Raid (md) and logical volume management (lvm) * DiskUsage * ApacheAndSamba * SslCertificates * ConfiguringBind * SettingUpLocales * ["Determining a 32 vs. a 64 bit kernel / CPU"][[Anchor(32vs64bitkernel)]] * BurningCds * GnomeLeaveDisplayActiveWhenLaptopClosed * MonitSystemMonitoring * https://raid.wiki.kernel.org/ ([https://raid.wiki.kernel.org/articles/m/d/s/Mdstat.html /proc/mdstat]) * LinuxMemoryManagement * LinuxBootConfiguration - ways of configuring various parts of the system at boot time * https://wiki.archlinux.org/index.php/Color_Bash_Prompt * SupportingOldDebianDistros * ["MySQL"] * ["openssh"] * ["bash"] * WaitingOnAnotherProcess * ["Synchronise debian packages between servers"] * ["Skipping header rows with sort"] * ["/Squid"] - proxy server == Handy Commands / Snippets == === column === column makes it easy to format data into visually spaced columns. For instance: {{{ ( x=0; while [ $x -lt 20 ] ; do echo $RANDOM $RANDOM $RANDOM $RANDOM $RANDOM $RANDOM; x=$(($x+1)); done ) | column -t}}} It's also possible to use a different input delimiter: {{{ ( x=0; while [ $x -lt 20 ] ; do echo ${RANDOM}z${RANDOM}z${RANDOM}zzz${RANDOM}z${RANDOM}z${RANDOM}; x=$(($x+1)); done ) | column -t -sz}}} === mtr === mtr combines the functionality of the '''traceroute''' and '''ping''' programs in a single network diagnostic tool. Available in the [https://packages.debian.org/stable/mtr mtr] and [https://packages.debian.org/stable/mtr-tiny mtr-tiny] debian packages. mtr includes gtk wheras mtr-tiny does not so it comes which much fewer package dependencies. [[BR]] A handy command to build a report: {{{ mtr -r -w -c 10 example.net}}} === netcat - measuring bandwidth between servers === {{{ # Run both ways, a number of times for confirmation # Imagine serverA and serverB: # set up netcat to listen (write the output into wc to confirm the bytes expected are received) serverA$ nc -l -p 12345 | wc -c # On serverA send a bunch of data (in this case 1GiB) using netcat - use "-q 0" to force a quit as soon as EOF is reached: serverB$ dd if=/dev/zero bs=$((2**20)) count=$((2**10)) | nc -q 0 serverA 12345 # On each server the output will look something like: # serverA: 1048576+0 records in 1048576+0 records out 1073741824 bytes (1.1 GB) copied, 9.68678 s, 111 MB/s # serverB: $ nc -l -p 12345 | wc -c 1073741824 }}} === SimpleHTTPServer — Simple HTTP request handler === SimpleHTTPServer is a core python library which provides a very easy way to set up a static HTTP server from a directory (for instance to check the local [http://munin-monitoring.org/ munin] reports for a server which is no running it's own http server: {{{ python -m SimpleHTTPServer }}} When The library is invoked using the python '''-m''' option ("run library module as a script") it binds to all network interfaces (by default on port 8000) and logs to stdout: {{{ user@server:/var/cache/munin/www$ python -m SimpleHTTPServer Serving HTTP on 0.0.0.0 port 8000 ... 10.0.10.1 - - [13/Feb/2018 22:54:47] "GET / HTTP/1.1" 200 - 10.0.10.1 - - [13/Feb/2018 22:54:47] "GET /static/style-new.css HTTP/1.1" 200 - 10.0.10.1 - - [13/Feb/2018 22:54:48] "GET /static/logo-h.png HTTP/1.1" 200 - 10.0.10.1 - - [13/Feb/2018 22:54:48] "GET /static/favicon.ico HTTP/1.1" 200 - ... }}} The port can be given if needed: {{{ user@server:/var/cache/munin/www$ python -m SimpleHTTPServer 1234 Serving HTTP on 0.0.0.0 port 1234 ... 10.0.10.1 - - [13/Feb/2018 22:59:16] "GET / HTTP/1.1" 200 - 10.0.10.1 - - [13/Feb/2018 22:59:16] "GET /static/style-new.css HTTP/1.1" 200 - 10.0.10.1 - - [13/Feb/2018 22:59:17] "GET /static/logo-h.png HTTP/1.1" 200 - 10.0.10.1 - - [13/Feb/2018 22:59:17] "GET /static/favicon.ico HTTP/1.1" 200 - ... }}} === trafshow === trafshow is an interactive text-based program that allows network connections to be monitored, somewhat like using {{{netstat}}} and {{{tcpdump}}} but using arrows and the enter key instead of typing stuff in. Available in the [https://packages.debian.org/stable/netdiag netdiag] debian package. === zdump === zdump prints the current time in each zonename named on the command line, and also dumps out all timezone transitions: {{{ # Check the timezone changes configured on a system in Melbourne for 2016: $ zdump -v /usr/share/zoneinfo/Australia/Melbourne | grep 2016 /usr/share/zoneinfo/Australia/Melbourne Sat Apr 2 15:59:59 2016 UTC = Sun Apr 3 02:59:59 2016 EST isdst=1 gmtoff=39600 /usr/share/zoneinfo/Australia/Melbourne Sat Apr 2 16:00:00 2016 UTC = Sun Apr 3 02:00:00 2016 EST isdst=0 gmtoff=36000 /usr/share/zoneinfo/Australia/Melbourne Sat Oct 1 15:59:59 2016 UTC = Sun Oct 2 01:59:59 2016 EST isdst=0 gmtoff=36000 /usr/share/zoneinfo/Australia/Melbourne Sat Oct 1 16:00:00 2016 UTC = Sun Oct 2 03:00:00 2016 EST isdst=1 gmtoff=39600 # Check the current time in a couple of different timezones: $ zdump /usr/share/zoneinfo/Australia/Melbourne /usr/share/zoneinfo/Europe/London /usr/share/zoneinfo/Australia/Melbourne Tue May 3 14:39:25 2016 EST /usr/share/zoneinfo/Europe/London Tue May 3 05:39:25 2016 BST }}} == External References == * [https://news.ycombinator.com/item?id=7555359 DynDNS ends free service / alternative providers] (Hacker News) * [https://news.ycombinator.com/item?id=7124720 Four Linux server monitoring tools] (Hacker News) * [https://www.ssllabs.com/ssltest/index.html Qualys SSL Labs SSL security tester] * On TCP socket states: [http://askubuntu.com/questions/538443/whats-the-difference-between-port-status-listening-time-wait-close-wait @askubuntu], [http://www.cs.northwestern.edu/~agupta/cs340/project2/TCPIP_State_Transition_Diagram.pdf state diagram] * https://help.ubuntu.com/community/RenameUSBDrive (tips on labelling various USB drives with Ubuntu linux) * Notes on files used to configure applications to work within a desktop environment (for example setting default applications): [https://help.ubuntu.com/community/UnityLaunchersAndDesktopFiles Ubuntu], [https://wiki.archlinux.org/index.php/Default_Applications ArchLinux Default Applications], [https://wiki.archlinux.org/index.php/Desktop_entries ArchLinux Desktop entries]