SlideShare uma empresa Scribd logo
1 de 16
Baixar para ler offline
Lab 1: Hello, Linux!
Advanced Operating Systems

Zubair Nabi
zubair.nabi@itu.edu.pk

January 23, 2013
Unix

• Multi-task, multi-user OS out of Bell Labs in 19691
• Initially in Assembly but later in C (1973)2
• Code recycling!
• Ken Thompson, Dennis Ritchie, Brian Kernighan, Douglas
McIlroy, Michael Lesk and Joe Ossanna
• Branched into BSD (FreeBSD, NetBSD, etc.)

1
2

http://www.youtube.com/watch?v=tc4ROCJYbm0

Dennis M. Ritchie and Ken Thompson. 1974. The UNIX time-sharing system.
Commun. ACM 17, 7 (July 1974), 365-375. DOI=10.1145/361011.361061
Linux
• Linux (circa 1991) is a Unix-clone under FOSS
• Comes in many flavours/distributions (distros): Linux kernel3 +
GUI (optional) + application/software suite
• bash (shell) + GCC + GDB + coreutils
• 600+ distros
• Popular ones: Ubuntu, Fedora, Debian, Gentoo, SUSE, etc.

• Now being used atop desktops, servers, and mobile/embedded
systems

Linus Torvalds: comp.os.minix mailing list (1991-08-25)
I’m doing a (free) operating system (just a hobby, won’t be big and
professional like gnu) for 386(486) AT clones.
3

http://www.kernel.org/
Ubuntu

• Built on top of Debian and developed/distributed by Canonical
Ltd.
• Most popular desktop/laptop distribution
• Applications: LibreOffice, Firefox (web browser), Thunderbird
(email/chat/news), Empathy (IM/VoIP), etc.
• Variants: Ubuntu Deskop, Ubuntu Server, Ubuntu for Phones, etc.
Linux guide(s)

• Introduction to Linux: A Hands on Guide; Achtelt Garrels;
CreateSpace Independent Publishing Platform
Available online:

http://www.tldp.org/LDP/intro-linux/html/
Common commands

Command

ls
cd
file
cat
pwd
man
logout/exit

Description
List the contents of a directory
Change directory (jump across the filesystem tree)
Display file type
Send file contents to standard output
Display current working directory
Display manual page
Close the current session
Files
Everything is a file
On a UNIX system, everything is a file; if something is not a file, it is a
process.
Type
Regular (-)
Directory (d)
Special (c)
Links (l)
Domain sockets (s)
Named pipes (p)
Block device files (b)

Description
Ordinary files
To list other files
Used for input/output
Pointers to other files
IPC through TCP/IP-like sockets
IPC enablers
To represent block devices
Partitioning

• Divides the disk device into multiple logical storage units
• Data partitions contain regular user data
• Swap partitions house the swap space
• Attached to the file system at mount points
• df displays free disk space in active partitions
Filesystem layout
Type

/bin
/boot
/dev
/etc
/home
/lib
/lost+found
/media
/mnt
/opt
/proc

Description
Programs shared by users, administrators,
and the system itself
Start-up files
Hardware devices
Configuration files
Home directories of users
Library files for programs and the system
Files saved in case of failure
Mount point for removable media
Mount point for external filesystems
Third-party software
Information about system resources (userspace window into kernel data structures)
Filesystem layout (2)

/sbin
/tmp
/usr
/var

Programs shared by administrators and the
system
Temporary space
User processes and libraries
Files which change size regularly, e.g. log
files, etc.
Paths, environment variables, and home directories

• Two types of paths:
1

Relative: Relative to the current working directory
• ∼: Relative to home directory

2

Absolute: Starting from the root directory

• Environment variables: Contain dynamic values that change the
behaviour of running programs, e.g. PATH, HOME, etc.
• Each user has a home directory
Manipulating files/directories

• Create directory: mkdir
• Move file/directory: mv
• Copy file/directory: cp
• Remove file/directory: rm
• Find file/directory: find <path> -name <filename>
Manipulating files and their contents

