0% found this document useful (0 votes)
40 views

The Basics of Linux

The document provides an overview of the basics of Linux, including: - What Linux is, its history beginning in 1991 when created by Linus Torvalds, and its key features such as being open-source, supporting multi-users and multitasking, and prioritizing security and stability. - The Linux architecture including its monolithic kernel, hardware abstraction layer, and system libraries. - The Linux file system hierarchy and the purpose of its main directories such as /bin, /etc, /home, /var, and /usr. - Common basic Linux commands for navigating and managing the file system and files, including ls, cd, pwd, cp, mv, rm,

Uploaded by

gareebdexter
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
40 views

The Basics of Linux

The document provides an overview of the basics of Linux, including: - What Linux is, its history beginning in 1991 when created by Linus Torvalds, and its key features such as being open-source, supporting multi-users and multitasking, and prioritizing security and stability. - The Linux architecture including its monolithic kernel, hardware abstraction layer, and system libraries. - The Linux file system hierarchy and the purpose of its main directories such as /bin, /etc, /home, /var, and /usr. - Common basic Linux commands for navigating and managing the file system and files, including ls, cd, pwd, cp, mv, rm,

Uploaded by

gareebdexter
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 63

The Basics of Linux

Zubair Sangi
Mehran University
Agenda
• What is Linux?
• History of Linux
• Linux Architecture
• File System Hierarchy
• Basic Linux Commands
• Users and Permissions
• Package Management
• Conclusion
What is Linux?
• Definition: Linux is an open-source, Unix-like operating system kernel
first created by Linus Torvalds in 1991.

• Key Features:
• Open Source
• Multiuser and Multitasking
• Security and Stability
Key features of Linux
1. Open Source:
• Definition: Linux is distributed under an open-source license, which
means that its source code is freely available to the public.
• Significance: Users can view, modify, and distribute the source code.
This fosters a collaborative development model, allowing a global
community of developers to contribute to its improvement.
Key features of Linux

Windows: Windows is a proprietary operating system, and its source


code is not freely available. Microsoft retains control over the
development and distribution.
Key features of Linux
2. Multiuser and Multitasking:
• Multiuser: Linux supports multiple users concurrently, allowing
different users to log in and use the system simultaneously.
• Multitasking: Linux efficiently handles multiple processes running
simultaneously, providing users with the illusion of parallel execution.
Key features of Linux

Windows: Windows also supports multiple users and multitasking.


However, historically, Linux has been considered more efficient in
managing system resources for multitasking.
Key features of Linux
Security and Stability:
• Security: Linux has a robust security model with features such as file
permissions, user authentication, and a secure kernel. Its open-source
nature allows for rapid identification and resolution of security
vulnerabilities.
• Stability: Linux is known for its stability and reliability. It can operate
for extended periods without requiring a reboot, making it well-suited
for critical systems and servers.
Key features of Linux

Windows: Windows has improved its security measures over the years,
with features like User Account Control (UAC) and BitLocker encryption.
However, historically, Windows has been a more prominent target for
malware due to its widespread use. In terms of stability, Linux servers
are often praised for their uptime, while Windows has made strides in
this area with each new version.
Key features of Linux

Windows: Windows has improved its security measures over the years,
with features like User Account Control (UAC) and BitLocker encryption.
However, historically, Windows has been a more prominent target for
malware due to its widespread use. In terms of stability, Linux servers
are often praised for their uptime, while Windows has made strides in
this area with each new version.
History of Linux
• Timeline:
• 1991: Linus Torvalds releases the first Linux kernel.
• 1992: First official release of the Linux kernel.
• 1994: Formation of the Linux development community.
• Today: Linux is a dominant force in server environments, embedded
systems, and more.
History of Linux
Impact on computing:
• Server Environments:
• Linux is widely used in server environments due to its stability, security, and
performance.
• Many internet servers, including those powering major websites, run on
Linux-based systems (e.g., Google, Facebook, AWS, Netflix, Wordpress).
History of Linux
Impact on computing:
• Embedded Systems:
• Linux serves as the foundation for many embedded systems, including those
in smartphones, routers, smart TVs, and IoT devices (e.g., Android OS,
Rasberry Pi, Router Firmware, many IOT devices, etc).
• Its adaptability and scalability make it suitable for a wide range of
applications.
History of Linux
Impact on computing:
• Cloud Computing:
• Linux is a common choice for cloud computing infrastructure.
• Leading cloud service providers often use Linux-based systems to deliver
scalable and reliable services.
Linux Architecture
• Monolithic Kernel:
• The Linux kernel is monolithic, meaning it contains all core functions.
• Hardware Abstraction Layer:
• Provides a bridge between hardware and the kernel.
• System Libraries:
• Essential libraries for system functionality.
File System hierarchy
• /bin: Essential user command binaries
• /etc: Configuration files
• /home: User home directories
• /var: Variable files (logs, spool files, etc.)
• /usr: User programs and files
• /tmp: Temporary files
• /dev: Device files
• /proc: Process information
File System hierarchy
/bin (Binary):

This directory contains essential binary executables (command binaries)


that are required for the system's basic operations. Commands like ls
(list), cp (copy), and mv (move) are typically found here.
File System hierarchy
/etc (Etcetera):

The /etc directory houses system-wide configuration files and shell


scripts that control the behavior of various programs. Configuration
files for network settings, user authentication, and system-wide settings
are commonly stored here.
File System hierarchy
/home:

The /home directory contains user home directories. Each user typically
has a subdirectory within /home where their personal files and settings
are stored.
File System hierarchy
/var (Variable):

The /var directory is used to store variable files—files whose content is


expected to change during normal system operation. This includes log
files, spool files (e.g., for printing), and temporary files.
File System hierarchy
/usr (User):

The /usr directory houses user-related programs and data, including the
majority of the system's executables, libraries, documentation, and
source code. It is one of the largest directories in a Linux file system.
File System hierarchy
/tmp (Temporary):

The /tmp directory is used to store temporary files. It is accessible by all


users and is often used for storing temporary data that does not need
to persist across reboots.
File System hierarchy
/dev (Device):

The /dev directory contains device files, which represent and interface
with devices connected to the system. These files allow applications to
communicate with hardware devices.
File System hierarchy
/proc (Process):

The /proc directory is a virtual file system that provides information


about running processes and system configuration. It does not contain
real files but rather provides a way for the kernel to expose information
about the system and its processes.
Basic Linux Commands
• ls: List directory contents
• cd: Change directory
• pwd: Print working directory
• cp: Copy files or directories
• mv: Move files or directories
• rm: Remove files or directories
• man: Display manual or help files
• mkdir: Create directories
Basic Linux Commands
ls command:

-R – lists all the files in the subdirectories.


-a – shows all files, including hidden ones.
-lh – converts sizes to readable formats, such as MB, GB, and TB.
Basic Linux Commands
cat command:

1. To create a file
cat > filename
• Files created with cat command cannot be edited
• Files can be override
• (ctrl+d) getting out of edit mode
Basic Linux Commands
cat command:

2. To concenate files into single file


cat f1 f2 f3 f4 > f5
Basic Linux Commands
cat command:

3. To add/append the content into existing file


cat >> f1
Basic Linux Commands
tac command:

tac f1
• It reverses the content from bottom to top.
• It works on multiple lines not on single line
Basic Linux Commands
cat command:

1. To concenate files into single file


cat f1 f2 f3 f4 > f5
Basic Linux Commands
touch command:

• To create an empty file(s)


• To update time stamp

touch f1 f2 f3 f4 f5 f6
Basic Linux Commands
Vi/vim command:

• To create and edit a file


• A programmer editor
• Important keys: :q, :w, :wq, :q!

vi f1
Basic Linux Commands
nano command:

• To create and edit a file


• A programmer editor
• Important keys: ctrl+x to exit, ctrl+o for updation, ctrl+y to save

nano f1
Basic Linux Commands
Nano Vs vi/vim:

