Simple precautions for a Linux user

Last modified 2012-Aug-14.

  1. Back up regularly

    The easiest way is to synchronize your files with a remote filesystem on another computer, via rsync. Here is a general-purpose driver script called rsynchro which synchronizes a given list of files rsynchro.lis between a local and remote machine.
  2. Use a safe deletion command instead of rm

    Create a wastebasket directory, e.g. ~/.wastebasket, and define the aliases (here using the bash shell),
    alias rm='echo "Use rem for reversible delete, \\rm  for regular delete"'
    alias rem='\mv -t ~/.wastebasket'
    
    Now you always type "rem file1 file2 ..." to delete files. If you need the original rm command, you can still get it by typing "\rm". You will quickly get used to typing "rem" instead of "rm", and before long you will thank yourself for making the effort. Just remember to empty your wastebasket directory occasionally.
  3. Make mv and cp safer

    Alias them to safer versions that prompt before overwriting, and create a backup of what they overwrite,
    alias mv='mv -i -b'
    alias cp='cp -i -b'
    

Mark Alford's home page

alford(at)wuphys.wustl.edu

Valid XHTML 1.0!