• Filter results: grep
• Invert: -v
• Display values from the top: head
• Display values from the bottom: tail
• Display unique values: uniq
• Change file permissions: chmod
• Permissions: -, r, w, x (bit masks)
• Permission categories: owner, group, everyone else

• Count number of lines (-l), words (-w), and bytes(-c): wc
Pipes and input/output redirection

• Pipe (|): Redirect standard output to standard input
• Input/output redirection (<>): Redirect standard input or output
to a file
• Appending redirection: << or >>
• Replacing a string in place:

sed -i s/<original_string>/<new_string>/
<file>
• Replacing a string and copying into a new file:

sed s/<original_string>/<new_string>/
<input_file> > <output_file>
Shell scripts

• Shell commands can be put into a file and executed as a script
• A file can be made executable through chmod
Today’s Task
• Write a bash script that:
1
2

3

4

5

Creates two folders in your home directory: 1) temp, and 2)
results,
Copies both dictionaries into temp and renames them to
american-english-dictionary and
british-english-dictionary,
Counts the total number of lines in both dictionaries and stores
them in count-british-english-dictionary and
count-american-english-dictionary in the
results folder,
Stores unique American English words (not present in the British
English dictionary) in unique-american-english and
unique British English words (not present in the American English
dictionary) in unique-british-english in the results
folder,
Stores common words (present in both dictionaries) in
common-english in the results folder.

Mais conteúdo relacionado

Mais procurados

Some basic unix commands
Some basic unix commandsSome basic unix commands
Some basic unix commands
aaj_sarkar06
 
AOS Lab 10: File system -- Inodes and beyond
AOS Lab 10: File system -- Inodes and beyondAOS Lab 10: File system -- Inodes and beyond
AOS Lab 10: File system -- Inodes and beyond
Zubair Nabi
 
AOS Lab 7: Page tables
AOS Lab 7: Page tablesAOS Lab 7: Page tables
AOS Lab 7: Page tables
Zubair Nabi
 
AOS Lab 1: Hello, Linux!
AOS Lab 1: Hello, Linux!AOS Lab 1: Hello, Linux!
AOS Lab 1: Hello, Linux!
Zubair Nabi
 

Mais procurados (20)

Some basic unix commands
Some basic unix commandsSome basic unix commands
Some basic unix commands
 
UNIX Basics and Cluster Computing
UNIX Basics and Cluster ComputingUNIX Basics and Cluster Computing
UNIX Basics and Cluster Computing
 
Linux Knowledge Transfer
Linux Knowledge TransferLinux Knowledge Transfer
Linux Knowledge Transfer
 
Useful linux-commands
Useful linux-commandsUseful linux-commands
Useful linux-commands
 
An Introduction to User Space Filesystem Development
An Introduction to User Space Filesystem DevelopmentAn Introduction to User Space Filesystem Development
An Introduction to User Space Filesystem Development
 
Basic commands
Basic commandsBasic commands
Basic commands
 
Introduction to-linux
Introduction to-linuxIntroduction to-linux
Introduction to-linux
 
Introduction to UNIX
Introduction to UNIXIntroduction to UNIX
Introduction to UNIX
 
Basic unix commands
Basic unix commandsBasic unix commands
Basic unix commands
 
Linux powerpoint
Linux powerpointLinux powerpoint
Linux powerpoint
 
Linux Network commands
Linux Network commandsLinux Network commands
Linux Network commands
 
AOS Lab 10: File system -- Inodes and beyond
AOS Lab 10: File system -- Inodes and beyondAOS Lab 10: File system -- Inodes and beyond
AOS Lab 10: File system -- Inodes and beyond
 
Useful Linux and Unix commands handbook
Useful Linux and Unix commands handbookUseful Linux and Unix commands handbook
Useful Linux and Unix commands handbook
 
Fun with FUSE
Fun with FUSEFun with FUSE
Fun with FUSE
 
Linux Basic Commands
Linux Basic CommandsLinux Basic Commands
Linux Basic Commands
 
AOS Lab 7: Page tables
AOS Lab 7: Page tablesAOS Lab 7: Page tables
AOS Lab 7: Page tables
 
