Friday, October 3, 2008

Using Shell Commands in Ruby

The following is a step by step guide how can you write shell linux commands inside ruby code and get their results in customized output created by ruby.


First of all execute the following command on shell prompt

shell> vi userinfo.rb

This will open up vi editor with a file named userinfo opened in it

1. Press i on your keyboard, this will switch the file userinfo into insert mode
2. Write the following code in it



#Code Starts
def user
user = `users`
end

def groups
groups = `groups`
end

puts "You are #{user} and you belongs to the groups \n #{groups}"
#Code Ends

3. Press ESC key on your keyboard to exit insert mode
4. Now write :wq and press enter key on your keyboard

This will throw you out to the shell prompt. On the shell prompt write the following command

shell> ruby userinfo.rb

You will get the customized output like this

You are root and you belong to the groups
  [A list of group will be displayed on this line]

Thats it to executing shell linux commands inside your linux code

Go back to the table of contents for 'Ruby on Linux'

Your first ruby code

Create a file in your linux using the following command

shell> touch helloworld.rb

or open up vi editor with the name of the new file to be created

shell> vi helloworld.rb

In the file that is opened, write your code by taking the following steps

1. Press i key on your keyboard
2. You will enter the write mode and now you can write your text [puts "Hello World"]

Now save and close down the file by taking the following steps

1. Press ESC key on your keyboard
2. Write :wq and Press Enter

The file will get saved and you will be thrown out to the shell prompt.

On shell prompt write the following command

shell> ruby helloworld.rb

You will shown the following output

Hello World

Thats it to writing your first ruby script and executing it on linux.

Go back to the table of contents for 'Ruby on Linux'

Setting up Ruby on Linux

The following are the steps that I performed to install ruby on my linux machine.


I went to http://www.ruby-lang.org/en/downloads/ There I found out a section with the heading Ruby Source Code

I pick the url of the link for the file using the right click and choosing the 'copy link location' in my firefox.

Then I went to the shell on my linux and put the following command

shell> wget ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7-p72.tar.gz

This downloaded the ruby source code to my root directory. I extracted the file using the following command

shell> tar -xvf ruby-1.8.7-p72.tar.gz

This command extracted the source archieve to ruby-1.8.7-p72 directory. Then I enter into this ruby-1.8.7-p72 directory and executed the following command

shell> ./configure

This is actually not a command rather a script, that is run to check the required configurations for the installation purposes. At the successful run of this script I executed the following command

shell> make

This make command compiled the code. At the end of the make command I executed the following command

shell> make install

This make install command installed the ruby and placed the ruby files in appropriate folders.

Thats all to what I did for installing ruby on a linux machine.

You can confirm your ruby installation by using the following command

shell> ruby -v

Go back to the table of contents for 'Ruby on Linux'

Ruby on Linux

Ruby on Linux

This is an effort to collect a guide for doing ruby development in a collection of step by step tutorials. The following is table of contents list for links to the articles in this same blog. You will see some articles completed while others are in process. Thanks

Table of Contents

1. Setting up Ruby on Linux (Completed)
2. Your First Ruby Code (Completed)
3. Connecting to MySQL database via Ruby (In process)
4. Using Shell Commands in Ruby (Completed)
5. Getting System information using Ruby code (In process)
6. More to come ...

Thursday, October 2, 2008

Hard or Soft link

How a Hard link is created?

A hard link to a file is created using the following command

root@xyz# ln file1 file2

The above command makes file2 a hard link to a file represented by the hard link file1.

How a Soft link is created?

The soft link to a file is created using the following command

root@xyz# ln -s file1 file3

The above command makes file3 a soft link to a file represented by the hard link file1

How a file with multiple hard links is deleted?

A file with multiple hard links is only deleted after all its hard links are deleted. Then the question is, Is there any way that we can remove all of the hard links in a single command? The answer to this question is ...*

How a file with a soft link is deleted?

The file with a soft link is deleted normally by using the rm command. In this case the soft link becomes broken, i.e. not linked to anything.

What happens to the soft links if a file is moved from its original location?

In case a file is moved from its original location the soft link pointing to this file becomes broken. If the pointed file is moved back to its original location, the broken link becomes active again.

What happens to the soft links if a file is removed?

