introduction to linux · ashish bhatia introduction to linux. philosophyconcept of usersfile...

114
Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses Introduction to Linux by Ashish Bhatia TechBuddy Consulting Pvt. Ltd. 19-21 June 2010 Ashish Bhatia Introduction to Linux

Upload: others

Post on 25-May-2020

5 views

Category:

Documents


0 download

TRANSCRIPT

Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses

Introduction to Linux

by Ashish Bhatia

TechBuddy Consulting Pvt. Ltd.

19-21 June 2010

Ashish Bhatia Introduction to Linux

Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses

Why learn Linux?

Ashish Bhatia Introduction to Linux

Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses

What is OS?

What is OS?

1 BIOS - Boot Loader - OS

2 Hardware - OS - Application Software - User

3 multi-user?

4 multi-tasking?

Ashish Bhatia Introduction to Linux

Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses

History of GNU/Linux

based on ideas from UNIX (originated in 1969 at AT&T)

created by Linus Torvalds in 1991

General Public License

GPL

distribution of source code with binary is mustmore details later

Ashish Bhatia Introduction to Linux

Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses

Files and Processes

A running program is a process

it has unique process identifier (PID)

Everything else is file

even devices like mouse, keyboard etc.every file has a unique inode number in Linux

Ashish Bhatia Introduction to Linux

Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses

File Hierarchy

Unlike windows(except recent versions) where data storage ispartitioned into various drives

In Linux all (accessible) data is under /

Ashish Bhatia Introduction to Linux

Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses

File Hierarchy

/ The ancestor of all directories on the system

/bin Essential tools and other programs (or binaries)

/dev Files representing the system’s various hardware devices(eg. /dev/dvd)

/etc Misc system configuration files, startup files (eg./etc/networking)

/home The home dir for all of the system’s users

/proc Files that give information about current systemprocesses

/root superuser’s home directory, whose username is root

/tmp Temp files

/usr Subdir with files related to user tools and applications

Ashish Bhatia Introduction to Linux

Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses

File Hierarchy

/ The ancestor of all directories on the system

/bin Essential tools and other programs (or binaries)

/dev Files representing the system’s various hardware devices(eg. /dev/dvd)

/etc Misc system configuration files, startup files (eg./etc/networking)

/home The home dir for all of the system’s users

/proc Files that give information about current systemprocesses

/root superuser’s home directory, whose username is root

/tmp Temp files

/usr Subdir with files related to user tools and applications

Ashish Bhatia Introduction to Linux

Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses

File Hierarchy

/ The ancestor of all directories on the system

/bin Essential tools and other programs (or binaries)

/dev Files representing the system’s various hardware devices(eg. /dev/dvd)

/etc Misc system configuration files, startup files (eg./etc/networking)

/home The home dir for all of the system’s users

/proc Files that give information about current systemprocesses

/root superuser’s home directory, whose username is root

/tmp Temp files

/usr Subdir with files related to user tools and applications

Ashish Bhatia Introduction to Linux

Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses

File Hierarchy

/ The ancestor of all directories on the system

/bin Essential tools and other programs (or binaries)

/dev Files representing the system’s various hardware devices(eg. /dev/dvd)

/etc Misc system configuration files, startup files (eg./etc/networking)

/home The home dir for all of the system’s users

/proc Files that give information about current systemprocesses

/root superuser’s home directory, whose username is root

/tmp Temp files

/usr Subdir with files related to user tools and applications

Ashish Bhatia Introduction to Linux

Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses

File Hierarchy

/ The ancestor of all directories on the system

/bin Essential tools and other programs (or binaries)

/dev Files representing the system’s various hardware devices(eg. /dev/dvd)

/etc Misc system configuration files, startup files (eg./etc/networking)

/home The home dir for all of the system’s users

/proc Files that give information about current systemprocesses

/root superuser’s home directory, whose username is root

/tmp Temp files

/usr Subdir with files related to user tools and applications

Ashish Bhatia Introduction to Linux

Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses

File Hierarchy

/ The ancestor of all directories on the system

/bin Essential tools and other programs (or binaries)

/dev Files representing the system’s various hardware devices(eg. /dev/dvd)

/etc Misc system configuration files, startup files (eg./etc/networking)

/home The home dir for all of the system’s users

/proc Files that give information about current systemprocesses

