Saturday, April 23, 2005

Getting help in Linux/Unix

Getting Help

1. man

man (short for “manual”) is a traditional form of online documentation in Unix and Linux operating systems. Specially formatted files, “man pages”, are written for most commands and distributed with the software. Running man somecommand will display the man page for (naturally) the command or program somecommand.

Because there are so many of them, man pages are grouped into enumerated sections. This system has been around so long that you will often see commands, programs, and even programming library functions referred to with their man section number. For instance, you might see man(1). This tells you that man is documented in section 1 (user commands); you can specify that you want the section 1 man page for “man” with the command

#man 1 man

or

#man - S 1 man

Specifying the section that man should look in is useful in the case of multiple items with the same name.

Man Page Sections

Section Contents
Section 1 user commands (intro only)
Section 2 system calls
Section 3 C library calls
Section 4 devices (e.g., hd, sd)
Section 5 file formats and protocols (e.g., wtmp, /etc/passwd, nfs)
Section 6 games (intro only)
Section 7 conventions, macro packages, etc. (e.g., nroff, ascii)
Section 8 system administration (intro only)

so man page for

killpg (2)

is different from

killpg (3)

again to access ther different man pages we will go as

#man - S 2 killpg

#man - S 3 killpg

In addition to man(1), there are the commands whatis(1) and apropos(1), whose shared purpose is to make it easier to find information in the man system. whatis gives a very brief description of system commands, somewhat in the style of a pocket command reference. apropos is used to search for a man page containing a given keyword

to look for a man page of your choice run

apropos

like

this is what i get when i run

# apropos utmp
endutent [getutent] (3) - access utmp file entries
getutent (3) - access utmp file entries
getutid [getutent] (3) - access utmp file entries
getutline [getutent] (3) - access utmp file entries
pututline [getutent] (3) - access utmp file entries
setutent [getutent] (3) - access utmp file entries
utmp (5) - login records
utmpname [getutent] (3) - access utmp file entries
wtmp [utmp] (5) - login records
endutent [getutent] (3) - access utmp file entries
getutent (3) - access utmp file entries
getutid [getutent] (3) - access utmp file entries

so it will give all those listings that have "utmp" in its description or name

2. HOWTOs and mini-HOWTOs

Get the full list of HOWTO's from www.tldp.org.
These files are well worth reading whenever you're not quite sure how to proceed with something. An amazing range of topics are covered in sometimes surprising detail.


3. Online Forums
There are many online forums.
the best among them is Linuxquestions.org

All Linux queries can be posted at linuxquestions.org.

If you are not a member , register at linuxquestions.org.



References:
http://slackware.com

Saturday, April 09, 2005

Mounting drives in Linux

This is a small tutorial on mouting drives in linux
I had written this document some time back for my linuxuser group
now i am re-writing this document with some changes

There is no substitute to man pages in linux. there is an exhaustive collection of information over there.

To start with, first of all you need to see which partition you want to mount

YOU can see that by running the following command at bash# prompt


#fdisk -l


If your hard disk is use

Primary master hda

Primary slave hdb

Secondary master hdc

Secondary slave hdd


If you use wrong device then you may get error message such as

"Cannot open device hdc"

If command is successful you get


[root@gaurav qmail]# fdisk /dev/hda


The number of cylinders for this disk is set to 4865.

There is nothing wrong with that, but this is larger than 1024,

And could in certain setups cause problems with:

1) software that runs at boot time (e.g., old versions of LILO)

2) booting and partitioning software from other OSs

(e.g., DOS FDISK, OS/2 FDISK)

Command (m for help):


At this prompt run ‘p’ single character to see your partition table


Here is the result of my partition table


Command (m for help): p

Disk /dev/hda: 40.0 GB, 40020664320 bytes

255 heads, 63 sectors/track, 4865 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes


Device Boot Start End Blocks Id System

/dev/hda1 * 1 561 4506201 b Win95 FAT32

/dev/hda2 562 3939 27133785 f Win95 Ext'd (LBA)

/dev/hda3 3940 4385 3582495 a5 FreeBSD

/dev/hda4 4386 4865 3855600 83 Linux

/dev/hda5 562 1096 4297356 7 HPFS/NTFS

/dev/hda6 1097 1606 4096543+ b Win95 FAT32

/dev/hda7 1607 3008 11261533+ b Win95 FAT32

/dev/hda8 3009 3872 6940048+ b Win95 FAT32

/dev/hda9 3873 3939 538146 b Win95 FAT32



You can easily recognize which drive you want to mount

Here I have my windows partitions as

devices Windows Partitions

/dev/hda1 C

/dev/hda5 D

/dev/hda6 E

/dev/hda7 F

/dev/hda8 G

/dev/hda9 H


Do not confuse with /dev/hda2

It is my extended partition you cannot mount that whole partition but you can only mount the logical drives in this partition


Here say if I want mount my E drive in Linux

