SlideShare a Scribd company logo
Team Emertxe
Linux Internals
Day 1
Introduction
Introduction
Let us ponder ...
● What exactly is an Operating System (OS)?
● Why do we need OS?
● How would the OS would look like?
● Is it possible for a team of us (in the room) to create an
OS of our own?
● Is it necessary to have an OS running in a Embedded
System?
● Will the OS ever stop at all?
Introduction
Operating System
Compiler Assembler Text Editor Database
System and Application Programs
Operating System
Humans
Program
Interface
User
Programs
Operating
System
OS
Interface
HW
Interface/
Privileged
Instr
Hardware
Introduction
What is Linux?
● Linux is a free and open source operating system that is
causing a revolution in the computer world
● Originally created by Linus Torvalds with the assistance of
developers called community
● This operating system in only a few short years is
beginning to dominate markets worldwide
Introduction
Why use Linux?
● Free & Open Source –GPL license, no cost
● Reliability –Build systems with 99.999% upstream
● Secure –Monolithic kernel offering high security
● Scalability –From mobile phone to stock market servers
Introduction
What is Open Source?
Freedom of
software
Freedom of
redistribute
Freedom of
copy
Freedom of
modify
Freedom of
use
Introduction
Open Source - How it all started?
● With GNU (GNU is not UNIX)
● Richard Stallman made the initial announcement in 1983, Free
Software Foundation (FSF) got formed during 1984
● Volunteer driven GNU started developing multiple projects,
but making it as an operating system was always a challenge
● During 1991 a Finnish Engineer Linus Torvalds developed core
OS functionality, called it as “Linux Kernel”
● Linux Kernel got licensed under GPL, which laid strong
platform for the success of Open Source
● Rest is history!
Introduction
Open Source - How it evolved?
● Multiple Linux distributions started emerging around the Kernel
● Some applications became platform independent
● Community driven software development started picking up
● Initially seen as a “geek-phenomenon”, eventually turned out to be
an engineering marvel
●
Centered around Internet
● Building a business around open source started becoming viable
● Redhat set the initial trend in the OS business
Customization
Applications
Kernel
Introduction
Open Source - Where it stands now?
OS Databases Server/Cloud Enterprise
Consumer Education CMS eCommerce
Introduction
Open Source vs Freeware
OSS Freeware
 Users have the right to access &
modify the source codes
 In case original programmer
disappeared, users & developer
group of the S/W usually keep its
support to the S/W.
 OSS usually has the strong users &
developers group that manage and
maintain the project
 Freeware is usually distributed in a
form of binary at ‘Free of Charge’,
but does not open source codes
itself.
 Developer of freeware could
abandon development at any time
and then final version will be the
last version of the freeware. No
enhancements will be made by
others.
 Possibility of changing its licensing