/root superuser’s home directory, whose username is root

/tmp Temp files

/usr Subdir with files related to user tools and applications

Ashish Bhatia Introduction to Linux

Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses

File Hierarchy

/ The ancestor of all directories on the system

/bin Essential tools and other programs (or binaries)

/dev Files representing the system’s various hardware devices(eg. /dev/dvd)

/etc Misc system configuration files, startup files (eg./etc/networking)

/home The home dir for all of the system’s users

/proc Files that give information about current systemprocesses

/root superuser’s home directory, whose username is root

/tmp Temp files

/usr Subdir with files related to user tools and applications

Ashish Bhatia Introduction to Linux

Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses

File Hierarchy

/ The ancestor of all directories on the system

/bin Essential tools and other programs (or binaries)

/dev Files representing the system’s various hardware devices(eg. /dev/dvd)

/etc Misc system configuration files, startup files (eg./etc/networking)

/home The home dir for all of the system’s users

/proc Files that give information about current systemprocesses

/root superuser’s home directory, whose username is root

/tmp Temp files

/usr Subdir with files related to user tools and applications

Ashish Bhatia Introduction to Linux

Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses

File Hierarchy

/ The ancestor of all directories on the system

/bin Essential tools and other programs (or binaries)

/dev Files representing the system’s various hardware devices(eg. /dev/dvd)

/etc Misc system configuration files, startup files (eg./etc/networking)

/home The home dir for all of the system’s users

/proc Files that give information about current systemprocesses

/root superuser’s home directory, whose username is root

/tmp Temp files

/usr Subdir with files related to user tools and applications

Ashish Bhatia Introduction to Linux

Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses

Linux Alternative for Windows

Internet Explorer = Firefox

Outlook Express = Thunderbird

Google Talk = Pidgin (and Skype)

media player = amarok

Microsoft Office = Open Office

Notepad = kate,vim

A more comprehensive list athttp://wiki.linuxquestions.org/wiki/Linux software equivalent to Windows software

Ashish Bhatia Introduction to Linux

Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses

Linux Alternative for Windows

Internet Explorer = Firefox

Outlook Express = Thunderbird

Google Talk = Pidgin (and Skype)

media player = amarok

Microsoft Office = Open Office

Notepad = kate,vim

A more comprehensive list athttp://wiki.linuxquestions.org/wiki/Linux software equivalent to Windows software

Ashish Bhatia Introduction to Linux

Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses

Linux Alternative for Windows

Internet Explorer = Firefox

Outlook Express = Thunderbird

Google Talk = Pidgin (and Skype)

media player = amarok

Microsoft Office = Open Office

Notepad = kate,vim

A more comprehensive list athttp://wiki.linuxquestions.org/wiki/Linux software equivalent to Windows software

Ashish Bhatia Introduction to Linux

Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses

Linux Alternative for Windows

Internet Explorer = Firefox

Outlook Express = Thunderbird

Google Talk = Pidgin (and Skype)

media player = amarok

Microsoft Office = Open Office

Notepad = kate,vim

A more comprehensive list athttp://wiki.linuxquestions.org/wiki/Linux software equivalent to Windows software

Ashish Bhatia Introduction to Linux

Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses

Linux Alternative for Windows

Internet Explorer = Firefox

Outlook Express = Thunderbird

Google Talk = Pidgin (and Skype)

media player = amarok

Microsoft Office = Open Office

Notepad = kate,vim

A more comprehensive list athttp://wiki.linuxquestions.org/wiki/Linux software equivalent to Windows software

Ashish Bhatia Introduction to Linux

Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses

Linux Alternative for Windows

Internet Explorer = Firefox

Outlook Express = Thunderbird

Google Talk = Pidgin (and Skype)

media player = amarok

Microsoft Office = Open Office

Notepad = kate,vim

A more comprehensive list athttp://wiki.linuxquestions.org/wiki/Linux software equivalent to Windows software

Ashish Bhatia Introduction to Linux

Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses

Linux Alternative for Windows

Internet Explorer = Firefox

Outlook Express = Thunderbird

Google Talk = Pidgin (and Skype)

media player = amarok

Microsoft Office = Open Office

Notepad = kate,vim

A more comprehensive list athttp://wiki.linuxquestions.org/wiki/Linux software equivalent to Windows software