I need to have an empty folder somewhere to mount.

We can make a folder anywhere but as going by the convention we make all the folders and mount them in

/mnt folder

So, go to the mnt folder under root directory

Make a new folder in mnt directory say win_e


If you want to mount it temporarily (till the system is running)

You can mount it by the following command


#mount /dev/hda6 /mnt/win_e


The syntax of the command is easy to interpret

/dev/hda6 gives the device you want to mount

/mnt/win_e gives the path of folder you want to mount

to mount a device with some other options ,for example i can mount my cdrom in two styles


#mount /dev/cdrom /mnt/cdrom

this will mount the cdrom as a filesystemn as define in /etc/ftab which is generally iso9660
if i want to mount this CDrom with the
cdfs filesystem then i need to do this as

#mount -t cdfs /dev/cdrom /mnt/cdrom


Now if you want to mount your partitions your drives permanently you can do that by making an entry in /etc/fstab file

This file is read each time the system boots.

And so it mounts the partitions listed in this drive

You can add an entry to this file as under corresponding headings


/dev/hda9 /mnt/win_h auto defaults 0 0



the above line refers to

/dev/hda9: gives the device

/mnt/win_h: gives the path of the folder

auto: tells to detect the filesystem automatically

defaults, 0 0 : these two basically deal with the type of mounting we are performing and where we want to dump the partiton


Lines of caution

1. Do not delete any existing entries of /etc/fstab file, it will be good if you take a backup of the fstab file and then

Perform any changes.

If something goes wrong in that file the system may not boot up (in the worst case)


2. While using the fdisk command

Be careful and do not try other options other than the p command


Command (m for help): p


If you r not sure of what you r doing.


3. After updating the fstab file if during startup you get error of some sorts that e.g.

/mnt/win_g not found, mounting failed

Then check if you have made a folder in the given path and no spelling mistakes are there in your fstab file.


Comments are Welcome.


Monday, April 04, 2005

Why FLOSS for Indian colleges/institutes


There are thousands of engineering and polytechnic colleges in India. Each year, a few hundred thousands of graduates and diploma holders earn their degree. They pay thousands of rupees as fees to get the best facilities. A part of this goes to buying foreign-origin software which they use either in college lab or for doing their assignments at home. This is a national waste of scarce resources. More so in a resource-poor, talent-rich part of the planet, which sometimes sees itself as a software superpower.

But Free Software is a matter of liberty, not just price. The Free Software Foundation (FSF), established in 1985, has for two decades now been dedicated to promoting computer users' rights to use, study, copy, modify, and redistribute computer programs. We would submit that it makes eminent sense to ensure that your students also have these freedoms, to allow them to think freely and grow significantly, in their quest to become the top software architects in the world of tomorrow.

Free/Libre and Open Source Software has many other advantages such as reliability, performance and security; building up of long-term capacity within the state and country itself; the Free (as in freedom) philosophy; encouraging innovations; offering alternatives to illegal copying; throwing up many possibilities in localisation; helping students vastly by allowing them to learn from the source code; getting access to literally thousands of tools; in addition, of course, to lower costs.

For every software which India's engineering students use; there is an alternate Free Software program available. Free Software (http://www.gnu.org/philosophy) offers freedom, accelerated possibilities and wider vistas to our students. In addition to all this, huge amounts of resources will be saved, and productivity gained, while deploying Free Software. This will not only make engineering education more cost-effective, but also more productive. It is in the interest of India, of your university, and your students, to ensure that VTU students get -- as early as possible -- an introduction to Free Software and its immense potential.

Issues related to Free/Libre and Open Source Software (FLOSS) in education are outlined very well at http://www.iosn.net/education/foss-education-primer/

Other than cost benefits, Free Software has other extremely pertinent advantages. We would urge you to serious consider the following:

  • No-fee licensing
  • Ease of license fee management
  • Better large-scale programmability
  • Easier integration
  • Better performance
  • Development convenience
  • Better support

In the case of education in computer sciences, FLOSS provides opportunities which nothing else can, as the Finland-based researcher Rajani points out:

  • Unrestricted access to the source code.
  • An environment of unlimited experimentation and tinkering.
  • Collaboration and interaction with a community of programmers, coders and users around the world.

In addition to providing ready and available tools, Free Software provides positive examples from projects around the globe. In practice, this means that if someone anywhere else on the linked-via-the-Internet planet has created a tool to reach a specific educational goal, one can take it as a starting point and build on it, without the need to "reinvent the wheel". The Dspace project and the Koha library software, are but two simple examples of such possibilities. As far as collaboration is concerned, Sourceforge is perhaps the biggest collaboration project ever created, uniting tens of thousands of software projects and hundreds of thousands of people around the world. "FLOSS itself has been called the most collaborative human effort ever," as Rajani rightly points out.

