Saturday, 31 August 2013

Linux - How does the linux file system work?

   /    

Root "/" file system: The kernel needs a root file system to mount at start up.
/bin (commands needed during bootup),
 /etc (config files) , 
/lib(shared libraries).
/usr filesystem : this file system is generally large as it contains the executable files to be shared amongst different machines. Files are usually the ones installed while installing Linux. This makes it possible to update the system from a new version of the distribution, or even a completely new distribution, without having to install all programs again. Sub directories include /bin, /include, /lib, /local (for local executables)

/var filesystem : this file system is specific to local systems. It is called as var because the data keeps changing. The sub directories include /cache/man (A cache for man pages), /games (any variable data belong to games), /lib (files that change), /log (log from different programs), /tmp (for temporary files)

/home filesystem: - this file system differs from host to host. User specific configuration files for applications are stored in the user's home directory in a file. UNIX creates directories for all users directory. E.g /home/my_name. Once the user is logged in ; he is placed in his home directory.

/proc filesystem : this file system does not exist on the hard disk. It is created by the kernel in its memory to provide information about the system. This information is usually about the processes. Contains a hierarchy of special files which represent the current state of the kernel .Few of the Directories include /1 (directory with information about process num 1, where 1 is the identification number), /cpuinfo (information about cpu), /devices (information about devices installed), /filesystem (file systems configured), /net (information about network protocols), /mem (memory usage)

    Note:   

  • At the time of installation of Linux, a file system is assigned and persists in the hard disk. This file system structure resembles a tree.
  • A file can be a list of names and numbers or executable programs. Linux treats every program as a file. Linux treats directories and computer components also as files.

What is Linux Shell? What is Shell Script?

   What is Shell   
Linux shell is a user interface used for executing the commands. Shell is a program the user uses for executing the commands. In UNIX, any program can be the users shell. Shell categories in Linux are: 
Bourne shell compatible,  -->  /dev/sh
C shell compatible, -----------> /dev/csh
Korn shell   --------------------> /dev/ksh
Bourne again shell  ---------->  /dev/bash

nontraditional, and historical.
A shell script, as the name suggests, is a script written for the shell. Script here means a programming language used to control the application. The shell script allows different commands entered in the shell to be executed. Shell script is easy to debug, quicker as compared to writing big programs. However the execution speed is slow because it launches a new process for every shell command executed. Examples of commands are cp, cn, cd.
Linux shell is the user interface to communicate with Linux operating system. Shell interprets the user requests, executes them. Shell may use kernel to execute certain programs. Shell Script: A shell script is a program file in which certain Linux commands are placed to execute one after another. A shell script is a flat text file. Shell scripts are useful to accept inputs and provide output to the user. Everyday automation process can be simplified by a shell script.

Tuesday, 27 August 2013

Linus Torvalds celebrates 22 years of Linux


It was 22 years ago on Sunday that Linus Torvalds announced in a newsgroup posting that he was creating a free operating system, a message he echoed in his announcement Sunday of the latest Linux kernel release candidate. 

"Hello everybody out there using minix - I'm doing a (free) operating system (just a hobby, won't be big and professional like gnu) for 386(486) AT clones," 
 Torvalds wrote on August 26, 1991, asking people to send in feature requests.


On Sunday, Torvalds announced the Linux 3.11-rc7 kernel release in similar fashion.
"Hello everybody out there using Linux -- I'm doing a (free) operating system (just a hobby, even if it's big and professional) for 486+ AT clones and just about anything else out there under the sun. This has been brewing since april 1991, and is still not ready. I'd like any feedback on things people like/dislike in Linux 3.11-rc7," he wrote on Google+.
"I originally ported bash(1.08) and gcc(1.40), but others have taken over user space and things still seem to work. This implies that I'll get the final 3.11 release within a week, and I'd like to know what features most people would want. Any suggestions are welcome, but I won't promise I'll implement them :-)," he added.

Torvalds was also quick to add, in a comment on his post, that any feature requests would be a bit late. "Yeah, I don't really want to get feature requests this late in the rc series... But it is 22 years today since that email, and I would like people to try the current 3.11-rc7 kernel I just cut and uploaded to the usual places," he wrote.
Version 3.11 of the Linux kernel has been given the codename Linux for Workgroups, a reference to Windows 3.11 for Workgroups, released by Microsoft a little over 20 years ago.
One of the bigger changes from version 3.10 of the kernel is improved power management in AMD Radeon graphic chips. 


Important Shortcuts For Linux

Ctrl + Alt + F1

