Skip to main content

One-Liners

Full System Updates on Ubuntu
apt-get update && env DEBIAN_FRONTEND=noninteractive apt-get dist-upgrade -y && apt-get autoremove --purge -y && apt-get autoclean && snap refresh
Update Ubuntu LXD Host & Containers (Needs to be saved to Script)
#!/usr/bin/env bash

# Update host system
env DEBIAN_FRONTEND=noninteractive apt-get update --allow-releaseinfo-change
env DEBIAN_FRONTEND=noninteractive apt-get dist-upgrade -y
env DEBIAN_FRONTEND=noninteractive apt-get autoremove --purge -y
env DEBIAN_FRONTEND=noninteractive apt-get autoclean
snap refresh

# Update LXD Containers
for i in $(lxc ls status=running -c n --format csv); do
  lxc exec $i --env DEBIAN_FRONTEND=noninteractive -T -- apt-get update --allow-releaseinfo-change
  lxc exec $i --env DEBIAN_FRONTEND=noninteractive -T -- apt-get dist-upgrade -y
  lxc exec $i --env DEBIAN_FRONTEND=noninteractive -T -- apt-get autoremove --purge -y
  lxc exec $i --env DEBIAN_FRONTEND=noninteractive -T -- apt-get autoclean
  lxc exec $i -T -- bash -c "hash snap 2>/dev/null && snap refresh"
done
Write random data to disk
dd if=/dev/urandom of=/dev/sd bs=4096 status=progress
Get block size of disk
blockdev --getbsz /dev/sdX
DANGEROUS - 3 passes zeroing of a disk while testing with badblocks
badblocks -t 0 -w -s -b 4096 -p 3 -v /dev/sdX
S.M.A.R.T. long test
# Start test
smartctl -t long /dev/sdX

# Print results
smartctl -x /dev/sdX