Tag Archives: linux

Wipe and shutdown remote Linux server over SSH

Wiping and shutting down a headless linux server over SSH.

Wipe
Copies zeros over the whole disk.

dd if=/dev/zero of=/dev/sdaX

Where sdaX is the device you want to wipe. Read discussion at security.stackexchange.

Shutdown
Since the shutdown command will be trashed by the wiping, we need to force shutdown in another way.

echo 1 > /proc/sys/kernel/sysrq
echo o > /proc/sysrq-trigger

Don’t try this at home.

Using screen for linux background processing

Perfect for long running batch jobs on a remote server over unreliable connections or if you want to bring your laptop home (instead of keeping that terminal running).

Log in and run
screen -t title_of_your_choice

Do the same thing again if you want to create another window.

All the following screen commands are preceeded by Ctrl-a (i.e. first press ctrl-a then the shortcut below)

  • 0-9 – switch to window by id
  • Ctrl-n – next window
  • Ctrl-a – previous window
  • d – quit screen (leaving it running)
  • k – kill window

The next day, log in as usual and attach to the screen session using

screen -x

Check the man page for screen for other options and shortcuts.