The TCP/IP Stack in the Linux Kernel
The TCP/IP Stack in the Linux KernelThe TCP/IP Stack in the Linux Kernel
The TCP/IP Stack in the Linux Kernel
 
Linux command for beginners
Linux command for beginnersLinux command for beginners
Linux command for beginners
 
AOS Lab 1: Hello, Linux!
AOS Lab 1: Hello, Linux!AOS Lab 1: Hello, Linux!
AOS Lab 1: Hello, Linux!
 
Module 02 Using Linux Command Shell
Module 02 Using Linux Command ShellModule 02 Using Linux Command Shell
Module 02 Using Linux Command Shell
 

Destaque (15)

AOS Lab 11: Virtualization
AOS Lab 11: VirtualizationAOS Lab 11: Virtualization
AOS Lab 11: Virtualization
 
AOS Lab 8: Interrupts and Device Drivers
AOS Lab 8: Interrupts and Device DriversAOS Lab 8: Interrupts and Device Drivers
AOS Lab 8: Interrupts and Device Drivers
 
Topic 13: Cloud Stacks
Topic 13: Cloud StacksTopic 13: Cloud Stacks
Topic 13: Cloud Stacks
 
Raabta: Low-cost Video Conferencing for the Developing World
Raabta: Low-cost Video Conferencing for the Developing WorldRaabta: Low-cost Video Conferencing for the Developing World
Raabta: Low-cost Video Conferencing for the Developing World
 
MapReduce and DBMS Hybrids
MapReduce and DBMS HybridsMapReduce and DBMS Hybrids
MapReduce and DBMS Hybrids
 
MapReduce Application Scripting
MapReduce Application ScriptingMapReduce Application Scripting
MapReduce Application Scripting
 
AOS Lab 4: If you liked it, then you should have put a “lock” on it
AOS Lab 4: If you liked it, then you should have put a “lock” on itAOS Lab 4: If you liked it, then you should have put a “lock” on it
AOS Lab 4: If you liked it, then you should have put a “lock” on it
 
The Anatomy of Web Censorship in Pakistan
The Anatomy of Web Censorship in PakistanThe Anatomy of Web Censorship in Pakistan
The Anatomy of Web Censorship in Pakistan
 
AOS Lab 5: System calls
AOS Lab 5: System callsAOS Lab 5: System calls
AOS Lab 5: System calls
 
AOS Lab 6: Scheduling
AOS Lab 6: SchedulingAOS Lab 6: Scheduling
AOS Lab 6: Scheduling
 
AOS Lab 9: File system -- Of buffers, logs, and blocks
AOS Lab 9: File system -- Of buffers, logs, and blocksAOS Lab 9: File system -- Of buffers, logs, and blocks
AOS Lab 9: File system -- Of buffers, logs, and blocks
 
Topic 14: Operating Systems and Virtualization
Topic 14: Operating Systems and VirtualizationTopic 14: Operating Systems and Virtualization
Topic 14: Operating Systems and Virtualization
 
The Big Data Stack
The Big Data StackThe Big Data Stack
The Big Data Stack
 
AOS Lab 12: Network Communication
AOS Lab 12: Network CommunicationAOS Lab 12: Network Communication
AOS Lab 12: Network Communication
 
Topic 15: Datacenter Design and Networking
Topic 15: Datacenter Design and NetworkingTopic 15: Datacenter Design and Networking
Topic 15: Datacenter Design and Networking
 

Semelhante a AOS Lab 1: Hello, Linux!

Presentation for RHCE in linux
Presentation  for  RHCE in linux Presentation  for  RHCE in linux
Presentation for RHCE in linux
Kuldeep Tiwari
 
PowerPoint_merge.ppt on unix programming
PowerPoint_merge.ppt on unix programmingPowerPoint_merge.ppt on unix programming
PowerPoint_merge.ppt on unix programming
Priyadarshini648418
 
Online Training in Unix Linux Shell Scripting in Hyderabad
Online Training in Unix Linux Shell Scripting in HyderabadOnline Training in Unix Linux Shell Scripting in Hyderabad
Online Training in Unix Linux Shell Scripting in Hyderabad
Ravikumar Nandigam
 
