1. What is linux?
Linux is an operating system. An operating
system is software that manages all of the hardware resources associated with
your desktop or laptop.
Thhe operating system manages the
communication between your software and your hardware 7
|
.
2.
Linux hierarchy
Static is content that remains unchanged until explicitly edited or reconfigured.
Dynamic or variable is content typically modified or appended
by active processes.
Persistent is content, particularly configuration settings,
that remain after a reboot.
Runtime is processor system-specific content or attributes
cleared during reboot.
Important Red Hat Enterprise Linux directories:
/usr:
Installed software, shared libraries, include files, and
static read-only program data.
Important subdirectories include:
/usr/bin: User commands.
/usr/sbin: System administration commands.
/usr/ local: Locally customized software.
/tmp: 10 days validity
/var
Variable data specific to this system that should persist
between boots. Files that dynamically change (e.g. databases, cache
directories, log files. printer spooled documents. and website content) may
be found under /var.
subdirectories contain:
/tmp: 30 days validity
/etc
Persistent system Configuration files specific to this system.
/etc/fstab: persistent entry remains after reboot(static)
/etc/seliux/config
/run
Runtime data for processes started since the last boot. This
includes process ID files and lock files, among other things. The contents of
this directory are recreated on reboot.
/home
Home directories where regular users store their personal data
and configuration files.
/root
Home directory for the administrative superuser, root.
/tmp
A world-writable space for temporary files. Files which have
not been accessed, changed, or modified for 10 days are deleted from this
directory automatically.
/boot
Files needed in order to start the boot process.
e.g /boot/grub
/dev
Contains special device files which are used by the system to
access hardware.
Hidden “Dot” Files
There are some files within the home
directory that are ordinarily hidden. Hidden files have names that
begin with a period; hence, they have been given the nickname of dot
files. Hidden files are not displayed by the ls command unless the –a
option is used in the format of ls –a.
Since the default shell for Linux is
the bash shell, the home directory contains the bash related scripts
indicated below.
Fle Description
|
File
|
Description
|
.bash_history
|
For users of the bash shell, a file
containing up to 500 of the most recent commands available for recall using
the up and down arrow keys.
|
.bash_logout
|
Script that is run by the bash shell
when the user logs out of the system
|
.bash_profile
|
Initialization script that is run by
the bash shell upon login in order to setup variables and aliases. When
bash is started as the default login shell, it looks for the .bash_profile
file in the user’s home directory; if not found, it looks for
.bash_login. If there is no .bash_login file, it then looks for a
.profile file.
|
.bashrc
|
Initialization script executed
whenever the bash shell is started in some way other than a login shell. It
is better to put system-wide functions and aliases in /etc/bashrc, which will
be presented later in the book.
|
.gtkrc
|
GTK initialization file. GTK+
is a multi-platform toolkit for creating graphical user interfaces, used by a
large number of applications. It is the toolkit used by the GNU
project's GNOME desktop.
|
.login
|
The initialization script that is
run whenever a user login occurs.
|
.logout
|
The script that is automatically run
whenever a user logout occurs.
|
.profile
|
Put default system-wide environment
variables in /etc/profile.
|
.viminfo
|
Initialization file for the Vim text
editor that is compatible with vi.
|
.wm_style
|
Specifys the default window manager
if one is not specified in startx
|
.Xdefaults & .Xresources
|
Initialization files for Xterm
resources for the user. Application program behavior can be changed by
modifying these files.
|
.xinitrc
|
The initialization file used when
running startx, which can be used to activate applications and run a
particular window manager.
|
.xsession
|
This file is executed when a user
logs in to an X-terminal and is used to automatically load the window manager
and applications.
|
Table 1: Common dot files for the bash shell
The list below indicates the dot
files installed in tclark’s home directory.
-rw------- 1
roseat roseat 3773 Jan 13 21:39
.bash_history
-rw-r--r--
1 roseat roseat 24 Aug 18
11:23 .bash_logout
-rw-r--r-- 1 roseat roseat 191 Aug 18 11:23 .bash_profile -rw-r--r-- 1 roseat roseat 124 Aug 18 11:23 .bashrc
-rw-r--r--
1 roseat roseat 237 May 22
2003 .emacs
|
|
-rw-r--r--
1 roseat roseat 120 Aug 24 06:44
.gtkrc
The following is the content of the
.bash_logout file in tclark’s home directory, which is executed whenever
logging out of the system. It does nothing more than clear the screen
upon logout.
# ~/.bash_logout
clear
The following is the content of the
.bashrc file from tclark’s home directory. Shell scripts will be
presented in a later chapter, but for now suffice it to say that the script
looks for a file in the /etc directory called bashrc and execute it if the
file exists.
# .bashrc
# User specific aliases and functions # Source global definitions if [ -f /etc/bashrc ]; then . /etc/bashrc fi
These files primarily affect
individual users on the Linux system. Next we'll look at the files
which affect the entire system.
Important System Files
Everything in the Linux environment
exists in files. It makes sense for users to become familiar with some
of the more important Linux system files. Some of these are
configuration files, others are devices which Linux makes available through
files and some are executable programs.
Table 2 below is by no means
intended to be an exhaustive list of Linux system files; however, it is a
good representation to give some insight into the inner workings of Linux.
|
|
File
|
Description
|
/boot/vmlinuz
|
The Linux kernel file. File
naming conventions may include release information
|
/dev/fd0
|
Device file for the first floppy
disk drive on the system
|
/dev/fd0H1440
|
Device driver for the first floppy
drive in high density mode, commonly invoked when formatting a floppy
diskette for that density
|
/dev/hda
|
Device file for the first IDE hard
drive on the system
|
/dev/hdc
|
Commonly, the IDE CDROM drive device
file which often is a symbolic link called to /dev/cdrom, the real CDROM
driver file.
|
/dev/null
|
A dummy device which contains
nothing. It is sometimes useful to send output to this device to make
it go away forever.
|
/etc/aliases
|
Contains aliases used by sendmail
and other mail transport agents. Whenever this file is changed, the
newaliases utility must be run to notify sendmail of the changes
|
/etc/bashrc
|
Contains global defaults and aliases
used by the bash shell
|
/etc/crontab
|
A parent shell script to run
commands periodically. It invokes hourly, daily, weekly, and monthly
scripts.
|
/etc/exports
|
Contains a list of filesystems which
may be made available to other systems on the network via NFS.
|
/etc/fstab
|
The file system table contains the
description of what disk devices are available at what mount points.
|
/etc/group
|
Holds information regarding security
group definitions.
|
/etc/grub.conf
|
The grub boot loader configuration
file
|
/etc/hosts
|
Contains host names and their
corresponding IP addresses used for name resolution whenever a DNS server is
unavailable
|
/etc/hosts.allow
|
Contains a list of hosts allowed to
access services on this computer.
|
/etc/hosts.deny
|
Contains a list of hosts forbidden
to access services on this computer.
|
/etc/inittab
|
Describes how the INIT process
should set up the system in various runlevels
|
/etc/issue
|
Contains the pre-login message,
often overwritten by the /etc/rc.d/rc.local script in Red Hat and some other
rpm-based Linux distributions
|
/etc/lilo.conf
|
The lilo boot loader configuration
file
|
/etc/modules.conf
|
Holds options for configurable
system modules
|
/etc/motd
|
This is the ”message of the day”
file which is printed upon login. It can be overwritten by /etc/rc.d/rc.local
Red Hat on startup.
|
/etc/mtab
|
Status information for currently
mounted devices and partitions
|
/etc/passwd
|
Contains information regarding registered
system users. Passwords are typically kept in a shadow file for better
security.
|
/etc/printcap
|
Holds printer setup information
|
/etc/profile
|
Contains global defaults for the
bash shell
|
/etc/resolv.conf
|
A list of domain name servers (DNS)
used by the local machine
|
/etc/securetty
|
This file contains a list of
terminals where root can login
|
/etc/termcap
|
An extensive ASCII text file
defining the properties of consoles, terminals, and printers
|
/proc/cpuinfo
|
Contains CPU related information
|
/proc/filesystems
|
Holds information regarding
filesystems that are currently in use
|
/proc/interrupts
|
Stores the interrupts that are
currently being used
|
/proc/ioports
|
A list of the I/O addresses used by
devices connected to the server
|
/proc/meminfo
|
Contains memory usage information
for both physical memory and swap
|
/proc/modules
|
Lists currently loaded kernel
modules
|
/proc/mounts
|
Displays currently mounted file
systems
|
/proc/stat
|
Contains various statistics about
the system, such as the number of page faults since the system was last
booted
|
/proc/swaps
|
Holds swap file utilization
information
|
/proc/version
|
Contains Linux version information
|
/var/log/lastlog
|
Stores information about the last
boot process
|
/var/log/messages
|
Contains messages produced by the
syslog daemon during the boot process
|
/var/log/wtmp
|
A binary data file holding login
time and duration for each user currently on the system
|
Table 2: Representative list of Linux files
Important Directories
/etc/rc.d
|
Contains subdirectories which contain
run level specific scripts
|
/etc/rc.d/init.d
|
run level initialization scripts
|
/etc/rc.d/rc?.d
|
Where ‘?’ is a number corresponding
to the default run level. Contains symbolic links to scripts which are in
/etc/rc.d/init.d. for services to be started and stopped at the indicated run
level.
|
/etc/skel
|
Holds example dot files used to
populate a new user's home directory.
|
/etc/X11
|
Contains subdirectories and
configuration files for the X Window system
|
Comments
Post a Comment