Ashish Bhatia Introduction to Linux

Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses

What is a user

A user represents a real-world entity and it has

username (and user ID)

group (and group ID)

Password

Home Dir

Default Shell

User Details

Ashish Bhatia Introduction to Linux

Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses

What is a user

A user represents a real-world entity and it has

username (and user ID)

group (and group ID)

Password

Home Dir

Default Shell

User Details

Ashish Bhatia Introduction to Linux

Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses

What is a user

A user represents a real-world entity and it has

username (and user ID)

group (and group ID)

Password

Home Dir

Default Shell

User Details

Ashish Bhatia Introduction to Linux

Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses

What is a user

A user represents a real-world entity and it has

username (and user ID)

group (and group ID)

Password

Home Dir

Default Shell

User Details

Ashish Bhatia Introduction to Linux

Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses

What is a user

A user represents a real-world entity and it has

username (and user ID)

group (and group ID)

Password

Home Dir

Default Shell

User Details

Ashish Bhatia Introduction to Linux

Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses

What is a user

A user represents a real-world entity and it has

username (and user ID)

group (and group ID)

Password

Home Dir

Default Shell

User Details

Ashish Bhatia Introduction to Linux

Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses

Users and Processes

GNU/Linux is a multi-user OS

Everything is a file or a process

Each process must specify which user is the owner

No one except owner has right to access that process*

what about files?

Ashish Bhatia Introduction to Linux

Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses

Users and Processes

GNU/Linux is a multi-user OS

Everything is a file or a process

Each process must specify which user is the owner

No one except owner has right to access that process*

what about files?

Ashish Bhatia Introduction to Linux

Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses

Users and Processes

GNU/Linux is a multi-user OS

Everything is a file or a process

Each process must specify which user is the owner

No one except owner has right to access that process*

what about files?

Ashish Bhatia Introduction to Linux

Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses

Users and Processes

GNU/Linux is a multi-user OS

Everything is a file or a process

Each process must specify which user is the owner

No one except owner has right to access that process*

what about files?

Ashish Bhatia Introduction to Linux

Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses

Users and Processes

GNU/Linux is a multi-user OS

Everything is a file or a process

Each process must specify which user is the owner

No one except owner has right to access that process*

what about files?

Ashish Bhatia Introduction to Linux

Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses

Users and Files

Each file has three (boolean) permissions

Read(r)Write(w)Execute(x)

All users can be grouped into

Owner(u)Group (members) (g)Others (o)

9 bitsr w x r w x r w x

Super-user bypasses file permissions

Ashish Bhatia Introduction to Linux

Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses

Users and Files

Each file has three (boolean) permissions

Read(r)Write(w)Execute(x)

All users can be grouped into

Owner(u)Group (members) (g)Others (o)

9 bitsr w x r w x r w x

Super-user bypasses file permissions

Ashish Bhatia Introduction to Linux

Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses

Users and Files

Each file has three (boolean) permissions

Read(r)Write(w)Execute(x)

All users can be grouped into

Owner(u)Group (members) (g)Others (o)

9 bitsr w x r w x r w x

Super-user bypasses file permissions

Ashish Bhatia Introduction to Linux

Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses

Users and Files

Each file has three (boolean) permissions

Read(r)Write(w)Execute(x)

All users can be grouped into

Owner(u)Group (members) (g)Others (o)

9 bitsr w x r w x r w x

Super-user bypasses file permissions

Ashish Bhatia Introduction to Linux

Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses

A few examples

chmod 600 file1

chmod 400 file2

chmod 711 file3

chmod 644 file4

chmod -R 644 dir1

Ashish Bhatia Introduction to Linux

Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses

A few examples

chmod 600 file1

chmod 400 file2

chmod 711 file3

chmod 644 file4

chmod -R 644 dir1

Ashish Bhatia Introduction to Linux

Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses

A few examples

chmod 600 file1

chmod 400 file2

chmod 711 file3

chmod 644 file4

chmod -R 644 dir1

Ashish Bhatia Introduction to Linux

Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses

A few examples

chmod 600 file1

chmod 400 file2

chmod 711 file3

chmod 644 file4

chmod -R 644 dir1

Ashish Bhatia Introduction to Linux

Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses

A few examples

chmod 600 file1

chmod 400 file2

