CLI notes

Repeat command

# while :; do echo 'Hit CTRL+C'; sleep 1; done

Search/Replace in multiple files

Search recursively from the directory of execution and operate on only regular, readable, writeable files and replace the word "cybernetnews" with "cybernet":
find ./ -type f -readable -writable -exec sed -i "s/cybernetnews/cybernet/g" {} \;

Set debians display resolution in VirtualBox

  1. In Debian log into root
  2. Run cd /etc/default/
  3. Open the file grub with you favorite editor ie: nano grub
  4. Look for the GRUB_GFXMODE line then replace it with the following:
    GRUB_GFXMODE=DesiredResolution
    GRUB_GFXPAYLOAD_LINUX=keep

    (In my case DesiredResolution=1280x1024. The resolution here must be a supported resolution. You can find a list of supported resolution by booting up to grub, running the grub shell then executing the vbeinfo command.)

  5. Run update-grub
  6. Restart your machine.
  7. done

Empty the trash using terminal

run sudo rm -rf ~/.local/share/Trash/*

Run process in background

nohup node server.js > /dev/null 2>&1 &

nohup ...do not terminate this process even when the stty is cut off.
> /dev/null ...stdout goes to /dev/null (which is a dummy device that does not record any output).
2>&1 ...stderr also goes to the stdout (which is already redirected to /dev/null). You may replace &1 with a file path to keep a log of errors, e.g.: 2>/tmp/myLog
& ...run this command as a background task.