Format an USB Stick with FAT32 on Linux

On UNIX-based OSes formatting a medium is usually done in the terminal. Even though most Linux distributions already include GUI-based formatting tools, this post is all about the terminal.

  1. Determine on which ID the USB stick is mounted: sudo fdisk -l

  2. Unmount the USB stick: unmount /dev/sd[x] (dependent on the previously determined ID)

  3. Format the USB stick with the FAT32 filesystem: sudo mkdosfs -n '[USB-DRIVE-NAME]' -I /dev/sd[x] -F 32

Using ImageMagick on Linux and macOS

ImageMagick is a free software package available on all major operation systems. It can read and transform more than 100 different iamge formats.

Installing ImageMagick:

  • Ubuntu: sudo apt-get install imagemagick
  • Fedora: yum install ImageMagick
  • macOS: brew install imagemagick

Example for converting an images from one format to another:

convert input_image.png output_image.jpg

Examples for resizing/transforming images:

  • convert input_image.jpg -resize 500x500 output_image.jpg
  • convert input_image.jpg -rotate 90 output_image.jpg
  • convert input_image.jpg -quality 95 output_image.jpg

Removing transparency in an image:

convert -flatten input_image.png output_image.png

Create a Bootable Medium on Linux

Every time you want to (re)install an operating system you have to create a bootable medium from an image file. Other cases where one needs a bootable CD or USB stick can be any system checking software that needs to operate alone, without the main operating system loaded and running.

Here are the steps for a typical Linux distribution:

  • Determine on which id the medium stick is mounted: sudo fdisk -l OR dmesg
  • Unmount the medium: umount /dev/sdb (sdb beeing an example)
  • Set the image file as bootable: isohybrid imagefile.iso (imagefile.iso beeing an example)
  • Copy the image on the prefered medium (e.g. an USB stick): sudo dd if=imagefile.iso of=/dev/sdb bs=4k
  • Unplug the medium: sync followed by sudo eject /dev/sdb

Fast Cursor Movements in the Terminal

This week’s post lists the absolute essential commands for moving the cursor quickly in the terminal.

  • Move to beginning of line: CTRL + A
  • Move to end of line: CTRL + E
  • Clear screen: CTRL + L
  • Erase text from cursor to end of line: CTRL + K
  • Erase text from cursor to beginning of line: CTRL + U

Essential Commands in Nano

This week’s post lists the absolute essential commands for the standard editor Nano.

  • Move to beginning of line: Ctrl + A
  • Move to end of line: Ctrl + E
  • Move down a page: Ctrl + V
  • Move up a page: Ctrl + Y
  • Cut/Delete line or marked text: Ctrl + K
  • Paste/Undo line or marked text: Ctrl + U
  • Display line number: Ctrl + C
  • Search: Ctrl + W