01 Introduction To Linux and Systems Administration
01 Introduction To Linux and Systems Administration
Chapter 01
Introduction to Linux and Systems Administration
Introduction to Linux
• By virtue of its open-source licensing, Linux is freely available to anyone. However, the
trademark on the name “Linux” rests with its creator, Linus Torvalds. The source code for
Linux is under copyright by its many individual authors, and licensed under the General
Public License v2 (GPLv2) license.
• The term “Linux” technically refers to just the Linux kernel. Most people refer to the
entire operating system as "Linux" because to most users an OS includes a bundle of
programs, tools, and services (like a desktop, clock, an application menu, and so on).
• Some people, particularly members of the Free Software Foundation, refer to this
collection as GNU/Linux, because many vital tools included are GNU components.
• However, not all Linux installations use GNU components as a part of the operating
system: Android, for example, uses a Linux kernel but relies very little on GNU tools.
• Released 25 years ago , OPEN SOURCE , NOT proprietorship software like Microsoft.
1. Open Source: Linux’s code is open source, released under the GNU General Public
License (GPL). This means:
1. You can download and install Linux for free.
2. Administrators can study and customize the OS according to their needs.
2. Customizability: Linux is incredibly customizable because it offers various
distributions (distros) with different software options. You can choose core
components, swap out applications, and tailor it to your preferences.
3. Widespread Use: Linux powers 70 percent of the world servers. It’s also found
in Android devices, Chromebooks, digital storage, cameras, and even cars.
4. Ownership: The name “Linux” is trademarked by its creator, Linus Torvalds. The
term technically refers to just the Linux kernel, but most people refer to the
entire OS as “Linux” or GNU/Linux due to the vital GNU components included.
• You may have heard of Unix, which is an operating system developed in the 1970s at Bell
Labs by Ken Thompson, Dennis Ritchie, and others. Unix and Linux are similar in many
ways, and in fact, Linux was originally created to be indistinguishable from Unix.
• Both have similar tools for interfacing with the system, programming tools, filesystem
layouts, and other key components. However, not all UNIXs are free and open source.
• Linux, is open-source and free to use, modify, and distribute under the GNU General
Public License. Examples of Linux include Fedora, Debian, Red Hat, Ubuntu, and Android.
• Unix is proprietary, owned by various organizations (like IBM, Oracle, or AT&T), and
requires a paid license for usage. Examples of Unix include IBM AIX, Darwin, Solaris, HP-
UX, and macOS X.
• Over the years, a number of different operating systems have been created that
attempted to be “unix-like” or “unix-compatible,” but Linux has been the most successful,
far surpassing its predecessors in popularity.
Module Code & Module Title Slide Title SLIDE 9
Windows vs Linux
Linux is used in the following ways: Server OS for web servers, database servers, file servers, email
servers and any other type of shared server. Supercomputers. Designed to support high-volume and
multithreading applications, Linux is well-suited for all types of server applications.
• Linux-powered web servers when using the internet. For the delivery of web
content, search results, and online purchasing, platforms like Google, Facebook,
and Amazon significantly rely on Linux servers.
• Household appliances, automotive entertainment systems and network file system
appliances. Network OS for routers, switches, domain name system servers, home
networking devices and more.
• When the shell is first opened, you are presented with a prompt, indicating that
the shell is waiting for input.
– The shell typically uses $ as the prompt, but may use a different symbol.
– Most importantly: when typing commands, either from this workshop or from other sources, do
not type the prompt, only the commands that follow it. Also note that after you type a
command, you have to press the Enter key to execute it.
– The prompt is followed by a text cursor, a character that indicates the position where your
typing will appear. The cursor is usually a flashing or solid block, but it can also be an
underscore or a pipe.
In Linux and other Unix-like operating systems, commands are often structured in one of two ways:
• command—option argument: In this structure, you first specify the command you want to run,
followed by an option (also known as a flag or a switch), and then an argument. The option
usually modifies the behavior of the command, and the argument is typically the object on which
the command acts.
– For example, in the command ls -l /home, ls is the command, -l is an option that tells ls to use a long listing format,
and /home is the argument specifying the directory to list.
• command subcommand argument: In this structure, after the initial command, a subcommand is
used to specify a particular operation of the command, followed by an argument.
– For example, in the command git clone https://github.com/user/repo.git, git is the command, clone is
the subcommand that tells git to clone a repository, and https://github.com/user/repo.git is the argument
specifying the repository to clone.
These structures provide a consistent way to interact with commands and their various
functionalities in the command-line interface. Different commands may support different options,
subcommands, and types of arguments, so it’s always a good idea to refer to the command’s manual
(man) pages for detailed usage information. You can access these with the man command, like so:
man ls or man git.
Module Code & Module Title Slide Title SLIDE 30
Navigating the File System
• Try
– cd (change directory)
– touch myfile (create file)
– mkdir mydir (create directory)
– ls –l myfile (examine file)
– ls –ld mydir (examine directory)
– chmod g+w myfile (add group write permission)
– ls –l myfile
– chmod ugo+x myfile (add user, group and other execute permission)
– ls –l myfile
– chmod ugo+w mydir (add user, group and other write permission)
– ls –ld mydir
– chmod a-w (a=ALL, remove user, group and other write permission)
There are three permissions for any file, directory or application program.
The following lists the symbols used to denote each, along with a brief
description:
r — Indicates that a given category of user can read a file.
w — Indicates that a given category of user can write to a file.
x — Indicates that a given category of user can execute the file.
For instance, if the user Aries creates an executable file named test, the output
of the command ls -l test would look like this:
-rwxrwxr-x 1 Aries student 0 Sep 26 12:25 test
The permissions for this file are listed at the start of the line, starting with r w x .
This first set of symbols define owner access.
The next set of r w x symbols define group access
The last set of symbols defining access permitted for all other users.
This listing indicates that the file is readable, writable, and executable by
the user who owns the file (user Aries) as well as the group owning the file
(which is a group named student).
The file is also world-readable and world-executable, but not world-writable.
ls is used to list the contents of a directory.
$ ls –l
Absolute mode:
We use octal (base eight) values represented like this:
Letter Permission Value
R read 4
W write 2
X execute 1
- none 0
For each column, User, Group or Other you can set values from 0 to 7.
Here is what each means:
0= --- 1= --x 2= -w- 3= -wx
4= r-- 5= r-x 6= rw- 7= rwx
• On directories, SGID ensures new files inherit the directory's group ownership, not the user's current
group.
• This is useful for maintaining consistent group ownership in shared directories.
• Example of SGID on a Directory:
• Consider a directory called /shared that is owned by group dev. If SGID is set on this directory:
chmod g+s /shared
• Any new file created inside /shared will automatically be assigned the dev group, ensuring consistency
in group ownership for collaborative work.
Set-user-ID
• The sticky bit is on directories residing within filesystems for Unix-like operating systems. When a
directory's sticky bit is set, the filesystem treats the files in such directories in a special way so
only the file's owner, the directory's owner, or root can rename or delete the file.
• You can set a sticky bit on a file or a folder using “t” or “1”.
chmod +t demo.sh
chmod 1755 demo.sh
The GNU General Public License (GPL) has had a significant influence on the development and availability of Linux;
1. Freedom of Use and Modification: The GPL assures that the Linux kernel source code will always remain
available1. This allows anyone to use, modify, and distribute the code, fostering a collaborative development
environment. This has led to the creation of numerous Linux distributions2.
2. Copyleft Principle: The GPL is a “copyleft” license, which means that any changes to the software must also be
distributed under the same license2. This ensures that improvements to the code are shared with the community,
promoting continuous development and innovation2.
3. Open Core Model: The GPL makes it difficult for companies to apply an “open core” model, where only the core of
a product is open source and other components are proprietary2. This ensures that the entire Linux kernel remains
open and free2.
4. Influence on Other Projects: The success of the Linux project under the GPL has influenced other successful
projects to adopt the GPL as well2.
5. Cost: The GPL doesn’t require Linux to be free of cost, although the source code is distributed without
charge1. This has made Linux accessible to a wide range of users, including those who may not have the financial
resources to pay for an operating system1.
In summary, the GPL has played a crucial role in shaping the open, collaborative, and accessible nature of Linux. It
has helped Linux to become a robust and widely-used operating system that it is today.
Command Description
ls -l to show file type and access permission
r read permission
w write permission
x execute permission
-= no permission
Chown user For changing the ownership of a file/directory
Chown user:group filename change the user as well as group for a file or directory
Command Description
sudo adduser username To add a new user
sudo passwd -l 'username' To change the password of a user
sudo userdel -r 'username' To remove a newly created user
sudo usermod -a -G GROUPNAME
To add a user to a group
USERNAME
sudo deluser USER GROUPNAME To remove a user from a group
finger Shows information of all the users logged in
finger username Gives information of a particular user
Command Description
sudo adduser username To add a new user
sudo passwd -l 'username' To change the password of a user
sudo userdel -r 'username' To remove a newly created user
sudo usermod -a -G GROUPNAME
To add a user to a group
USERNAME
sudo deluser USER GROUPNAME To remove a user from a group
finger Shows information of all the users logged in
finger username Gives information of a particular user
Chapter 02
Virtualization and OS installation