If a file is removed the soft links continue to exists but becomes broken.

What happens to the hard links a file is moved from its original location?

It makes no difference. By moving a file having multiple hard links means moving a hard link. So if a hard link is moved to some other place, it does not effect any other hard link pointing to the same file.

What happens to the hard links if a file is removed?

It just is not possible to remove a file having at least one hard link. If you remove one hard link, that particular link is deleted not the actual file. The actual file is only deleted when the last hard link pointing to the file is removed.

How can we list all of the hard links or soft links to a particular file?

List Hard Links

You can list all of the hard links to a file 'file1' by using the following command

root@xyz# find [directory to search] -samefile [file name (which can be any hard link) as argument]

for example

root@xyz# find / -samefile file1

or

root@xyz# find . -samefile file1

You can also use the inode number for searching the hard links to it

for example

root@xyz# find . -inum [inode number]

You can find the inode number of a file by using the following command

root@xyz# ls -i

List Soft Links

You can list the soft links to a file using the following command

root@xyz# find -lname file1

It is better to put a * as prefix in the file name like below

root@xyz# find -lname "*file1"

Because we have not mentioned the directory where the search should be made so the search will be made in the current directory. We can mention the directory where the search should be made in the following way

root@xyz# find . -lname "*file1"

or

root@xyz# find / -lname "*file1"


For more details you can have a look at the following resources

  1. Hard and Symbolic link [A free registration will be required for the above link]
  2. Symbolic link
  3. Hard link

Sunday, September 28, 2008

Sticky Bit

A sticky bit is set on a directory to prevent unwanted users from removing contents within the directory.


It is commonly set on /tmp directory

root@xyz:~# chmod +t /usr/local/tmp

You can read the following articles for more information

  1. Sticky bit
  2. What is Sticky Bit
  3. The sticky bit and directories

Single User Mode on Linux

You can get into single user mode using init 1 command like below


root@xyz:~# init 1

But never use this command remotely. Once used remotely the system will get into single user mode and any network user will get disconnected.

You can get out of single user mode by using

root@xyz:~# init 3 or init 5

Broadcast to all linux users

You can use wall command to broadcast to all of the users connected to your machine. e.g.


root@xyz:~# wall This machine is shutting down

See who is online on your linux machine

Use who command to see who is online on your system


root@xyz:~# who

The results will be a list of users connected on your machine.

Disk Quotas in Linux

You have to setup your file system with disk quota enabled. Then you can use the following commands to manipulate your disk quotas

root@xyz:~# quotacheck
root@xyz:~# quotaon
root@xyz:~# edquota
root@xyz:~# quota
root@xyz:~# repquota


You can futher read the following articles
  1. Managing Disk Usage with Quotas
  2. Implementing quotas to restrict disk space usage
  3. Manage user accounts in a multi-user Linux environment with disk quotas
  4. Disk quotas

Friday, September 19, 2008

Linux File System 14 - usr directory

/usr - This is one of the most important directories in the system as it
contains all the user binaries. X and its supporting libraries can be
found here. User programs like telnet, ftp etc are also placed here.
/usr/doc contains useful system documentation. /usr/src/linux contains the
source code for the Linux kernel.

Linux File System 13 - tmp directory

/tmp - This directory contains mostly files that are required temporarily.
Many programs use this to create lock files and for temporary storage of
data. On some systems, this directory is cleared out at boot or at
shutdown.

Linux File System 12 - root directory

/root - We talked about user home directories earlier and well this one is
the home directory of the user root. This is not to be confused with the
system root, which is directory at the highest level in the filesystem.

Linux File System 11 - proc directory

/proc - This is a special directory on your system. We have a more detailed
article on this one below.

--------------------------
Discover the possibilities of the /proc directory
By Federico Kereki on February 15, 2008 (9:00:02 AM)

The /proc directory is a strange beast. It doesn't really exist, yet you can explore it. Its zero-length files are neither binary nor text, yet you can examine and display them. This special directory holds all the details about your Linux system, including its kernel, processes, and configuration parameters. By studying the /proc directory, you can learn how Linux commands work, and you can even do some administrative tasks.

Under Linux, everything is managed as a file; even devices are accessed as files (in the /dev directory). Although you might think that "normal" files are either text or binary (or possibly device or pipe files), the /proc directory contains a stranger type: virtual files. These files are listed, but don't actually exist on disk; the operating system creates them on the fly if you try to read them.