• Vi: Vi/Vim is highly customizable and extensible through configuration


files. Users can install plugins and customize the editor to suit their
preferences.
• Nano: Nano is less customizable compared to Vi/Vim. While users can
configure some settings, it doesn't offer the same level of extensibility
as Vi/Vim
Basic Linux Commands
histroy command:

• To check the history of commands used

history
Basic Linux Commands
Directories:

mkdir:
• To create a directory
mkdir mydir
Basic Linux Commands
Nested Directories:

mkdir -p mydir/dir1/dir2/dir3/dir4

pwd (present working directory)

cd ../../../../../..
Basic Linux Commands
Multiple Directories:

mkdir dir1 dir2 dir3 dir4


Basic Linux Commands
Creating hidden Directories:

mkdir .dir1
Basic Linux Commands
Removing Directories:

1. Empty directory
rmdir dir1
2. Directory with content
rm –r dir1
Basic Linux Commands
Cut paste operation:

mv file1 dir1
• mv f1 f2 (when source and destination are files then shell will ask
permission for overwriting in destined file)
• mv f1 f2 (f2 is new file, work as a rename operation)
Basic Linux Commands
Rename operation:

mv file1 file2
mv dir1 dir2
Basic Linux Commands
Copy paste operation:

cp file1 file2
Basic Linux Commands
less, head, tail

Cat > filelines50

less filelines50
head filelines50
tail filesline50
Basic Linux Commands
hostname:

hostname
o/p
ip-172-31-47-225.ap-south-1.compute.internal
Basic Linux Commands
ifconfig:

cat /etc/os-release

tree:

yum install tree –y:


Basic Linux Commands
yum install httpd

yum remove httpd

yum install tree –y:

whoami:
o/p root
Basic Linux Commands
echo:

• echo “I am over on the ninth cloud”

yum list installed

yum list installed | less


Basic Linux Commands
echo:

• echo “I am over on the ninth cloud”


• echo “Welcome” > file1
• echo > file1

yum list available

yum list available | less


Basic Linux Commands
yum install httpd –y

yum install update httpd

service httpd start


service httpd status
chkconfig httpd on
Users and Permissions
• Users and Groups:
• Each user belongs to one or more groups.
• File Permissions:
• Read (r), Write (w), Execute (x)
• chmod: Change file permissions
• chown: Change file ownership
Access modes/permissions
-rw-r--r--. 1 root root 150 Nov 22 19:59 newfile

owner User Group Size Date and Time Name

Group

Others

Symbolic
link

*read, *write, *execute


Access modes/permissions
Access Mode File Directory
r 4 To display the content To list the content
w 2 To modify To create or remove
x 1 To execute the file To enter the directory
Access modes/permissions
Commands:

chmod — used to change the access mode


chown — used to change the owner of file or directory
chgrp — used to change the group of a file
Access modes/permissions
Two methods to change the permissions:

First method is Decimal method:

r=4
w=2
x=1
Access modes/permissions
Two methods to change the permissions:

Decimal method:

chmod 777 dir1


chmod 534 file1
Access modes/permissions
Two methods to change the permissions:

Second method is letter method:

u = user/owner operators
g = group =+-
o = other
Access modes/permissions
Two methods to change the permissions:

Second method is letter method:

u = rwx — give all permissions to user


u+w — add write permission to user
o-x — remove permission of execution from others
Access modes/permissions
Two methods to change the permissions:

Second method is letter method:

r-- — u=r
rwx — g=wrx
-wx — o=wx
chmod u=r, g=rwx, o=wx file1
chmod u-wx, g+w, o=wx file1
Package Management
• Package Managers:
• Examples: apt, yum, pacman
• Installing Software:
• Use package manager commands to install, update, or remove software.
Conclusion
Recap of Key Points:
• Linux is open source, multiuser, and stable.
• Understanding the file system hierarchy is crucial.
• Basic commands are fundamental for navigating and managing files.
• Users, groups, and permissions control access.
• Package management simplifies software installation.
Q&A

You might also like