Saturday, May 28, 2011

Data Recovery in Linux

Yesterday was really an unlucky day for me. An example for this may be, I have deleted a lot of my useful data by mistake. I was going to delete a folder using SHIFT + DEL, but in doing so by mistake I had pressed SHIFT + END then SHIFT + DEL. Grrrrrrrrrrrr :x.
So, now I need a software for data recovery for ext4 filesystem.


TestDisk - CGSecurity

TestDisk is wonderful FOSS under GNU Public License. It is capable enough to data recovery from lost partitions and/or make non-booting disks bootable again when caused by faulty software, certain types of viruses or human error (such as accidentally deleting a Partition Table).
TestDisk can run under
* DOS (either real or in a Windows 9x DOS-box),
* Windows (NT4, 2000, XP, 2003, Vista, 2008, Windows 7 (x86 & x64),
* Linux,
* FreeBSD, NetBSD, OpenBSD,
* SunOS and
* MacOS X


How to recover data?

Open terminal and type:
1. Installation:
# yum install testdisk
2. Run:
# testdisk
Now, you can see a text user interface like this:

Note: Use keyboard: left arrow move left, right arrow to move right, Up arrow to move up, down arrow to move down and Press Enter to Select an option.
Now, select an option which you think best for you. But, I prefer to main a log.


Select the disk from which you want to recover data and Proceed.


Select partition type, here in my case Intel and Press Enter.


Select Analyse and Press Enter.


Just Select Quick search and Press Enter. First time, it will take some time, in my case it took half an hour.


Now, select the partition from which you want to recover data and Press P. It will list all files and directories inside the partition.

Note: White Color files indicate existing files and Red color files indicates deleted files.

Just select the deleted file which you want to recover and Press c to copy. Now, you will get a options asking about destination location. Choose your destination location and Press Y. This copy process will take some time depending upon files size. When the 'Copying, please wait...' message will be replaced by 'Copy done!' message, then you can find your files on destination location.

I hope this post will help you. Thanks for Visiting by blog.

Cheers. :)

Google Summer Of Code 2011- Student

GSOC

Port Infrastructure TurboGears1 apps to TurboGears2

This year, I am participating in Google Summer Of Code 2011 as a student.
From Summer coding ideas for 2011 , I have selected Port Infrastructure TurboGears1 apps to TurboGears2 as my Summer Of Code project. Thou, I am interested to work on another project hopefully Fedora Medical. But, my semester exams are going to begin from 19th May 2011. So, till now looks like situation is not favouring me to accept another project.

Here, you can find my proposal in Summer Of Code 2011 for Port Infrastructure TurboGears1 apps to TurboGears2.
I have already conversation with Matt Domsch (mentor) and Toshio Kuratomi on #fedora-admin about this issue. With the permission Of Matt Domsch and his suggestion, I have decided to working on fas application first.
Yesterday, I have cloned fas app from "git clone git://git.fedorahosted.org/git/fas.git" and successfully completed modiication on setup.py and convert.py files.

I love development work and enjoying my work in GSoC 2011. :D
Thanks To Google for Conducting Summer Of Code.

Fedora And Open Source Event, GCECT

Before I start, I like to Thanks Rahul Sundaram, Prosun Sir, all Speakers, all Volunteers and my college teachers who help me a lot to organise this event successfully.
Thou, I agree that there where few mistakes may be since this was my first event or first FOSS event in our college (strange na) or may be due to lack of any Senior fedora Ambassador.

What ever may be I put you to decide the perfect reason for this.


Event Details: https://fedoraproject.org/wiki/Fedora_14_release_party_gcect
Total Event Registration: 200+
Total Event Attended: almost 150