Most virtual files always have a current timestamp, which indicates that they are constantly being kept up to date. The /proc directory itself is created every time you boot your box. You need to work as root to be able to examine the whole directory; some of the files (such as the process-related ones) are owned by the user who launched it. Although almost all the files are read-only, a few writable ones (notably in /proc/sys) allow you to change kernel parameters. (Of course, you must be careful if you do this.)
/proc directory organization

The /proc directory is organized in virtual directories and subdirectories, and it groups files by similar topic. Working as root, the ls /proc command brings up something like this:

1 2432 3340 3715 3762 5441 815 devices modules
129 2474 3358 3716 3764 5445 acpi diskstats mounts
1290 248 3413 3717 3812 5459 asound dma mtrr
133 2486 3435 3718 3813 5479 bus execdomains partitions
1420 2489 3439 3728 3814 557 dri fb self
165 276 3450 3731 39 5842 driver filesystems slabinfo
166 280 36 3733 3973 5854 fs interrupts splash
2 2812 3602 3734 4 6 ide iomem stat
2267 3 3603 3735 40 6381 irq ioports swaps
2268 326 3614 3737 4083 6558 net kallsyms sysrq-trigger
2282 327 3696 3739 4868 6561 scsi kcore timer_list
2285 3284 3697 3742 4873 6961 sys keys timer_stats
2295 329 3700 3744 4878 7206 sysvipc key-users uptime
2335 3295 3701 3745 5 7207 tty kmsg version
2400 330 3706 3747 5109 7222 buddyinfo loadavg vmcore
2401 3318 3709 3749 5112 7225 cmdline locks vmstat
2427 3329 3710 3751 541 7244 config.gz meminfo zoneinfo
2428 3336 3714 3753 5440 752 cpuinfo misc

/proc resources

Finding documentation about the /proc filesystem can be a chore, because it's distributed all around the kernel source. Looking in the /usr/scr/linux/Documentation directory, I found proc.txt, which contains plenty of information but is somewhat dated: its latest update was in November 2000, when kernel version 2.4.0 was just about to come out. Still, wading through this directory is easier than looking at the C source files. Note that you might end up getting more than you wanted; for example, the laptop-mode.txt file is almost 1,000 lines long and deals exclusively with the single /proc/sys/vm/laptop_mode file.

The numbered directories (more on them later) correspond to each running process; a special self symlink points to the current process. Some virtual files provide hardware information, such as /proc/cpuinfo, /proc/meminfo, and /proc/interrupts. Others give file-related info, such as /proc/filesystems or /proc/partitions. The files under /proc/sys are related to kernel configuration parameters, as we'll see.

The cat /proc/meminfo command might bring up something like this:
# cat /proc/meminfo
MemTotal: 483488 kB
MemFree: 9348 kB
Buffers: 6796 kB
Cached: 168292 kB
...several lines snipped...

If you try the top or free commands, you might recognize some of these numbers. In fact, several well-known utilities access the /proc directory to get their information. For example, if you want to know what kernel you're running, you might try uname -srv, or go to the source and type cat /proc/version. Some other interesting files include:
/proc/apm: Provides information on Advanced Power Management, if it's installed.
/proc/acpi: A similar directory that offers plenty of data on the more modern Advanced Configuration and Power Interface. For example, to see if your laptop is connected to the AC power, you can use cat /proc/acpi/ac_adapter/AC/state to get either "on line" or "off line."
/proc/cmdline: Shows the parameters that were passed to the kernel at boot time. In my case, it contains root=/dev/disk/by-id/scsi-SATA_FUJITSU_MHS2040_NLA5T3314DW3-part3 vga=0x317 resume=/dev/sda2 splash=silent PROFILE=QuintaWiFi, which tells me which partition is the root of the filesystem, which VGA mode to use, and more. The last parameter has to do with openSUSE's System Configuration Profile Management.
/proc/cpuinfo: Provides data on the processor of your box. For example, in my laptop, cat /proc/cpuinfo gets me a listing that starts with:
processor : 0
vendor_id : AuthenticAMD
cpu family : 6
model : 8
model name : Mobile AMD Athlon(tm) XP 2200+
stepping : 1
cpu MHz : 927.549
cache size : 256 KB

