Friday, February 1, 2008

Text viewer

To view text in linux, there are several tools that one can use. The purpose of the text viewer is to view the text file and not editing it. Some of it also equipped with search function to ease reading.
If you are using GUI, you can use gedit, which is available if you are using gnome desktop environment. Gedit works as both editor and viewer. If you are using KDE desktop, you can use KEdit.

In the absence of GUI, a few tools can be used, such as less and more. These 2 tools is quite similar with only the difference in name.
To use less:
# less filename

and similarly to use more:
# more filename

Another tool that can be used is cat. Cat's purpose is to concatenate 2 file into one, but if used to a single file, cat will display the file to standard output. To use cat:
# cat filename

Thursday, January 17, 2008

Installing multimedia codecs in linux

Codecs, is an important element when we are talking about playing and watching multimedia files. To install codecs on linux box, it is an easy task. Just follow the below instructions :-) :

  1. Download the codecs source from here. Thank you to the mplayer team for this magnificent codecs source.
  2. Login as superuser
    • # su -
  3. Extract the downloaded archive
    • # tar -xvjf all-20061022.tar.bz2
  4. Make 2 directories if they are not already exist.
    • # mkdir /usr/local/lib/codecs
    • # mkdir /usr/lib/win32
  5. Copy the content of the extracted directory to the newly created directory
    • # cp all-20061022/* /usr/local/lib/codecs
    • # cp all-20061022/* /usr/lib/win32
  6. Change the permission of the directories to 755
    • # chmod 755 /usr/local/lib/codecs
    • # chmod 755 /usr/lib/win32
  7. Finish. Congratulations, you have managed to install multimedia codecs into your linux box. You can test it by playing any video with your favorite media player.

Monday, January 14, 2008

Backup using tar and ssh

Doing backup is important. You do not want to store your backup at the same machine where the data is stored. It is to avoid data loss when the machine broke down. To do this job, you can use tar paired with ssh to archive your important data and transfer it through network to another machine. Below are the steps:

1. Make sure the backup machine is installed with ssh server and the service is running
# yum install openssh-server
# service sshd start

2. Go to the folder where you want to backup. Use tar to archive and send it though network to backup machine
# tar -cvjf - /path/to/backup | ssh user@backupmachine "cat > /home/backup.tar.bz2"

3. Finish. Congatulations, your backup file is now safely kept in the backup machine

Wednesday, December 19, 2007

Your own installed CIDR tables

When setting up networking, one of useful tool is the cidr tables, where you can refer the netmask and you can determine the cidr length for your netmask. Usually people will search the internet for network calculator or try to search for the cidr table. There is another easy way for you to have a cidr table installed in your computer and you can refer to it anytime you want using a single command. The package is perl-Net-IP. Install it using yum.

# yum install perl-Net-IP

After the installation finished, you can refer to the cidr table using the below command:

# iptab

There you go, a cidr table installed in your own computer for your own reference anytime. Have fun :-)

Tuesday, December 18, 2007

Sending message to users

To send message to a particular user, you have to know what is the user tty. You can do this by typing:

# w


This command is used to show who is logged on and what they are doing. The output of the above command is usually like below(Click to see the image clearly):



To send message to a specific user:

$ write username tty

Example, to send message to user user1:

$ write user1 pts/3


Write you messages, and then press Ctrl-d to exit 'write'

To send message to all connected user, use wall command:

$ wall

Type your message and Ctrl-d to exit 'wall'