Ch02 Host MGMT
Ch02 Host MGMT
Ch02 Host MGMT
1 / 73
Werkneh E. (MSc in Computer Networking)
Linux History
2 / 73
Werkneh E. (MSc in Computer Networking)
Linux History
3 / 73
Werkneh E. (MSc in Computer Networking)
Linux History...
4 / 73
Werkneh E. (MSc in Computer Networking)
Installation of Linux Operating Systems
5 / 73
Werkneh E. (MSc in Computer Networking)
The Linux File Tree and Managing Directories…
6 / 73
Werkneh E. (MSc in Computer Networking)
The Linux File Tree and Managing Directories…
7 / 73
Werkneh E. (MSc in Computer Networking)
The Linux File Tree and Managing Directories…
8 / 73
Werkneh E. (MSc in Computer Networking)
The Linux File Tree and Managing Directories…
9 / 73
Werkneh E. (MSc in Computer Networking)
The Linux File Tree and Managing Directories…
10 / 73
Werkneh E. (MSc in Computer Networking)
The Linux File Tree and Managing Directories…
/bin
This directory contains a number of essential commands that are available to
unprivileged users (such as cat, chmod, chown, etc)
11 / 73
Werkneh E. (MSc in Computer Networking)
The Linux File Tree and Managing Directories…
/sbin
o The /sbin directory is similar to the /bin directory.
o It contains essential binaries that are generally intended to be run by the root
user for system administration.
12 / 73
Werkneh E. (MSc in Computer Networking)
The Linux File Tree and Managing Directories…
/lib
This is where all kernel modules needed for system boot libraries that are
required by root system commands (commands found in /bin and /sbin)
Binaries found in /bin and /sbin often use shared libraries located in /lib
13 / 73
Werkneh E. (MSc in Computer Networking)
The Linux File Tree and Managing Directories…
/opt
The purpose of /opt is to store optional software
In many cases these software from outside the distribution repository
It may an empty /opt directory on many systems
A large package can install all its files in /bin, /lib, /etc, subdirectories
within /opt/ $packagename/
For example the package is called wp, then it installs in /opt/wp, putting
binaries in /opt/wp/bin and man pages in /opt/wp/man
14 / 73
Configuration Directories
/boot
The /boot directory contains all files needed to boot the computer, Linux
kernels are stored here
These files don’t change very often
On Linux systems you typically find the /boot/grub directory here; /boot/grub
contains /boot/grub/grub.cfg (older systems may still have
/boot/grub/grub.conf) which defines the boot menu that is displayed before
the kernel starts
15 / 73
Werkneh E. (MSc in Computer Networking)
The Linux File Tree and Managing Directories…
Configuration Directories...
/etc
All of the machine-specific configuration files should be located in /etc
Historically /etc stood for etcetera, today people often use the Editable Text
Configuration acronym
Many times the name of a configuration files is the same as the application,
daemon, or protocol with .conf added as the extension
16 / 73
Werkneh E. (MSc in Computer Networking)
The Linux File Tree and Managing Directories…
Data Directories
/home
Users can store personal or project data under /home
Represented by tile (~) in terminal
It is common practice to name the users home directory after the user name
in the format /home/$USERNAME. For example:
17 / 73
Werkneh E. (MSc in Computer Networking)
The Linux File Tree and Managing Directories…
Data Directories...
/ro ot
On many systems /root is the default location for personal data and profile of
the root user
18 / 73
Werkneh E. (MSc in Computer Networking)
The Linux File Tree and Managing Directories…
Data Directories...
/media
The /media directory serves as a mount point for removable media devices such
as CD-ROM’s, digital cameras, and various usb-attached devices
Most Linux distributions today mount all removable media in /media
19 / 73
Data Directories...
/mnt
The /mnt directory should be empty and should only be used for temporary
mount points
Unix and Linux administrators used to create many directories here, like
/mnt/ something/
You likely will encounter many systems with more than one directory created
and/or mounted inside /mnt to be used for various local and remote
filesystems
20 / 73
Werkneh E. (MSc in Computer Networking)
The Linux File Tree and Managing Directories…
Data Directories...
/tmp
Applications and users should use /tmp to store temporary data when
needed
Data stored in /tmp may use either disk space or RAM. Both of which are
managed by the operating system
Never use /tmp to store data that is important or which you wish to archive
21 / 73
Werkneh E. (MSc in Computer Networking)
The Linux File Tree and Managing Directories…
Memory Directories
/dev
Device files in /dev appear to be ordinary files, but are not actually/standard
file
The /dev directory is populated with files as the kernel is recognizing
hardware
Common hardware such as hard disk devices are represented by device files in
/dev; SATA or SCSI or USB
22 / 73
Memory Directories...
/dev/null
/dev/null which can be considered as a black hole
It has unlimited storage, but nothing can be retrieved from it; Technically
speaking, anything written to /dev/null will be discarded
It can be useful to discard unwanted output from commands; Thus, it is not a
good location to store your backups
23 / 73
Werkneh E. (MSc in Computer Networking)
The Linux File Tree and Managing Directories…
Memory Directories...
/p roc
It is another special directory, appearing to be ordinary files, but not taking up
disk space
It is actually a view of the kernel, or better, what the kernel manages, and is a
means to interact with it directly
It contains special files that represent system and process
information
24 / 73
Werkneh E. (MSc in Computer Networking)
The Linux File Tree and Managing Directories…
Memory Directories...
The /usr contains many directories and files. Such as, /usr/bin and /usr/include
25 / 73
Werkneh E. (MSc in Computer Networking)
The Linux File Tree and Managing Directories…
Memory Directories...
/usr/bin
It is a directory which contains a lot of commands
26 / 73
Werkneh E. (MSc in Computer Networking)
The Linux File Tree and Managing Directories…
Memory Directories...
/usr/lib
Libraries for each are located inside the /usr/lib directory
27 / 73
Werkneh E. (MSc in Computer Networking)
The Linux File Tree and Managing Directories…
Memory Directories...
28 / 73
Werkneh E. (MSc in Computer Networking)
The Linux File Tree and Managing Directories…
Memory Directories...
/var/log
It is a directory which serves as a central point to contain all log files
29 / 73
Werkneh E. (MSc in Computer Networking)
The Linux File Tree and Managing Directories…
Memory Directories...
/var/cache
It is a directory which can contain cache data for several applications
30 / 73
Werkneh E. (MSc in Computer Networking)
The Linux File Tree and Managing Directories…
Terminal
To issue any commands and it is possible to open it by using
shortcuts Cntrl + Alt + T
The shell is where commands are invoked, A command is typed at a
shell prompt
The command prompt contains the following:
Commands are case-sensitive, usually lower-case
31 / 73
Werkneh E. (MSc in Computer Networking)
The Linux File Tree and Managing Directories…
Logging out
To exit from the shell, use the exit command
Pressing CTRL + D at the shell prompt will also quit the shell
Quitting all programs should log you out
If in a text-only single-shell environment, exiting the shell should be
sufficient
In a window environment, the window manager should have a log out
command for this purpose
After logging out, a new login prompt should be displayed
32 / 73
Werkneh E. (MSc in Computer Networking)
The Linux File Tree and Managing Directories…
Managing Directories
pwd
Means Print/present working directory
It is a tool not directory which can displays the current directory
33 / 73
Werkneh E. (MSc in Computer Networking)
The Linux File Tree and Managing Directories…
Managing Directories...
pwd...
It is a tool not directory which can displays the current directory
34 / 73
Werkneh E. (MSc in Computer Networking)
The Linux File Tree and Managing Directories…
Managing Directories...
Cd <directory1>
It is a tool not directory which can change the current directory
It stands for Change Directory
35 / 73
Werkneh E. (MSc in Computer Networking)
The Linux File Tree and Managing Directories…
Managing Directories...
Cd or cd ~
To return to home directory
36 / 73
Werkneh E. (MSc in Computer Networking)
The Linux File Tree and Managing Directories…
Managing Directories...
CdTo/ return to root directory, don’t forget to put space b/n cd and
forward slash (not window uses backward slash)
Remember that root directory is represented as / in Linux
37 / 73
Werkneh E. (MSc in Computer Networking)
The Linux File Tree and Managing Directories…
Managing Directories...
Cd directory1/directory2
To navigate to multiple directories at the same time
38 / 73
Werkneh E. (MSc in Computer Networking)
The Linux File Tree and Managing Directories…
Managing Directories...
Cd ..
This tool used to go to the parent directory (the one just above the current
directory in the directory tree)
39 / 73
Werkneh E. (MSc in Computer Networking)
The Linux File Tree and Managing Directories…
Managing Directories...
40 / 73
The Linux File Tree and Managing Directories…
Managing Directories...
41 / 73
Werkneh E. (MSc in Computer Networking)
The Linux File Tree and Managing Directories…
Managing Directories...
ls
ls is stands for list
You can list the contents of a directory with ls
42 / 73
Werkneh E. (MSc in Computer Networking)
The Linux File Tree and Managing Directories…
Managing Directories...
ls -l
Many times you will be using options with ls to display the contents of the
directory in different formats or to display different parts of the directory
Typing just ls gives you a list of files in the directory. Typing ls -l (that is a
letter l, not the number 1) gives you a long format
43 / 73
Managing Directories...
ls -l
The information specified in detailed list are: File/Directory
name
44 / 73
Werkneh E. (MSc in Computer Networking)
The Linux File Tree and Managing Directories…
Managing Directories...
ls -R
To List all the directories, subdirectories and files
45 / 73
Werkneh E. (MSc in Computer Networking)
The Linux File Tree and Managing Directories…
Managing Directories...
ls -a
To List all including the hidden files and represented as “ .“
46 / 73
Werkneh E. (MSc in Computer Networking)
The Linux File Tree and Managing Directories…
Managing Directories...
mkdir
mkdir is stands for make directory
mkdir is used to create a new directory on Linux file tree
47 / 73
Werkneh E. (MSc in Computer Networking)
The Linux File Tree and Managing Directories…
Managing Directories...
rmdir
rmdir is stands for remove directory
rmdir is used to remove the existed directory if it is empty
48 / 73
Werkneh E. (MSc in Computer Networking)
File Management and Manipulation h
49 / 73
Werkneh E. (MSc in Computer Networking)
File Management and Manipulation
Everything is a File
A directory is a special kind of file, but it is still a (case sensitive!) file
Even a terminal window (/dev/pts/4) or a hard disk (/dev/sdb) is represented
somewhere in the file system as a file
50 / 73
Werkneh E. (MSc in Computer Networking)
File Management and Manipulation
51 / 73
Werkneh E. (MSc in Computer Networking)
File Management and Manipulation
touch
One easy way to create a file is with touch
52 / 73
Werkneh E. (MSc in Computer Networking)
File Management and Manipulation…
rm
When you no longer need a file, use rm to remove it
Unlike some graphical user interfaces, the command line in general does not
have a waste bin or trash can to recover files
Therefore, be careful when removing files!
53 / 73
Werkneh E. (MSc in Computer Networking)
File Management and Manipulation…
rm -i
To prevent yourself from accidentally removing a file, you can type rm -i
54 / 73
Werkneh E. (MSc in Computer Networking)
File Management and Manipulation…
cp <source> <target>
To copy a file, use cp with a source and a target argument
If the target is a directory, then the source files are copied to that target
directory
55 / 73
Werkneh E. (MSc in Computer Networking)
File Management and Manipulation…
cp -i
To prevent copy from overwriting existing files, use the cp –I (for interactive)
command
56 / 73
Werkneh E. (MSc in Computer Networking)
File Management and Manipulation…
mv
Use mv to rename a file or to move the file to another directory
57 / 73
Werkneh E. (MSc in Computer Networking)
File Management and Manipulation…
File Ownership
In Linux, there are two basic owners; User owner and Group owner
respectively
The users and groups of a system can be locally managed in /etc/passwd
and /etc/ group, or they can be in a NIS, LDAP, or Samba domain
These users and groups can own files. Actually, every file has a user owner
and a group owner, as can be seen in the following screenshot
58 / 73
Werkneh E. (MSc in Computer Networking)
File Management and Manipulation…
File Ownership...
User nkengr owns file11, three of those are also owned by the group
nkengr
By default group is created by a user name and it is a member of that
group by default
59 / 73
Werkneh E. (MSc in Computer Networking)
File Management and Manipulation…
chgrp
chgrp stands for change group
It can change the group owner of a file using the chgrp command
60 / 73
Werkneh E. (MSc in Computer Networking)
File Management and Manipulation…
chown
chown stands for change owner
The user owner of a file can be changed with chown command
61 / 73
Werkneh E. (MSc in Computer Networking)
File Management and Manipulation…
62 / 73
Werkneh E. (MSc in Computer Networking)
File Management and Manipulation…
Permissions
The nine characters following the file type denote the permissions in
three triplets
Permission can be r for read access, w for write access, and x for
execute
You need the r permission to list (ls) the contents of a directory
You need the x permission to enter (cd) a directory
You need the w permission to create files in or remove files from a directory
63 / 73
Werkneh E. (MSc in Computer Networking)
File Management and Manipulation…
64 / 73
Werkneh E. (MSc in Computer Networking)
File Management and Manipulation…
File Management Important Commands...
66 / 73
Werkneh E. (MSc in Computer Networking)
File Management and Manipulation…
File Management Important Commands...
68 / 73
Werkneh E. (MSc in Computer Networking)
File Management and Manipulation…
head
It is used to display the first ten lines of a file
69 / 73
Werkneh E. (MSc in Computer Networking)
File Management and Manipulation…
tail
It is similar to head, the tail command will display the last ten lines of a file
70 / 73
Werkneh E. (MSc in Computer Networking)
File Management and Manipulation…
Working with File Contents...
cat
It is used to Display, copy, combine, and create text file
If the file is longer than the screen, it will scroll to the end
71 / 73
Werkneh E. (MSc in Computer Networking)
File Management and Manipulation…
Working with File Contents...
tac
It copies standard input to standard output; It is used to display a file on the
screen from bottom to top
It is the opposite of cat
72 / 73
Werkneh E. (MSc in Computer Networking)
File Management and Manipulation…
73 / 73
Werkneh E. (MSc in Computer Networking)
File Management and Manipulation…
74 / 73
Werkneh E. (MSc in Computer Networking)
File Management and Manipulation…
Working with File Contents...
E.g2 you can use grep with cat for search from output which
filters only the word
cat fruits | grep ^a
E.g3 three commands as
cat fruits | grep –v a | sort -r
75 / 73
Werkneh E. (MSc in Computer Networking)
File Management and Manipulation…
Working with File Contents...
77 / 73
Werkneh E. (MSc in Computer Networking)
File Management and Manipulation…
78 / 73
Werkneh E. (MSc in Computer Networking)
File Management and Manipulation…
Working with File Contents...
79 / 73
Werkneh E. (MSc in Computer Networking)
File Management and Manipulation…
Editors
Several choices available:
vi Standard UNIX editor
gedit graphical text editor
nano Simple display-oriented text editor
Pico Simple display-oriented text editor
80 / 73
Werkneh E. (MSc in Computer Networking)
File Management and Manipulation…
Redirection in Linux
Most programs/commands reads input(stdin) form Keyboard, produce output to
screen/terminal (stdout and stderr)
Standard error is similar to standard output, but used for error and warning
messages and both are displayed in terminal, so they get mixed
More than “>” symbol is used for output (stdout) redirection and the less
than < (stderr)symbol is input redirection
For example you can redirect the output of ls –al command to a file see latter if output is
redirected to a file output.txt file using cat command shown below
81 / 73
Werkneh E. (MSc in Computer Networking)
File Management and Manipulation…
Redirection in Linux…
82 / 73
Werkneh E. (MSc in Computer Networking)
File Management and Manipulation…
Redirection in Linux…
If we redirect an output to existing file, then it’s content is overwritten
For this purpose we use append (>>) in order not to replace the existing file as
follows. The following e.g. also shows input redirections
83 / 73
Werkneh E. (MSc in Computer Networking)
File Management and Manipulation…
Redirection in Linux…
Standard input (stdin) used to read data shown as follows
We can use stdin to attach email file as
84 / 73
Werkneh E. (MSc in Computer Networking)
File Management and Manipulation…
85 / 73
Werkneh E. (MSc in Computer Networking)
File Management and Manipulation…
86 / 73
Werkneh E. (MSc in Computer Networking)
File Management and Manipulation…
87 / 73
Werkneh E. (MSc in Computer Networking)
Users, Groups and Process Management…
Identify Yourself
whoami
The whoami command is used to tells you your username
who
The who command will give you info about who is logged on the system
88 / 73
Werkneh E. (MSc in Computer Networking)
Users, Groups and Process Management…
Identify Yourself...
w
The w command shows you who is logged on and what they are doing
id
The id command will give you your user id, primary group id, and a list of the
groups that you belong to
89 / 73
Werkneh E. (MSc in Computer Networking)
Users, Groups and Process Management…
User Management
root
The local user database on Linux (and on most Unixes) is /etc/passwd
The root user also called the superuser, is the most powerful account on your
Linux system
This user can do almost anything, including the creation of other users
The root user always has userid 0 (regardless of the name of the account)
90 / 73
Werkneh E. (MSc in Computer Networking)
Users, Groups and Process Management…
User Management...
User Management...
92 / 73
Werkneh E. (MSc in Computer Networking)
Users, Groups and Process Management…
User Management...
93 / 73
Werkneh E. (MSc in Computer Networking)
Users, Groups and Process Management…
User Management...
userdel
The userdel command is used to delete users from the system
The -r option of userdel will also remove the home directory
94 / 73
Werkneh E. (MSc in Computer Networking)
Users, Groups and Process Management…
User Management...
usermod
The usermod command is used to modify existing user
Options:
-d home directory
- -s starting program (shell)
-p password
-g (primary group assigned to the user)
-G (other group the user belongs to )
To add the group ‘others’ to the user user2
usermod –G others user2
95 / 73
Werkneh E. (MSc in Computer Networking)
Users, Groups and Process Management…
Password
passwd
Passwords of users can be set with the passwd command
Options: user’s name (only required if your are root and want to change another
user’s password
User passwords are encrypted and kept in /etc/shadow. The
/etc/shadow file is read only and can only be read by root
Example: To change the password for the account your are currently
logged as…
Passwd
Enter existing password
Enter new password
Enter new password again
96 / 73
Werkneh E. (MSc in Computer Networking)
Users, Groups and Process Management…
Password
Passwd…
To change the password for user1 created above:
97 / 73
Werkneh E. (MSc in Computer Networking)
Users, Groups and Process Management…
Password...
98 / 73
Werkneh E. (MSc in Computer Networking)
Users, Groups and Process Management…
Password...
99 / 73
Werkneh E. (MSc in Computer Networking)
Users, Groups and Process Management…
Group Management
groupadd
Users can be listed in groups. Groups allow you to set permissions on the
group level instead of having to set permissions for every individual user
Groups can be created with the groupadd command. The example below shows
the creation of (empty) groups
100 / 73
Werkneh E. (MSc in Computer Networking)
Users, Groups and Process Management…
Group Management...
groupdel
The groupdel command can permanently remove a group from the
system
101 / 73
Werkneh E. (MSc in Computer Networking)
Users, Groups and Process Management…
$groupmod –n newgroupname
groupmod Modifies group attributes. oldgroupame
103 / 73
Werkneh E. (MSc in Computer Networking)
Users, Groups and Process Management…
104 / 73
Werkneh E. (MSc in Computer Networking)
Users, Groups and Process Management…
Process Management
What is process
Kernel considers each program running on your system to be a process
Any command that you give to your Linux machine starts a new process
105 / 73
Werkneh E. (MSc in Computer Networking)
Users, Groups and Process Management…
Process Management…
Type of process
Foreground process
They seen on the screen needs inputs from users
You can start them from desktop menu or from terminal
e.g. office
Background process
Run in the background, usually don’t need inputs from the user
E.g. Antivirus
106 / 73
Werkneh E. (MSc in Computer Networking)
Users, Groups and Process Management…
Process Management…
PID
All processes have a process id or PID
kernel identifies each process by a PID
PPID
Every process has a parent process (with a PPID). The child process is often
started by the parent process
init
The init process always has process ID 1. The init process is started by the
kernel itself so technically it does not have a parent process
107 / 73
Werkneh E. (MSc in Computer Networking)
Users, Groups and Process Management…
Process Management …
bg and fg
To send the process to background use bg <process>
To send the process back to from use fg <process>
Top utility
Displays all the running process in the machine in the form of
• PID-process ID • S-status (D(uninteraptable sleep, R(running),
• user-task owner T (traced/stoped), s (sleep), Z(zombie)
• PR-priority value( 20, -20) • %CPU-cpu percentage used
• NI-nice value • %MEM-Memory percentage used
• VIRT-virtual memory used (kb) • time-cpu time
• RES-physical memory used (kb) • command- command name
• SHR-share memory used (kb)
108 / 73
Werkneh E. (MSc in Computer Networking)
Users, Groups and Process Management…
Process Management …
ps utility
Stands for process status, it is like window task manager
To check all the process under user use ps ux
To check process status of a single process use ps PID
To get PID use pidof <processname>
E.g. pidof firefox
kill
Terminate running process, use kill PID
109 / 73
Werkneh E. (MSc in Computer Networking)
Users, Groups and Process Management…
Process Management …
Niceness
Used for prioritize process which called niceness value which is
between -20 and 19
Lower niceness value, higher the priority
Default value of all process is 0
Syntax: nice –n ‘nice value’ process name or
renice ‘nice value’ –p PID (existing processes)
110 / 73
Werkneh E. (MSc in Computer Networking)
Users, Groups and Process Management…
Maintaining Log Files
syslog
Many events that occur on a Linux system should be logged for
administrative purposes
syslog facility in Linux allows to log such events
syslog can be configured to log different events (severity (‘level’) and
service/facility) to different places (on same machine or on remote syslog
server)
/etc/syslog.conf
It stores syslog’s configuration, stored in the form of
facility. Level destination
Facility: the creator of the message (user,kernel, mail, security etc.)
Level: is a severity threshold - (from lowest to highest): debug, info,
notice, warning, err, crit, alert, emerg
Destination:
111 / 73 where messages will be sent
Werkneh E. (MSc in Computer Networking)
Users, Groups and Process Management…
Maintaining Log Files…
Reconfiguring syslog
If you change /etc/syslog.conf, you need to tell syslog to re-read the
configuration
Accomplished by sending the syslogd process a SIGHUP signal
112 / 73
Werkneh E. (MSc in Computer Networking)
Users, Groups and Process Management…
Maintaining Log Files…
Log Rotation
syslog will normally allow log files to grow without bound until you run out of
disk space. . .
The solution is to use log rotation: a scheme whereby existing log files are
periodically renamed and ultimately deleted
logrotate can be configured with /etc/logrotate.conf
113 / 73
Werkneh E. (MSc in Computer Networking)
Users, Groups and Process Management…
114 / 73
Werkneh E. (MSc in Computer Networking)
Users, Groups and Process Management…
Backup Media
Traditionally, backups have been made onto tapes
Can store lots of data on reasonably cheap tapes
Copying to a different hard disk
There is a risk of losing the backup along with the original
Better if on a remote computer
CD writers can be used to store backups on CDs
Convenient for long-term storage
Handy to remove to remote locations
115 / 73
Werkneh E. (MSc in Computer Networking)
Users, Groups and Process Management…
File System Repair, Backup and Restoration…
Types of Backup
Full backup — includes everything of importance
Might not include system files, can include a lot of files, many of which
hardly ever change
Differential backup — only includes changes since last full backup
Nightly backup only needs to include files changed since the last full backup
Recovery requires the full backup on which it was based
Incremental backup — only includes changes since last backup
Nightly backup only includes files changed in the last 24 hours
Recovery requires the last full backup and a complete sequence of
incremental backups after that
116 / 73
Werkneh E. (MSc in Computer Networking)
Users, Groups and Process Management…
File System Repair, Backup and Restoration…
Backup Strategy
The backup schedule should be regular and well known by those who rely
on it
It must be decided what to backup and what can be left out
Typically a full backup is done once a week or once a month
Daily changes are recorded in a differential or incremental backup each
night
Large sites might have more than these two levels to their strategy
Monthly tapes might be kept for a long time, in case a really old file
becomes important
118 / 73
Werkneh E. (MSc in Computer Networking)
Users, Groups and Process Management…
File System Repair, Backup and Restoration…
120 / 73
Werkneh E. (MSc in Computer Networking)
Users, Groups and Process Management…
File System Repair, Backup and Restoration…
121 / 73
Werkneh E. (MSc in Computer Networking)
Users, Groups and Process Management…
File System Repair, Backup and Restoration…
122 / 73
Werkneh E. (MSc in Computer Networking)
Users, Groups and Process Management…
File System Repair, Backup and Restoration…
Scripting Backup
It is common to have a script to perform backups each night
Might perform different types of backup, e.g., a full backup on Saturday
night and a differential one on other nights
Such a script can be run with cron, making backup automatic
Example scripts are readily available on the WWW
123 / 73
Werkneh E. (MSc in Computer Networking)
Users, Groups and Process Management…
gzip - gunzip
For efficient utilization of space
gzip used to compress while gunzip is used for
decompressing
For example to compress file1.txt use
gzip file1.txt
To uncompress file1.gz use
gunzip file1.gz
124 / 73
Werkneh E. (MSc in Computer Networking)
Users, Groups and Process Management…
bzip2 -bunzip2
Files can also be compressed with bzip2 which takes a little
more time than gzip, but compresses better.
For example to compress text.txt use
$ bzip2 text.txt
Files can be uncompressed again with bunzip2.
$ bunzip2 text.txt.bz2
125 / 73
Werkneh E. (MSc in Computer Networking)
Users, Groups and Process Management…
man
Most Linux commands have an associated manual page,
called manpage
Syntax : man <command>
Example: $ man ls
Shows manual entry for the command ls
Press q to quit and return to the shell prompt
man uses the less viewer
Use the cursor keys for scrolling
126 / 73
Werkneh E. (MSc in Computer Networking)
Users, Groups and Process Management…
man…
Other common keystrokes:
Space jump down a page
b jump back up a page
/word search for the next occurrence of “word”
n repeat the previous search
g go to the top
127 / 73
Werkneh E. (MSc in Computer Networking)
Users, Groups and Process Management…
Package Management
apt-get
Advanced Packaging Tool (APT) performing such functions
as
installation of new software packages,
upgrade of existing software packages,
updating of the package list index, and
even upgrading the entire Ubuntu system.
128 / 73
Werkneh E. (MSc in Computer Networking)
Users, Groups and Process Management…
Package Management…
apt-get…
apt-get update – refresh available updates
apt-get upgrade – upgrade all packages
apt-get dist-upgrade – upgrade with package replacements
apt-cache policy pkg-check weather the pkg installed or not
apt-cache search pkg-check the avialability of the pkg
apt-get install pkg – install pkg
apt-get purge pkg – uninstall pkg
apt-get autoremove – remove obsolete packages
apt-get -f install – try to fix broken packages
dpkg --configure -a – try to fix broken packages
129 / 73
Werkneh E. (MSc in Computer Networking)
Users, Groups and Process Management…
Kernel Customization
130 / 73
Werkneh E. (MSc in Computer Networking)
Users, Groups and Process Management…
Kernel Customization…
131 / 73
Werkneh E. (MSc in Computer Networking)
Users, Groups and Process Management…
132 / 73
Werkneh E. (MSc in Computer Networking)
Users, Groups and Process Management…
Mechanisms
Resources Control Mechanisms
CPU Nice numbers
Process priorities
Batch queues
Schedule parameters
Memory Process resource limit
Memory management- related parameters.
Paging(swap) space.
Disk I/O File system organization accross physical.
Disk and controllers.
File placement on disk.
I/O related parameters.
Network I/O Network memory buffers.
Network related parameters.
Network infrastructure.
133 / 73
Werkneh E. (MSc in Computer Networking)
h
73 / 73