This shows that I have only one processor, numbered 0, of the 80686 family (the 6 in cpu family goes as the middle digit): an AMD Athlon XP, running at less than 1GHz.
/proc/loadavg: A related file that shows the average load on the processor; its information includes CPU usage in the last minute, last five minutes, and last 10 minutes, as well as the number of currently running processes.
/proc/stat: Also gives statistics, but goes back to the last boot.
/proc/uptime: A short file that has only two numbers: how many seconds your box has been up, and how many seconds it has been idle.
/proc/devices: Displays all currently configured and loaded character and block devices. /proc/ide and /proc/scsi provide data on IDE and SCSI devices.
/proc/ioports: Shows you information about the regions used for I/O communication with those devices.
/proc/dma: Shows the Direct Memory Access channels in use.
/proc/filesystems: Shows which filesystem types are supported by your kernel. A portion of this file might look like this:
nodev sysfs
nodev rootfs
nodev bdev
nodev proc
nodev cpuset
...some lines snipped...
nodev ramfs
nodev hugetlbfs
nodev mqueue
ext3
nodev usbfs
ext2
nodev autofs

The first column shows whether the filesystem is mounted on a block device. In my case, I have partitions configured with ext2 and ext3 mounted.
/proc/mounts: Shows all the mounts used by your machine (its output looks much like /etc/mtab). Similarly, /proc/partitions and /proc/swaps show all partitions and swap space.
/proc/fs: If you're exporting filesystems with NFS, this directory has among its many subdirectories and files /proc/fs/nfsd/exports, which shows the file system that are being shared and their permissions.
/proc/net: You can't beat this for network information. Describing each file in this directory would require too much space, but it includes /dev (each network device), several iptables (firewall) related files, net and socket statistics, wireless information, and more.

There are also several RAM-related files. I've already mentioned /proc/meminfo, but you've also got /proc/iomem, which shows you how RAM memory is used in your box, and /proc/kcore, which represents the physical RAM of your box. Unlike most other virtual files, /proc/kcore shows a size that's equal to your RAM plus a small overhead. (Don't try to cat this file, because its contents are binary and will mess up your screen.) Finally, there are many hardware-related files and directories, such as /proc/interrupts and /proc/irq, /proc/pci (all PCI devices), /proc/bus, and so on, but they include very specific information, which most users won't need.
What's in a process?

As I said, the numerical named directories represent all running processes. When a process ends, its /proc directory disappears automatically. If you check any of these directories while they exist, you will find plenty of files, such as:
attr cpuset fdinfo mountstats stat
auxv cwd loginuid oom_adj statm
clear_refs environ maps oom_score status
cmdline exe mem root task
coredump_filter fd mounts smaps wchan

Let's take a look at the principal files:
cmdline: Contains the command that started the process, with all its parameters.
cwd: A symlink to the current working directory (CWD) for the process; exe links to the process executable, and root links to its root directory.
environ: Shows all environment variables for the process.
fd: Contains all file descriptors for a process, showing which files or devices it is using.
maps, statm, and mem: Deal with the memory in use by the process.
stat and status: Provide information about the status of the process, but the latter is far clearer than the former.