You would already know that Linux can support various terminals. This command helps you move to the first terminal from wherever you are.

Ctrl + Alt + Fn (n=1..6)

In the standard setup, Linux can support a total of 6 terminals. This command lets you move to the terminal of your choice.

tty
This command is used to print the name of the terminal that you are currently using.

Ctrl + Alt + F7
This command is used to move to the graphical user interface terminal.

Ctrl + Alt + Fn (n=7..12)
This command helps the user go to the desired graphical user interface terminal. As a default setup, these terminals aren’t running anything, but one can use them to run a different server.

Tab
When you’re using a text terminal, you can use this command to autocomplete a command. If there is only one option, then the command is completed automatically, else it shows all the options that are available.

ArrowUp
This is used to scroll up and edit the command history. You need to press enter in order to execute this.

Shift + PgUp
This one scrolls the terminal output upwards. It also works on the login prompt, thereby allowing the user to scroll through whatever messages there are during bootup.

Shift + PgDown
Same as above, just scroll downwards.

Ctrl + Alt + +
In the X-windows system, this command is used to change the resolution of the next X-server, if it has been set to multiple resolutions.

Ctrl + Alt + -
This is the opposite of the above command. You use this to change to the previousX-server resolution.

Ctrl + Alt + BkSpc
In the event that the X-windows server that you were using has crashed and there is no way to exit it, this command helps you kill the said X-windows server in such a situation.

Ctrl + Alt + Del
When you’re at the text-mode console, this is the normal shut down command. It shuts the system down and reboots it.

Ctrl + c
This command shuts down the process that is currently running.

Ctrl + d
This command is used in order to logout from the terminal that you are on.

Ctrl + d
This command sends the [End-of-file] to the process that is running. Pressing it twice makes you log out of the system as well.

Ctrl + s
You use this command if you want to stop a transfer to a terminal.

Ctrl + q
If the terminal you’re working on stops responding then this command can help resume the transfer to the said terminal.

Ctrl + z
This command is used to shift the process that is currently running to the background.

exit
This is an alternate command for ‘logout’. It is used to log out of the system.

reset
This command is used to restore to default setting, a terminal that is screwed up. This means that it is displaying odd characters. The command is sometimes invisible when you’re typing it.

MiddleMouseButton
This is how you carry out the copy-paste function in Linux. The command is used best when you have a Linux-enabled three button mouse.

~(tilde)
This command takes you back to the home directory.

. (dot)
This command is for the current directory. A command such as ./the_program is going to try and run the file the_program.

.. (two dots)
This command changes the current directory into the parent directory.

Sunday, 25 August 2013

NS2 Configuration and Installation

 STEP 1 
download the NS-2.35 allinone software from the following link. 
    • http://sourceforge.net/projects/nsnam/files/allinone/ns-allinone-2.35/ns-allinone-2.35.tar.gz/download
    (or)
    https://dl.dropbox.com/u/24623828/ns-allinone-2.35.tar.gz
     STEP 2 
  •  Copy that file to /home/<username> (home folder of user)
    Open terminal again and execute the following commands one by one
    • tar zxvf ns-allinone-2.35.tar.gz
    • cd ns-allinone-2.35
    • ./install
       STEP 3 
  • You may possibly get one error during your installation is linkstate/ls.h error
  • If you get the above error, open the file (~ns-2.35/linkstate/ls.h) using gedit or any text editor
  • Go to line number 137 and change this line
    (void eraseAll() { erase(baseMap::begin(), baseMap::end()); })  
    to
    void eraseAll() { this->erase(baseMap::begin(), baseMap::end()); }
    • again you try the command ./install and this time the installation will be successful.
 STEP 4 
    • Once installed the PATH information will be provided to you.
    • Copy the PATH and LD_LIBRARY_PATH Variable to /home/<username>/.bash_profile (see a dot in the beginning it is a hidden file)
    • edit by -----> gedit /home/<username>/.bash_profile (for fedora)
      edit by -----> gedit /home/<username>/.bashrc (for ubuntu)    
         
Input the path information in .bash_profile file like this                                     
 export PATH=$PATH:/home/<username>/ns-allinone-2.35/bin:/home/<username>/ns-allinone-2.35/tcl8.5.10/unix:/home/<username>/ns-allinone-2.35/tk8.5.10/unix

export LD_LIBRARY_PATH=/home/<username>/ns-allinone-2.35/otcl-1.14:/home/<username>/ns-allinone-2.35/lib
 STEP 5 
then checkitby
$>  ns
a
$> nam