I got into a lot of trouble last time I wrote a post with a title like this. Let’s tempt fate again!
We haven’t had a things you already know, unless you don’t post for at least a few months, so here’s something that still surprises some people.
Instead of doing this:
$ sudo vi ./file
You can do this:
$ sudoedit ./file
Safer, easier, better :).
From the manpage(8), the tool creates a temporary copy of the file, then invokes whichever editor you have defined in
EDITOR. When you’re done editing, the temporary modified file is copied back to the original location.