chmod 711 file3

chmod 644 file4

chmod -R 644 dir1

Ashish Bhatia Introduction to Linux

Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses

Users and Files

File Permissions on Dir

Execute permission is required for a user to cd into a directory

Execute-only permission allows a user to access the files in adirectory as long as the user knows the names of the files inthe directory(and the user is allowed to read the files)

Execute+Read permission is required to view files containedin dir (eg. ls)

Execute+Read+Write permission allows the user to create,delete, or modify any files or subdirectories(even if the file orsubdirectory is owned by another user)

Ashish Bhatia Introduction to Linux

Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses

Users and Files

File Permissions on Dir

Execute permission is required for a user to cd into a directory

Execute-only permission allows a user to access the files in adirectory as long as the user knows the names of the files inthe directory(and the user is allowed to read the files)

Execute+Read permission is required to view files containedin dir (eg. ls)

Execute+Read+Write permission allows the user to create,delete, or modify any files or subdirectories(even if the file orsubdirectory is owned by another user)

Ashish Bhatia Introduction to Linux

Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses

Users and Files

File Permissions on Dir

Execute permission is required for a user to cd into a directory

Execute-only permission allows a user to access the files in adirectory as long as the user knows the names of the files inthe directory(and the user is allowed to read the files)

Execute+Read permission is required to view files containedin dir (eg. ls)

Execute+Read+Write permission allows the user to create,delete, or modify any files or subdirectories(even if the file orsubdirectory is owned by another user)

Ashish Bhatia Introduction to Linux

Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses

Users and Files

File Permissions on Dir

Execute permission is required for a user to cd into a directory

Execute-only permission allows a user to access the files in adirectory as long as the user knows the names of the files inthe directory(and the user is allowed to read the files)

Execute+Read permission is required to view files containedin dir (eg. ls)

Execute+Read+Write permission allows the user to create,delete, or modify any files or subdirectories(even if the file orsubdirectory is owned by another user)

Ashish Bhatia Introduction to Linux

Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses

Users and Files

Something More

SetUID(u+s)

SetGID(g+s)

Sticky Bit(t)

Ashish Bhatia Introduction to Linux

Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses

Users and Files

Something More

SetUID(u+s)

SetGID(g+s)

Sticky Bit(t)

Ashish Bhatia Introduction to Linux

Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses

Users and Files

Something More

SetUID(u+s)

SetGID(g+s)

Sticky Bit(t)

Ashish Bhatia Introduction to Linux

Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses

Users and Files

Something More

SetUID(u+s)

SetGID(g+s)

Sticky Bit(t)

Ashish Bhatia Introduction to Linux

Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses

Is Linux (really) secure?

Security of system or data?

1 Security by design

designed for connectivity and securityusers do not login into admin account (by default)users do not install packages from unverified sourcessome distros require admin account even for connecting usb

2 intelligent users

3 Smaller market to target for attackers

Ashish Bhatia Introduction to Linux

Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses

Is Linux (really) secure?

Security of system or data?1 Security by design

designed for connectivity and securityusers do not login into admin account (by default)users do not install packages from unverified sourcessome distros require admin account even for connecting usb

2 intelligent users

3 Smaller market to target for attackers

Ashish Bhatia Introduction to Linux

Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses

Is Linux (really) secure?

Security of system or data?1 Security by design

designed for connectivity and securityusers do not login into admin account (by default)users do not install packages from unverified sourcessome distros require admin account even for connecting usb

2 intelligent users

3 Smaller market to target for attackers

Ashish Bhatia Introduction to Linux

Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses

Is Linux (really) secure?

Security of system or data?1 Security by design

designed for connectivity and securityusers do not login into admin account (by default)users do not install packages from unverified sourcessome distros require admin account even for connecting usb

2 intelligent users

3 Smaller market to target for attackers

Ashish Bhatia Introduction to Linux

Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses

Shell

provides the traditional user interface for the Unix operatingsystem and for Unix-like systems

Some popular shells

bash

ksh

csh

Unless mentioned all slides assume bash

Ashish Bhatia Introduction to Linux

Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses

Shell

provides the traditional user interface for the Unix operatingsystem and for Unix-like systemsSome popular shells

bash

ksh

csh

Unless mentioned all slides assume bash

Ashish Bhatia Introduction to Linux

Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses

