Linux Overview
Introduction and commands
Akinwale Oshodi
Red Hat Academy Instructor
[Link]@[Link]
@akoshodi
Linux
● Linux is a free open-source operating system
based on Unix. Linus Torvalds originally
created Linux with the assistance of
developers from around the world.
● Free
● Unix-like
● Open source
● Network operating system
Linux
● UNIX is a Multi-User/Multi-Tasking
operating system and exists in many
different versions (“derivates”): Solaris,
AIX, XENIX, HP-UX, SINIX, Linux
● Operating system (OS): Sum of all
programs which are required to operate
a computer and which control and
monitor the application programs.
Operating System
CPU
RAM
Monitor
OS
Flash
Keyboard Memory
Printer Disk CD/DVD
Mouse
What is Linux
● Pure Linux is a kernel.
● A kernel provides access to the computer
hardware and controls access to resources.
● The kernel decides who will use a resource,
for how long and when.
● You can download the Linux kernel from the
official web site at [Link]
What is Linux
● However, the Linux kernel itself is useless
unless you get all the applications such as
text editors, email clients, browsers, office
applications, etc.
● Therefore, someone came up with the idea
of a Linux distribution.
First steps at the computer
● Since UNIX is a multi-user operating
system, it can deal with several users
simultaneously. Each user needs a user
account
● Each user has a personal environment
(home directory, shell), which can be
accessed only by her- /himself (and by the
system adminstrator and those people w
First steps at the computer (cont’d)
● Inside the system the user is identified by
his user ID (UID) and his group identity
(group ID, GID).
There are two user types
● ‘normal’ users with restricted rights
● system administrator (root) with all
privileges.
First steps at the computer (cont’d)
● The latter is responsible for the
installation, configuration and
maintenance of the system as well as
the user administration
● Each user has to logon and to logoff
from the system (login/logout). Each
user account is protected by a
password
First steps at the computer (cont’d)
● Though there is a graphical interface, UNIX
needs the possibility for direct command
input for practical use. This can be
accomplished via the window manager or
the desktop environment (‘console’)
● Generally, all UNIX commands have a
variety of options, which usually begin with
-
Examples
man command
man -k expression
● Displays the manual pages (“man pages”)
for the provided command. man -k
searches for man pages containing the
expression in the NAME section
Examples
passwd
● sets a new password.
● Passwords should be constructed from a
combination of letters, digits and special
characters, and should not appear in any
dictionary or similar list. Otherwise, the
password can be hacked by systematic
search algorithms.
Examples
who
whoami
● who displays information about all users
which are logged into the system
● user name,
● terminal where the corresponding user
is working,
● time of login.
whoami is self-explanatory.
Working at external terminals
● To login to a distant host, one has to provide
the corresponding IP address, either numerical
or as the complete host name [Link].
Syntax:
ssh username@hostname
● Enables logging in to an arbitrary host which
can be located via an IP address (if one knows
the user account and the password). Logoff
with exit, Ctrl-D or logout.
Working at external terminals
● To copy files from one host to another,
the command scp (“secure copy”) is
used
Syntax:
scp file1 username@hostname:file2
scp username@hostname:file1 file2
File systems
● “In UNIX everything is a file.”
The following file-system objects can be found
● ‘normal’ (text-) files
● executable files (binary files or shell scripts)
● Directories
● device files
● Pipes
● symbolic or hard links (references to files)
File systems (cont’d)
● All files and file system objects are ordered
within a hierarchical file tree with exactly one
root directory ‘/’
● In contrast to the MS-Windows file system,
the UNIX file system does not distinguish
between different drives. All physical devices
(hard disks, DVD, CDROM, USB, floppy) are
denoted by specific files inside a certain
directory within the file tree (usually within
/dev)
Navigating Paths Cont’d
● File names consist of a sequence of
letters, digits and certain special
characters, and must not contain
slashes (for convenience, they should
neither contain empty spaces).
● Avoid characters which might be
interpreted by the shell in a special
way.
Navigating Paths Cont’d
● A file can be referenced within the file tree
by either an absolute or a relative path
name.
● An absolute path name consists of all
directories leading to the file and the file
name, and always begins with a / (the root
directory)
● In many shells and application programs,
the tilde (~) denotes the home directory
Navigating Paths Cont’d
Syntax:
● pwd: displays the current directory.
● cd [directory]: Changes into the given
directory, or into the home directory
when no parameter is provided.
● As in MS-DOS/Windows, “..” denotes
the parent and “.” the current directory
Search pattern for file name
● the shell is a specific program which deals
with the interpretation of input commands.
● If these commands have parameters which
are file names, several files can be addressed
simultaneously by means of a search pattern,
which is expanded by the shell.
● the file name expansion is performed prior to
the execution of the command.
Search pattern for file name
Command Examples
Syntax:
ls [-alR] [file/directory]
● displays the names (and, optionally, the
properties) of files or lists the content of a
directory. File and directory names can
be be absolute or relative
Command-line Expansions
● -a list also files/directories which begin
with a dot (hidden)
● -l long listing format. Displays
permissions, user and group, time stamp,
size, etc.
● -R for directories, all sub-directories will
be displayed recursively
Copy, move and delete files/directories
● In addition to ls there are other commands for
working with files which can be used together
with file name patterns
Syntax:
mkdir directory
rmdir directory
● mkdir creates an empty directory, rmdir
deletes an empty directory.
Command Examples
cp file1 file2
cp file1 [file2 ...] directory
cp -r dir1 dir2
cp -r dir1 [dir2 ...] directory
copies files or directories. The original
file/directory remains unmodified. option: -r
directories are copied recursively with all
subdirectories.
Command Examples
mv file1 file2
mv file1 [file2 ...] directory
mv dir1 dir2
mv dir1 [dir2 ...] directory
● Rename or move files or directories. Similar to cp, but
original is ‘destroyed’. First command from above
renames files, other commands move files/directories.