Category: Linux

  • Popular Linux Browsers

    Firefox

    Firefox is the best browser available for linux. What makes it so good besides its advanced features is it’s wondeful plugins and extensions support. Firefox is installable via apt.

    Useful extensions for firefox:

    1. Flashgot: FlashGot is a free Mozilla/Firefox/Flock/Thunderbird extension (compatible with Netscape too), meant to handle single and massive (“all” and “selection”) downloads with several external Download Managers. You can install flashgot for firefox from here.
    2. Tab Mix Plus: Tab Mix Plus enhances Firefox’s tab browsing capabilities. It includes such features as duplicating tabs, controlling tab focus, tab clicking options, undo closed tabs and windows, plus much more. It also includes a full-featured session manager with crash recovery that can save and restore combinations of opened tabs and windows. You can install Tab Mix Plus for firefox from here.

    Opera

    Opera is an alternate browser which can be used in case you find problems with displaying of some sites in Firefox. Opera is now available in MEPIS repositories. So you can install it directly.
    # apt-get install opera

  • Searching Techniques in Linux

    Here I shall cover the various techniques that can be used for searching.

    Searching for files

    “locate” works by maintaining a database of all the files which are present on the hard disk. When a search is performed for a specific file, this information is retrieved from the database. In order to update the database run the command “updatedb”. For example,

    # updatedb
    # locate ‘rc.firewall’

    “find” command is used for the same purpose as “locate” but the difference is that instead of maintaining a database it directly searches. For example,
    # find /etc/ -name ‘rc.firewall’

    Searching for files within packages

    You can either use “dpkg” or “apt-file” but for dpkg it is necessary that the package be installed and for apt-file you have to perform update regularly.
    # dpkg -S ‘apt.conf’
    (if the package containing apt.conf is installed then only will it return the result)
    OR
    # apt-file update
    # apt-file search ‘apt.conf’

    This search is useful if you want to know to which package a particular file / command belongs to.

    Searching (and replacing text) in multiple files

    “grep” is a very popular command which can be used to search for text in directories recursively.
    # grep -R ‘search_string’ *

    “rpl” (package installable via apt) is a good utility for replacing text in multiple files. For example,
    # rpl -vRa ‘old_string’ ‘new_string’
    (use option -s for simulation run)

  • Instant Messaging

    Instant Messaging – my favourite topic. There was a time in my graduation when I used to chat like hell and experiment with all the available messaging clients. My two cousins Sumana and Sujana and a friend Swetha used to always be the ‘bakras’ (scapegoats) bearing me :-). Times have changed now and I don’t chat so much but that doesn’t stop me from writing on my favourite topic. So go ahead and read it.

    Gyach (Yahoo Messenger for Linux)

    Gyach is yahoo messenger for linux and is supposed to support voice chat along with webcam. It is not availabe by default in the mepis/ubuntu repository and you will have to download it. You can either download their rpm, convert it to .deb using “alien” and install or you could download their source, compile it and install. There is also a thread which discusses how to install Gyach on Mepis.

    I was unable to use Gyach voice chat. But with other better software such as skype available, voice chat is not a big issue. As far as webcam is concerned, I was able to view other’s webcam but not able to broadcast mine. I also had a few issues with gyach (installed from rpm) crashing on my machine.

    Also, please note that there is an official Yahoo Messenger provided by Yahoo for linux users. But it is so outdated that I highly don’t recommend it.

    Skype
    Skype is a cross-platform voice messenger which is based on P2P technology. Mepis comes installed with Skype by default. If necessary, you can download the binary package for Mepis here.

    Pidgin

    Welcome to the King of Instant Messengers – Pidgin (formerly know as Gaim). Pidgin is a multi-protocol instant messenger available for both Linux and Windows. Using this messenger alone you can log into yahoo, msn, aim, google, etc. There are also many plugins available. Some very good plugins which are available by default are “System Tray Icon” and “Message Notification” plugins. Currently pidgin does not support voice/video chat but these are going to be added in the next major release.

    Notes:

    1. At the time of writing this article, there does not seem to be a binary package (.deb) available for pidgin. So you will have to download the source and compile and install it.Pidgin is now available in debian backports repository.
    2. Pidgin stores all message conversation in “~/.purple/logs/”. I generally move this folder to a location of which I take backup regularly and then create a soft link “~/.purple/logs” to the new location.
    3. Pidigin now comes with a console based messenger known as “finch”.

    Guifications

    Guifications is another plugin available for pidgin. This plugin is used to display events like user login, logout, etc. in a box at the corner of the screen.

  • Auto-mounting partitions

    The details of the partitions detected on the hard-disk is maintained in ‘/etc/fstab’ file. Simply Mepis automatically detects the available partitions and adds them as dynamic entries in /etc/fstab. If you want to make that partition entry as static, you will have to move that entry above the line “# Dynamic entries below, identified by ‘users’ option” in ‘/etc/fstab/’ file.

    In order to auto-boot a parition, you will have to change ‘noauto’ to ‘auto’. It is also a good idea to remove ‘users’ from the mount options so that only the superuser (root) can mount and un-mount partitions.

  • Mepis Basics

    Now that I have convinced you into using Linux (I do hope I have :-)), it is time to get into action. This page is the first of the many pages which I am going to write as to how best you can customize linux to suit your needs. Now that we are all set, let’s going.

    Gettting and installing Simply Mepis

    Simply Mepis is available for free and its ISO can be download from any of its mirror sites. Installing mepis is a child’s play and the official mepis site have also provided some documentation related to it.

    Notes:

    1. If you have no idea about what partitions are and how to create partitions, then I suggest you take the help of someone who is more experienced so that you don’t screw up something.
    2. It is always advisable to take backup of important data on your hard disk before partitioning, so that even if anything goes wrong you don’t lost valuable data.

    Basics of Linux

    In order to follow my articles, it is necessary that you have a basic understanding of what linux is, the console mode, the directory structure, some useful commands, etc. A book on basic linux usage may provide handy. Alternatively there will be many articles online which help you in getting started with linux. You can google for articles on introduction to linux on the net.

    Below are some linux useful commands which I highly recommend you understand before proceeding any further. I have just given a brief description for each of the commands. You may want to refer its man page or google for more information. Also execute each of the commands at least once so that you understand properly how it works.

    1. at – Executes commands at a later time
    2. alias – nicknames a command
    3. bash – Command Interpreter (shell)
    4. bc – Arbitrary calculator language
    5. cc – c language compiler
    6. cat – concatenates files to std output
    7. cd – Change Directory
    8. chmod – Change file access permissions
    9. clear – clears the screen
    10. csh – C shell
    11. cut – remove sections from each line of a file
    12. date – echoes and sets the systemdate
    13. diff – find differences between two files
    14. df – report disk space usage
    15. du – disk usage of each file
    16. env- runs a program with a modified environment
    17. exit – exits a shell
    18. export – exports a variable
    19. fg -runs a job in the foreground
    20. find – searches for a file in a directory hierarchy
    21. finger – displays information about a user
    22. ftp – allows user to transfer files to and from a remote network site
    23. g++ – c++ compiler
    24. gcc – same as cc
    25. gdb – gnu debugger
    26. gunzip – compress and uncompress files
    27. host – lookup hostnames using DNS domain server
    28. hostname – shows the system’s host name
    29. history – shows the last 1000 commands in .bash_history
    30. info – program to read documentation
    31. kill – Terminate a process
    32. killall – Kill a process by name
    33. last – show listing of last logged in users
    34. less – justs like more but you can scroll up or down
    35. links – popular text browser which supports frames
    36. ln – creates a link to a file or directory
    37. login – its used to sign on to a system .Switching between users.
    38. logname – prints users login name
    39. logout – exit a login shell
    40. ls – lists directory contents
    41. lynx – general purpose www text browser for linux
    42. mail – send and receive mails
    43. man – displays online manual pages
    44. mesg – controls write access to your terminal
    45. mkdir – creates the directory if does not exists
    46. more – opposite of less .read files by pages
    47. mv – moves (rename) files
    48. nohup – runs a command ignoring hangup signals
    49. pico – simple text editor in the style of pine composer
    50. ps – report process status
    51. pwd – prints the name of current working directory
    52. reset – restores variables to default values
    53. rm – remove files or directories
    54. rmdir – remove empty directories
    55. sleep – pauses for number seconds
    56. sort – sort lines of text files
    57. su – changes the effective user id and group id to that of a USER
    58. tail – outputs the last part of files (see also head)
    59. talk – copies lines from your terminal to any other terminal
    60. tar – tar archiving utility
    61. touch – change file timestamps like modification times etc.
    62. tty – prints the filename of the terminal connected to the standard input
    63. ttutor – typing tutor for linux
    64. umask – sets the default permissions for the file creation
    65. vi – Text editor for linux
    66. vim – Improved vi editor
    67. vimtutor – starts the vimtutor for learning the vim commands
    68. w – Shows who is logged on and what they are doing
    69. wall – send a message to everybody’s terminal
    70. whereis – locate the source/binary for a command
    71. whatis – search the database for complete words
    72. who – show who is logged on
    73. whoami – prints the effective userid
    74. write – send a message to another user
    75. zcat – compress uncompress files

    Mepis Configuration

    Many gui-based tools are provided exclusively by Mepis for performing some basic configuration of Linux such as configuring mouse and monitor, configuring network, creating and deleting uers, copying between desktops, testing and repairing paritions, etc. Some of them are mentioned below.

    1. msystem – MEPIS System configurator
    2. mnetwork – MEPIS Network assistant (some great news, since version 6.5 MEPIS supports WPA authentication for wireless networks)
    3. mxconfig – MEPIS X Window assistant
    4. muser – MEPIS User Assistant

    Control Center

    ‘kcontrol’ is a utility provided by KDE to configure many settings of your system which include setting background and screen saver, session management, power management, etc.

    Installing, uninstalling and upgrading packages from repository (using Synaptic and apt-get)

    Before I get into the details of how to use the tools for package maintenance, I shall give a brief introduction about debian package maintenance (as MEPIS is based on Debian and is tightly integrated with the Debian repositories).

    Debian provides a central repository for all the well-known Debian software. There may be other repositories provided by other debian software developers. The list of the repositories which we are using can be found in ‘/etc/apt/sources.list’. The database of what packages are available and their versions are stored locally on our machine. We need to update these databases regularly so that we know when newer versions of the packages are available. Please note that only the details of the debian packages and not the packages itself are what are stored on our machine locally. When you run a command to install a package, then only is the package actually transferred to our PC and installed.

    Now that I have explained how debian package maintenance works, let me cover the tools which we use for this purpose. There are two tools which can be used currently:

    1. apt-get (text based)

      Before installing a package or upgrading your system, it is very important that you update the database on your system which has information of the available packages and their versions. This can be done by running the command:
      # apt-get update

      In order to install a package, after running ‘apt-get update’, run:
      # apt-get install packagename

      In oder to uninstall a package, run:
      # dpkg -r packagename
      or if you want to remove the configuration files as well run:
      # dpkg –purge packagename

      The equivalent commands using apt for the above two operations are:
      # apt-get remove packangename
      # apt-get –purge remove packagename

      In order to upgrade the entire system, after running ‘apt-get update’, run:
      # apt-get upgrade

      You can limit the rate at which apt downloads packages using one of the below methods:

      • Set up a proxy server with delay pools and use apt-get to work with proxy as below (complicated).
        # apt-get -o Acquire::http::Proxy=’http://192.168.0.1:3128/’ upgrade
      • Install “trickle” package and use it to rate-limit apt-get as below (simple but might not work).
        # trickle -d 8 apt-get upgrade
      • Execute the below script “update.sh” to download all the upgraded packages and once this is done, run “apt-get upgrade” (simple and highly recommended method).


        #!/bin/bash

        cd /var/cache/apt/archives || {
        echo Failed to change to /var/cache/apt/archives >&2
        exit 1
        }

        apt-get update

        # first filter out all but the URIs with the grep
        # next grab just the first arg in uri and second arg in name
        apt-get --print-uris -y dist-upgrade | grep "^'" | while read uri name x;
        do
        # trim the leading and trailing quotes from the URI
        uri=`echo $uri | sed -e "s/^'//; s/'$//"`
        #echo $uri
        wget -c -t 0 --limit-rate=8k "$uri" -O "$name"
        done

        This code had been taken from Bandwidth limited apt-get

    2. Synaptic (gui based)

      Synaptic is a wonderful GUI tool using which you can install, remove, upgrade specific packages and also upgrade the entire system. Please note that before performing an install or an upgrade, it is important you click on ‘Reload’ button (this is equivalent to ‘apt-get update’). In order to upgrade the entire system, after reloading, click on ‘Mark All Upgrades’ followed by the ‘Apply Changes’ button.

    Notes:

    1. All the packages which are downloaded during installation are stored in ‘/var/cache/archives/’ directory. This directory is emptied by default when the system is rebooted. This can be unset by either using ‘msystem’ (select System Tweaks and uncheck ‘Clear packages at boot’) or by setting EMPTY_CACHE=no in /etc/default/mepis directory. Besides doing this, you will also have to open Synaptic, go to Settings->Preferences->Files and select what to do with the downloaded packages.

      In order to delete the downloaded packages you can just run:
      # apt-get clean

      In order to delete the downloaded packages which are no longer available in the repository you can run:
      # apt-get autoclean

    2. Avoid using “apt-get dist-upgrade” or the “Smart” upgrade option in Synatpic. Always use the default upgrade option. Use the smart upgrade option only if you are 100% sure that you know what you are doing. Becaue smart upgrade may tend to uninstall certain packages in order to install some packages.
    3. All the archives which are downloaded are stored in “/var/cache/apt/archives” directory. As this is located in the root partition, if it is formatted sometime for upgrading, these files may get deleted. Therefore it is not a bad idea to move this folder into some other partition and create a soft link “/var/cache/apt/archives” pointing to the new location of archives directory.
    4. While performing an upgrade, if you do not want to upgrade a particular package, you can execute the below command.
      # echo packagename hold | dpkg –set-selections

    Here are some related links.

    Debian Repository HOWTO
    APT HOWTO

    Installing a package not available in repository

    While the above procedure tells you how to install from the debian repository sometimes the software may not be available in the repository. Instead a binary package (.deb/.rpm) or the source (.tar.gz/.tar.bz) may be provided. In that case you will have to use the below method.

    From binary debian package (example: package.deb)

    The procedure is straight-forward for a binary debian package. Run the following command”
    # dpkg -i package.deb

    From binary rpm package (example: package.rpm)

    You will have to first convert the .rpm to .deb using ‘alien’ as below:
    # alien package.rpm

    This will generate a .deb binary file which can be installed as above:
    # dpkg -i package.deb

    From source (example: package.tar.gz / package.tar.bz2)

    You will have to first extract the source using the below commands depending upon whether .tar.gz is provided or .tar.bz2 is provided:
    # tar -xvzf package.tar.gz
    or
    # tar -xvjf package.tar.bz2

    After extracting the source directory, enter it and read ‘README’ or ‘INSTALL’ file for instructions on how to build and install the package. Please note that building a package from source generally requires the development packages of the libraries which it uses to be installed (development packages end with ‘-dev’). While the libraries are necessary for running the application, the development packages of the libraries are not necessary and can be un-installed once the compilation is over. Generally the below steps are following while installing from sources:

    1. Configuring: This involves generating Makefile’s depending upon the configuration of your system by running:
      # ./configure –prefix=/usr/local/packagename
    2. Compiling:
      # make
    3. Testing (may or may not be available):
      # make test
      or
      # make check
    4. Installing:
      # make install
    5. Uninstalling (may or may not be available):
      # make uninstall

    Adding and removing startup services

    Services can be added and removed from startup using ‘update-rc.d’ command. The start-up scripts are generally located in ‘/etc/init.d/’ directory. For example if you want to start the service ‘ssh’ during boot-up, you would run the following command:
    # update-rc.d ssh defaults
    and to stop the service ‘ssh’ from starting, you would run the following command:
    # update-rc.d -f ssh remove

    While services can be added and removed from startup using the above method, please note that when upgrading the system, during the upgradation of the package providing the service, the service is added to boot at start-up automatically. Hence I recommend that if you are sure you are not going to use a particular service, it is best to completely uninstall the package providing that service rather than just removing it from start-up. I shall later cover how we can know as to which package does a particular service (or start-up script) belongs to.

  • Introduction to Linux

    Why Linux?

    The million dollar question – Why use Linux? In my view, for three simple reasons.

    1. It is free
    2. It is more secure
    3. You don’t have the problem of viruses

    And my justifications for the above three reasons.

    1. Yes, I feel very guilty being a software engineer and using pirated software. You may argue that Microsoft is minting, they are robbing us, their software is extremely costly, it won’t make a difference to them, blah … blah … but I still believe that it is ethically wrong to use pirated software. And the same holds for music. There are always free sites as Music India Online and Raaga from where you can listen to streaming audio.
    2. Linux is open-source which means people get to see the code. Hence all the loop-holes in the software are already reported before they can be exploited. This makes Linux more secure than Windows.
    3. Viruses .. they are all around us :-). Need I really say anything about this?

    Talking about the superiority of Linux, I should confess that right now Windows still rules in the market. Some top reasons being:

    1. Its gui is far better than most of the linux distros.
    2. If my stats are not wrong, 90% of home machines use Windows. Maybe in 2020 only 10% of home machines would use Windows but the bottom line is that right now, its Windows which has dominated the OS market.
    3. Last but not the least, because of above point, drives for TV Tuner Cards, digicams. etc. are written for only Windows by the hardware product supplier. Believe me, this was one time when I felt … Oh God, why arn’t there any official linux drivers for this hardware product (referring to my TV Tuner Card)?

    Which Linux distro?

    Just before I get into suggesting which linux to use, let me give you a small background on how these distros – Ubuntu, Fedora, Mandrake, Suse, Mepis, etc. are made.

    The heart for any linux distribution is the kernel. This kernel is maintained by the Linux Guru “Linus Trovalds”. There are a set of kernel developers who keep working on the present kernel and improving it. Once they have added some new features, they send it to Linus for review. Linus reviews them and incorporates them in the kernel and releases its new version.

    Now, individual packages (like firewall, photo editing software, etc.) are generally maintained by organizations or individuals.

    Now the various linux distros are formed by taking this kernel, taking the software whichever they feel is necessary and bundling them together and giving to the user as an Operating System.

    Giving you an overview of how generally Linux distros are made, I now go into which linux distro. to use and the one I suggest is Mepis. Few reasons why I chose this OS are

    1. It is debian based which has a huge user community
    2. It has a great UI (almost as good as Windows)
    3. It runs off a live CD. What I mean by a live CD is that you don’t need to install it on your hard disk to have a look and feel of it. You can run it directly from your cd, check for its compatibility with your hardware and then install.

    This has also been awarded the Best Free Desktop Linux . Point & Click Linux! is an excellent book which helps users in gettting started and using SimplyMepis.

    Just on a side note, Mepis is based on Debian which is based on apt package manager (I will talk about apt in the later chapters). If you are looking for a rpm based distribution which is great for beginners just like Mepis, then you may try out PCLinuxOS.

    Distrowatch.com is a great website which keeps track of all the Linux Distributions.

    Is shift from Windows to Linux possible?

    Though I am linux fan, I shall not lie in saying that this completely depends upon the level of exposure to Linux and inquisitiveness of the user.

    • If you are someone who has never used Linux and are least interested in learning something new, then I suggest you stick to Windows.
    • If you are someone who has a fair knowledge of Linux (like the basic commands, permissions, etc.) and have some exposure to Linux, then you can shift to Linux completely.
    • If you are somewhere between a novice and an expert, then I suggest you install Linux (without deleting Windows) and later when you get hold on Linux, you can completely shift to it from Windows.