"Linux/FreeBSD Tips & Tricks"

Published: Sat 15 July 2017

In content.

  • FreeBSD is started up by the program 'init'. The first thing init does when starting multiuser mode (ie, starting the computer up for normal use) is to run the shell script /etc/rc. By reading /etc/rc and the /etc/rc.d/ scripts, you can learn a lot about how the system is put together, which again will make you more confident about what happens when you do something with it.
  • sh (the default Bourne shell in FreeBSD) supports command-line editing. Just ``set -o emacs'' or ``set -o vi'' to enable it.
  • When you have made modifications to a file in vi, and then find that you can't write it, type "!rm -f %" then ":w!" to force the write. This won't work if you don't have write permissions to the directory and probably won't be suitable if you're editing through a symbolic link.
  • If you accidentally end up inside vi, you can quit it by pressing Escape, colon (:), q (q), bang (!) and pressing return.
  • If you write part of a filename in tcsh, pressing TAB will show you the available choices when there is more than one, or complete the filename if there's only one match.
  • nc(1) or netcat is useful not only for redirecting input/output to tcp or udp connections, but also for proxying them with inetd(8)
  • Simple tcsh prompt: set prompt = '%#'