Linux hacks
Command Line Completion
The Bash default command line completion isn't as good as Windows. But you can configure it to be the same. Just edit ~/.inputrc and add the following:
set completion-ignore-case on
set mark-directories on
set mark-symlinked-directories on
set show-all-if-ambiguous on
set visible-stats on
$if mode=vi
"\C-0-": digit-argument
TAB: menu-complete
"\e[Z": "\C-0-\t"
$else
TAB: menu-complete
"\e[Z": "\M—1\t"
$endif
Auto login
If you're creating a simple Virtual Machine that's only got a console and you don't have any security concerns (e.g. a test network isolated from the internet), then you can enable auto-login.
Install the package mingetty. e.g. apt-get install mingetty
Enable the root account. e.g. sudo passwd root
Edit the tty file.
In Ubuntu 10.04 it is in /etc/init/tty.conf. Change the line to exec /sbin/mingetty --autologin root tty1
In Ubuntu 9.04 or earlier it is in /etc/event.d/tty1. Change the line to exec /sbin/mingetty --autologin root tty1
In other linuxes, try /etc/inittab. Change the line to 1:2345:respawn:/sbin/mingetty --autologin root tty1
Stop terminal auto-off
By default the terminal window will blank out if nothing is done, which is not very useful if you're monitoring stuff. To disable this, use the following command.
setterm -blank 0 -powersave off -powerdown 0
Generate CSV file of current directory
find -printf '"%P";"%Tc";"%s";\n' > ~/files.csv
Get the end of a file
less +F error.log
To page up / page down, you need to press Ctrl-c.
To re-enter forward forever mode, press F.
Make a time-stamped backup of a file
cp /folder/file.ext{,-`date +%Y-%m-%d-%H%M%S`}