Process in Linux

Main Attributes

uid - user with whose permissions process executes

pid - process id

ppid - parent process id

terminal - to which process is attached

Ashish Bhatia Introduction to Linux

Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses

Process in Linux

Main Attributes

uid - user with whose permissions process executes

pid - process id

ppid - parent process id

terminal - to which process is attached

Ashish Bhatia Introduction to Linux

Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses

Process in Linux

Main Attributes

uid - user with whose permissions process executes

pid - process id

ppid - parent process id

terminal - to which process is attached

Ashish Bhatia Introduction to Linux

Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses

Process in Linux

Main Attributes

uid - user with whose permissions process executes

pid - process id

ppid - parent process id

terminal - to which process is attached

Ashish Bhatia Introduction to Linux

Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses

Standard I/O

Every process has access to three (standard) files

stdin (usually keyboard) - 0

stdout (usually monitor) - 1

stderr (usually monitor) - 2

Ashish Bhatia Introduction to Linux

Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses

Standard I/O

Every process has access to three (standard) files

stdin (usually keyboard) - 0

stdout (usually monitor) - 1

stderr (usually monitor) - 2

Ashish Bhatia Introduction to Linux

Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses

Standard I/O

Every process has access to three (standard) files

stdin (usually keyboard) - 0

stdout (usually monitor) - 1

stderr (usually monitor) - 2

Ashish Bhatia Introduction to Linux

Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses

I/O Redirection

Standard I/O of the process can be redirected to other file(s)

cmd >filename

redirects output from stdout to filenameoriginal contents of file are overwrittenuse >>to append the output to original content

cmd 2>filename

redirects output from stderr to filenameoriginal contents of file are overwrittenuse >>to append the output to original content

cmd <filename

redirects input from stdin to filename

use /dev/null as output file to discard the output

Ashish Bhatia Introduction to Linux

Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses

I/O Redirection

Standard I/O of the process can be redirected to other file(s)

cmd >filename

redirects output from stdout to filenameoriginal contents of file are overwrittenuse >>to append the output to original content

cmd 2>filename

redirects output from stderr to filenameoriginal contents of file are overwrittenuse >>to append the output to original content

cmd <filename

redirects input from stdin to filename

use /dev/null as output file to discard the output

Ashish Bhatia Introduction to Linux

Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses

I/O Redirection

Standard I/O of the process can be redirected to other file(s)

cmd >filename

redirects output from stdout to filenameoriginal contents of file are overwrittenuse >>to append the output to original content

cmd 2>filename

redirects output from stderr to filenameoriginal contents of file are overwrittenuse >>to append the output to original content

cmd <filename

redirects input from stdin to filename

use /dev/null as output file to discard the output

Ashish Bhatia Introduction to Linux

Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses

I/O Redirection

Standard I/O of the process can be redirected to other file(s)

cmd >filename

redirects output from stdout to filenameoriginal contents of file are overwrittenuse >>to append the output to original content

cmd 2>filename

redirects output from stderr to filenameoriginal contents of file are overwrittenuse >>to append the output to original content

cmd <filename

redirects input from stdin to filename

use /dev/null as output file to discard the output

Ashish Bhatia Introduction to Linux

Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses

Executing multiple processes(sequentially)

What are the possible cases?

cmd1 ; cmd2

cmd2 is executed after completion of cmd1

cmd1 && cmd2

cmd2 is executed after successful completion of cmd1eg. rm abc && mkdir abccreates directory abc only if abc file is deleted successfully

cmd1 || cmd2

cmd2 is executed on un-successful completion of cmd1

cmd1 | cmd2

cmd2 is executed on successful completion of cmd1 and takesoutput of cmd1 as its input

Ashish Bhatia Introduction to Linux

Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses

Executing multiple processes(sequentially)

What are the possible cases?

cmd1 ; cmd2

cmd2 is executed after completion of cmd1

cmd1 && cmd2

cmd2 is executed after successful completion of cmd1eg. rm abc && mkdir abccreates directory abc only if abc file is deleted successfully

cmd1 || cmd2

cmd2 is executed on un-successful completion of cmd1

cmd1 | cmd2

cmd2 is executed on successful completion of cmd1 and takesoutput of cmd1 as its input

Ashish Bhatia Introduction to Linux

Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses

Executing multiple processes(sequentially)

What are the possible cases?

cmd1 ; cmd2

cmd2 is executed after completion of cmd1

cmd1 && cmd2

cmd2 is executed after successful completion of cmd1eg. rm abc && mkdir abccreates directory abc only if abc file is deleted successfully

cmd1 || cmd2

cmd2 is executed on un-successful completion of cmd1

cmd1 | cmd2

cmd2 is executed on successful completion of cmd1 and takesoutput of cmd1 as its input

Ashish Bhatia Introduction to Linux

Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses

Executing multiple processes(sequentially)

What are the possible cases?

cmd1 ; cmd2

cmd2 is executed after completion of cmd1

cmd1 && cmd2

cmd2 is executed after successful completion of cmd1eg. rm abc && mkdir abccreates directory abc only if abc file is deleted successfully

cmd1 || cmd2

cmd2 is executed on un-successful completion of cmd1

cmd1 | cmd2

cmd2 is executed on successful completion of cmd1 and takesoutput of cmd1 as its input

Ashish Bhatia Introduction to Linux

Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses

Executing multiple processes(sequentially)

What are the possible cases?

cmd1 ; cmd2

cmd2 is executed after completion of cmd1

cmd1 && cmd2

cmd2 is executed after successful completion of cmd1eg. rm abc && mkdir abccreates directory abc only if abc file is deleted successfully

cmd1 || cmd2

cmd2 is executed on un-successful completion of cmd1

cmd1 | cmd2

cmd2 is executed on successful completion of cmd1 and takesoutput of cmd1 as its input

Ashish Bhatia Introduction to Linux

Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses

Executing multiple processes(in parallel)

what is background mode?

start process in background mode directly

using & at the end of command

start process normally (foreground)

press z (stops the process)execute bg (to start most recently stopped process inbackground mode)

Ashish Bhatia Introduction to Linux

Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses

Executing multiple processes(in parallel)

what is background mode?

start process in background mode directly

using & at the end of command

start process normally (foreground)

press z (stops the process)execute bg (to start most recently stopped process inbackground mode)

Ashish Bhatia Introduction to Linux

Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses

Executing multiple processes(in parallel)

what is background mode?

start process in background mode directly

using & at the end of command

start process normally (foreground)

press z (stops the process)execute bg (to start most recently stopped process inbackground mode)

Ashish Bhatia Introduction to Linux

Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses

Executing multiple processes(in parallel)

Handling processes running in background

jobs - print currently pending (running + stopped) jobs

kill %1 - kills job corresponding to number 1 in the jobsoutput

fg - brings a background process back to foreground

Ashish Bhatia Introduction to Linux

Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses

Executing multiple processes(in parallel)

Handling processes running in background

jobs - print currently pending (running + stopped) jobs

kill %1 - kills job corresponding to number 1 in the jobsoutput

fg - brings a background process back to foreground

Ashish Bhatia Introduction to Linux

Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses

Executing multiple processes(in parallel)

Handling processes running in background

jobs - print currently pending (running + stopped) jobs

kill %1 - kills job corresponding to number 1 in the jobsoutput

fg - brings a background process back to foreground

Ashish Bhatia Introduction to Linux

Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses

Executing multiple processes(in parallel)

Handling processes running in background

jobs - print currently pending (running + stopped) jobs

kill %1 - kills job corresponding to number 1 in the jobsoutput

fg - brings a background process back to foreground

Ashish Bhatia Introduction to Linux

Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses

Executing multiple processes(in parallel)

More process handling

ps [-ely] - see all processes of all users

pstree - shows processes in tree-like (father-child) relation

top - show list of running processes interactively

q - quitk - kill a process

signal -9 kill without warningsignal -15 kill after warning (allows cleanup)

kill [signal] process-id

kill -9 process-id

killall [signal] process-cmd-name

Ashish Bhatia Introduction to Linux

Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses

Executing multiple processes(in parallel)

More process handling

ps [-ely] - see all processes of all users

pstree - shows processes in tree-like (father-child) relation

top - show list of running processes interactively

q - quitk - kill a process

signal -9 kill without warningsignal -15 kill after warning (allows cleanup)

kill [signal] process-id

kill -9 process-id

killall [signal] process-cmd-name

Ashish Bhatia Introduction to Linux

Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses

Executing multiple processes(in parallel)

More process handling

ps [-ely] - see all processes of all users

pstree - shows processes in tree-like (father-child) relation

top - show list of running processes interactively

q - quitk - kill a process

signal -9 kill without warningsignal -15 kill after warning (allows cleanup)

kill [signal] process-id

kill -9 process-id

killall [signal] process-cmd-name

Ashish Bhatia Introduction to Linux

Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses

Executing multiple processes(in parallel)

More process handling

ps [-ely] - see all processes of all users

pstree - shows processes in tree-like (father-child) relation

top - show list of running processes interactively

q - quitk - kill a process

signal -9 kill without warningsignal -15 kill after warning (allows cleanup)

kill [signal] process-id

kill -9 process-id

killall [signal] process-cmd-name

Ashish Bhatia Introduction to Linux

Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses

Executing multiple processes(in parallel)

More process handling

ps [-ely] - see all processes of all users

pstree - shows processes in tree-like (father-child) relation

top - show list of running processes interactively

q - quitk - kill a process

signal -9 kill without warningsignal -15 kill after warning (allows cleanup)

kill [signal] process-id

kill -9 process-id

killall [signal] process-cmd-name

Ashish Bhatia Introduction to Linux

Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses

Executing multiple processes(in parallel)

More process handling

ps [-ely] - see all processes of all users

pstree - shows processes in tree-like (father-child) relation

top - show list of running processes interactively

q - quitk - kill a process

signal -9 kill without warningsignal -15 kill after warning (allows cleanup)

kill [signal] process-id

kill -9 process-id

killall [signal] process-cmd-name

Ashish Bhatia Introduction to Linux

Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses

Free Software

As defined by FSF (1986)

1 run the program (for any purpose)

2 study how the program works (and change it to your needs)

3 redistribute copies

4 improve the program and release your improvements to thepublic

Ashish Bhatia Introduction to Linux

Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses

Free Software

As defined by FSF (1986)

1 run the program (for any purpose)

2 study how the program works (and change it to your needs)

3 redistribute copies

4 improve the program and release your improvements to thepublic

Ashish Bhatia Introduction to Linux

Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses

Free Software

As defined by FSF (1986)

1 run the program (for any purpose)

2 study how the program works (and change it to your needs)

3 redistribute copies

4 improve the program and release your improvements to thepublic

Ashish Bhatia Introduction to Linux

Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses

Free Software

As defined by FSF (1986)

1 run the program (for any purpose)

2 study how the program works (and change it to your needs)

3 redistribute copies

4 improve the program and release your improvements to thepublic

Ashish Bhatia Introduction to Linux

Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses

Licenses

1 GNU General Purpose License

2 GNU Lesser General Purpose License

3 Apache License

4 BSD License

5 lot of others

Disclaimer: I am not a legal expert

Ashish Bhatia Introduction to Linux

Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses

Licenses

1 GNU General Purpose License

2 GNU Lesser General Purpose License

3 Apache License

4 BSD License

5 lot of others

Disclaimer: I am not a legal expert

Ashish Bhatia Introduction to Linux

Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses

Licenses

1 GNU General Purpose License

2 GNU Lesser General Purpose License

3 Apache License

4 BSD License

5 lot of others

Disclaimer: I am not a legal expert

Ashish Bhatia Introduction to Linux

Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses

Licenses

1 GNU General Purpose License

2 GNU Lesser General Purpose License

3 Apache License

4 BSD License

5 lot of others

Disclaimer: I am not a legal expert

Ashish Bhatia Introduction to Linux

Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses

Licenses

1 GNU General Purpose License

2 GNU Lesser General Purpose License

3 Apache License

4 BSD License

5 lot of others

Disclaimer: I am not a legal expert

Ashish Bhatia Introduction to Linux

Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses

GNU GPL

1 most popular (and most sophisticated)

2 a work derived from GPL licensed work must be licensedunder GPL

3 linking to GPL code?

Ashish Bhatia Introduction to Linux

Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses

GNU GPL

1 most popular (and most sophisticated)

2 a work derived from GPL licensed work must be licensedunder GPL

3 linking to GPL code?

Ashish Bhatia Introduction to Linux

Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses

GNU GPL

1 most popular (and most sophisticated)