policy
Introduction
GPL
● Basic rights under the GPL – access to source code, right
to make derivative works
● Reciprocity/Copy-left
● Purpose is to increase amount of publicly available
software and ensure compatibility
● Licensees have right to modify, use or distribute
software, and to access the source code
Introduction
GPL - Issues
● Linking to GPL programs
● No explicit patent grant
● Does no discuss trademark rights
● Does not discuss duration
● Silent on sub-licensing
● Relies exclusively on license law, not contract
Introduction
Linux Properties
● Multitasking
● Multi-user
● Multiprocessing
● Protected Memory
● Hierarchical File System
Introduction
Linux Components
● Hardware Controllers: This subsystem is
comprised of all the possible physical devices
in a Linux installation - CPU, memory
hardware, hard disks
● Linux Kernel: The kernel abstracts and
mediates access to the hardware resources,
including the CPU. A kernel is the core of the
operating system
● O/S Services: These are services that are
typically considered part of the operating
system (e.g. windowing system, command
shell)
● User Applications: The set of applications in
use on a particular Linux system (e.g. web
browser)
User
Application
GNU
C
Library
System Call Interface
Kernel
Architecture Dependent
Kernel Code
Hardware Platform
Linux
UserSpaceKernelSpace
Introduction
Linux Directory Structure
/
/boot
/dev
/bin
/etc
/lib
/media
/mnt
/opt
/sbin
/tmp
/usr
/root
/home
/var
/proc
User home directories
Root user's home directory
Essential user command binaries
Essential super user command binaries
Essential shared libraries and kernel modules
Multi user utilities and application
Add-on application software packages
Host specific configuration
Device files
Mount point for removable media
Mount point for temporarily mounted file systems
Static boot-able images
Temporary files
Variable files (Logs)
Virtual FS documenting kernel and process status
User Interfaces
User Interfaces
GUI
● Can use Mouse, Keyboard, Touch Screens
User Interfaces
CLI
● Textual mode used to execute requested commands
User Interfaces
The Shell
● What is a Shell
● Types of shells
– Login
– Non Login
● sh
● bash
● ksh
● csh
● Hands on:
– cat /etc/shells
– echo $0
User Interfaces
The Shell - Invocation
● The main task of a shell is providing a user environment
shell
Input
(ls)
List all
the
files
List all
the
files
User Interfaces
The Shell - bash
● Bash – The command interpreter
– .bash_profile (During login)
– .bashrc (New instance)
– .bash_logout (Logout)
– .bash_history (Command history)
● Hands on:
– Enter ls -a in your home directory
– Display contents of all files mentioned above
User Interfaces
The Shell – Environmental Variables
● Login-shell's responsibility is to set the non-login shell and
it will set the environment variables
● Environment variables are set for every shell and generally
at login time
● Environmental variables are set by the system.
● Environmental variables hold special values. For instance
$ echo $SHELL
● Environmental variables are defined in /etc/profile,
/etc/profile.d/ and ~/.bash_profile.
● When a login shell exits, bash reads ~/.bash_logout
User Interfaces
The Shell – Environmental Variables
● env - lists shell environment variable/value pairs
● export [var_name] - exports/sets a shell variable
– HOME - path to user’s home directory
– PATH - executable search path
– PWD - present working directory
– PS1 - command prompt
● N=10 - Assigning the variable. This a temporary variable
effective only inside the current shell)
● unset N - Unset the environment variable N
Basic Shell Commands
Basic Shell Commands
Types
●
An executable program like all those files can have in
/usr/bin.
●
A command built into the shell itself. bash provides a number
of commands internally called shell built-ins The cd
command, for example, is a shell built-in
●
A shell function. These are miniature shell scripts
incorporated into the environment.
●
An alias. Commands that you can define yourselves, built
from other commands.
●
To know the type, try
$ type <command>
Basic Shell Commands
Information
●
ls - list's all the files
●
pwd - gives present working directory
●
man - gives information about command
●
info <topic> - information pages on <topic>
●
which - shows full path of command
●
df - disk free
●
du - disk usage
●
stat - File and Inode information
●
uname - print system information
Basic Shell Commands
User Specific
● All Accesses into a Linux System are through a User
● User related Shell Command Set
– useradd - create user
– userdel - delete user
– su - [username] - start new shell as different user
– finger - user information lookup
– passwd - change or create user password
– who, w - to find out who is logged in
– whoami - who are you
Basic Shell Commands
Remote Access
● ssh - (secured login) is a program for logging into a
remote machine and for executing commands on a
remote machine.
Example: ssh username@ipaddress
● scp - (secured copy) copies files between hosts on a
network.
Example: scp filename username@ipaddress:/path/
Basic Shell Commands
File System related
● Every thing is viewed as a file in Linux. Even a directory
is a file.
– mount - Mounting filesystem
– find, locate - Search for files
– cd - change directory.
– cp - copy
– mv - move, rename
– rm – remove
Basic Shell Commands
File System related
– mkdir - make directory
– rmdir - remove directory
– cat, less, head, tail - used to view text files
– touch - create and update files
– wc - counts the number of lines in a file
Basic Shell Commands
Archiving
● gzip - This will compress folder or file
● gunzip - This will uncompress
● tar - Archiving files
Basic Shell Commands
Filters
● Filters are the programs, which read some input, perform
the transformation on it and gives the output. Some
commonly used filters are as follow
– tail - Print the last 10 lines of each FILE to standard
output.
– sort - Sort lines of text files
– tr - Translate, squeeze, and/or delete characters from
standard input, writing to standard output.
– wc - Print newline, word, and byte counts for each file
Basic Shell Commands
Pattern Matching
● Grep is pattern matching tool used to search the name
input file. Basically its used for lines matching a pattern
Example:
$ ls | grep *.c
This will list the files from the current directory with .c
extension
Files
Listing
user@user:~] ls -l
total 12
drwxrwxr-x 2 user user 4096 Jun 23 16:48 A-Direcory
brw-r--r-- 1 root root 7, 0 Jun 23 16:55 block_file
crw-r--r-- 1 root root 108, 0 Jun 23 16:49 character_file
lrwxrwxrwx 1 user user 12 Jun 23 16:50 link_to_regular_file -> regular_file
prw-rw-r-- 1 user user 0 Jun 23 16:50 named_pipe
-rw-rw-r-- 1 user user 0 Jun 23 16:48 regular_file
-rwxrwxr-x 1 user user 7639 Jun 23 16:54 server
srwxrwxr-x 1 user user 0 Jun 23 16:55 server_socket
permissions
owner
& group
file
size
created date
& time
file name
Files
Types
user@user:~] ls -l
total 12
drwxrwxr-x 2 user user
brw-r--r-- 1 root root
crw-r--r-- 1 root root
lrwxrwxrwx 1 user user
prw-rw-r-- 1 user user
-rwxrwxr-x 1 user user
srwxrwxr-x 1 user user
Directory
Block
Character
Soft Link
FIFO (sometimes =)
Plain Text
Socket
Files
Permissions
user@user:~] ls -l
total 1
-r w x r w x r - x 2 user user
Read 100 - 4
Write 010 - 2
Execute 001 - 1
Value used to Set
Files
Permissions
user@user:~] ls -l
total 1
-r w x r w x r w x 2 user user
user group others
Files
Permission Modification
● chmod – Change file permissions
● chown – Change file owner
● chmod [ ug+r, 746 ] file.txt
● chown -R user:group [ filename | dir ]
I/O Redirection
Output
●
Output redirection ( > )
●
Redirecting to append ( >> )
●
Redirecting the error (2>)
Examples:
$ ls > /tmp/output_file
Redirects the output of ls to output_file
$ ls -l >> /tmp/output_file
Appends the output of ls -l to output_file
$ ls 2> /tmp/output_file
Redirects the error output of ls to output_file
I/O Redirection
Pipe
● A pipe is a form of redirection that is used in Linux
operating systems to send the output of one program to
another program for further processing.
● A pipe is designated in commands by the vertical bar
character
Example:
$ ls -al /bin | less
Visual Editor - vi
Visual Editor - vi
● Screen-oriented text editor originally created for the
Unix operating system
● The name vi is derived from the shortest unambiguous
abbreviation for the ex command visual
● Improved version is called as vim
● To open a file
$ vi <filename>
or
$ vim <filename>
Visual Editor - vi
● vi opens a file in command mode to start mode.
● The power of vi comes from its 3 modes
– Escape mode (Command mode)
●
Search mode
● File mode
– Editing mode
● Insert mode
● Append mode
● Open mode
●
Replace mode
– Visual mode
Visual Editor – vi
Cursor Movement
● You will clearly need to move the cursor around your file.
You can move the cursor in command mode.
● vi has many different cursor movement commands. The
four basic keys appear below
– k move up one line
– h line move one character to the left
– l line move one character to the right
– j move down one line
● Yes! Arrow keys also do work. But these makes typing
faster
Visual Editor – vi
Basic Commands
● Open a file
$ vi <file_name>
● How to exit
:q -> Close with out saving.
:wq -> Close the file with saving.
:q! -> Close the file forcefully with out saving
● Already looks too complicated?
● Try by yourself, let us write a C program
Visual Editor – vi
Escape / Command Mode
● In command mode, characters you perform actions like moving the
cursor, cutting or copying text, or searching for some particular text
– Search mode
● vi can search the entire file for a given string of text. A string is a
sequence of characters. vi searches forward with the slash (/) key
and string to search. To cancel the search, press ESC .You can
search again by typing n (forward) or N (backward). Also, when vi
reaches the end of the text, it continues searching from the
beginning. This feature is called wrap scan
● Instead of (/), you may also use question (?). That would have
direction reversed
● Now, try out. Start vi as usual and try a simple search. Type
/<string> and press n and N a few times to see where the cursor
goes.
Visual Editor – vi
Escape / Command Mode
– File mode
●
Changing (Replacing) Text
:%s/first/sec - Replaces the first by second every where in
the file
:%s/orange/apple/gc - For all lines in a file, find string
"orange" and replace with string "apple" for each instance on
a line
●
File Interactions (edit and read)
:e filename - open another file without closing the current
:r filename - reads file named filename in place
●
Editor Settings
:set all - display all settings of your session
Visual Editor – vi
Escape / Command Mode – Useful Shortcuts
Command Operation
G Go to last line of the file
gg Go to first line of the file
. Repeat the previous command
Ctrl a Increment number under the cursor by 1
Ctrl x Decrements numbers under the cursor by 1
J Joining the two adjacent lines
(n)gg Move cursor to nth
line
Visual Editor – vi
Editing Mode
Command Mode Name Insertion Point
a Append just after the current character
A Append end of the current line
i Insert just before the current character
I Insert beginning of the current line
o Open new line below the current line
O Open new line above the current line
Visual Editor – vi
Editing Mode – Editing Text
Command Operation
dd For deleting a line
(n)dd For deleting a n lines
x To delete a single character
D Delete contents of line after cursor
dw Delete word
(n)dw Delete n words
● Deleting Text Sometimes you will want to delete some of
the text you are editing. To do so, first move the cursor
so that it covers the first character of the group you want
to delete, then type the desired command from the table
below.
Visual Editor – vi
Visual Mode – Editing Text
● Visual Mode
– Visual mode helps to visually select some text, may be
seen as a sub mode of the command mode to switch
from the command mode to the visual mode type one
of
● v - visual mode
● ctrl+v - Go's to visual block mode.
● d or y Delete or Yank selected text
● I or A Insert or Append text in all lines (visual block
only)
Stay connected
About us: Emertxe is India’s one of the top IT finishing schools & self learning kits
provider. Our primary focus is on Embedded with diversification focus on Java,
Oracle and Android areas
Branch Office: Corporate Headquarters:
Emertxe Information Technologies, Emertxe Information Technologies,
No-1, 9th Cross, 5th Main, 83, Farah Towers, 1st
Floor,
Jayamahal Extension, MG Road,
Bangalore, Karnataka 560046 Bangalore, Karnataka - 560001
T: +91 809 555 7333 (M), +91 80 41289576 (L)
E: training@emertxe.com
https://www.facebook.com/Emertxe https://twitter.com/EmertxeTweet https://www.slideshare.net/EmertxeSlides
Thank You