2nd Feb 2011, I entered into my college campus at 9:00 A.M (1 and half hour before event was going to begin), my friend (responsible for managing auditorium and audio system setup) called both the person (lives beside our college campus) who were responsible for auditorium and audio system setup. Event's starting time was 10:30 A.M, but auditorium and Audio system setup was completed at 11:30 A.M in simple 1 and half hour late. Few people may be thinking why we haven't go for Auditorium and Audio system setup day before the event's day. The reason is simple, we already had a cost related problem and going for those setup day before that means we had to pay charges for two days. Ok! Atlast event started almost at 12:00 P.M.
Note: I have learned a new thing and I like to share this with my friends those who are first time going to organize any Event. Try to maintain that Event's beginning time must not be before 11:30am.

Event started with the speech of Mr.Indranil Das Gupta. Really very inspiring speech in which he had explained us about FOSS, importance of FOSS. Few information about fedora like total number of languages currently available in fedora. He had also mentioned about Fedora Project and Google Summer Coding. Here I can't stop myself saying about the best example of the importance of FOSS given by Mr. Indranil. i.e., air we breath is like FOSS and we can't live without it, may be we can hold our-self for few secs but after that we will start choking for air. He also mentioned about people like Sayamindu Das Gupta, Gopal V, Subhodip Biswas, Arindam Ghosh, Susmit Shannigrahi, Máirín Duffy and about their contributions to FOSS and Fedora.

-- break for 30mins --

After his speech I found a lot of attendees, specially new faces taking interest into FOSS and asking me about how to make contribution on FOSS and Fedora projects. Before, he leave he suggested me to create a group with other WBUT Board (West Bengal University Of Technology) students. I really found this very important after this event.

After break, my friend Er. Rahul Ghose came on stage to speak on “Awareness On Programming tools in linux”. Really very important topic for attendees since almost all attendees were Computer Science Engineering and Information Technology students. Before, event many students asked me about programming tools which are available in Linux. I hope this speech has solved a lot of queries regarding that.

After that around 2:20, Mr A.Mani was holding the mic for his speech on “Digitization of Documents in Fedora Linux”. Few people may be don't know that Mr. A.Mani is an Ambassador from India and has a lot of experience on events. Also, he coordinates the activities of ILUG-CALINFO. “Digitization of Documents” - a new topic for me too. So, I was trying to lessen his speech carefully. Few topics which I liked a lot from his speech are Copy-Left Licenses, Creative Common Licenses, Open Hardware, Scan Tailor and few others.

Next came Abhishek Jha, I guess this was his first speech on FOSS event speech (please correct me if I am wrong). He answered about one of the question asked by attendees “How to make money from FOSS projects”. He used examples of his friends and some tips during his speech for his explanation regarding this.

Next my turn, it was almost around 4:50, I guess. I have heard a lot of attendees were interested to hear on this topic “Cloud Computing and OpenStack-swift”. But, everyone was tired a lot during my speech, So I have to cut down my speech. I told them about What is cloud computing?, Importance of Cloud Computing, Public Cloud and Private Cloud, Cloud Infrastructure, OpenStack Servers, Swift tool, and few other topics.

During, speech I have found lots of questions from attendees. So, I have added a Question and Answer section at the end. Few of the question which I remember now are:
1. What is Fedora??
2. How to make money from FOSS projects??
3. When FOSS project's codes are open to be changed by anyone, what about the security from harmful code, if someone intentionally adds a harmful code??
4. About Fedora bugs and where to report, etc

Conclusion and Suggestion:

I think we need to create a mailing list or fedora-wbut group for wbut-students on fedora (if possible). Since for each and every fedora release there is at-least one fedora event by WBUT students. But, these events lacks co-ordinators, also searching for them before event is almost not possible due to exams, campussing, college etc. I guess a group or mailing list will be best to bind them all at a common place.

Reset Cisco Router Password using Minicom

Suppose you have a cisco router with configuration and password set. Today, I am going to tell you how to reset the Cisco router using Minicom (linux application).

Install MiniCom in fedora:
To install minicom in fedora type
# yum install minicom