Linuxtraining 130710022121-phpapp01
Linuxtraining 130710022121-phpapp01Linuxtraining 130710022121-phpapp01
Linuxtraining 130710022121-phpapp01
Chander Pandey
 
GMES_FOR_006_EN_TPZ - Linux - Start-v1.0.pptx
GMES_FOR_006_EN_TPZ - Linux - Start-v1.0.pptxGMES_FOR_006_EN_TPZ - Linux - Start-v1.0.pptx
GMES_FOR_006_EN_TPZ - Linux - Start-v1.0.pptx
AhmedWasiu
 
Unix fundamentals and_shell scripting
Unix fundamentals and_shell scriptingUnix fundamentals and_shell scripting
Unix fundamentals and_shell scripting
Ganesh Bhosale
 
Introduction khgjkhygkjiyhgikjyhgikygkii
Introduction khgjkhygkjiyhgikjyhgikygkiiIntroduction khgjkhygkjiyhgikjyhgikygkii
Introduction khgjkhygkjiyhgikjyhgikygkii
cmdept1
 

Semelhante a AOS Lab 1: Hello, Linux! (20)

Unix _linux_fundamentals_for_hpc-_b
Unix  _linux_fundamentals_for_hpc-_bUnix  _linux_fundamentals_for_hpc-_b
Unix _linux_fundamentals_for_hpc-_b
 
Presentation for RHCE in linux
Presentation  for  RHCE in linux Presentation  for  RHCE in linux
Presentation for RHCE in linux
 
PowerPoint_merge.ppt on unix programming
PowerPoint_merge.ppt on unix programmingPowerPoint_merge.ppt on unix programming
PowerPoint_merge.ppt on unix programming
 
Online Training in Unix Linux Shell Scripting in Hyderabad
Online Training in Unix Linux Shell Scripting in HyderabadOnline Training in Unix Linux Shell Scripting in Hyderabad
Online Training in Unix Linux Shell Scripting in Hyderabad
 
LINUX_admin_commands.pptx
LINUX_admin_commands.pptxLINUX_admin_commands.pptx
LINUX_admin_commands.pptx
 
KMSUnix and Linux.pptx
KMSUnix and Linux.pptxKMSUnix and Linux.pptx
KMSUnix and Linux.pptx
 
redhat_by_Cbitss.ppt
redhat_by_Cbitss.pptredhat_by_Cbitss.ppt
redhat_by_Cbitss.ppt
 
VTU 3RD SEM UNIX AND SHELL PROGRAMMING SOLVED PAPERS
VTU 3RD SEM UNIX AND SHELL PROGRAMMING SOLVED PAPERSVTU 3RD SEM UNIX AND SHELL PROGRAMMING SOLVED PAPERS
VTU 3RD SEM UNIX AND SHELL PROGRAMMING SOLVED PAPERS
 
Linuxtraining 130710022121-phpapp01
Linuxtraining 130710022121-phpapp01Linuxtraining 130710022121-phpapp01
Linuxtraining 130710022121-phpapp01
 
3. intro
3. intro3. intro
3. intro
 
cisco
ciscocisco
cisco
 
Unix Shell Script - 2 Days Session.pptx
Unix Shell Script - 2 Days Session.pptxUnix Shell Script - 2 Days Session.pptx
Unix Shell Script - 2 Days Session.pptx
 
Linux: Everyting-as-a-service
Linux: Everyting-as-a-serviceLinux: Everyting-as-a-service
Linux: Everyting-as-a-service
 
Linux
LinuxLinux
Linux
 
GMES_FOR_006_EN_TPZ - Linux - Start-v1.0.pptx
GMES_FOR_006_EN_TPZ - Linux - Start-v1.0.pptxGMES_FOR_006_EN_TPZ - Linux - Start-v1.0.pptx
GMES_FOR_006_EN_TPZ - Linux - Start-v1.0.pptx
 
2. UNIX OS System Architecture easy.pptx
2. UNIX OS System Architecture easy.pptx2. UNIX OS System Architecture easy.pptx
2. UNIX OS System Architecture easy.pptx
 