These files provide several script programming challenges. For example, if you want to hunt for zombie processes, you could scan all numbered directories and check whether "(Z) Zombie" appears in the /status file. I once needed to check whether a certain program was running; I did a scan and looked at the /cmdline files instead, searching for the desired string. (You can also do this by working with the output of the ps command, but that's not the point here.) And if you want to program a better-looking top, all the needed information is right at your fingertips.
Tweaking the system: /proc/sys

/proc/sys not only provides information about the system, it also allows you to change kernel parameters on the fly, and enable or disable features. (Of course, this could prove harmful to your system -- consider yourself warned!)

To determine whether you can configure a file or if it's just read-only, use ls -ld; if a file has the "W" attribute, it means you may use it to configure the kernel somehow. For example, ls -ld /proc/kernel/* starts like this:
dr-xr-xr-x 0 root root 0 2008-01-26 00:49 pty
dr-xr-xr-x 0 root root 0 2008-01-26 00:49 random
-rw-r--r-- 1 root root 0 2008-01-26 00:49 acct
-rw-r--r-- 1 root root 0 2008-01-26 00:49 acpi_video_flags
-rw-r--r-- 1 root root 0 2008-01-26 00:49 audit_argv_kb
-r--r--r-- 1 root root 0 2008-01-26 00:49 bootloader_type
-rw------- 1 root root 0 2008-01-26 00:49 cad_pid
-rw------- 1 root root 0 2008-01-26 00:49 cap-bound

You can see that bootloader_type isn't meant to be changed, but other files are. To change a file, use something like echo 10 >/proc/sys/vm/swappiness. This particular example would allow you to tune the virtual memory paging performance. By the way, these changes are only temporary, and their effects will disappear when you reboot your system; use sysctl and the /etc/sysctl.conf file to effect more permanent changes.

Let's take a high-level look at the /proc/sys directories:
debug: Has (surprise!) debugging information. This is good if you're into kernel development.
dev: Provides parameters for specific devices on your system; for example, check the /dev/cdrom directory.
fs: Offers data on every possible aspect of the filesystem.
kernel: Lets you affect the kernel configuration and operation directly.
net: Lets you control network-related matters. Be careful, because messing with this can make you lose connectivity!
vm: Deals with the VM subsystem.
Conclusion

The /proc special directory provides full detailed information about the inner workings of Linux and lets you fine-tune many aspects of its configuration. If you spend some time learning all the possibilities of this directory, you'll be able to get a more perfect Linux box. And isn't that something we all want?
Federico Kereki is an Uruguayan systems engineer with more than 20 years' experience developing systems, doing consulting work, and teaching at universities.

Federico Kereki is an Uruguayan systems engineer with more than 20 years' experience developing systems, doing consulting work, and teaching at universities.

This article content is taken from http://www.linux.com/feature/126718
--------------------------

Linux File System 10 - opt directory

/opt - This directory contains all the software and add-on packages that
are not part of the default installation. Generally you will find KDE and
StarOffice here. Again, this directory is not used very often as it's
mostly a standard in Unix installations.

Linux File System 09 - mnt directory

/mnt - This is a generic mount point under which you mount your filesystems
or devices. Mounting is the process by which you make a filesystem
available to the system. After mounting your files will be accessible
under the mount-point. This directory usually contains mount points or
sub-directories where you mount your floppy and your CD. You can also
create additional mount-points here if you want. There is no limitation to
creating a mount-point anywhere on your system but convention says that
you do not litter your file system with mount-points.

Linux File System 08 - lost_found directory

/lost+found - Linux should always go through a proper shutdown. Sometimes
your system might crash or a power failure might take the machine down.
Either way, at the next boot, a lengthy filesystem check using fsck will
be done. Fsck will go through the system and try to recover any corrupt
files that it finds. The result of this recovery operation will be placed
in this directory. The files recovered are not likely to be complete or
make much sense but there always is a chance that something worthwhile is
recovered.

Linux File System 07 - lib directory

/lib - This contains all the shared libraries that are required by system
programs. Windows equivalent to a shared library would be a DLL file.

Linux File System 06 - home directory

/home - Linux is a multi-user environment so each user is also assigned a
specific directory which is accessible only to them and the system
administrator. These are the user home directories, which can be found
under /home/username. This directory also contains the user specific
settings for programs like IRC, X etc.

Linux File System 05 - etc directory

/etc - This directory contains all the configuration files for your system.
Your lilo.conf file lies in this directory as does hosts, resolv.conf and
fstab. Under this directory will be X11 sub-directory which contains the
configuration files for X. More importantly, the /etc/rc.d directory
contains the system startup scripts. This is a good directory to backup
often. It will definitely save you a lot of re-configuration later if you
re-install or lose your current installation.

Linux File System 04 - dev directory

/dev - This is a very interesting directory that highlights one important
characteristic of the Linux filesystem - everything is a file or a
directory. Look through this directory and you should see hda1, hda2 etc,
which represent the various partitions on the first master drive of the
system. /dev/cdrom and /dev/fd0 represent your CDROM drive and your floppy
drive. This may seem strange but it will make sense if you compare the
characteristics of files to that of your hardware. Both can be read from
and written to. Take /dev/dsp, for instance. This file represents your
speaker device. So any data written to this file will be re-directed to
your speaker. Try 'cat /etc/lilo.conf > /dev/dsp' and you should hear some
sound on the speaker. That's the sound of your lilo.conf file! Similarly,
sending data to and reading from /dev/ttyS0 ( COM 1 ) will allow you to
communicate with a device attached there - your modem.

Linux File System 03 - boot directory

/boot - This directory contains the system.map file as well as the Linux
kernel. Lilo places the boot sector backups in this directory.

Linux File System 02 - bin directory

/bin - In contrast to /sbin, the bin directory contains several useful
commands that are used by both the system administrator as well as
non-privileged users. This directory usually contains the shells like
bash, csh etc. as well as much used commands like cp, mv, rm, cat, ls.
There also is /usr/bin, which contains other user binaries. These binaries
on the other hand are not essential for the user. The binaries in /bin
however, a user cannot do without.

Linux File System 01 - sbin directory

/sbin

This directory contains all the binaries that are essential to the working of the system. These include system administration as well as maintenance and hardware configuration programs.

You can find lilo, fdisk, init, ifconfig etc here. These are the essential programs that are required by all the users.

Another directory that contains system binaries is

/usr/sbin

This directory contains other binaries of use to the system administrator. This is where you will find the network daemons for your system along with other binaries that only the system administrator has access to, but which are not required for system maintenance, repair etc



The /usr/sbin directory contains non-vital system utilities that are used after booting (i.e., starting the system) by the system administrator.

This is in contrast to the /sbin directory, whose contents include vital system utilities that are necessary before the /usr directory has been mounted (i.e., attached logically to the main filesystem).

A few of the more familiar programs in /usr/sbin are adduser, chroot, groupadd, kppp, kudzu, ping, setquota, traceroute, userdel and xcdroast.

/usr/sbin also contains some daemons, which are programs that run silently in the background, rather than under the direct control of a user, waiting until they are activated by a particular event or condition. Among the daemons in /usr/sbin are crond, pppd, sshd and xinetd.

/usr/sbin is a subdirectory of /usr, which is used to store many application programs. Another subdirectory of /usr, /usr/bin, contains programs that are not required for booting or repairing the system. The directory /usr/local/sbin is used for locally installed system administration programs.

Because /usr/sbin's programs are not intended for running by ordinary users, it is not in the path (i.e., the set of directories that system searches to find commands) for such users, as is also the case with /sbin. This can easily be seen by using the echo command (which displays whatever follows it or its value) while logged in as an ordinary user to see the value of the $PATH variable (which contains the user's path), i.e.,

echo $PATH

However, /usr/sbin is in the root user's (i.e., administrative account's) path, as can be seen by using the same command when logged in as the root user.

As is the case with any directory, the contents of /usr/sbin can be viewed by using the ls command, i.e.,

ls /usr/sbin

Thursday, August 28, 2008

LPIC Exam 101 - Objective 1 -

This is objective 1 of lpic exam 101

Wednesday, August 27, 2008

Setting a path variable

You need to write the following line in the .profile_bash file for the particular user you want to set the path variable. This file is a hidden file and it is placed in the root folder of the user for example at /home/username directory where username is to be replaced by the name of the user

export variable_name=path

for example

export DROOLS_PATH=/home/drools/

How Display your linux path?

You can display your linux path by writing down the following command

echo $PATH

How to display the list of linux machine users

cat /etc/passwd will list down all of the users.

Wednesday, July 30, 2008

How to list all of the processes on linux machine

You can use the following command to see all of the running linux processes


shell>ps -ax

Thursday, May 1, 2008

Buy gadgets mobiles notebooks and computers on installments in Pakistan

Raffle Systems provides you the option to buy gadgets, computers and notebooks and mobiles on installments free of mark up or any other hidden charges. Vow this is a great offer and one must go for it. The following is a detailed link about them.

Raffle Systems

The addresses are these

LAHORE
57-D-1, Gulberg III, Lahore - Pakistan. +92-42-5871201-02 +92-42-5873972

2nd Floor, Suite No.45, Hafeez Center, Main Boulevard, Gulberg III, Lahore. +92-02-5715111, 5710363, 5710855 +92-42-5752237