More Related Content

What's hot

Linux-Internals-and-Networking
Linux-Internals-and-NetworkingLinux-Internals-and-Networking
Linux-Internals-and-Networking
Emertxe Information Technologies Pvt Ltd
 
BusyBox for Embedded Linux
BusyBox for Embedded LinuxBusyBox for Embedded Linux
BusyBox for Embedded Linux
Emertxe Information Technologies Pvt Ltd
 
Linux Internals - Part III
Linux Internals - Part IIILinux Internals - Part III
Linux Internals - Part III
Emertxe Information Technologies Pvt Ltd
 
Linux programming - Getting self started
Linux programming - Getting self started Linux programming - Getting self started
Linux programming - Getting self started
Emertxe Information Technologies Pvt Ltd
 
Embedded Linux on ARM
Embedded Linux on ARMEmbedded Linux on ARM
Embedded Linux on ARM
Embedded Linux on ARMEmbedded Linux on ARM
Embedded Operating System - Linux
Embedded Operating System - LinuxEmbedded Operating System - Linux
Embedded Operating System - Linux
Emertxe Information Technologies Pvt Ltd
 
QEMU - Binary Translation
QEMU - Binary Translation QEMU - Binary Translation
QEMU - Binary Translation
Jiann-Fuh Liaw
 
U Boot or Universal Bootloader
U Boot or Universal BootloaderU Boot or Universal Bootloader
U Boot or Universal Bootloader
Satpal Parmar
 