Unix fundamentals and_shell scripting
Unix fundamentals and_shell scriptingUnix fundamentals and_shell scripting
Unix fundamentals and_shell scripting
 
Introduction-to-Linux.pptx
Introduction-to-Linux.pptxIntroduction-to-Linux.pptx
Introduction-to-Linux.pptx
 
Introduction-to-Linux.pptx
Introduction-to-Linux.pptxIntroduction-to-Linux.pptx
Introduction-to-Linux.pptx
 
Introduction khgjkhygkjiyhgikjyhgikygkii
Introduction khgjkhygkjiyhgikjyhgikygkiiIntroduction khgjkhygkjiyhgikjyhgikygkii
Introduction khgjkhygkjiyhgikjyhgikygkii
 

Mais de Zubair Nabi (11)

Lab 5: Interconnecting a Datacenter using Mininet
Lab 5: Interconnecting a Datacenter using MininetLab 5: Interconnecting a Datacenter using Mininet
Lab 5: Interconnecting a Datacenter using Mininet
 
Topic 12: NoSQL in Action
Topic 12: NoSQL in ActionTopic 12: NoSQL in Action
Topic 12: NoSQL in Action
 
Lab 4: Interfacing with Cassandra
Lab 4: Interfacing with CassandraLab 4: Interfacing with Cassandra
Lab 4: Interfacing with Cassandra
 
Topic 10: Taxonomy of Data and Storage
Topic 10: Taxonomy of Data and StorageTopic 10: Taxonomy of Data and Storage
Topic 10: Taxonomy of Data and Storage
 
Topic 11: Google Filesystem
Topic 11: Google FilesystemTopic 11: Google Filesystem
Topic 11: Google Filesystem
 
Lab 3: Writing a Naiad Application
Lab 3: Writing a Naiad ApplicationLab 3: Writing a Naiad Application
Lab 3: Writing a Naiad Application
 
Topic 9: MR+
Topic 9: MR+Topic 9: MR+
Topic 9: MR+
 
Topic 8: Enhancements and Alternative Architectures
Topic 8: Enhancements and Alternative ArchitecturesTopic 8: Enhancements and Alternative Architectures
Topic 8: Enhancements and Alternative Architectures
 
Topic 7: Shortcomings in the MapReduce Paradigm
Topic 7: Shortcomings in the MapReduce ParadigmTopic 7: Shortcomings in the MapReduce Paradigm
Topic 7: Shortcomings in the MapReduce Paradigm
 
Lab 1: Introduction to Amazon EC2 and MPI
Lab 1: Introduction to Amazon EC2 and MPILab 1: Introduction to Amazon EC2 and MPI
Lab 1: Introduction to Amazon EC2 and MPI
 
Topic 6: MapReduce Applications
Topic 6: MapReduce ApplicationsTopic 6: MapReduce Applications
Topic 6: MapReduce Applications
 

Último

Tales from a Passkey Provider Progress from Awareness to Implementation.pptx
Tales from a Passkey Provider  Progress from Awareness to Implementation.pptxTales from a Passkey Provider  Progress from Awareness to Implementation.pptx
Tales from a Passkey Provider Progress from Awareness to Implementation.pptx
FIDO Alliance
 
Structuring Teams and Portfolios for Success
Structuring Teams and Portfolios for SuccessStructuring Teams and Portfolios for Success
Structuring Teams and Portfolios for Success
UXDXConf
 
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
panagenda
 
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptxHarnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
FIDO Alliance
 
Hyatt driving innovation and exceptional customer experiences with FIDO passw...
Hyatt driving innovation and exceptional customer experiences with FIDO passw...Hyatt driving innovation and exceptional customer experiences with FIDO passw...
Hyatt driving innovation and exceptional customer experiences with FIDO passw...
FIDO Alliance
 

Último (20)

TopCryptoSupers 12thReport OrionX May2024
TopCryptoSupers 12thReport OrionX May2024TopCryptoSupers 12thReport OrionX May2024
TopCryptoSupers 12thReport OrionX May2024
 
Tales from a Passkey Provider Progress from Awareness to Implementation.pptx
Tales from a Passkey Provider  Progress from Awareness to Implementation.pptxTales from a Passkey Provider  Progress from Awareness to Implementation.pptx
Tales from a Passkey Provider Progress from Awareness to Implementation.pptx
 
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
 
