UNIVERSITY OF DAR ES SALAAM
COLLEGE OF INFORMATION AND COMMUNICATION
TECHNOLOGIES
(CoICT)
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
IS371: SYSTEM ADMINISTRATION IN LINUX
Assignment 1
Members:
1. MWAKASOKE, Meshack M.
2. TERI, Anjela E.
3. NNKO, Gift A.
4. BAKARI, Abdillah I.
5. NSIMBA, Eric M.
6. MWAFYUMA, Emmanuel
Solutions
1. Login guest
username: guest
password: guest
2. guest@guest-pc~$ pwd
/home/guest
3. guest@guest-pc~$ cd / && ls
Linux Directory structure
/ – The Root Directory
This is the main folder of Linux systems. Everything on a Linux system is contained
within this folder. It is similar to the C:/ folder in Microsoft Windows systems.
/bin – Essential User Binaries
The /bin directory contains the essential user binaries (programs) that must be
present when the system is mounted in single-user mode. It contains important
system programs and utilities such as the bash shell. Placing these files in the /bin
directory ensures the system will have these important utilities even if no other file
systems are mounted.
/boot – Static Boot Files
The /boot directory contains the files needed to boot the system – for example, the
GRUB boot loader’s files and the Linux kernels are stored here. However, the
boot-loader configuration files are not stored in this folder.
/cdrom – Historical Mount Point for CD-ROMs
The /cdrom directory isn’t part of the FHS standard, but still available on Ubuntu and
other operating systems. It’s a temporary location for CD-ROMs inserted in the
system. However, the standard location for temporary media is inside the /media
directory.
1
/dev – Device Files
Linux exposes devices as files, and the /dev directory contains a number of special
files that represent devices. These are not actual files as we know them, but they
appear as files – for example, /dev/sda represents the first SATA drive in the system.
This directory also contains virtual devices that don’t actually correspond to
hardware. For example, /dev/random produces random numbers. /dev/null is a
special device that produces no output and automatically discards all input.
/etc – Configuration Files
The /etc directory contains configuration files, which can generally be edited by hand
in a text editor. The /etc directory only contains system-wide configuration files.
User-specific configuration files are located in each user’s home directory.
/home – Home Folders
The /home directory contains a home folder for each user. For example, if the user’s
name is guest, he will have a home folder located at /home/guest. This home folder
contains the user’s data files and user-specific configuration files. Each user only has
write access to their own home folder and must obtain elevated permissions (become
the root user) to modify other files on the system.
/lib – Essential Shared Libraries
The /lib directory contains libraries needed by the essential binaries in the /bin and
/sbin folder.
/lost+found – Recovered Files
Each Linux file system has a lost+found directory. If the file system crashes, a file
system check will be performed at next boot. Any corrupted files found will be placed
in the lost+found directory, so you can attempt to recover as much data as possible.
/media – Removable Media
The /media directory contains subdirectories where removable media devices
inserted into the computer are mounted. For example, when you insert a CD into your
Linux system, a directory will automatically be created inside the /media directory.
You can access the contents of the CD inside this directory.
2
/mnt – Temporary Mount Points
The /mnt directory is where system administrators mounted temporary file systems
while using them in the past. For example, if you’re mounting a Windows partition to
perform some file recovery operations, you might mount it at /mnt/windows. However,
current Linux systems allow a user to mount the file systems at any folder in the
system.
/opt – Optional Packages
The /opt directory contains subdirectories for optional software packages. It’s
commonly used by proprietary and other software that doesn’t obey the Linux
standard file system hierarchy – for example, a Google Chrome program might dump
its files in /opt/google/chrome when installed.
/proc – Kernel & Process Files
The /proc directory similar to the /dev directory because it doesn’t contain standard
files. It contains special files that represent system and process information.
/root – Root Home Directory
The /root directory is the home directory of the root user. Instead of being located at
/home/root, it’s located at /root. This is distinct from /, which is the system root
directory.
/run – Application State Files
The /run directory gives applications a standard place to store transient files they
require like sockets and process IDs. These files can’t be stored in /tmp because files
in /tmp may be deleted.
/sbin – System Administration Binaries
The /sbin directory is similar to the /bin directory. It contains essential binaries that
are generally intended to be run by the root user for system administration.
/selinux – SELinux Virtual File System
If your Linux distribution uses SELinux for security (Fedora and Red Hat, for
example), the /selinux directory contains special files used by SELinux. It’s similar to
3
/proc. Ubuntu doesn’t use SELinux, so the presence of this folder on Ubuntu appears
to be a bug.
/srv – Service Data
The /srv directory contains “data for services provided by the system.” If a system
uses the Apache HTTP server to serve a website, the website’s files should be stored
in a directory inside the /srv directory.
/tmp – Temporary Files
Applications store temporary files in the /tmp directory. These files are generally
deleted whenever your system is restarted and may be deleted at any time by utilities
such as tmpwatch.
/usr – User Binaries & Read-Only Data
The /usr directory contains applications and files used by users, as opposed to
applications and files used by the system. For example, non-essential applications
are located inside the /usr/bin directory instead of the /bin directory and non-essential
system administration binaries are located in the /usr/sbin directory instead of the
/sbin directory. Libraries for each are located inside the /usr/lib directory. The /usr
directory also contains other directories – for example, architecture-independent files
like graphics are located in /usr/share.
The /usr/local directory is where locally compiled applications install to by default –
this prevents them from mucking up the rest of the system.
/var – Variable Data Files
The /var directory is the writable counterpart to the /usr directory, which must be
read-only in normal operation. Log files and everything else that would normally be
written to /usr during normal operation are written to the /var directory. For example,
you’ll find log files in /var/log.
4. The /bin folder contains user binaries used by users while /sbin contains system
binaries contained in the system
Examples:
4
/bin /sbin
mkdir ifconfig
chmod reboot
which shutdown
5. guest@guest-pc~$ find -type d -name “guest” -ls
6. guest@guest-pc~$ mkdir test
7. guest@guest-pc~$ cp /etc/resolv.conf test
8. guest@guest-pc~$ mv test testing
9. guest@guest-pc~$ rm -r testing
10. guest@guest-pc~$ c hmod 700 .
11. guest@guest-pc~$ s udo chmod 700 /tmp (Will only work if guest user is in sudoers
file)
12.
Single User mode Multi-user mode
Run-Level 1 2
Action Does not configure network interfaces, It does not configure
start daemons, or allow non-root logins network interfaces or start
when used. daemons.
13.
.bashrc For bash shell. It contains commands and runs whenever
the shell is opened
.bash_profile For bash shell. It also contains commands but only runs
when the user logs in.
.cshrc For C shell. It contains C shell constructs.
.login For C shell. It also contains C shell constructs but only runs
5
when the user logs in.
.emacs Contains LISP functions for Emacs editor
.exrc Contains commands for vi editor
.f vwm2rc Contains commands for the fvwm2 window manager
.twmrc Contains commands for the twm window manager
.newsrc It contains a list of all newsgroups offered at the site.
.xdefault For programs using the X Window System. Each line
specifies a resource (usually the name of a program and
some property of that program) along with the value that
resource should take.
.xinitrc For the X Window System. Consists of shell commands
that run whenever you log into an X session.
14. guest@guest-pc~$ sudo shutdown -h now
15. guest@guest-pc~$ rm *.ext (Where ext stands for the targeted extension)