Linux systems - Getting started with setting up and embedded platform
Linux systems - Getting started with setting up and embedded platformLinux systems - Getting started with setting up and embedded platform
Linux systems - Getting started with setting up and embedded platform
Emertxe Information Technologies Pvt Ltd
 
Troubleshooting Linux Kernel Modules And Device Drivers
Troubleshooting Linux Kernel Modules And Device DriversTroubleshooting Linux Kernel Modules And Device Drivers
Troubleshooting Linux Kernel Modules And Device Drivers
Satpal Parmar
 
Browsing Linux Kernel Source
Browsing Linux Kernel SourceBrowsing Linux Kernel Source
Browsing Linux Kernel Source
Motaz Saad
 
Part 02 Linux Kernel Module Programming
Part 02 Linux Kernel Module ProgrammingPart 02 Linux Kernel Module Programming
Part 02 Linux Kernel Module Programming
Tushar B Kute
 
Linux Locking Mechanisms
Linux Locking MechanismsLinux Locking Mechanisms
Linux Locking Mechanisms
Kernel TLV
 
Making Linux do Hard Real-time
Making Linux do Hard Real-timeMaking Linux do Hard Real-time
Making Linux do Hard Real-time
National Cheng Kung University
 
Linux kernel modules
Linux kernel modulesLinux kernel modules
Linux kernel modules
Dheryta Jaisinghani
 
Linux Internals - Interview essentials 4.0
Linux Internals - Interview essentials 4.0Linux Internals - Interview essentials 4.0
Linux Internals - Interview essentials 4.0
Emertxe Information Technologies Pvt Ltd
 
Linux Internals - Kernel/Core
Linux Internals - Kernel/CoreLinux Internals - Kernel/Core
Linux Internals - Kernel/Core
Shay Cohen
 
LAS16-402: ARM Trusted Firmware – from Enterprise to Embedded
LAS16-402: ARM Trusted Firmware – from Enterprise to EmbeddedLAS16-402: ARM Trusted Firmware – from Enterprise to Embedded
LAS16-402: ARM Trusted Firmware – from Enterprise to Embedded
Linaro
 
Arm device tree and linux device drivers
Arm device tree and linux device driversArm device tree and linux device drivers
Arm device tree and linux device drivers
Houcheng Lin
 

What's hot (20)

Linux-Internals-and-Networking
Linux-Internals-and-NetworkingLinux-Internals-and-Networking
Linux-Internals-and-Networking
 
BusyBox for Embedded Linux
BusyBox for Embedded LinuxBusyBox for Embedded Linux
BusyBox for Embedded Linux
 
Linux Internals - Part III
Linux Internals - Part IIILinux Internals - Part III
Linux Internals - Part III
 
Linux programming - Getting self started
Linux programming - Getting self started Linux programming - Getting self started
Linux programming - Getting self started
 
Embedded Linux on ARM
Embedded Linux on ARMEmbedded Linux on ARM
Embedded Linux on ARM
 
Embedded Linux on ARM
Embedded Linux on ARMEmbedded Linux on ARM
Embedded Linux on ARM
 
Embedded Operating System - Linux
Embedded Operating System - LinuxEmbedded Operating System - Linux
Embedded Operating System - Linux
 
QEMU - Binary Translation
QEMU - Binary Translation QEMU - Binary Translation
QEMU - Binary Translation
 
U Boot or Universal Bootloader
U Boot or Universal BootloaderU Boot or Universal Bootloader
U Boot or Universal Bootloader
 
Linux systems - Getting started with setting up and embedded platform
Linux systems - Getting started with setting up and embedded platformLinux systems - Getting started with setting up and embedded platform
Linux systems - Getting started with setting up and embedded platform
 
Troubleshooting Linux Kernel Modules And Device Drivers
Troubleshooting Linux Kernel Modules And Device DriversTroubleshooting Linux Kernel Modules And Device Drivers
Troubleshooting Linux Kernel Modules And Device Drivers
 
Browsing Linux Kernel Source
Browsing Linux Kernel SourceBrowsing Linux Kernel Source
Browsing Linux Kernel Source
 
Part 02 Linux Kernel Module Programming
Part 02 Linux Kernel Module ProgrammingPart 02 Linux Kernel Module Programming
Part 02 Linux Kernel Module Programming
 
Linux Locking Mechanisms
Linux Locking MechanismsLinux Locking Mechanisms
Linux Locking Mechanisms
 
Making Linux do Hard Real-time
Making Linux do Hard Real-timeMaking Linux do Hard Real-time
Making Linux do Hard Real-time
 
Linux kernel modules
Linux kernel modulesLinux kernel modules
Linux kernel modules
 
Linux Internals - Interview essentials 4.0
Linux Internals - Interview essentials 4.0Linux Internals - Interview essentials 4.0
Linux Internals - Interview essentials 4.0
 
Linux Internals - Kernel/Core
Linux Internals - Kernel/CoreLinux Internals - Kernel/Core
Linux Internals - Kernel/Core
 
LAS16-402: ARM Trusted Firmware – from Enterprise to Embedded
LAS16-402: ARM Trusted Firmware – from Enterprise to EmbeddedLAS16-402: ARM Trusted Firmware – from Enterprise to Embedded
LAS16-402: ARM Trusted Firmware – from Enterprise to Embedded
 
Arm device tree and linux device drivers
Arm device tree and linux device driversArm device tree and linux device drivers
Arm device tree and linux device drivers
 