ISLAMABAD
Block # 53, Mezaine 1, 2, 3 F6/G6, Fazl-e-Haq Raod,Near PIA Building, Blue Area, Islamabad. +92-51-2873973 +92-51-2873976

KARACHI
512 5th Floor, Business Avenue, PECHS Block 6, Main Shahra-e-Faisal, Karachi. +92-21-4392512-14 +92-21-4392517

FAISALABAD
Office # 13, 2nd Gallery, 2nd FloorRex City Plaza, Satiana Road, Faisalabd.
+92-41-8532084-85
+92-41-8532085

Multan
Office # 64, Ground Floor, Khan Plaza.Multan Cantt, Multan.
+92-61-4580432

Wednesday, April 30, 2008

The X Window System - Post 1

X window System components

  1. X Server
  2. Window Manager
  3. Desktop Environment

X Server

The x server is responsible for Raw display, Character Placement, Pixel Placement etc.

Window Manager

The window manager is responsible for placing a border around raw graphic output and providing some basic controls on that border to control the graphical output from X Server. You can say that window manager provides the look and feel of your linux operating system.

There are different window managers, a few among them are KWM, Rawfish, Ice window manager etc.


Desktop Environment

The Graphical utilities, Configuration programs etc fall under the desktop environments. Desktop environments provide these tools so that you can control your linux operating system using your mouse. A few examples of most used desktop environments are KDE, Gnome, CDE, etc


Installing and Configuring X Server

You can install or upgrade your own, from
ftp://metalab.unc.edu/pub/Linux/X11/Xfree86-*
If you need to manually configure the X server, there are several
possible methods:

  1. Try to use the XF86Setup program, which can help identify the correct X server and monitor timings for the video hardware.
  2. Make sure that the X server has the correct options. If you log in as the superuser, you should be able to use X --probeonly to get a listing of the video card chipset, memory, and any special graphics features. Also, refer to the manual page for the X server. (E.g.; man X), and try running the X server and redirecting the standard error output to a file so you can determine, after you can view text on the screen again, what error messages the server is generating; e.g., X 2>x.error.
  3. With that information, you should be able to safely refer to one of the references provided by the Linux Documentation Project. ("Where can I get the HOWTO's and other documentation? ") There are several HOWTO's on the subject, including a HOWTO to calculate video timings manually if necessary. Also, the Installation and Getting Started guide has a chapter with a step-by-step guide to writing a XF86Config file.

Resources

These are some good resources for X window system

  1. http://www.linuxdevcenter.com/pub/a/linux/2005/08/25/whatisXwindow.html?page=1

The X window system video lectures on http://www.youtube.com/

An X Window System Tutorial (Part 01)



An X Window System Tutorial (Part 02)



An X Window System Tutorial (Part 03)



An X Window System Tutorial (Part 04)



An X Window System Tutorial (Part 05)



An X Window System Tutorial (Part 06)

Tuesday, April 29, 2008

Getting Started

LPIC certifications are divided into three levels

  1. LPIC 1
  2. LPIC 2
  3. LPIC 3

The detailed objectives covered on these certifications are listed on the following link on the official LPIC website.

http://www.lpi.org/en/lpi/english/certification/the_lpic_program

LPIC 1

LPIC 1 is further divided into two papers. Exam 101 and Exam 102


Fees

LPIC 1 Exam 101 costs 155 USD and you can register for it through http://www.prometric.com/default.htm using your credit card.

LPIC 1 Exam 102 also costs 155 USD and you can follow the same procedure for its registration.

Resources

Some of very good resources for LPIC 1 certification are as follows


http://www.ibm.com/developerworks/linux/lpi/101.html [Free Resource]

There are also some video trainings available for LPIC 1 certification. They are from

  1. VTC - http://www.vtc.com/
  2. CBT Nuggest - http://www.cbtnuggets.com/

These video lectures are not free. But they can be downloaded using P2P networks.

There is also some exam engines available to simulate the LPIC exam tests. One beautiful exam engine is this

  1. Visual CertExam suite, you can find this at http://www.visualcertexam.com/

I myself is in the process of learning Linux and going to get LPIC certification in a short time. I will blog about my experience of that too. Anyone who wants to share his experience of LPIC certifications should comment on this blog, it will be helpful for anyone viewing this blog. Thanks

Free Advertising