How to Set Email Addresses for a Linux User

Sometimes you may receive email failure messages when your computer tries to send a mail to a linux user regarding things like errors in cron jobs, etc. and the email address is not a valid one , e.g. root@your-computer-name. To fix this, set up forwarding of emails or aliases for your linux users. Here are the steps to setting up aliases, assuming we want to do this for the user root.

  • Open the aliases file :
    $ sudo vim /etc/aliases
  • Enter the new alias you want on a new line in the following format
    root: youremail@address.com
  • Save and close the file
  • Run the newaliases command
    $ newaliases

Now that this is done, the computer will send all root’s future emails to youremail@address.com

How to Edit Multiple files with VIM

This tutorial is a simple technique for editing multiple files in VIM which I stumbled upon very recently.

Suppose you have 3 files you want to edit at a go, you can simply run

$ vim file1.txt file2.txt file3.txt

If you want to edit all the files in a directory, you can cd to that directory and run

$ vim *

While editing the files, you can switch to the next file using the command :next of :n. :wnext can be used to write changes and move to the next file in one go.

To move to previous file run :previous . To save and move to previous file in one go run :wprevious.

To see where you are in the list of files open, run :args

How to Type Special Characters in Ubuntu

Here I describe a technique to type special characters in Ubuntu with the keyboard if you use a few special symbols occasionally.

  • First, learn the hexadecimal value for the character. One way to do this is to open the Character Map application, find the character and check the unicode value at the bottom of the window. Close Character Map when done. Assuming the character you want to type is é then unicode values is 00e9
  • Type Ctrl + Shift + U, then type the unicode value of the character. You may omit leading zeros. So for é that will be Ctrl + Shift + U + e9. Then press Enter. Note after pressing Ctrl + Shift + U, an underlined u will appear behind the cursor to signify you are in unicode entry mode.

How to Fix Problem With Wireless on Toshiba Laptop Running Ubuntu

In this blog, I will describe a solution if you suddenly find out that wireless connection is not working on your Toshiba laptop running Ubuntu. This fix applies to a Toshiba Satellite to be specific but may work on other makes. While it may not fix all wireless problems, it worked in my case.

Symptoms
The light for wireless is not lit.
When you press Fn + F8 which is meant to switch on/off wireless, the wireless light does not come on.
You are unable to connect to the internet by wireless.

Cause
The problem could be caused by a problem in the hardware.

Solution
Switch off the computer.
Disconnect the power cable and remove the battery.
Press and hold the power button for at least 30 seconds.
Replace the battery.
Start the computer. Wireless facility should now start working.

Source
Jason’s Computer Science Blog – » Toshiba Laptop + Ubuntu, Wireless Switch Problem http://www.jasonernst.com/2012/03/05/toshiba-laptop-ubuntu-wireless-switch-problem/

How to Convert .AMR Files to .MP3 Format

In this article I will describe how to convert .amr files to .mp3 format.

AMR is the file format used to store spoken audio using the AMR (Adaptive Multi-Rate) codec. Cellphones commonly store spoken audio in AMR format.

We assume that you are using Windows 7, Vista or XP.

To convert a .amr file to .mp3 format, do the following:

  • Visit http://www.amrtomp3converter.com/
  • Download and install the AMR to MP3 converter software
  • Open the converter and add the .amr file you want to convert
  • Press the button to convert to .mp3 format, then select the destination folder

How to Mount Windows Partitions on Ubuntu

This tutorial describes how to mount a Windows partition on Ubuntu if you find it isn’t mounted automatically. We will use the UUID of the partition in mounting. I will describe how to mount Windows partition whenever Ubuntu is booted.

1. Find the device you want to mount. To do this, run the following in a terminal

$ sudo fdisk -l

Windows partitions will usually be in ntfs format. Usually it is at /dev/sda2 or /dev/sda3 and you may be able to differentiate the windows partition from a windows recovery partition by comparing the sizes.

2. Find the UUID of the windows partition by running the following in the terminal:

$ sudo blkid

Find the one corresponding to the Windows partition and have it handy.

3. Back up your file systems table configuration file (fstab) by running the following the following in a terminal:

$ sudo cp /etc/fstab /etc/fstab.orig

4. Edit fstab using your favourite editor. e.g.

$ sudo gedit /etc/fstab

5. Assuming we want to set the mount point for Windows to /media/windows, add the following line to fstab

$ UUID=the-uuid /media/windows ntfs-3g defaults,user,locale=en_US.utf8 0 0

Where the-uuid is the UUID you found in step 2. Save the close the file.

6. create that directory by running :

$ sudo mkdir /media/windows/

7. Unmount the partition and remount it by running these in a terminal:


$ sudo umount /media/windows
$ sudo mount /media/windows

Reference:
MountingWindowsPartitions – Community Ubuntu Documentation https://help.ubuntu.com/community/MountingWindowsPartitions

How to Enable ping on Amazon ec2 server

This post describes how to enable pinging on your amazon ec2 server.

  • Log in to amazon aws console and click ec2 tab
  • Find the security group  of your ec2 instance under Security Groups on the wc2 page
  • Create a key and certificate which you will use with ec2-authorize command.
    • On the top right of the screen click the down arrow next to your name
    • Click Security Credentials on the dropdown menu. You will be redirected to Security Credentials page
    • Click X.509 Certicates tab under Access Credentials section
    • Click Create a new Certificate
    • Download the private key and certificate in the resulting dialog that appears
  • Upload the private key and certificate to your ec2 server by sftp
  • Install ec2-api-tools package if not already installed
    • To do this, enable ubuntu multiverse repository if not already enabled
      • To do this, back up your sources list by running
        $sudo cp /etc/apt/sources.list /etc/apt/sources.list.backup 
      • Open /etc/apt/sources.list
      • Uncomment the lines for multiverse list by removing the leading # symbols
      • Save and close the file
      • Retrieve updated package lists by running
        $sudo apt-get update
  • Enable icmp ping by running
    $ec2-authorize -K /path/to/private/key \
    -C /path/to/certificate your-instance-security-group \
    -P icmp -t -1:-1 -s 0.0.0.0/0