Similar to Linux Internals - Part I

Linux systems - Linux Commands and Shell Scripting
Linux systems - Linux Commands and Shell ScriptingLinux systems - Linux Commands and Shell Scripting
Linux systems - Linux Commands and Shell Scripting
Emertxe Information Technologies Pvt Ltd
 
Introduction to Linux
Introduction to LinuxIntroduction to Linux
Introduction to Linux
PRIYATHAMDARISI
 
Basic orientation to Linux
Basic orientation to LinuxBasic orientation to Linux
Basic orientation to Linux
Vidyaratha Kissoon
 
Linux
LinuxLinux
Tips and Tricks for Increased Development Efficiency
Tips and Tricks for Increased Development EfficiencyTips and Tricks for Increased Development Efficiency
Tips and Tricks for Increased Development Efficiency
Olivier Bourgeois
 
Linux week 2
Linux week 2Linux week 2
Linux week 2
Vinoth Sn
 
Linuxtraining 130710022121-phpapp01
Linuxtraining 130710022121-phpapp01Linuxtraining 130710022121-phpapp01
Linuxtraining 130710022121-phpapp01Chander Pandey
 
Linux introduction (eng)
Linux introduction (eng)Linux introduction (eng)
Linux introduction (eng)
Anatoliy Okhotnikov
 
Linux administration training
Linux administration trainingLinux administration training
Linux administration training
iman darabi
 
Adhocr T-dose 2012
Adhocr T-dose 2012Adhocr T-dose 2012
Adhocr T-dose 2012
Gratien D'haese
 
Lesson 1 Linux System Fundamentals
Lesson 1 Linux System Fundamentals  Lesson 1 Linux System Fundamentals
Lesson 1 Linux System Fundamentals
Sadia Bashir
 
Basics of Linux Commands, Git and Github
Basics of Linux Commands, Git and GithubBasics of Linux Commands, Git and Github
Basics of Linux Commands, Git and Github
Devang Garach
 
UNIX/Linux training
UNIX/Linux trainingUNIX/Linux training
UNIX/Linux training
Michael Olafusi
 
Linux basics
Linux basics Linux basics
Linux basics
suniljosekerala
 
Linux basic
Linux basicLinux basic
Linux basic
Pragyagupta37
 

Similar to Linux Internals - Part I (20)

Linux systems - Linux Commands and Shell Scripting
Linux systems - Linux Commands and Shell ScriptingLinux systems - Linux Commands and Shell Scripting
Linux systems - Linux Commands and Shell Scripting
 
Introduction to Linux
Introduction to LinuxIntroduction to Linux
Introduction to Linux
 
Basic orientation to Linux
Basic orientation to LinuxBasic orientation to Linux
Basic orientation to Linux
 
Linux
LinuxLinux
Linux
 
Tips and Tricks for Increased Development Efficiency
Tips and Tricks for Increased Development EfficiencyTips and Tricks for Increased Development Efficiency
Tips and Tricks for Increased Development Efficiency
 
Linux week 2
Linux week 2Linux week 2
Linux week 2
 
Linux Presentation
Linux PresentationLinux Presentation
Linux Presentation
 
Linuxtraining 130710022121-phpapp01
Linuxtraining 130710022121-phpapp01Linuxtraining 130710022121-phpapp01
Linuxtraining 130710022121-phpapp01
 
Linux introduction (eng)
Linux introduction (eng)Linux introduction (eng)
Linux introduction (eng)
 
Linux administration training
Linux administration trainingLinux administration training
Linux administration training
 
3. intro
3. intro3. intro
3. intro
 
cisco
ciscocisco
cisco
 
Tutorial 2
Tutorial 2Tutorial 2
Tutorial 2
 
Adhocr T-dose 2012
Adhocr T-dose 2012Adhocr T-dose 2012
Adhocr T-dose 2012
 
Lesson 1 Linux System Fundamentals
Lesson 1 Linux System Fundamentals  Lesson 1 Linux System Fundamentals
Lesson 1 Linux System Fundamentals
 
Basics of Linux Commands, Git and Github
Basics of Linux Commands, Git and GithubBasics of Linux Commands, Git and Github
Basics of Linux Commands, Git and Github
 
UNIX/Linux training
UNIX/Linux trainingUNIX/Linux training
UNIX/Linux training
 
Linux basics
Linux basics Linux basics
Linux basics
 
Linux basic
Linux basicLinux basic
Linux basic
 
Linux
LinuxLinux
Linux
 

More from Emertxe Information Technologies Pvt Ltd

Career Transition (1).pdf
Career Transition (1).pdfCareer Transition (1).pdf
Career Transition (1).pdf
Emertxe Information Technologies Pvt Ltd
 
10_isxdigit.pdf
10_isxdigit.pdf10_isxdigit.pdf

More from Emertxe Information Technologies Pvt Ltd (20)

premium post (1).pdf
premium post (1).pdfpremium post (1).pdf
premium post (1).pdf
 
Career Transition (1).pdf
Career Transition (1).pdfCareer Transition (1).pdf
Career Transition (1).pdf
 
10_isxdigit.pdf
10_isxdigit.pdf10_isxdigit.pdf
10_isxdigit.pdf
 
01_student_record.pdf
01_student_record.pdf01_student_record.pdf
01_student_record.pdf
 
02_swap.pdf
02_swap.pdf02_swap.pdf
02_swap.pdf
 
01_sizeof.pdf
01_sizeof.pdf01_sizeof.pdf
01_sizeof.pdf
 