Configure Minicom:
The configuration has to be done as root or user with root privilege.
# minicom -s or #minicom -s -c on
The -c on will enable the colour mode on.

Use the 'Up/Down' arrow to select "Serial port setup" and press "Enter".
Now type A to change serial device. Here, you have to know which tty is assigned for serial port. To know that type,

$ dmesg | grep ttyS
[ 1.297446] serial8250: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A
[ 1.297896] 00:06: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A

So, In this case tty for serail port is ttyS0.
Select "E", now change the "Bps/Par/Bits" to "Current: 9600 8N1"or something else by pressing "A" next or "B" previous or using default C = 9600, D = 38400 and E=115200. Press "Enter".
Select "F", to disable Hardware Flow Control and press "Enter" to save the settings and exit back to the configuration menu.



Use the "Up/Down" arrow to select the "Save setup as dfl".
Now, your configuration is saved.
From now type
$ minicom or minicom -c on
as a normal user to connect with the Router.

Note: for more info about available functions in minicom
$ minicom
Now, press Ctrl+A, then Z for help

Reset Password:
First, Power off the Cisco router then Power on again. When the moment after CISCO ISO will be Self decompressing the image, you have to send the router the break signal as it is booting. In minicom, press Ctrl+A then F to send break signal.
This should bring you to the "rommon" prompt:
rommon 1 >

Now, for the rest part I guess you already know and don't have to write here....
Thou, if you need I will write it for you.

Install multiple linux OS on a single PC

Now a days there are so many Linux distributions and also each of them has their own speciality. There are many users those who have dual boot OS(two different OS on a single machine). Many of my own friends have fedora/Ubuntu and Windows OS installed.

Today I am going to say about how to install fedora, Ubuntu, and Windows XP on a same PC.
1: Install XP
2: Install Ubuntu
3: Install fedora.

Note: When you install fedora after the installation of Ubuntu your Ubuntu's grub will be removed and you can't see Ubuntu on the Grub's list.

Now, to get the Ubuntu on the Grub's List follow these Steps:
1. boot with fedora
2. open terminal
$su -

as root type this command.
# fdisk -l

Hint: Check Column "System"
Lets /dev/sda3 partition contains your Ubuntu OS.
3. mount your Ubuntu partition.
# mount /dev/sda3 /mnt
4. Open the grub menu.lst file
# cd /mnt/boot/grub
# gedit menu.lst
Now search for similar lines:


title Ubuntu 8.10, kernel 2.6.30.9
uuid 84c1144f-93ff-4f12-8a6a-90f12f51421c
kernel (hd0,2)/boot/vmlinuz-2.6.30.9 root=UUID=84c1144f-93ff-4f12-8a6a-90f12f51421c ro quiet splash
initrd (hd0,2)/boot/initrd.img-2.6.30.9
quiet

title Ubuntu 8.10, kernel 2.6.30.9 (recovery mode)
uuid 84c1144f-93ff-4f12-8a6a-90f12f51421c
kernel (hd0,2)/boot/vmlinuz-2.6.30.9 root=UUID=84c1144f-93ff-4f12-8a6a-90f12f51421c ro single
initrd (hd0,2)/boot/initrd.img-2.6.30.9

title Ubuntu 8.10, memtest86+
uuid 84c1144f-93ff-4f12-8a6a-90f12f51421c
kernel (hd0,2)/boot/memtest86+.bin
quiet



Copy these lines and paste these inside the fedora's grub menu list file:
# gedit /boot/grub/menu.lst
now restart fedora OS
This time you can see few more options on your Grub's List.

Setting custom Prompt

As much as I know maximum linux family's users were Windows users previously or using Linux parallel with Windows/Mac OS. I was too a Windows user previously, now fully switched to Linux.
In Windows, we have seen prompt command in command prompt(cmd) to change the prompt of the cmd.

