Operating Systems and Linux II
Operating Systems and Linux II
Partitions
Major partitions on a Linux system:
data partition: normal Linux system data, including the root partition containing all
the data to start up and run the system
swap partition: expansion of the computer's physical memory, extra memory on hard
disk.
Usually, systems contain a root partition, one or more data partitions and one or more
swap partitions.
fdisk
Swap space is only accessible for the system itself, and is hidden from view during
normal operation. Any problem with using the swap partition?
Typically, system data is separate from user data. Programs that offer services are kept
in a different place than the data handled by this service. Different partitions created:
a partition with all data necessary to boot the machine
a partition with configuration data and server programs
one or more partitions containing the database tables, user mails, an ftp archive etc.
a partition with user programs and application
one or more partitions for the user specific files (home directories)
one or more swap partitions
nettech:> df -h .
Filesystem
Size Used Avail Use% Mounted on
/dev/hda7
980M 163M 767M 18% /
/dev/hda8
496M 183M
288M
39% /
/dev/hda1
124M
8.4M 109M
8% /bo
/dev/hda5
19G 15G 2.7G 85% /opt
/dev/had6
7.0G 5.4G 1.2G 81% /usr
/dev/had7
3.7G 2.7G 867M 77% /var
Init process
The kernel, once it is loaded, finds init in sbin and executes it. When init starts,
Init process
What is init 6?
Links
Default files
Standard input
Standard Output
Standard error
Signal
Running state
Creation
Ready
Scheduling
Event
Signal or Event
Uninterruptible
Interruptible
Executing
Termination
Zombie
Input-Output Redirection
Output redirection with > and |
Redirecting "nothing" to an existing file is equal to emptying
the file
same redirection to an nonexistent file will create a new empty
file with the given name
To find a word within some text, display all lines matching
pattern1, or exclude lines also matching pattern2 from being
displayed:
grep pattern1 file | grep -v pattern2
Input-Output Redirection
To display output of a directory listing one page at a time:
ls -la | less
To find a file in a directory:
ls -l | grep part_of_file_name
who | wc l
aspell < text.txt > error.log
cat afile >> bfile
File descriptors
ls > dirlist 2>&1
set -o noclobber
Processes
at [options] time
Execute commands at a specified time and optional date. The commands are taken
from standard input or from a file.
Example: $at 1:00 am tomorrow < scriptfile
By default, only a privileged user can execute the command.
Role of script files, e.g., /etc/profile
Users are supposed to edit their crontabs in a safe way using the crontab e
command. The default editor is vi
This crontab entry reminds bob to go to his sports club every Thursday
night:
bob:~> crontab -l
# (/tmp/crontab.18185 installed on Wed Sep 19 16:37:08 2001)
38 16 * * 3 mail -s "sports evening" bob