We have many other examples to look to. Savannah provides software development services at no cost to free software developers around the world. Savannah provides a web front-end for hosting and maintaining project homepages, bug tracking, CVS, FTP, and mailing lists. These all services are offered, running entirely on Free Software, without ads, for the entire community.

In addition to the above, the inherent qualities of FLOSS make it a prime tool for achieving local language educational software, especially for languages which are not deemed commercially viable for proprietary software vendors. This has the scope of offering both relevance and employment to so many of your bright young students.

There are literally hundreds of Free Software's programs which colleges or universities can adopt. As Vishweshwaraiah Technological University is one of the biggest and most prestigious engineering-related universities in India, its time for VTU to give the lead and significantly move towards using Free Software. This would encourage other smaller Universities to follow suit. Let the VTU have the pride to be the first one to adopt Free Software in its educational curriculum, on a scale significant enough to make a difference to the future of VTU, its many students, and to India itself.

Because of the software tools prescribed in the colleges, and also a general lack of awareness of Free Software options, most colleges currently use Microsoft Windows based operating system. Yet, in terms of technological features, stability, learning possibilities, the GNU/Linux is increasingly being recognised as the best available globally. It is the best suited for any educational institution. Students can not only use it, but also can study its source code to understand its internal workings. Likewise, they can easily get in touch with the many volunteers who have put together this amazing set of tools, and collaborate internationally to created more suitable products and also hike their own skill-sets.

Inspite of constraints built in many a syllabi of engineering colleges, many colleges across South Asia have begun adopting GNU/ Linux, starting with the server room, where it is well known for its stability and security. Now it has entered our labs and desktops. In addition to this, GNU/Linux is playing an impressive role in building up the world of 'social software', encouraging people to collaborate and build knowledge in entirely new ways -- as seen from the emergence of such FLOSS tools such as wikis and blogs. Without the agenda of sharing knowledge, such approaches could not have been dreamt of. This collaboratively-written letter, with the ideas and inputs from people across India and the globe, is an example of such a trend. VTU needs to make a historic decision in terms of seizing possibilities thrown up by such trends.

Take a specific example from the world of simulation: Matlab v/s Octave

Matlab is used in communication and electronics lab. Matlab for an individual license for use in a university (academic use) costs $500. Any college will have to buy a minimum of 25 licenses. This means shelling out Rs.537,500.

Octave, which is a simulation software written by university professors. This usually comes, along and as part of, the GNU/Linux Operating System. The advantage to students is that they don't have to buy a limited student version to use at their homes. They can use Octave both at their lab and at home.

Sci Lab is another Free Software competitor for Matlab. It uses sophisticated algorithms to analyse data and produce aesthetic graphics.

NG-SPICE is yet another GPLd Circuit Simulator which is based on the University of Berkeley's Spice Version 3f5.

But such examples are not restricted to the high-end aspects alone.

Currently, as engineering students, we all use or used Microsoft Word to submit our project documents for review and for other academic purposes. Recent technological developments have offered us Open Office which is as good as Microsoft Office and has the same, if not better, features. Microsoft Office in fact lacks some features like PDF (Portable Document Format) support, compatibility with older versions of Microsoft Office itself, lack a vector drawing application, etc. Open Office gives you everything starting from a word processor, to presentation software to PDF generator. It is fully compatible with Microsoft Office -- so already existing data in those formats can be used. Wouldn't you agree that it's the right time to save money and enhance efficiency of technological education in our country? Apart from, of course, ensuring that concepts like freedom emerge in the world of software-use too?

Computer Networks Subject Teaching: Ethereal, tcpdump, NS2 etc: We use the above mentioned tools for the teaching of Computer Networks and Data Communication subjects. There are a number of other GNU GPLed tools which can be used in a number of other labs for teaching and learning.

Content Management Systems: Drupal, PHP-Nuke etc: These are fascinatingly useful tools for building websites and info portals for students to make online learning possible. In the world of online forums, Free Software have a number of free options. You could well imagine the impact that the accelerated spread of such easily-reachable and usable tools would have, not just on the engineers of tomorrow, but on the wider Indian society as a whole.

VHDL -- Xilinx v/s Alliance 5.0, gEDA: The Xilinx software for VHDL simulation is available for individual systems. Xilinx lacks in VLSI CAD systems, but the Alliance 5.0 is an EDA VLSI CAD, and has set of tools which meets the needs of academics and gives complete tools for VLSI design including support for VHDL as well as verilog support. gEDA is another set of free software which helps in complete design of electronics system. The above are just a few examples. There are many such software programs from which students can benefit. We hope the university understands the urgency and the need. We would be happy to give the university any information/help that is needed. Currently, India has a wide range of volunteer GNU/Linux support groups, a list of which can be found at http://wikiwikiweb.de/LugsList and we would be more than happy to offer whatever support is needed, from our end, for a shiftover to a freer world of software and computing.


The above is matter has been taken from the VTU-FLOSS Campaign

http://bangalore.gnu.org.in/?VTU-FLOSS_Campaign