Today I am going to discuss about same thing for linux.
In Linux, PS1 shell variable sets the prompt. We can use this variable to set our own custom prompt with the use of special escaped sequences.
Here, are few common escape sequences:
\h - short hostname
\u - username
\w - current working directory
\! - history number of the current command
\$ - this shows the privilege i.e for root users # and for non-root users $
Setting custom prompt using special escaped sequences:
1. temporary change:
$ PS1="\u@\h: \w \$" this will give you prompt something like this:
prabindatta@localhost: /home/prabindatta $

2. to make this change permament:
$ vi /.bashrc
at the end append your line something like this:
PS1='\u@\h: \w \$'

Install ns-2 Simulator in fedora 13

What is ns-2 Simulator??

Ns is a discrete event simulator targeted at networking research. Ns provides substantial support for simulation of TCP, routing, and multicast protocols over wired and wireless (local and satellite) networks.

Download:

First you need to download ns-2 Simulator
link: NS-2 Simulator Download

Pre-Installation:

Before your ns-2 installation few packages must be already installed. Required packages (for fedora only) are:
1. yum install gcc.
2. yum install tcl-devel.
3. yum install libX11-devel.
4. yum install libXt-devel.
Note:
This is an important for f14 users. Fedora 14 users have to do some changes in the code of ns-2.34 (inside some .cc files) before install.
For eg:. lets take an example code "Test::Test(para1, para2).value();" it has to be changed into "Test(para1,para2).value();"

Installation:

1. Unarchive the downloaded file "ns-allinone-2.34.tar.gz" into /opt
$ tar -xvf ns-allinone-2.34.tar.gz
2. open terminal type
$ cd /opt/ns-allinone-2.34/
3. Start the installation process
$ ./install
4. At the end of installation you can see few lines like:
Libraries have been installed in:
/opt/ns-allinone-2.34/lib

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
- add LIBDIR to the `LD_LIBRARY_PATH' environment variable
during execution
- add LIBDIR to the `LD_RUN_PATH' environment variable
during linking
- use the `-Wl,--rpath -Wl,LIBDIR' linker flag
- have your system administrator add LIBDIR to `/etc/ld.so.conf'

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
..................
..................(few lines)
Please put /opt/ns-allinone-2.34/bin:/opt/ns-allinone-2.34/tcl8.4.18/unix:/opt/ns-allinone-2.34/tk8.4.18/unix
into your PATH environment; so that you'll be able to run itm/tclsh/wish/xgraph.

IMPORTANT NOTICES:

1. You MUST put /opt/ns-allinone-2.34/otcl-1.13, /opt/ns-allinone-2.34/lib, into your LD_LIBRARY_PATH environment variable. If it complains about X libraries, add path to your X libraries into LD_LIBRARY_PATH. If you are using csh, you can set it like: setenv LD_LIBRARY_PATH If you are using sh, you can set it like: export LD_LIBRARY_PATH= 2. You MUST put /opt/ns-allinone-2.34/tcl8.4.18/library into your TCL_LIBRARY environmental variable. Otherwise ns/nam will complain during startup.

Setting the environment variables:

Add all these lines into your ~/.bashrc file:
export PATH=$PATH:"/opt/ns-allinone-2.34/bin:/opt/ns-allinone-2.34/tcl8.4.18/unix:/opt/ns-allinone-2.34/tk8.4.18/unix"
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:"/opt/ns-allinone-2.34/otcl-1.13:/opt/ns-allinone-2.34/lib"
export TCL_LIBRARY=$TCL_LIBRARY:"/opt/ns-allinone-2.34/tcl8.4.18/library"

Validate successful installation:

After these steps, you can run the ns validation suite with
$cd ns-2.34; ./validate

1. Now its time to check if your installation is really successful. You can do so by:
$ cd /opt/ns-allinone-2.34/ns-2.34
$ ./validate (this will take some time)

Convert a partition