07_product_matrix.pdf
07_product_matrix.pdf07_product_matrix.pdf
07_product_matrix.pdf
 
06_sort_names.pdf
06_sort_names.pdf06_sort_names.pdf
06_sort_names.pdf
 
05_fragments.pdf
05_fragments.pdf05_fragments.pdf
05_fragments.pdf
 
04_magic_square.pdf
04_magic_square.pdf04_magic_square.pdf
04_magic_square.pdf
 
03_endianess.pdf
03_endianess.pdf03_endianess.pdf
03_endianess.pdf
 
02_variance.pdf
02_variance.pdf02_variance.pdf
02_variance.pdf
 
01_memory_manager.pdf
01_memory_manager.pdf01_memory_manager.pdf
01_memory_manager.pdf
 
09_nrps.pdf
09_nrps.pdf09_nrps.pdf
09_nrps.pdf
 
11_pangram.pdf
11_pangram.pdf11_pangram.pdf
11_pangram.pdf
 
10_combinations.pdf
10_combinations.pdf10_combinations.pdf
10_combinations.pdf
 
08_squeeze.pdf
08_squeeze.pdf08_squeeze.pdf
08_squeeze.pdf
 
07_strtok.pdf
07_strtok.pdf07_strtok.pdf
07_strtok.pdf
 
06_reverserec.pdf
06_reverserec.pdf06_reverserec.pdf
06_reverserec.pdf
 
05_reverseiter.pdf
05_reverseiter.pdf05_reverseiter.pdf
05_reverseiter.pdf
 

Recently uploaded

DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
Product School
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
OnBoard
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
Paul Groth
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
Safe Software
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
Sri Ambati
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
DianaGray10
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
Product School
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
Alison B. Lowndes
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
Prayukth K V
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
91mobiles
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Jeffrey Haguewood
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Tobias Schneck
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
Product School
 

Recently uploaded (20)

DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
 

