Linux Environment

File System Layout
A typical Linux Directory Structure is for example the one used by the Debian distribution:




 * bin
 * Essential user programs are stored here. These represent the bare minimum set of programs required for a user to use the system. Things like the shell and the filesystem commands (ls, cp, and so on) are stored here. The /bin directory usually doesn't receive modification after installation. If it does, it's usually in the form of package upgrades that we provide.


 * boot
 * Files that are used by the Linux Loader (LILO). This directory also receives little modification after an installation. The kernel is stored here as of Slackware 8.1. In earlier releases of Slackware, the kernel was simply stored under /, but common practice is to put the kernel and related files here to facilitate dual-booting.


 * dev
 * Everything in Linux is treated as a file, even hardware devices like serial ports, hard disks, and scanners. In order to access these devices, a special file called a device node has to be present. All device nodes are stored in the /dev directory. You will find this to be true across many Unix-like operating systems.


 * etc
 * This directory holds system configuration files. Everything from the X Window configuration file, the user database, to the system startup scripts. The system administrator will become quite familiar with this directory over time.


 * home
 * Linux is a multiuser operating system. Each user on the system is given an account and a unique directory for personal files. This directory is called the user's home directory. The /home directory is provided as the default location for user home directories.


 * lib
 * System libraries that are required for basic operation are stored here. The C library, the dynamic loader, the ncurses library, and kernel modules are among the things stored here.


 * mnt
 * This directory contains temporary mount points for working on hard disks or removable drives. Here you'll find mount points for your CD-ROM and floppy drives.


 * opt
 * Optional software packages. The idea behind /opt is that each software package installs to /opt/software-package, which makes it easy to remove later. Slackware distributes some things in /opt (such as KDE in /opt/kde), but you are free to add anything you want to /opt.


 * proc
 * This is a unique directory. It's not really part of the filesystem, but a virtual filesystem that provides access to kernel information. Various pieces of information that the kernel wants you to know are conveyed to you through files in the /proc directory. You can also send information to the kernel through some of these files. Try doing cat /proc/cpuinfo.


 * root
 * The system administrator is known as root on the system. root's home directory is kept in /root instead of /home/root. The reason is simple. What if /home was a different partition from / and it could not be mounted? root would naturally want to log in and repair the problem. If his home directory was on the damaged filesystem, it would make it difficult for him to log in.


 * sbin
 * Essential programs that are run by root and during the system bootup process are kept here. Normal users will not run programs in this directory.


 * tmp
 * The temporary storage location. All users have read and write access to this directory.


 * usr
 * This is the big directory on a Linux system. Everything else pretty much goes here, programs, documentation, the kernel source code, and the X Window system. This is the directory to which you will most likely be installing programs.


 * usr/doc
 * Documentation for the user apps, in many file formats.


 * usr/share
 * Config files and graphics for many user apps.


 * usr/src
 * Source code files for the system's software, including the Linux kernel.


 * usr/include
 * Header files for the C compiler. The header files define structures and constants that are needed for building most standard programs. A subdirectory under /usr/include contains headers for the C++ compiler.


 * usr/X11R6
 * The X Window System and things for it. The subdirectories under /usr/X11R6 may contain some X binaries themselves, as well as documentation, header files, config files, icons, sounds, and other things related to the graphical programs.


 * usr/local
 * This is where you install apps and other files for use on the local machine. If your machine is a part of a network, the /usr directory may physically be on another machine and can be shared by many networked Linux workstations. On this kind of a network, the /usr/local directory contains only stuff that is not supposed to be used on many machines and is intended for use at the local machine only.


 * var
 * This directory contains variable data that changes constantly when the system is running. For example, system log files, cache data, and program lock files are stored here. This is the directory for frequently-changing data. See below some interesting subdirectories.


 * var/log
 * A directory that contains system log files. They're updated when the system runs, and checking them out can give you valuable info about the health of your system. If something in your system suddenly goes wrong, the log files may contain some info about the situation.


 * var/mail
 * Incoming and outgoing mail is stored in this directory.


 * var/spool
 * This directory holds files that are queued for some process, like printing.

Kernel Initialization
To understand better the initialization process of linux read the document.


 * The kernel messages during the intialization are usually transferred to for a permanent record.
 * The directory has many initialization files.
 * : start script.
 * or : kill script executed by runlevel 0 (halt) or 6 (reboot).

Kernel initialization
 * The first program to run under Slackware besides the Linux kernel is init. This program reads the file to see how to run the system.

start and shutdown
To start a program automatically, edit the file and insert the command to be executed.

To stop the program when the system shutdown, edit the file and insert the command to be executed.

Linux can automatically start and stop a program that use the model. Fore more information read the file.

Changing the default Runlevel
Edit the file and change the line where the default runlevel is defined. Example:

id:3:initdefault:
 * 1) The default runlevel is defined here

Most Linux distributions include the command for managing runlevel services. Type or  to read more about its usage and syntax.

If you use SuSe Linux you can start the Yast Control Center and click at System->Runlevel-Editor to define in which runlevels your program will be started.

Some examples of usage are described below using the service Samba (smb)

$ chkconfig smb smb on $ chkconfig -l smb smb 0:off 1:off 2:on 3:off 4:off 5:on 6:off $ chkconfig smb off $ chkconfig smb 35
 * 1) Check whether the service is active or not in one of the runlevels
 * 1) List the status of the service in all runlevels
 * 1) Deactivate the service in all runlevels
 * 1) Activate the service in the runlevels 3 and 5

Changing the keyboard layout
Edit the file and change the line where the default keyboard layout is defined. Examples for German and Portuguese layout:

KEYTABLE="de-latin1.map.gz"      or   KEYTABLE="br-abnt2.map.gz" and YAST_KEYBOARD="german-de,pc104"  or   YAST_KEYBOARD="portugese-br,pc104"

To change the default keyboard layout for the X engine, edit the file and change the lines of the Section "InputDevice" where the default keyboard layout is defined. Example:

Identifier    "Keyboard1" Driver        "kbd" Option        "AutoRepeat" "500 30" Option        "XkbRules" "xorg" Option        "XkbModel" "pc104" Option        "XkbLayout" "br" Option        "XkbVariant" "abnt2"

Lilo
append="ether=0,0,eth1" boot=/dev/sda vga=0x305 read-only prompt timeout=30
 * Lilo is responsible to initialize the linux system using usually a start menu at MBR.
 * Use the command liloconfig to configure the lilo settings.
 * You can edit the file /etc/lilo.conf and change manually some settings:

image = /boot/linux root = /dev/sda3 label = linux
 * If are having troubles with the console resolution, then try to add the property vga=??? in the lilo.conf file.

You can configure the colordepth: Color depth           640x480 800x600 1024x768 1280x1024 1600x1200 256 (8bit) 	 	0x301 	0x303 	0x305 	 0x307 	  0x31C 32000 (15bit) 	 	0x310 	0x313 	0x316 	 0x319 	  0x31D 65000 (16bit) 	 	0x311 	0x314 	0x317 	 0x31A 	  0x31E 16.7 Mill. (24bit) 	0x312 	0x315 	0x318 	 0x31B 	  0x31F