Easier, Faster, and More Powerful – Notes Document Properties Reimagined
Easier, Faster, and More Powerful – Notes Document Properties ReimaginedEasier, Faster, and More Powerful – Notes Document Properties Reimagined
Easier, Faster, and More Powerful – Notes Document Properties Reimagined
 
Extensible Python: Robustness through Addition - PyCon 2024
Extensible Python: Robustness through Addition - PyCon 2024Extensible Python: Robustness through Addition - PyCon 2024
Extensible Python: Robustness through Addition - PyCon 2024
 
Structuring Teams and Portfolios for Success
Structuring Teams and Portfolios for SuccessStructuring Teams and Portfolios for Success
Structuring Teams and Portfolios for Success
 
Microsoft CSP Briefing Pre-Engagement - Questionnaire
Microsoft CSP Briefing Pre-Engagement - QuestionnaireMicrosoft CSP Briefing Pre-Engagement - Questionnaire
Microsoft CSP Briefing Pre-Engagement - Questionnaire
 
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
 
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptxHarnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
 
How we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdfHow we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdf
 
Design Guidelines for Passkeys 2024.pptx
Design Guidelines for Passkeys 2024.pptxDesign Guidelines for Passkeys 2024.pptx
Design Guidelines for Passkeys 2024.pptx
 
Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...
Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...
Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...
 
Portal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russePortal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russe
 
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
 
WebRTC and SIP not just audio and video @ OpenSIPS 2024
WebRTC and SIP not just audio and video @ OpenSIPS 2024WebRTC and SIP not just audio and video @ OpenSIPS 2024
WebRTC and SIP not just audio and video @ OpenSIPS 2024
 
Your enemies use GenAI too - staying ahead of fraud with Neo4j
Your enemies use GenAI too - staying ahead of fraud with Neo4jYour enemies use GenAI too - staying ahead of fraud with Neo4j
Your enemies use GenAI too - staying ahead of fraud with Neo4j
 
AI mind or machine power point presentation
AI mind or machine power point presentationAI mind or machine power point presentation
AI mind or machine power point presentation
 
Intro in Product Management - Коротко про професію продакт менеджера
Intro in Product Management - Коротко про професію продакт менеджераIntro in Product Management - Коротко про професію продакт менеджера
Intro in Product Management - Коротко про професію продакт менеджера
 
(Explainable) Data-Centric AI: what are you explaininhg, and to whom?
(Explainable) Data-Centric AI: what are you explaininhg, and to whom?(Explainable) Data-Centric AI: what are you explaininhg, and to whom?
(Explainable) Data-Centric AI: what are you explaininhg, and to whom?
 
Hyatt driving innovation and exceptional customer experiences with FIDO passw...
Hyatt driving innovation and exceptional customer experiences with FIDO passw...Hyatt driving innovation and exceptional customer experiences with FIDO passw...
Hyatt driving innovation and exceptional customer experiences with FIDO passw...
 

