nix, shell, perl, php, mysql and mac os x tips and tricks

Sunday, May 29, 2005

Using crypt to encrypt/decrypt files

A file can be encrypted in the shell mode using crypt, or in the edit mode using the -x or X option. When you are ready to decrypt the file, you can use the crypt command in the shell mode. The following is the command format to encrypt a file:
crypt < oldfile > newfile
The system prompts you for a password.

Before removing the unencrypted oldfile, make sure the encrypted newfile can be decrypted using the appropriate password.

To decrypt a file, redirect the encrypted file to a new file you can read. The command to decrypt a file is as follows:
crypt < encrypted_file > new_filename 

Monday, May 23, 2005

Use wget to retrieve a directory of mp3s

wget -r -l1 --no-parent -A.mp3 -R.html,.gif

Monday, May 9, 2005

Block a particular IP address with iptables

iptables -I INPUT -s -j DROP