Widely Vision

  • Real History of Israel

  • Poll

  • Get a PDF version

  • Follow This Blog

  • August 2009
    S M T W T F S
    « Jul   Sep »

Archive for August, 2009

/proc Tuning Your System Performance

Posted by aboelnour on August 24, 2009


Peace be upon you:

we will talk about the /proc directory in your file system in linux,so enjoy 🙂

I know the article is long but it really Deserves.


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.

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 numbered directories (more on them later) correspond to each running 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.

The cat /proc/meminfo command might bring up something like this:

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/sda10 ro quiet
which tells me which partition is the root of the filesystem,and more.

/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:

/proc/filesystems: Shows which filesystem types are supported by your kernel. A portion of this file might look like this:

The first column shows whether the filesystem is mounted on a block device. In my case, I have partitions configured 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.

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:

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.


The /proc special directory provides full detailed information about the inner workings of Linux and lets you tuning many 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?


it was a simple look on the /proc directory 😀 any feedback is welcomed.




Posted in linux | Leave a Comment »

Be root in Debian Using sudo

Posted by aboelnour on August 23, 2009

Peace be upon you:

In last few days I installed Debian 5.0 and as usual I need to deal with System Files.

so I Opened my Dear Terminal and typing sudo and the surprise become there is no Sudo in Debian so How can I get the root privileges?

Run in terminal:

su –

and enter your root Password and deal.

The hyphen argument (-) to su instructs it to behave as if root had logged in on the console, so that it executes whatever shell customizations are set up. The root user has the home directory /root by default, and using su - will place you in that directory. Terminate the root session by exiting the shell with Ctrl-D or exit.

Using su to start a root shell session is almost as tempting for bad habits as a console login, however. Although you can give the --command option to su to execute a single command, rather than entire shell, retyping root’s password each time becomes tiresome. Furthermore, using su means that you have to share the root password with anyone else who wants to run a program as root. Additionally, you can’t restrict what those users can do as root. It may well be that you want them to run only one or two commands that require root privileges, not have dominion over your entire system.

The sudo program provides a solution to these problems and allows a more flexible and controllable approach to get root privileges. Install it by becoming root with su and using the aptitude package manager to install the software.

To install sudo Run in terminal:

su –

aptitude install sudo

then Run in terminal:

su –


this will start up text editor showing sudo’s configration file which is /etc/sudoers

find the line which contain this line:

root ALL=(ALL) ALL

copy it ,substituting your username for root and paste it under this line.

then save and exit.

now test if sudo work or not Run in terminal:


the answer must be your user name

now run in trminal:

sudo whoami

the answer must be root if sudo work.

so that’s it any feedback is welcomed




Posted in linux | Leave a Comment »

APT (Advanced Packaging Tool)

Posted by aboelnour on August 8, 2009


Peace be upon you:

last Article we talked about installing a program from it’s source code and we said that way become recursive 😀 and more difficult so there is a magic stick in Linux called PMS (Package Management system) this tool enable the users to deal with programs without suffering .

A package management system is often called an “install manager”.This can lead to confusion between
a package management system and an installer.

The PMS :

1) Typically part of the operating system.

2) Can verify and manage all packages on the system.

The installer :

1) Each product comes bundled with its own installer.

2) Only works with its bundled product.

we will talk about the APT (Advanced Packaging Tool) the PMS for Debian distribution and other distribution which based on Debian like ubuntu.


1) APT :

* Definition:

– The Advanced Packaging Tool, or APT, is a free user interface that works with libraries to handle the installation and removal of software on the Debian GNU/Linux operating system and its variants.

– APT simplifies the process of managing software on your computer systems by automating the removal ,configuration and installation of packages, either from binary files or by compiling source code.

* Functions :

– Apt can be functionally considered to be a front-end to dpkg, While dpkg performs
actions on individual packages, apt tools manage relations (especially dependencies) between them.

Apt have alot of tasks like:

1)  Update is used to resynchronize the package index files from their sources from /etc/apt/sources.list.
2) Upgrade is used to install the newest versions of all packages currently installed on the system from the sources listed in /etc/apt/sources.list.
3) dist-upgrade in addition to performing the function of upgrade,also intelligently handles changing dependencies with new versions of packages.

* Configuration and files :