2 a work derived from GPL licensed work must be licensedunder GPL

3 linking to GPL code?

Ashish Bhatia Introduction to Linux

Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses

GNU LGPL

1 less restrictive than GPL

2 LGPL licensed code can be linked by non-(L)GPL code

3 derivative work must still release code for personal use (ofcustomer)

4 LGPL vs GPL? which one to use?

Ashish Bhatia Introduction to Linux

Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses

GNU LGPL

1 less restrictive than GPL

2 LGPL licensed code can be linked by non-(L)GPL code

3 derivative work must still release code for personal use (ofcustomer)

4 LGPL vs GPL? which one to use?

Ashish Bhatia Introduction to Linux

Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses

GNU LGPL

1 less restrictive than GPL

2 LGPL licensed code can be linked by non-(L)GPL code

3 derivative work must still release code for personal use (ofcustomer)

4 LGPL vs GPL? which one to use?

Ashish Bhatia Introduction to Linux

Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses

GNU LGPL

1 less restrictive than GPL

2 LGPL licensed code can be linked by non-(L)GPL code

3 derivative work must still release code for personal use (ofcustomer)

4 LGPL vs GPL? which one to use?

Ashish Bhatia Introduction to Linux

Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses

BSD

1 Very permissive

2 just give credits to the previous contributors

3 no need to release source-code

4 “If you want to give your software away for free, use BSD. Ifyou want to share your software, use the GPL”(Courtesy:OSnews)

Ashish Bhatia Introduction to Linux

Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses

BSD

1 Very permissive

2 just give credits to the previous contributors

3 no need to release source-code

4 “If you want to give your software away for free, use BSD. Ifyou want to share your software, use the GPL”(Courtesy:OSnews)

Ashish Bhatia Introduction to Linux

Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses

BSD

1 Very permissive

2 just give credits to the previous contributors

3 no need to release source-code

4 “If you want to give your software away for free, use BSD. Ifyou want to share your software, use the GPL”(Courtesy:OSnews)

Ashish Bhatia Introduction to Linux

Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses

BSD

1 Very permissive

2 just give credits to the previous contributors

3 no need to release source-code

4 “If you want to give your software away for free, use BSD. Ifyou want to share your software, use the GPL”(Courtesy:OSnews)

Ashish Bhatia Introduction to Linux

Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses

Apache

1 Permissiveness same as BSD but legally more explicit

2 handles the problem of software patents

3 author of the code (automatically) gives up the right to any of(his/her) patent used in the code

Ashish Bhatia Introduction to Linux

Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses

Apache

1 Permissiveness same as BSD but legally more explicit

2 handles the problem of software patents

3 author of the code (automatically) gives up the right to any of(his/her) patent used in the code

Ashish Bhatia Introduction to Linux

Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses

Apache

1 Permissiveness same as BSD but legally more explicit

2 handles the problem of software patents

3 author of the code (automatically) gives up the right to any of(his/her) patent used in the code

Ashish Bhatia Introduction to Linux

Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses

Case 1

ACME systems internally uses CRM whose codebase is basedon a GPL based CRM. Can an employee of the company askfor the source code?

Ashish Bhatia Introduction to Linux

Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses

Case 2

Microspecial Inc. supplies embedded systems to thegovernment, as per the government orders they cannot releasethe source code to anyone but their codebase is based on GPLbased code. What if someone asks for the source code? dothey have to give it?

Ashish Bhatia Introduction to Linux

Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses

Case 3

Stickpoint Solutions released Office software 1.0 under GPLand in the next version, they decide to move to BSD license?can they do it?

Ashish Bhatia Introduction to Linux

Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses

Case 4

Tivo used parts of Linux kernel code for its consumerelectronics product, so they had to release the source codebut they put on the hardware check to avoid customised codefrom execution. Is this a violation of GPL?

Ashish Bhatia Introduction to Linux

Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses

Case 5

Web Ultimates released source code of CMS(web application)under GPL, Web Peers Inc. used the code to develop theirwebsite, do they have to release the source code of theirwebsite?

Ashish Bhatia Introduction to Linux

Philosophy Concept of Users File Handling in Linux Process Handling in Linux Licenses

References

1 Linux Man Pages

2 The Linux Documentation Project

3 Free Software Foundation (FSF) website

Ashish Bhatia Introduction to Linux