AOS Lab 1: Hello, Linux!

  • 1. Lab 1: Hello, Linux! Advanced Operating Systems Zubair Nabi zubair.nabi@itu.edu.pk January 23, 2013
  • 2. Unix • Multi-task, multi-user OS out of Bell Labs in 19691 • Initially in Assembly but later in C (1973)2 • Code recycling! • Ken Thompson, Dennis Ritchie, Brian Kernighan, Douglas McIlroy, Michael Lesk and Joe Ossanna • Branched into BSD (FreeBSD, NetBSD, etc.) 1 2 http://www.youtube.com/watch?v=tc4ROCJYbm0 Dennis M. Ritchie and Ken Thompson. 1974. The UNIX time-sharing system. Commun. ACM 17, 7 (July 1974), 365-375. DOI=10.1145/361011.361061
  • 3. Linux • Linux (circa 1991) is a Unix-clone under FOSS • Comes in many flavours/distributions (distros): Linux kernel3 + GUI (optional) + application/software suite • bash (shell) + GCC + GDB + coreutils • 600+ distros • Popular ones: Ubuntu, Fedora, Debian, Gentoo, SUSE, etc. • Now being used atop desktops, servers, and mobile/embedded systems Linus Torvalds: comp.os.minix mailing list (1991-08-25) I’m doing a (free) operating system (just a hobby, won’t be big and professional like gnu) for 386(486) AT clones. 3 http://www.kernel.org/
  • 4. Ubuntu • Built on top of Debian and developed/distributed by Canonical Ltd. • Most popular desktop/laptop distribution • Applications: LibreOffice, Firefox (web browser), Thunderbird (email/chat/news), Empathy (IM/VoIP), etc. • Variants: Ubuntu Deskop, Ubuntu Server, Ubuntu for Phones, etc.
  • 5. Linux guide(s) • Introduction to Linux: A Hands on Guide; Achtelt Garrels; CreateSpace Independent Publishing Platform Available online: http://www.tldp.org/LDP/intro-linux/html/
  • 6. Common commands Command ls cd file cat pwd man logout/exit Description List the contents of a directory Change directory (jump across the filesystem tree) Display file type Send file contents to standard output Display current working directory Display manual page Close the current session
  • 7. Files Everything is a file On a UNIX system, everything is a file; if something is not a file, it is a process. Type Regular (-) Directory (d) Special (c) Links (l) Domain sockets (s) Named pipes (p) Block device files (b) Description Ordinary files To list other files Used for input/output Pointers to other files IPC through TCP/IP-like sockets IPC enablers To represent block devices
  • 8. Partitioning • Divides the disk device into multiple logical storage units • Data partitions contain regular user data • Swap partitions house the swap space • Attached to the file system at mount points • df displays free disk space in active partitions
  • 9. Filesystem layout Type /bin /boot /dev /etc /home /lib /lost+found /media /mnt /opt /proc Description Programs shared by users, administrators, and the system itself Start-up files Hardware devices Configuration files Home directories of users Library files for programs and the system Files saved in case of failure Mount point for removable media Mount point for external filesystems Third-party software Information about system resources (userspace window into kernel data structures)
  • 10. Filesystem layout (2) /sbin /tmp /usr /var Programs shared by administrators and the system Temporary space User processes and libraries Files which change size regularly, e.g. log files, etc.
  • 11. Paths, environment variables, and home directories • Two types of paths: 1 Relative: Relative to the current working directory • ∼: Relative to home directory 2 Absolute: Starting from the root directory • Environment variables: Contain dynamic values that change the behaviour of running programs, e.g. PATH, HOME, etc. • Each user has a home directory
  • 12. Manipulating files/directories • Create directory: mkdir • Move file/directory: mv • Copy file/directory: cp • Remove file/directory: rm • Find file/directory: find <path> -name <filename>
  • 13. Manipulating files and their contents • Filter results: grep • Invert: -v • Display values from the top: head • Display values from the bottom: tail • Display unique values: uniq • Change file permissions: chmod • Permissions: -, r, w, x (bit masks) • Permission categories: owner, group, everyone else • Count number of lines (-l), words (-w), and bytes(-c): wc
  • 14. Pipes and input/output redirection • Pipe (|): Redirect standard output to standard input • Input/output redirection (<>): Redirect standard input or output to a file • Appending redirection: << or >> • Replacing a string in place: sed -i s/<original_string>/<new_string>/ <file> • Replacing a string and copying into a new file: sed s/<original_string>/<new_string>/ <input_file> > <output_file>
  • 15. Shell scripts • Shell commands can be put into a file and executed as a script • A file can be made executable through chmod
  • 16. Today’s Task • Write a bash script that: 1 2 3 4 5 Creates two folders in your home directory: 1) temp, and 2) results, Copies both dictionaries into temp and renames them to american-english-dictionary and british-english-dictionary, Counts the total number of lines in both dictionaries and stores them in count-british-english-dictionary and count-american-english-dictionary in the results folder, Stores unique American English words (not present in the British English dictionary) in unique-american-english and unique British English words (not present in the American English dictionary) in unique-british-english in the results folder, Stores common words (present in both dictionaries) in common-english in the results folder.