MODULE I
LINUX BASICS
by: Dr. Ram Paul Hathwal
Dept of CSE, ASET, AUUP
Linux for Devices Department of Computer
Science and Engineering
CSE438
Dr. Ram Paul Hathwal
Department of Computer Science and Engineering
Amity University Uttar Pradesh
Topics Department of Computer
Science and Engineering
Introduction to Linux
File System of the Linux
General usage of Linux kernel & basic commands
Linux users and group
Permissions for file
Directory and users
Searching a file & directory
Zipping and Unzipping concepts
Linux for the Industry 4.0 Era
OPENIL and its advantages
Features of OPENIL
Department of Computer
Linux Shell Science and Engineering
Shell interprets the command
and request service from kernel whoami pwd
Similar to DOS but DOS has only one set of ls Bash, Tcsh, Zsh
interface while Linux can select different shell
– Bourne Again shell (Bash), TC shell
(Tcsh), Z shell (Zsh) Kernel
Different shell has similar but different
functionality
Bash is the default for Linux
Graphical user interface of Linux is in fact an
application program work on the shell
Example: Department of Computer
Linux Shell Commands Science and Engineering
Frequently used commands available in most shells:
ls : to show (list) the names of the file in the
current directory
cd : change directory,
– e.g. change to the root directory
cd / change to the parent of that
cd . directory
.
cp : copy one file to another
– e.g. cp abc.txt xyz.txt
copy abc.txt to xyz.txt
rm : remove a file
Example: Department of Computer
Linux Shell Commands Science and Engineering
man : ask for the manual (or help) of a command
– e.g. man cd ask for the manual of the command cd
pwd : show the name of the present working directory
cat : to show the content of a text file
– e.g. cat abc.txt show the content of abc.txt
whoami : to show the username of the current user
More Linux/Unix commands
Topics Department of Computer
Science and Engineering
Introduction to Linux
File System of the Linux
General usage of Linux kernel & basic commands
Linux users and group
Permissions for file
Directory and users
Searching a file & directory
Zipping and Unzipping concepts
Linux for the Industry 4.0 Era
OPENIL and its advantages
Features of OPENIL
Department of Computer
Linux User Login Science and Engineering
Linux is a multiuser OS
Allow multiple users to use the resource of a computer at the
same time
Every user needs to login the system with the password
provided to identify their right in using the resource
Require for both client-server based system or desktop
Department of Computer
Linux User Interface Science and Engineering
Traditional Linux (Unix also) uses command- driven
interface (or text-based interface)
User need to type lines of command to instruct the
computer to work, similar to DOS
Advantage: fast in speed. Very few resource is
required for its implementation
Disadvantages: user needs to type, hence can easily
make error. Besides, user needs to memorize all
commands
Suitable for expert users and for the systems that
interaction with user is not frequent, such as servers
19
Department of Computer
Linux User Interface Science and Engineering
By adopting the X-Window technology, graphical user
interface (GUI) is available for Linux:
Uses pointing devices (e.g. mouse) to control the system, similar to
Microsoft’s Windows
Provide menu-driven and/or icon-driven interfaces
menu-driven: user is provided with a menu of choices. Each
choice refers to a particular task
icon-driven: tasks are represented by pictures (icon) and shown to
user. Click on an icon invokes one task
Advantages: No need to memorize commands.
Always select task from menus or icons
Disadvantages: Slow and require certain resource for its
implementation
Suitable for general users and systems, such as PC
Linux User Interface Department of Computer
Science and Engineering
A typical Linux GUI based on
GNOME
Similar to Microsoft’s Windows,
however, different window systems can
be chosen (e.g. GNOME, KDE, etc)
Topics
Department of Computer
Science and Engineering
Introduction to Linux
File System of the Linux
General usage of Linux kernel & basic commands
Linux users and group
Permissions for file
Directory and users
Searching a file & directory
Zipping and Unzipping concepts
Linux for the Industry 4.0 Era
OPENIL and its advantages
Features of OPENIL
ZIP command Department of Computer
Science and Engineering
ZIP is a compression and file packaging utility for Unix.
Each file is stored in single .zip {.zip-filename} file with the
extension .zip.
The zip program puts one or more compressed files into a
single zip archive, along with information about the files (name,
path, date, time of last modification, protection, and check
information to verify file integrity). An entire directory structure
can be packed into a zip archive with a single command.
Compression ratios of 2:1 to 3:1 are common for text files.
zip has one compression method (deflation) and can also store files
without compression.
zip automatically chooses the better of the two for each file to be
compressed.
ZIP Command Department of Computer
Science and Engineering
Syntax
zip [options] zipfile files_list
Extracting from .zip
Unzip <filename.zip>
Possibilities:
1. -d removes files from a zip archieve
Zip –d <filename.zip> <file.txt>
2. -u updates a file in zip archieve
Zip –u <filename.zip> <file.txt>
3. -m deletes original files after zipping
Zip –m <filename.zip> file.txt
4. -r recursively zips files in a directory
Zip –r <filename.zip> <directory_name>
5. -v verbose mode or prints diagnostic information
Zip –v <filename.zip> <file1.txt>
Gzip/gunzip Command Department of Computer
Science and Engineering
Another popular compression algorithm that allows to reduce the size of
a file and keep original file mode, ownership and timestamp.
.gz file format and uses gzip utility to compress and decompress files
By default, gzip keeps the original file name and
timestamp in the compressed file
Syntax:
gzip <test.txt>
Shall create a <test.txt.gz> and delete the original file
For compress multiple files or directory into one file, first you need
to create a Tar archive and then compress the .tar file with Gzip. A
file that ends in .tar.gz or .tgz is a Tar archive compressed with
Gzip.
Gzip/gunzip Command Department of Computer
Science and Engineering
Gunzip synopsis
gunzip [ -acfhlLnNrtvV ] [-S suffix] [ name ... ]
gunzip also recognizes the special extensions .tgz and .taz as shorthands
for .tar.gz and .tar.Z respectively.
Possibilities:
1. -k allows to keep original file
Gzip –k <filename>
Or –c
Gzip –c <filename> > filename.gz
2. -v prints the percentage reduction and name of files processed
Gzip –v <filename>
3. Compress multiple files
Gzip <file1> <file2> <file3>
gzip OPTIONS Department of Computer
Science and Engineering
-f –force
Force compression or decompression even if the file has
multiple links or the corresponding file already exists
gzip OPTIONS Department of Computer
Science and Engineering
-l –list
For each compressed file, list the following fields:
compressed size: size of the compressed file
uncompressed size: size of the uncompressed file
ratio: compression ratio (0.0% if unknown)
uncompressed_name: name of the uncompressed file
-n --no-name
– When compressing, do not save the original file name and time stamp by
default.
– When decompressing, do not restore the original file name if present
(remove only the gzip suffix from the compressed file name) and do not
restore the original time stamp if present.
gzip OPTIONS Department of Computer
Science and Engineering
change the compression level
-# --fast –best
– Regulate the speed of compression using the specified digit #
• -1 or --fast
indicates the fastest compression method, less compression
• -9 or --best
indicates the slowest compression method
best compression
• The default compression level is-6
• That is, biased towards high compression
– Gzip –9 <filename>
gzip decompression Department of Computer
Science and Engineering
Compressed files can be restored to their original form using:
– gzip -d or
– Gunzip or
– Zcat
– Gzip –d <filename.gz>
gunzip can currently decompress files created by gzip, zip,
compress, compress -H or pack.
– The detection of the input format is automatic.
gzip and gunzip can also compress or decompress data from
standard input and output
– ls -laR $HOME | gzip > filelist.gz
– Or by using –c option
Department of Computer
Linux Command bzip2 Science and Engineering
bzip2, bunzip2
a block-sorting file compressor, v1.0.2
bzcat
decompresses files to stdout
bzip2recover
recovers data from damaged bzip2 files
on the average about 10-20% better than gzip
– at the expense of longer compression times
Output with .bz2 filename extension
Department of Computer
bzip2: Synopsis Science and Engineering
bzip2 [ -cdfkqstvzVL123456789 ] [ filenames ... ]
bunzip2 [ -fkvsVL ] [ filenames ... ]
bzcat [ -s ] [ filenames ... ]
bzip2recover filename
Each file is replaced by a compressed version of itself, with the
name "original_name.bz2“
https://www.geeksforgeeks.org/bzip2-command-in-linux-with-examples/
https://www.javatpoint.com/linux-bzip2-bunzip2
https://www.javatpoint.com/linux-bzcat-bzmore
https://www.geeksforgeeks.org/tar-command-linux-examples/
bzip2 OPTIONS Department of Computer
Science and Engineering
-c –stdout
– (as in gzip) Compress or decompress to standard output.
• -t –test
– Check integrity of the specified file(s), but don't
decompress them.
This really performs a trial decompression and throws
away the result.
• -k –keep
– Keep (don't delete) input files during compression or
decompression.
bzip2 OPTIONS Department of Computer
Science and Engineering
• -s –small
Reduce memory usage, for compression, decompression
and testing.
• -1 (or --fast) to -9 (or --best)
Set the block size to 100 k, 200 k .. 900 k when
compressing.
Has no effect when decompressing.
bzip2 decompression Department of Computer
Science and Engineering
bzcat
decompresses files to stdout
• bunzip2
• Cannot use bunzip2 to uncompress files compressed with gzip
and vice versa
• bzip2 -d
decompresses all specified files.
Files which were not created by bzip2 will be detected and
ignored
warning issued.
bzip2 decompression Department of Computer
Science and Engineering
filename.bz2 filename filename
filename.bz filename.tar
filename.tbz2 filename.tar
filename.tbz anyothername.out
anyothername
Linux Command: tar Department of Computer
Science and Engineering
tar is a general-purpose archiving utility
Stands for Tape Archive
capable of packing many files into a single
archive file,
while retaining information needed to restore the
files fully, such as file permissions and ownership.
Department of Computer
tar options Science and Engineering
• -c
Create a new archive
• -x
Extract files from an archive
• -t
List table of contents to an archive
• -r
append
tar options Department of Computer
Science and Engineering
• -u
Update files
• -d
Compare files in the archive to those in the file system
• -v
• – print verbose information
• -k
To keep any existing files when extracting
• B filename
To specify that the tar file to be read or written is filename.
Other commands Department of Computer
Science and Engineering
Synopsis:
compress [ -f ] [ -v ] [ -c ] [ -V ] [ -r ] [ -b bits ]
[ name ... ]
uncompress [ -f ] [ -v ] [ -c ] [ -V ] [ name ... ]
zip [-aABcdDeEfFghjklLmoqrRSTuvVwXyz!@$] [- b
path] [-n suffixes] [-t mmddyyyy] [-tt mmddyyyy]
[ zipfile [ file1 file2 ...]] [-xi list]
unzip [-Z] [-cflptuvz[abjnoqsCLMVX$/:]] file[.zip]
[file(s) ...] [-x xfile(s) ...] [-d exdir]
Topics Department of Computer
Science and Engineering
Introduction to Linux
File System of the Linux
General usage of Linux kernel & basic commands
Linux users and group
Permissions for file
Directory and users
Searching a file & directory
Zipping and Unzipping concepts
Linux for the Industry 4.0 Era
OPENIL and its advantages
Features of OPENIL
Department of Computer
OPENIL Science and Engineering
It is an open source software platform for industrial automation
It provides following features:
Secure:
Industrial-grade security
Trusted computing
Hardened software
Cryptographic operations
End to end security
Real-Time
OpenIL provides a true real-time software platform
Real-time Linux kernel, professionally developed, tested and validated
Deterministic
OpenIL supports the latest Time-Sensitive Networking technology.
OpenTSN architecture runs on various hardware.
OPENIL Advantages Department of Computer
Science and Engineering
100% OPEN SOURCE
Linux distribution specifically developed, tested, and packaged for industrial
systems
CROSS PLATFORM
True cross-platform software platform, not limited to specific device or
hardware architecture
INDUSTRY LEADING EXPERTS
Technology experts and developers from industry-leading companies are
actively building OpenIL software and solutions
OPENIL Advantages
Department of Computer
Science and Engineering
WELL DOCUMENTED AND SUPPORTED
Development and user manuals are well documented with active
community support.
FIELD PROVEN
Every release is rigorously tested in industrial environments on
production systems.
CONTINUOUSLY EVOLVING
OpenIL targets broad industrial applications, and is always evolving.
Go on to the OPENIL website
Summary Department of Computer
Science and Engineering
Linux is an operating system that is built by a community of
software developers around the world and led by its creator,
Linus Torvalds
It is derived originally from the UNIX operating system, but has
grown beyond UNIX in popularity and power over the years
Most Linux software projects are protected by one of a set of
licenses that fall under the Open Source Initiative umbrella. The
most prominent of these is the GNU Public License (GPL)
The GNOME desktop environment has become the default
desktop environment for many Linux systems, including Fedora
and RHEL
Summary Department of Computer
Science and Engineering
• To become an expert Linux user, you must be able to use the
shell to type commands
• Commands for moving around the filesystem, copying files,
moving files, and removing files are among the most basic
commands you need to work from the shell
• Use the locate and find commands for finding files and grep for
searching files
Linux Usage in Industry Department of Computer
Science and Engineering
Internet
Major players like Amazon, Google and Netflix all rely on
Linux for delivering services
Facebook and Twitter each use a Linux variant that has
been tweaked in-house
Finance
A number of markets trade using solutions built on a Linux
stack, including the Wall Street, NYSE Euronext, London
Stock Exchange and Chicago Mercantile Exchange
Linux Usage in Industry Department of Computer
Science and Engineering
Insurance
AIG uses Red Hat and SUSE variants in its architecture
Health insurer, Cigna, uses Red Hat to build operating
environments on Linux
Healthcare
Red Hat skills come in handy for Linux system
administration jobs at healthcare organizations such as
Beth Israel Deaconess Medical Center
Many Debian “pure blends” — subsets of the Debian
GNU/Linux distribution — address the specific needs of
healthcare providers and researchers by packaging the
kernel with drug databases or electronic medical record
systems
Linux Usage in Industry Department of Computer
Science and Engineering
Other Industries
Government, education and military are other sectors
increasing their reliance on Linux system administration
Innovative companies using Linux systems to support
advances in autonomous vehicles, wearable devices, and
other “smart” combinations of hardware and software
Startups and smaller businesses often choose the open-
source OS for their operating servers because so many
distributions are freely available
Department of Computer
Job Positions Science and Engineering
DevOps Engineer Software Developer
Java Developer Linux Engineer
Software Engineer
TechOps Engineer
Systems Administrator
Systems Engineer
Senior Java Developer
Senior Software Engineer Build release
Python Developer management Engineer
Network Engineer
Software Developer
Linux Engineering Admin
Department of Computer
Science and Engineering
Linux Certifications
Most of the hiring manager are looking to recruit Linux
professionals.
The emergence of open cloud platforms is creating increasing
demand for Linux professionals who have the right expertise
Linux-certified professionals always be a better position in the
job market
Employers are looking for more Linux talent.
Better salary increments for Linux certified professionals
Department of Computer
Linux Certifications Science and Engineering
Some of the best Linux certification are given below:
Linux Foundation
Red Hat Linux SuSE Linux
Oracle
Linux Professional Institute (LPIC)
CompTIA
Check it
References Department of Computer
Science and Engineering
Linux Bible, The comprehensive Tutorial Resource, 8th
Edition
Linux: The Complete Reference, Sixth Edition
Linux Programming and Scripting, Video Course NPTEL
https://www.openil.org/
Department of Computer
Science and Engineering
Thanks!…
Any question?