1695714533-1. Basics of Working With Linux Operating System
1695714533-1. Basics of Working With Linux Operating System
Disclaimer
The content is curated from online/offline resources and used for educational purpose only
Basics of working with Linux Operating System
Learning Objectives
You will learn in this lesson:
• Operating System
• Linux Kernel
• Shell Scripting
Basics of working with Linux Operating System
Scenario
Introduction
• Operating System acts as an interface between the
computer hardware components and the user.
Source: https://upload.wikimedia.org/wikipedia/
Basics of working with Linux Operating System
Security Job-
Storage User-Interface
Management accounting Manage
Management Management
ment
Basics of working with Linux Operating System
What is Linux?
• The Linux OS is free and open-source and behaves
like a Unix-like operating system.
Linux Features
• UNIX-like kernel.
• Open source.
• Preemptive multitasking
• Portable
• Security
Basics of working with Linux Operating System
Linux Architecture
• Hardware Layer
• Kernel
• Shell
• Utilities
Source: https://media.geeksforgeeks.org/wp-content/uploads/
Basics of working with Linux Operating System
History of Linux
Linux Distributions
• Ubuntu
• Debian
• Fedora
• Kali Linux
• Arch Linux
• Raspberry Pi OS
Basics of working with Linux Operating System
• Memory management
• Process management
• Device drivers
• System calls and security
Source: https://blog.digilentinc.com/wp-content/uploads/2015/05/1280px-Kernel_Layout.svg_.png
Basics of working with Linux Operating System
ls command
ls -a (all) ls -S (size)
Lists all the files (including .* files) Lists the biggest files first
ls -l (long) ls -r (reverse)
Long listing (type, date, size, owner, Reverses the sort order
permissions)
Lists the files in the current directory, in alphanumeric order, except files starting with the “.” character
Basics of working with Linux Operating System
cd -
Gets back to the previous current directory.
pwd
Displays the current directory ("working directory").
Basics of working with Linux Operating System
cp command
cp <source_file> <target_file>
Copies the source file to the target.
cp -i (interactive)
Asks for user confirmation if the target file already exists
mv and rm commands
mv <old_name> <new_name> (move)
Renames the given file or directory.
mv -i (interactive)
If the new file already exits, asks for user confirm
rm -i (interactive)
Always ask for user confirm.
command function
touch filename1 fileName2 fileName3 …. easy way to create a file
-rw-r-----
Readable and writable for file owner, only readable for users belonging to the file group.
drwx------
Directory only accessible by its owner
-------r-x
File executable by others but neither by your friends nor by yourself. Nice protections for a trap...
Basics of working with Linux Operating System
Shell Scripting
Basics of working with Linux Operating System
What is a Shell ?
• A shell is an environment that takes commands
typed by the user and calls the operating system to
run those commands.
• It is a program that acts as the interface between
the user and the Linux system, allowing the user
to enter commands for the operating system
to execute.
• Shell accepts the instruction or commands
in English and translates them into computers
native binary language.
Source: https://www.opensourceforu.com/2020/03/reasons-to-use-linux/
Basics of working with Linux Operating System
Kind of Shells
Kind of Shells
Bourne Shell
C Shell
Korn Shell
Bash Shell
Tcsh Shell
Basics of working with Linux Operating System
Shell Scripting
• Shell script is a plain text file that contains a series of command(s).
• Shell script takes input from user, file and output them on screen.
• It saves lots of time by automating routine admin tasks.
Basics of working with Linux Operating System
• Encapsulate complex configuration details and get a full power of the operating system.
• The ability to combine commands allows you to create new commands, thereby adding value to your
operating system.
Basics of working with Linux Operating System
Practical Examples:
write a shell script to use if then else
#!/bin/bash
if [ -f isit.txt ]
then echo isit.txt exists!
else echo isit.txt not found!
fi
Basics of working with Linux Operating System
#!/bin/bash
echo -n Enter the count:
read count
if [ $count -eq 42 ]
then
echo "42 is correct."
elif [ $count -gt 42 ]
then
echo "Too much."
else
echo "Not enough."
fi
Basics of working with Linux Operating System
#!/bin/sh
a=0
while [ $a -lt 10 ]
do
echo $a
a=`expr $a + 1`
done
Basics of working with Linux Operating System
SSH
• SSH stands for “Secure Shell”.
• SSH transfers the data in encrypted form between
the host and the client.
• It transfers inputs from the client to the host and
relays back the output. SSH runs at TCP/IP port 22
ssh user_name@host(IP/Domain_name
SSH
https://phoenixnap.com/kb/linux-ssh-commands
Basics of working with Linux Operating System
SCP
• The scp command allows you to copy files over ssh connections.
• This is pretty useful if you want to transport files between computers
Syntax
• scp examplefile yourusername@yourserver:/home/yourusername/
Example
• scp file1.pdf [email protected]:/root/Desktop
Basics of working with Linux Operating System
Summary
• We know about the basic of Linux operating systems
Quiz
1. Who founded Linux Kernel?
Answer: b
Linus Torvalds
Basics of working with Linux Operating System
Quiz
2. Which symbol represents the top-level directory?
a) ~
b) @
c) #
d) /
Answer: d
/
Basics of working with Linux Operating System
Quiz
3. Which symbol represents the user's home directory?
a) ~
b) @
c) #
d) /
Answer: a
~
Basics of working with Linux Operating System
References
• https://en.wikipedia.org/wiki/Linux_kernel
• https://www.tutorialspoint.com/operating_system/os_linux.html
• https://buildmedia.readthedocs.org/media/pdf/lym/latest/lym.pdf
• https://phoenixnap.com/kb/linux-commands-cheat-sheet
• https://www.guru99.com/file-permissions.html
• https://www.hostinger.in/tutorials/linux-commands
Basics of working with Linux Operating System
Thank You