Convert ext2 -> ext3
Suppose you want to convert your /tmp partition into ext3 then follow the following step:-
1. # init 1(Single user mode)
2. un-mount your partition which you like to convert
# umount /tmp
or
# mount -o remount,rw /tmp
3. command to convert
# tune2fs -j /dev/sda6 (Here /dev/sda6 represent /tmp partition.you must check using fdisk -l command)
This command add .journal file into /tmp partition.
4.Open /etc/fstab file change partition type of /tmp into ext3.
5.Now check file system type using following command:-
# file -s /dev/sda9
6.# init 6(Restart)

Convert from ext 3 -> ext2
Suppose you want to convert your /tmp partition into ext2 then follow the following step:-

1.# init 1(single user mode)
2. un-mount your partition which you like to convert
# umount /tmp
or
# mount -o remount,ro /tmp(better choice)
3. command to convert
# tune2fs -O^has_journal /dev/sda9 (Here /dev/sda9 represent /tmp partition)
4.# e2fsck /dev/sda9
5.# rm -f /tmp/.journal (Removing .journal file)
6.Open /etc/fstab file change partition type of /tmp into ext2.
7.Check partition type of /dev/sda9 using following command:-
# file -s /dev/sda9
8.# init 6(Restart)

Add a partion with linux

How to add a partition with linux??
If your linux OS has very low space and also you have extra/free space in your HDD which you can add with linux just follow the simple steps:
$ su
Password:
# fdisk -l
Disk /dev/sda: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x15c415c3

Device Boot Start End Blocks Id System
/dev/sda1 * 1 5100 40959734+ 7 HPFS/NTFS
/dev/sda2 5100 10199 40960000 7 HPFS/NTFS
/dev/sda3 10199 15298 40960000 83 Linux (going to format this partition since this partition contains other files which I want to delete)
/dev/sda4 * 15299 18944 29284352 83 Linux
/dev/sda5 18944 19458 4122624 82 Linux swap / Solaris

# mkfs.ext3 /dev/sda3
mke2fs 1.41.10 (10-Feb-2009)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
2564096 inodes, 10240000 blocks
512000 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=0
313 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624

Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 34 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.

# vi /etc/fstab
append this line (make your modifications as your needs)
/dev/sda3 /disk1 ext3 defaults 1 2

here:
/dev/sda3 is your formatted partition
/disk1 is your directory name like /opt, /home, /usr
ext3 is your partition type, check above that /dev/sda3 is formatted to ext3 format

Note: for more info check man pages for fdisk, mkfs.ext3 and fstab

HP Printer's Driver

Last Monday, on 30th August 2010, my friend came to my home with his new HP Laser printer, he don't know how to remove the stickers from inside. Like to add here, 1st time removing those stickers are no 'so easy', normally a 'normal person' has fear to do that alone. After that I have successfully removed those. Now, he requesting me to check if the printer is working properly or not. I have fedora 13 as default OS plus another open source linux. HP provides a printer's driver CD for windows.

On that moment I was unaware how to work with this on linux. Here goes the solution:


1. Online installation:

Go to: http://hplipopensource.com/hplip-web/index.html
Now, Click on Download HPLIB
this will take you to .
From this page select your distribution, for fedora:
Step1 :Select Distribution: Fedora
Step 2: Select Version: 12 (don't worry if you are using fedora 13)
Step 3: Select Printer Type:<select your printer type> (OfficeJet/ Deskjet/ LaserJet/...)
Step 4: Select Printer Model:<select your printer's model no.> (p1007/ 2100d /...)
After filling all the above click twice or thrice Next.
Now, Under the Topic "Installer Walkthrough"
Step 1:
Click on Download HPLIP to download the installer file in your HDD.
Now, follow all the guide lines given below on that page.


2. Offline installation:

Download these packages from outside source(for fedora 13):
* cups-devel (CUPS devel- Common Unix Printing System development files)
* libusb (libusb - USB library)
* libjpeg (libjpeg - JPEG library)
* libcrypto (libcrypto - OpenSSL cryptographic library)
* libnetsnmp-devel (libnetsnmp-devel - SNMP networking library development files)
* pyqt4-dbus (PyQt 4 DBus - DBus Support for PyQt4)
* pyqt4 (PyQt 4- Qt interface for Python (for Qt version 4.x))
* reportlab (Reportlab - PDF library for Python)
* dbus (DBus - Message bus system)
* sane-devel (SANE - Scanning library development files)
* pil (PIL - Python Imaging Library (required for commandline scanning with hp-scan))
* xsane (xsane - Graphical scanner frontend for SANE)
* cups-ddk (CUPS DDK - CUPS driver development kit)

Note: Updated package list for fedora 14:
* libjpeg-turbo in place of libjpeg
* libjpeg-turbo-devel
* openssl-devel
* net-snmp-devel
* libusb-devel
* python-devel
* xsane (xsane - Graphical scanner frontend for SANE)
* sane-backends-devel
* dbus-devel
* libtool
After successfully installation of all the above package send me a mail requesting for off-line package for HP printer's driver.

Images:

Security problems:
read from below link to make your data secure->
Hacking Network Printers

For Online Configuration:
type http://:port
eg:
http://localhost:631
from this page your can add printer, search onlone help, check printer status, etc.
I am not going on details since you can find all those of your own.

Commands used/related with printers:
For a parallel printer the device name is usually /dev/lp0 and for a USB printer the name is usually /dev/usb/lp0.

View the content of the Printer Queue
$ lpq
HP_LaserJet_P6100 is ready

System Printer's Status (Ipstat-> list all printers)
$ lpstat -p -d
printer HP-OfficeJet_6100 is idle. enabled since Sun 05 Sep 2010 01:19:39 AM IST
system default destination: HP-OfficeJet_6100

Other commands:
cancel(1), lp(1), lpadmin(8), lpoptions(1), lprm(1), lpstat(1)
use man to find details on each.

Check Hardware and few linux's commands

few handy linux command and check hardware

CPU info:

$ cat /proc/cpuinfo

Running kernel version

$ uname -r

Version of most installed applications:
$ gcc -v
$ gcc --version

What is the running kernel and compiler installed
$ cat /proc/version

X server, X Protocol, Build Operating System version and and Kernel command line:
$ X -showconfig

What pci cards are installed and what irq/port is used
$ cat /proc/pci

What kernel modules are loaded
lsmod

Memory and swap information
detail-> $ cat /proc/meminfo
short info-> $ free or $ free -m (output in megabits)

Hard drives partitiontion
$ fdisk -l

Free/used drive space
$ df -h

Show disk usage by current directory and all subdirectories
$ du | less or $du | more

What takes up so much space on your box
Run from the directory in question and the largest chunk shows up last
$ find $1 -type d | xargs du -sm | sort -g

What is the distribution
$ cat /etc/issue
$ cat /etc/issue.net

For finding or locating files
$ find <location to search (path)> -name <starting string of file name which you want to search>
$ locate <file name>
$ which <file name> (search in all path available in PATH)
$ whereis [-bmsu] [-BMS directory... -f] filename...
where b:Search only for binaries. m:Search only for manual sections.
s:Search only for sources. u: Search for unusual(not b:m:s) entries.

Use dmesg to view the kernel ring buffer (error messages)
$ dmesg | less or $ dmesg | more

Watch error messages as they happen (sysklog needed)
as root,
$ tail -f /var/log/messages (this will shows last 10 lines, use a number in front of f for more lines)

list all processes running
$ ps -A

Find a process by name
$ ps -ef | grep -i <plain text>
eg:
$ ps -ef | grep sendmail

See current environment list, or pipe to file
$ env | more
$ env > environmentvariablelist.txt

Show current userid and assigned groups
$ id

See all command aliases(shortcut command for a long command) for the current user
$ alias

rpms installed on current
$ rpmquery --all | less
$ rpmquery --all > <filename>
$ rpmquery --all | grep -i <plaintext>

Present Working Directory:
pwd

Get ls in less
ls --color=always | less -R

Notes:

The /proc/ directory contains a hierarchy of special files which represent the current state of the kernel — allowing applications and users to peer into the kernel's view of the system.

Look at man <command> or info <command> for other options you can use for bash commands.

Lock a folder(/directory)

Sometime it happens in few cases that you are sharing a common pc and an user account with others. It may happen that you want few of your data to keep away the reach of other users.

use the below code with some modification(where specified) to lock your folder:

dir_lock.sh
#! /bin/bash

# Use the bash shell to run the script

cd <path to folder>

i=$(ls -al | grep "<folder name>")

j=${i:0:10}

echo "$j"

if [ "$j" == 'drwxr-xr-x' ]; then

chmod 000 <folder name>

elif [ "$j" == 'd---------' ]; then

chmod 755 <folder name>

fi

i=$(ls -al |grep '<folder name>')

echo " -> ${i:0:10}"
Now, place the above file dir_lock.sh on the same directory which you want to lock.

now type(in terminal):

1. $ cd <path to directory where your dir_lock.sh file exists>

2. $ chmod 500 dir_lock.sh

3. $ ./dir_lock.sh

from next time use $ ./dir_lock.sh to lock and unlock your directory.

Manual Pages (man pages)

To read a man page the general command is:

$/# man <command>

eg:

$ man ifconfig

The above command gives you a name, synopsis, note short description about the command, list of options with that command and author . At the same time you can see something like this on first line for ipconfig:

IFCONFIG(8) Linux Programmer’s Manual IFCONFIG(8)

IFCONFIG(8) denotes name(section) here the name: IPCONFIG and section: 8.

Linux Programmer's Manual denotes section means section 8 is Linux Programmer's Manual.

Now, a question may come in your mind what is sections??

The manual pages are categorised into sections. There are 8 sections in fedora 13.

The standard sections of the manual include:
1 User Commands
2 System Calls
3 C Library Functions
4 Devices and Special Files
5 File Formats and Conventions
6 Games et. Al.
7 Miscellanea
8 System Administration tools and Deamons.

Tips and tweet:

1. Suppose you want to find info about a C command. You have reduce the search time of man pages by using this format:

$ man 3 <C command>

eg: $ man 3 scanf

2. Convert man pages to any other format.

$ man -t <command>

The above command returns in postscript format. Now using the below command we can convert a man page to pdf file.

eg: $ man -t ifconfig | ps2pdf -> ifconfig.pdf

3. An equivalent command of whatis:

$ man -f <command>

eg:

$ man -f man
man (1) - format and display the on-line manual pages
man (1p) - display system documentation
man (7) - macros to format man pages
man-pages (7) - conventions for writing Linux man pages
man.config [man] (5) - configuration data for man

$ man -f ifconfig
ifconfig (8) - configure a network interface

In the above two commands, 1st command searches and returns 5 man pages and second command return only one man page.

4. Search an string (or word) in all man pages(inside a man page).

$ man -K <command>

Note: This command takes a long time.

Install realplayer in fedora

Today I am going to write about how to install RealPlayer11GOLD.rpm in fedora 13. Before Installation 1st thing which you need is the RealPlayer11GOLD.rpm package. You can download package from:

https://player.helixcommunity.org/2005/downloads/

or

http://www.real.com/realplayer/linux

Now steps to installs:

1. $su -

password:<your default user's password.>

2.#rpm -ivh <path to rpm package>/RealPlayer11GOLD.rpm

3.Exit (if you want, you can install this package as root(super user) also)

3.$cd /opt/real/RealPlayer

4.$./realplay

after this you can see GUI to install realplayer.

5.Now you can run RealPlayer by typing this commond:

$cd /opt/real/RealPlayer

$./realplay

Best Of Luck!

if you face any problem free to give your comments...