Program for Palindrome

cat filename|while read LINE
do
REVERSE=`echo "${LINE}"|rev`
if [ "${LINE}" = "${REVERSE}" ]
then
echo "Palidrome: ${LINE}"
fi
done

Program for print star

echo "Stars"

for (( i=1; i<=5; i++ ))
do
for (( j=1; j<=i; j++ ))
do
echo -n " *"
done
echo ""
done

for (( i=5; i>=1; i-- ))
do
for (( j=1; j<=i; j++ ))
do
echo -n " *"
done
echo ""
done

Program for for-loop

echo "Can you see the following:"

for (( i=1; i<=5; i++ ))
do
for (( j=1; j<=i; j++ ))
do
echo -n "$i"
done
echo ""
done


echo "Can you see the following:"

for (( i=1; i<=5; i++ ))
do
for (( j=1; j<=i; j++ ))
do
echo -n "$j"
done
echo ""
done

Program for Digit

if [ $# -ne 1 ]
then
echo "Usage: $0 number"
echo " I will find sum of all digit for given number"
echo " For eg. $0 123, I will print 6 as sum of all digit (1+2+3)"
exit 1
fi

n=$1
sum=0
sd=0
while [ $n -gt 0 ]
do
sd=`expr $n % 10`
sum=`expr $sum + $sd`
n=`expr $n / 10`
done
echo "Sum of digit for numner is $sum"

Program for reverse order

if [ $# -ne 1 ]
then
echo "Usage: $0 number"
echo " I will find reverse of given number"
echo " For eg. $0 123, I will print 321"
exit 1
fi

n=$1
rev=0
sd=0

while [ $n -gt 0 ]
do
sd=`expr $n % 10`
rev=`expr $rev \* 10 + $sd`
n=`expr $n / 10`
done
echo "Reverse number is $rev"

File System in Linux

The Linux operating system provides a file system to organized the data on Linux based computer. The file system has a hierarchical tree like structure to store file in a directory. File containing data of similar nature are place under one directory. All the Linux files are stored in one main directory called root. The administrator of the Linux operating system stored all the home directory of the end user in the slash(/) home directory.

Copy & Paste Command

yy/Y :- Select the current line that is to be copied.

nyy/NY :- Select a line including the current line.

P :- Places the selected text after the current cursor position.

p :- Places the selected text before the current cursor position.

Deletion & Modification Commands

dw :- Delete a word
cw :- Change a word
dd :- Delete a line
cc :- Change a line
x :- Delete a character before current cursor position.
j :- Join the current line with next line.
u :- Undo last changes[ctrl + z]
U :-Restore last changes
. :-Repeats last changes

Insert / Replace Command

A :- Appends the text after current users position. Append text at the end of line.

I :- Insert text at the current cursor position .Insert text at the beginning of line.

O :- Insert the blank line below the current line & than unable to insert text in blank line. Insert blank line above the current line & than unable to insert text in blank line.

Rx :- Replace current character with character x.

Cursor Movement Commands

H :- Moves the cursor to the previous character.
L :- Moves the cursor to the next character.
k :- Moves the cursor up by one line.
j :- Moves the cursor down by one line.
o :- Moves the cursor beginning of a line.

Use of VI Editor

The VI Editor is a visual editor in Linux that enable you to create an edit text files containing data, document or programs.
Using the VI editor you can display content of file on the screen and add,insert ,delete or change parts of text in a file.
Syntax: $ vi
In the above command filename is the name of specified file. The above command create a text file & enable you to add text in the file.

Kernel Sapce & User Space

Kernel space is where the 'Kernel' executes & provides its services.User space is that set of memory location in which user processes run.A process is an executing instance of a program.

What is Shell?

Linux has simple user interface called the shell that provides the services that a user wants. It is through shell user interact with computers.It protects the users from having to know the intricate. Some of the common shell in Linux are bash, sh, tcsh, csh, bornshell etc.

What is Kernel?

The core of the Linux system is the kernel the operating system program. The kernel controls the resources of computers,Allocating them to different users & tasks it interact directly with hardware there by making programs easy to write & portable across different hardware platform.However, the user not deal directly with the kernel.Instead ,the Logon process starts up separate,interactive program called a shell for each user.

What is Linux

Linux is an operating system for PC computers and workstations that now features a fully functional graphical user interface(GUI),just like Windows and the Mac(through more stable). Linux was developed in the early 1990s by Linus Torvalds,along with other programmers around the world. As an operating system, Linux perform many of the same function as UNIX, Mac, Windows, and Windows NT.However,Linux is distiguished by its power and flexibility.Most PC operating system, such as windows,began their development within the confines of small,restricted personal computer,which have only recently become more versatile machines.