/etc/apt : has the apt configuration folders and files.
/etc/apt/ : sources.list : Locations to fetch packages from.
/etc/apt/apt.conf : APT configuration file.
/var/cache/apt/archives/ : storage area for retrieved package files.
/var/lib/apt/lists/ : storage area for state information for each package resource specified in sources.list.

* Sources :

so the important Question now is from where the APT gets it’s archives

and packages ?

it gets it’s programs from Repositories In order to give users more control over the kinds of software that they are allowing to be installed on their system , software is often downloaded from a number of software repositories.

– APT relies on the concept of repositories in order to find software and resolve dependencies.
For APT, a repository is a directory containing packages along with an index file.
This can be specified as a networked or CDROM location. The Debian project keeps a central repository
of over 25,000 software packages ready for download and installation.

– For extra packages, any number of additional repositories can be added to APT’s sources.list configuration
file (/etc/apt/sources.list) and then be queried by APT.

– Graphical front-ends (like Synaptic Package Manager) often allow modifying source.list more simply(apt-setup).

Once a package repository has been specified, packages in that repository can be installed without specifying a source.

2) APT Throw The Terminal :

NOTE : The next commands must insert sudo before it to obtain the root privileges.

a) commands dealing with installing and removing :

apt-get update

to refresh the repositories.

apt-get install programName

to install new program.

apt-get upgrade

to upgrade all packages on your system

apt-get dist-upgrade

to upgrade your distribution like your kernel version

apt-get remove programName

to remove a program but this command will keep the program confi files in your home

apt-get –purge remove programName

to remove a program and remove his config files from your home

b) commands dealing with programs database (searching ,….) :

apt-cache search programName

to search on program with his name.

apt-cache showpkg programName

to view every information about this package and it’s libraries and dependencies.

apt-cache dumpavail

to view every package come with your distribution and view information about it.

apt-cache pkgnames

to view all package which is one your system.

apt-get autoclean

to remove the unneeded .deb packages ,when you install a program the apt download the .deb package and the libraries which program need then install the program and he left the .deb package, so this command will remove

the unneeded .deb packages


so that’s it any feedback is welcomed .

best wishes,


Posted in linux | Leave a Comment »

Setup from a source file

Posted by aboelnour on August 3, 2009


Peace be upon you:

Our article today is about install programs and applications from their source code in Ubuntu .

Requirements: basic knowledge about APTand Packages.


1) why install from the source?

some programs don’t exist as .deb package, so the default way is the program come in source code and can be used on different distributions and different OS’s.

2) How can i differentiate between the package and the source code files?

The package file come with extension .deb , .rpm , .tgz , .bin, but the source file come with extension .tar.gz , .tar.bz2 , .zip

and after extract it you will find files like README ,INSTALL , configure , makefile.

3) How can i install a program from package file or a source file?

from package file just let your dpkg work by double click on the package will finish your installation.

from a source file it is what the article talked about.

4 stages and you will finish your installation from source:

Stage #1 >> preparation :

just extract the source file with your desktop environment or with your terminal

tar xvzf  fribidi-0.10.9.tar.gz

tar xvjf  fribidi-0.10.9.tar.bz2

unzip fribidi-0.10.9.zip

it will generate a new file called  fribidi-0.10.9 so run in terminal:

cd fribidi-0.10.9

Stage#2 >> read instructions and sure from the dependents :

every program to run need a libraries so how you know the libraries needed?

* read the instructions on the web site which you download the file.

* read the README , INSTALL file.

some things is required to install from source:

GCC, build-essential (for distributions which based on debian),make,g++ , automake , autoconf , glibc-devel

Don’t started without be sure that you provide this requirements and the program dependencies.

Stage#3 >> Installation :

a) the configuration operation

run in terminal:


this command task is to be sure that the program requirements and libraries are exist.

if the requirements and libraries are exist a new file will be created called “MakeFile”.

if not an error message will appear.

NOTE : There’s a possibility that you don’t have a configure file. Anyway,still you have autogen.sh ,Type ./autogen.sh to generate configure file.

b) the Build operation

run in terminal:


here the program be built .may this operation take a long time depends on the program size.

c) The installation operation

run in terminal

make install

Stage#4 >> clean :

run in terminal

make clean

task: to remove the unneeded files after installation.

to remove your program run in terminal

make uninstall


Disadvantage of setup from source:

the main problem is in the Stage#2 because the program may want a lot of  libraries and this libraries want another libraries so the Stage will become recursion 😀 so in some times this Stage become impossible.