Linux Internals - Part I

  • 3. Introduction Let us ponder ... ● What exactly is an Operating System (OS)? ● Why do we need OS? ● How would the OS would look like? ● Is it possible for a team of us (in the room) to create an OS of our own? ● Is it necessary to have an OS running in a Embedded System? ● Will the OS ever stop at all?
  • 4. Introduction Operating System Compiler Assembler Text Editor Database System and Application Programs Operating System Humans Program Interface User Programs Operating System OS Interface HW Interface/ Privileged Instr Hardware
  • 5. Introduction What is Linux? ● Linux is a free and open source operating system that is causing a revolution in the computer world ● Originally created by Linus Torvalds with the assistance of developers called community ● This operating system in only a few short years is beginning to dominate markets worldwide
  • 6. Introduction Why use Linux? ● Free & Open Source –GPL license, no cost ● Reliability –Build systems with 99.999% upstream ● Secure –Monolithic kernel offering high security ● Scalability –From mobile phone to stock market servers
  • 7. Introduction What is Open Source? Freedom of software Freedom of redistribute Freedom of copy Freedom of modify Freedom of use
  • 8. Introduction Open Source - How it all started? ● With GNU (GNU is not UNIX) ● Richard Stallman made the initial announcement in 1983, Free Software Foundation (FSF) got formed during 1984 ● Volunteer driven GNU started developing multiple projects, but making it as an operating system was always a challenge ● During 1991 a Finnish Engineer Linus Torvalds developed core OS functionality, called it as “Linux Kernel” ● Linux Kernel got licensed under GPL, which laid strong platform for the success of Open Source ● Rest is history!
  • 9. Introduction Open Source - How it evolved? ● Multiple Linux distributions started emerging around the Kernel ● Some applications became platform independent ● Community driven software development started picking up ● Initially seen as a “geek-phenomenon”, eventually turned out to be an engineering marvel ● Centered around Internet ● Building a business around open source started becoming viable ● Redhat set the initial trend in the OS business Customization Applications Kernel
  • 10. Introduction Open Source - Where it stands now? OS Databases Server/Cloud Enterprise Consumer Education CMS eCommerce
  • 11. Introduction Open Source vs Freeware OSS Freeware  Users have the right to access & modify the source codes  In case original programmer disappeared, users & developer group of the S/W usually keep its support to the S/W.  OSS usually has the strong users & developers group that manage and maintain the project  Freeware is usually distributed in a form of binary at ‘Free of Charge’, but does not open source codes itself.  Developer of freeware could abandon development at any time and then final version will be the last version of the freeware. No enhancements will be made by others.  Possibility of changing its licensing policy
  • 12. Introduction GPL ● Basic rights under the GPL – access to source code, right to make derivative works ● Reciprocity/Copy-left ● Purpose is to increase amount of publicly available software and ensure compatibility ● Licensees have right to modify, use or distribute software, and to access the source code
  • 13. Introduction GPL - Issues ● Linking to GPL programs ● No explicit patent grant ● Does no discuss trademark rights ● Does not discuss duration ● Silent on sub-licensing ● Relies exclusively on license law, not contract
  • 14. Introduction Linux Properties ● Multitasking ● Multi-user ● Multiprocessing ● Protected Memory ● Hierarchical File System
  • 15. Introduction Linux Components ● Hardware Controllers: This subsystem is comprised of all the possible physical devices in a Linux installation - CPU, memory hardware, hard disks ● Linux Kernel: The kernel abstracts and mediates access to the hardware resources, including the CPU. A kernel is the core of the operating system ● O/S Services: These are services that are typically considered part of the operating system (e.g. windowing system, command shell) ● User Applications: The set of applications in use on a particular Linux system (e.g. web browser) User Application GNU C Library System Call Interface Kernel Architecture Dependent Kernel Code Hardware Platform Linux UserSpaceKernelSpace
  • 16. Introduction Linux Directory Structure / /boot /dev /bin /etc /lib /media /mnt /opt /sbin /tmp /usr /root /home /var /proc User home directories Root user's home directory Essential user command binaries Essential super user command binaries Essential shared libraries and kernel modules Multi user utilities and application Add-on application software packages Host specific configuration Device files Mount point for removable media Mount point for temporarily mounted file systems Static boot-able images Temporary files Variable files (Logs) Virtual FS documenting kernel and process status
  • 18. User Interfaces GUI ● Can use Mouse, Keyboard, Touch Screens
  • 19. User Interfaces CLI ● Textual mode used to execute requested commands
  • 20. User Interfaces The Shell ● What is a Shell ● Types of shells – Login – Non Login ● sh ● bash ● ksh ● csh ● Hands on: – cat /etc/shells – echo $0
  • 21. User Interfaces The Shell - Invocation ● The main task of a shell is providing a user environment shell Input (ls) List all the files List all the files
  • 22. User Interfaces The Shell - bash ● Bash – The command interpreter – .bash_profile (During login) – .bashrc (New instance) – .bash_logout (Logout) – .bash_history (Command history) ● Hands on: – Enter ls -a in your home directory – Display contents of all files mentioned above
  • 23. User Interfaces The Shell – Environmental Variables ● Login-shell's responsibility is to set the non-login shell and it will set the environment variables ● Environment variables are set for every shell and generally at login time ● Environmental variables are set by the system. ● Environmental variables hold special values. For instance $ echo $SHELL ● Environmental variables are defined in /etc/profile, /etc/profile.d/ and ~/.bash_profile. ● When a login shell exits, bash reads ~/.bash_logout
  • 24. User Interfaces The Shell – Environmental Variables ● env - lists shell environment variable/value pairs ● export [var_name] - exports/sets a shell variable – HOME - path to user’s home directory – PATH - executable search path – PWD - present working directory – PS1 - command prompt ● N=10 - Assigning the variable. This a temporary variable effective only inside the current shell) ● unset N - Unset the environment variable N
  • 26. Basic Shell Commands Types ● An executable program like all those files can have in /usr/bin. ● A command built into the shell itself. bash provides a number of commands internally called shell built-ins The cd command, for example, is a shell built-in ● A shell function. These are miniature shell scripts incorporated into the environment. ● An alias. Commands that you can define yourselves, built from other commands. ● To know the type, try $ type <command>
  • 27. Basic Shell Commands Information ● ls - list's all the files ● pwd - gives present working directory ● man - gives information about command ● info <topic> - information pages on <topic> ● which - shows full path of command ● df - disk free ● du - disk usage ● stat - File and Inode information ● uname - print system information
  • 28. Basic Shell Commands User Specific ● All Accesses into a Linux System are through a User ● User related Shell Command Set – useradd - create user – userdel - delete user – su - [username] - start new shell as different user – finger - user information lookup – passwd - change or create user password – who, w - to find out who is logged in – whoami - who are you
  • 29. Basic Shell Commands Remote Access ● ssh - (secured login) is a program for logging into a remote machine and for executing commands on a remote machine. Example: ssh username@ipaddress ● scp - (secured copy) copies files between hosts on a network. Example: scp filename username@ipaddress:/path/
  • 30. Basic Shell Commands File System related ● Every thing is viewed as a file in Linux. Even a directory is a file. – mount - Mounting filesystem – find, locate - Search for files – cd - change directory. – cp - copy – mv - move, rename – rm – remove
  • 31. Basic Shell Commands File System related – mkdir - make directory – rmdir - remove directory – cat, less, head, tail - used to view text files – touch - create and update files – wc - counts the number of lines in a file
  • 32. Basic Shell Commands Archiving ● gzip - This will compress folder or file ● gunzip - This will uncompress ● tar - Archiving files
  • 33. Basic Shell Commands Filters ● Filters are the programs, which read some input, perform the transformation on it and gives the output. Some commonly used filters are as follow – tail - Print the last 10 lines of each FILE to standard output. – sort - Sort lines of text files – tr - Translate, squeeze, and/or delete characters from standard input, writing to standard output. – wc - Print newline, word, and byte counts for each file
  • 34. Basic Shell Commands Pattern Matching ● Grep is pattern matching tool used to search the name input file. Basically its used for lines matching a pattern Example: $ ls | grep *.c This will list the files from the current directory with .c extension
  • 35. Files Listing user@user:~] ls -l total 12 drwxrwxr-x 2 user user 4096 Jun 23 16:48 A-Direcory brw-r--r-- 1 root root 7, 0 Jun 23 16:55 block_file crw-r--r-- 1 root root 108, 0 Jun 23 16:49 character_file lrwxrwxrwx 1 user user 12 Jun 23 16:50 link_to_regular_file -> regular_file prw-rw-r-- 1 user user 0 Jun 23 16:50 named_pipe -rw-rw-r-- 1 user user 0 Jun 23 16:48 regular_file -rwxrwxr-x 1 user user 7639 Jun 23 16:54 server srwxrwxr-x 1 user user 0 Jun 23 16:55 server_socket permissions owner & group file size created date & time file name
  • 36. Files Types user@user:~] ls -l total 12 drwxrwxr-x 2 user user brw-r--r-- 1 root root crw-r--r-- 1 root root lrwxrwxrwx 1 user user prw-rw-r-- 1 user user -rwxrwxr-x 1 user user srwxrwxr-x 1 user user Directory Block Character Soft Link FIFO (sometimes =) Plain Text Socket
  • 37. Files Permissions user@user:~] ls -l total 1 -r w x r w x r - x 2 user user Read 100 - 4 Write 010 - 2 Execute 001 - 1 Value used to Set
  • 38. Files Permissions user@user:~] ls -l total 1 -r w x r w x r w x 2 user user user group others
  • 39. Files Permission Modification ● chmod – Change file permissions ● chown – Change file owner ● chmod [ ug+r, 746 ] file.txt ● chown -R user:group [ filename | dir ]
  • 40. I/O Redirection Output ● Output redirection ( > ) ● Redirecting to append ( >> ) ● Redirecting the error (2>) Examples: $ ls > /tmp/output_file Redirects the output of ls to output_file $ ls -l >> /tmp/output_file Appends the output of ls -l to output_file $ ls 2> /tmp/output_file Redirects the error output of ls to output_file
  • 41. I/O Redirection Pipe ● A pipe is a form of redirection that is used in Linux operating systems to send the output of one program to another program for further processing. ● A pipe is designated in commands by the vertical bar character Example: $ ls -al /bin | less
  • 43. Visual Editor - vi ● Screen-oriented text editor originally created for the Unix operating system ● The name vi is derived from the shortest unambiguous abbreviation for the ex command visual ● Improved version is called as vim ● To open a file $ vi <filename> or $ vim <filename>
  • 44. Visual Editor - vi ● vi opens a file in command mode to start mode. ● The power of vi comes from its 3 modes – Escape mode (Command mode) ● Search mode ● File mode – Editing mode ● Insert mode ● Append mode ● Open mode ● Replace mode – Visual mode
  • 45. Visual Editor – vi Cursor Movement ● You will clearly need to move the cursor around your file. You can move the cursor in command mode. ● vi has many different cursor movement commands. The four basic keys appear below – k move up one line – h line move one character to the left – l line move one character to the right – j move down one line ● Yes! Arrow keys also do work. But these makes typing faster
  • 46. Visual Editor – vi Basic Commands ● Open a file $ vi <file_name> ● How to exit :q -> Close with out saving. :wq -> Close the file with saving. :q! -> Close the file forcefully with out saving ● Already looks too complicated? ● Try by yourself, let us write a C program
  • 47. Visual Editor – vi Escape / Command Mode ● In command mode, characters you perform actions like moving the cursor, cutting or copying text, or searching for some particular text – Search mode ● vi can search the entire file for a given string of text. A string is a sequence of characters. vi searches forward with the slash (/) key and string to search. To cancel the search, press ESC .You can search again by typing n (forward) or N (backward). Also, when vi reaches the end of the text, it continues searching from the beginning. This feature is called wrap scan ● Instead of (/), you may also use question (?). That would have direction reversed ● Now, try out. Start vi as usual and try a simple search. Type /<string> and press n and N a few times to see where the cursor goes.
  • 48. Visual Editor – vi Escape / Command Mode – File mode ● Changing (Replacing) Text :%s/first/sec - Replaces the first by second every where in the file :%s/orange/apple/gc - For all lines in a file, find string "orange" and replace with string "apple" for each instance on a line ● File Interactions (edit and read) :e filename - open another file without closing the current :r filename - reads file named filename in place ● Editor Settings :set all - display all settings of your session
  • 49. Visual Editor – vi Escape / Command Mode – Useful Shortcuts Command Operation G Go to last line of the file gg Go to first line of the file . Repeat the previous command Ctrl a Increment number under the cursor by 1 Ctrl x Decrements numbers under the cursor by 1 J Joining the two adjacent lines (n)gg Move cursor to nth line
  • 50. Visual Editor – vi Editing Mode Command Mode Name Insertion Point a Append just after the current character A Append end of the current line i Insert just before the current character I Insert beginning of the current line o Open new line below the current line O Open new line above the current line
  • 51. Visual Editor – vi Editing Mode – Editing Text Command Operation dd For deleting a line (n)dd For deleting a n lines x To delete a single character D Delete contents of line after cursor dw Delete word (n)dw Delete n words ● Deleting Text Sometimes you will want to delete some of the text you are editing. To do so, first move the cursor so that it covers the first character of the group you want to delete, then type the desired command from the table below.
  • 52. Visual Editor – vi Visual Mode – Editing Text ● Visual Mode – Visual mode helps to visually select some text, may be seen as a sub mode of the command mode to switch from the command mode to the visual mode type one of ● v - visual mode ● ctrl+v - Go's to visual block mode. ● d or y Delete or Yank selected text ● I or A Insert or Append text in all lines (visual block only)
  • 53. Stay connected About us: Emertxe is India’s one of the top IT finishing schools & self learning kits provider. Our primary focus is on Embedded with diversification focus on Java, Oracle and Android areas Branch Office: Corporate Headquarters: Emertxe Information Technologies, Emertxe Information Technologies, No-1, 9th Cross, 5th Main, 83, Farah Towers, 1st Floor, Jayamahal Extension, MG Road, Bangalore, Karnataka 560046 Bangalore, Karnataka - 560001 T: +91 809 555 7333 (M), +91 80 41289576 (L) E: training@emertxe.com https://www.facebook.com/Emertxe https://twitter.com/EmertxeTweet https://www.slideshare.net/EmertxeSlides