so there is the magic stick  PMS (Package management system ) like APT,RPM and yum.

this tools save your time and your efforts to bring the program to you and install it.


Methods can help you to install from source:

1) if you want a source file from a repository you have :

to bring the source file from the repository run :

sudo apt-get source programName

and to install the source file run :

sudo apt-get build-dep programName

if you want to make a package to this source file run :

dpkg-buildpackage -rfakeroot

you can install the .deb package that you made by running :

sudo dpkg -i programeName.deb

2) if you have a source file you can use the tool “auto-apt” run :

sudo apt-get install auto-apt

and redo the 4 stages but with this commands with the same arrange :

auto-apt run ./configure
sudo make install

this tool make Stage#2 more Easier by bring the Headers that your program need.


so that’s it any feedback is welcomed

Best wishes,


Posted in linux | 2 Comments »

your fstab file

Posted by aboelnour on August 1, 2009

One cogwheel

Peace be upon you:

our article today is about the /etc/fstab file.

Target: to get a good knowledge about the fstab file to deal with partitions and mounting.

Requirements: knowledge with the mounting commands and Basic Knowledge about hard partitioning in linux.


the fstab file is one of very important files in linux directory structure

The file pass his configurations to the kernel to deal with different file systems ,links the hard disk partitions with others and it has many operations on this partitions.

The main function of this file is used in dual-booting systems where there is more than operating system and each operating system have its partitions with their own format .

if you want to share a partition from operating system to another operating system you need to mount this partition and the mount configurations saved in the fstab file to mount this partition every the system boot.

you can show the contact of the /etc/fstab file

by running in terminal :

cat /etc/fstab

so you will see something like this :

# <file system> <mount point>   <type>   <options>       <dump>   <pass>

proc                         /proc                      proc         defaults            0                  0

/dev/hda1             /                               ext3          defaults,errors=remount-ro 0

1)  fstab syntax :

(Device)   (mount point)   (file system type)   (options)       (dump)   (pass)

-> Device :

The device/partition (by /dev location or UUID) that contain a file system (The physical path).

By Default Ubuntu Using the UUID to identify partitions.

to list your devices by UUID run in terminal:

sudo blkid

->Mont Point:

The location that you created to mount in it the Device the default location is /media you can use /mnt or your /home

as a mount point

->File Sytem type:

You may either use auto or specify a file system. Auto will attempt to automagically detect the file system of the target file system and in general works well. In general auto is used for removable devices .


  • auto
  • vfat – used for FAT partitions.
  • ntfs, ntfs-3g – used for ntfs partitions.
  • ext2, ext3, jfs, etc.
  • iso9660 – for CD/DVD.
  • swap

-> Options:

Mount options of access to the device/partition.


1) defaults

the option “defaults” contain other options in it :

rw : that’s mean the mounted device will have the permission to read and write

auto : that’s mean the device will mounted automatically

and other options like : suid, dev, exec, nouser, and async.

2) ro

that’s mean the mounted device will be read-only

3) noauto

that’s mean the mounted device won’t mount when Booting

4) user

that’s mean any user in the system can mount this device but the one who mount the device only he can unmount it

5) users

that’s mean any user can mount this device and any user can unmount it

6) exec / noexec

Permit/Prevent the execution of binaries from the device.


1) you can use many options seperate between every option” , ” COMMA.

2) for more options run in terminal man mount

-> Dump:

this field take only 0 or 1.

1 : The backup utility dump will backup file system.(to use this the tool dump must be installed).

0 : Ignore backing up the device.

-> Pass

this field also take only 0 , 1 and 2 and indicating if the device must be checked in booting stage or not

0 : Device ignored.

1 : Check this device first.

2 :  Check this partition(s) next ,all partitions marked with a “2” are checked in sequence and you do not need to specify an order.

2) related commands :

to edit in the fstab file:

sudo gedit /etc/fstab

To get a list of all the UUIDs, use one of the following two commands:

sudo blkid

ls -l /dev/disk/by-uuid

To list the drives and relevant partitions that are attached to your system, run:

sudo fdisk -l

To mount all file systems in /etc/fstab run:

sudo mount -a


so that’s it any feedback is welcomed

best wishes,


Posted in linux | Tagged: , , , , | Leave a Comment »

%d bloggers like this: