SlideShare a Scribd company logo
Tarcisio Coutinho
16 Nov 2012
Dev-day
Linux - 101
Timeline
● 1965 :: MULTICS :: MTI, Bell Labs (AT&T) e General
Eletric
● 1969 :: Ken Thompson :: Unics (Assembly)
● 1971 :: Ken Thompson :: Rewrites the system on B
language (to solve portability problems)
● 1973 :: Thompson and Denis Richie :: C programming
language
● 1974 :: UNIX o/
● 1983 :: AT&T closes the UNIX's source code
● 1983 :: Andrew Tanenbaum :: MINIX
● 1984 :: Richard Stallman :: GNU (GCC, Emacs)
● 1991 :: Linux Torvalds :: GNU/Linux
GNU/Linux Distribution Timeline
http://futurist.se/gldt/
GNU/Linux
GNU/Linux Structure
Shell
What is Shell?
● Provides the command prompt and to interpret
commands
● Provides user interface for the OS and Kernel
Shell implementations
● bash (bourne again shell :: GNU implementation)
● ash (Almquist Shell :: BSD)
● csh (C shell :: BSD)
● tcsh (tee-shell)
● sh (Stephen Bourne)
● ksh (Korn shell)
Shell Variable Basics
● bash maintains a set of shell variables
○ PS1 :: Prompt String 1 :: Default interaction
○ PS2 :: Prompt String 1 :: Continuation interactive
prompt
○ PATH :: contains a list of all the directories that
hold commands or other programs you are likely to
execute
● bash variables are untyped
Export Variables
● When a variable is exported to the environment, it is
passed into the environment of all child processes
● let's go to the terminal
○ REDU="Redu Tech"
■ conventionally uppercase
○ echo $REDU or echo ${REDU}
■ $ prefix to interpret a shell var
○ echo "echo $REDU" | bash
Fun with PS1 :: Information
● u - Username
● h - Hostname
● w - Full path of the current woking directory
export PS1="u@h w"
export PS1="u@redu: w "
Fun with PS1 :: Colors
● e[ :: indicates the beginning of color
● x;ym :: indicates color code
● e[m :: indicates end of color prompt
White 1;37
Green 1;32
Cyan 1;36
Yellow 1;33
PS1="e[01;32mue[m@redu: w "
PS1="e[01;32mue[me[1;37m@e
[mredu: w "
PS1="e[01;32mue[me[1;37m@e
[me[1;36mredu:e[m w "
PS1="e[01;32mue[me[1;37m@e
[me[1;36mredu:e[me[1;33mwe
[m "
Streams, Pipes
and Redirects
Streams
● Everything is a file.
○ a program reading from the terminal’s device file
will receive characters typed at the keyboard
● When a program is launched, it is automatically
provided with three file descriptors
○ Standard input (abbreviated stdin) :: 0
○ Standard output (abbreviated stdout) :: 1
○ Standard error (abbreviated stderr) :: 2
● The standard input is different than parameters
Pipes and Redirects
● Pipes |
○ provides communication inter-process
■ tie the output of one program to the input of
another
■ e.g. echo "echo 'Hello Redu'" | bash
● Redirection
○ allows you to manage the origin of input streams
and the destination of output streams
■ > :: Redirection operator
■ >> :: Append operator
■ < :: Receive stdin from file
GNU and Unix
Commands
Tricks
● cd - :: go to the recent directory
○ Works with git branches
■ git checkout -
● !! :: call most recent command
○ bang-bang
● $( ) :: Command substitution or sub-shell
○ cd $(pwd)/..
GNU and Unix
sed & awk
Sed
● Stream based processing text editor
echo "sed tutorial. sed is a powerful text editor" |
sed 's/sed/awk/'
echo "sed tutorial. sed is a powerful text editor" |
sed 's/sed/awk/g'
echo "sed tutorial. sed is a powerful text editor" |
sed 's/sed/awk/2g'
Sed
echo "line without numbers nline with numbers: 1 2 3 " |
sed -r 's/[0-9]+/X/g'
echo "line without numbers nline with numbers: 1 2 3 " |
sed -rn 's/[0-9]+/X/g'
echo "line without numbers nline with numbers: 1 2 3 " |
sed -rn 's/[0-9]+/X/gp'
Sed
● Delete lines
○ sed '1,2-3 d' [FILE]
○ sed '/[pattern]/d [FILE]
○ sed -i '1 d' [FILE]
● Add lines
○ sed '/[pattern]/ i [text]' [FILE]
○ sed '/[pattern]/ a [text]' [FILE]
○ sed "1s/^/[text]" [FILE]
Awk
● AWK
○ processing text programming language
■ column based
awk -F [pattern] '{ [CMD] }'
$n -> variable from split by pattern match
ls -l | awk -F ' ' '{print $0}'
Quests
Fun with Seds
● Parse rails logs
○ Request count development.log
○ Top 10 most slow compound log job
grep awk head wc
uniq sort tail sed 'N;'
sed cut nl expand
tr
Dev-day
Linux - 101

More Related Content

What's hot

bpftrace - Tracing Summit 2018
bpftrace - Tracing Summit 2018bpftrace - Tracing Summit 2018
bpftrace - Tracing Summit 2018
AlastairRobertson9
 
Code Smart - Makefile (special release)
Code Smart - Makefile (special release)Code Smart - Makefile (special release)
Code Smart - Makefile (special release)
Yu-Chuan Pi
 
IPython from 30,000 feet
IPython from 30,000 feetIPython from 30,000 feet
IPython from 30,000 feet
takluyver
 
ncurses in your hobostove
ncurses in your hobostovencurses in your hobostove
ncurses in your hobostoveSmartLogic
 
Unix command quickref
Unix command quickrefUnix command quickref
Unix command quickref
Arduino Aficionado
 
Cryptography : From Demaratus to RSA
Cryptography : From Demaratus to RSACryptography : From Demaratus to RSA
Cryptography : From Demaratus to RSA
benlamm
 
Trip itparsing
Trip itparsingTrip itparsing
Trip itparsingCapIpad
 
MFC Menu
MFC MenuMFC Menu
関西Vim勉強会#5 vimrcの書き方
関西Vim勉強会#5 vimrcの書き方関西Vim勉強会#5 vimrcの書き方
関西Vim勉強会#5 vimrcの書き方
tsukkee _
 
Class & sub class
Class & sub classClass & sub class
Class & sub class
HSS-Software House
 
Graphics 32 bit
Graphics 32 bitGraphics 32 bit
Graphics 32 bit
Asjad Ali
 
Doubly linklist
Doubly linklistDoubly linklist
Doubly linklist
ilsamaryum
 
Code
CodeCode
Script
ScriptScript
Script
fauzasmg
 
Golang勉強会
Golang勉強会Golang勉強会
Golang勉強会
Shin Sekaryo
 
Linux for Beginners
Linux for  BeginnersLinux for  Beginners
Linux for Beginners
Gobinath Loganathan
 

What's hot (19)

Ssh
SshSsh
Ssh
 
bpftrace - Tracing Summit 2018
bpftrace - Tracing Summit 2018bpftrace - Tracing Summit 2018
bpftrace - Tracing Summit 2018
 
Code Smart - Makefile (special release)
Code Smart - Makefile (special release)Code Smart - Makefile (special release)
Code Smart - Makefile (special release)
 
FSE 2008
FSE 2008FSE 2008
FSE 2008
 
IPython from 30,000 feet
IPython from 30,000 feetIPython from 30,000 feet
IPython from 30,000 feet
 
ncurses in your hobostove
ncurses in your hobostovencurses in your hobostove
ncurses in your hobostove
 
Unix command quickref
Unix command quickrefUnix command quickref
Unix command quickref
 
Cryptography : From Demaratus to RSA
Cryptography : From Demaratus to RSACryptography : From Demaratus to RSA
Cryptography : From Demaratus to RSA
 
Trip itparsing
Trip itparsingTrip itparsing
Trip itparsing
 
MFC Menu
MFC MenuMFC Menu
MFC Menu
 
Jose dossantos.doc
Jose dossantos.docJose dossantos.doc
Jose dossantos.doc
 
関西Vim勉強会#5 vimrcの書き方
関西Vim勉強会#5 vimrcの書き方関西Vim勉強会#5 vimrcの書き方
関西Vim勉強会#5 vimrcの書き方
 
Class & sub class
Class & sub classClass & sub class
Class & sub class
 
Graphics 32 bit
Graphics 32 bitGraphics 32 bit
Graphics 32 bit
 
Doubly linklist
Doubly linklistDoubly linklist
Doubly linklist
 
Code
CodeCode
Code
 
Script
ScriptScript
Script
 
Golang勉強会
Golang勉強会Golang勉強会
Golang勉強会
 
Linux for Beginners
Linux for  BeginnersLinux for  Beginners
Linux for Beginners
 

Similar to Dev day linux redu

Unix Ramblings
Unix RamblingsUnix Ramblings
Unix Ramblings
Bill Miller
 
Linux Commands - Cheat Sheet
Linux Commands - Cheat Sheet Linux Commands - Cheat Sheet
Linux Commands - Cheat Sheet
Isham Rashik
 
Unleash your inner console cowboy
Unleash your inner console cowboyUnleash your inner console cowboy
Unleash your inner console cowboy
Kenneth Geisshirt
 
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
 
Perl - laziness, impatience, hubris, and one liners
Perl - laziness, impatience, hubris, and one linersPerl - laziness, impatience, hubris, and one liners
Perl - laziness, impatience, hubris, and one liners
Kirk Kimmel
 
Unleash your inner console cowboy
Unleash your inner console cowboyUnleash your inner console cowboy
Unleash your inner console cowboy
Kenneth Geisshirt
 
lect01.ppt
lect01.pptlect01.ppt
lect01.ppt
DrSamsonChepuri1
 
Terminals and Shells
Terminals and ShellsTerminals and Shells
Terminals and Shells
Hoffman Lab
 
Linux tech talk
Linux tech talkLinux tech talk
Linux tech talk
Prince Raj
 
Mac OSX Terminal 101
Mac OSX Terminal 101Mac OSX Terminal 101
Mac OSX Terminal 101
Murugun Murugun
 
101 3.1 gnu and unix commands
101 3.1 gnu and unix commands101 3.1 gnu and unix commands
101 3.1 gnu and unix commandsAcácio Oliveira
 
Unit 6 bash shell
Unit 6 bash shellUnit 6 bash shell
Unit 6 bash shellroot_fibo
 
Getting started with the Terminal
Getting started with the TerminalGetting started with the Terminal
Getting started with the Terminal
Wade Armstrong
 
01 linux basics
01 linux basics01 linux basics
01 linux basics
Robson Levi
 
10.8.2018
10.8.201810.8.2018
10.8.2018
Rajes Wari
 
01_linux_basics.ppt
01_linux_basics.ppt01_linux_basics.ppt
01_linux_basics.ppt
Mahmood Adel
 
Tomáš Čorej: Configuration management & CFEngine3
Tomáš Čorej: Configuration management & CFEngine3Tomáš Čorej: Configuration management & CFEngine3
Tomáš Čorej: Configuration management & CFEngine3
Jano Suchal
 
Introduction to-linux
Introduction to-linuxIntroduction to-linux
Introduction to-linux
kishore1986
 
Linuxcommands 091018105536-phpapp01
Linuxcommands 091018105536-phpapp01Linuxcommands 091018105536-phpapp01
Linuxcommands 091018105536-phpapp01
Nagarajan Kamalakannan
 
Unix fundamentals and_shell scripting
Unix fundamentals and_shell scriptingUnix fundamentals and_shell scripting
Unix fundamentals and_shell scripting
Ganesh Bhosale
 

Similar to Dev day linux redu (20)

Unix Ramblings
Unix RamblingsUnix Ramblings
Unix Ramblings
 
Linux Commands - Cheat Sheet
Linux Commands - Cheat Sheet Linux Commands - Cheat Sheet
Linux Commands - Cheat Sheet
 
Unleash your inner console cowboy
Unleash your inner console cowboyUnleash your inner console cowboy
Unleash your inner console cowboy
 
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
 
Perl - laziness, impatience, hubris, and one liners
Perl - laziness, impatience, hubris, and one linersPerl - laziness, impatience, hubris, and one liners
Perl - laziness, impatience, hubris, and one liners
 
Unleash your inner console cowboy
Unleash your inner console cowboyUnleash your inner console cowboy
Unleash your inner console cowboy
 
lect01.ppt
lect01.pptlect01.ppt
lect01.ppt
 
Terminals and Shells
Terminals and ShellsTerminals and Shells
Terminals and Shells
 
Linux tech talk
Linux tech talkLinux tech talk
Linux tech talk
 
Mac OSX Terminal 101
Mac OSX Terminal 101Mac OSX Terminal 101
Mac OSX Terminal 101
 
101 3.1 gnu and unix commands
101 3.1 gnu and unix commands101 3.1 gnu and unix commands
101 3.1 gnu and unix commands
 
Unit 6 bash shell
Unit 6 bash shellUnit 6 bash shell
Unit 6 bash shell
 
Getting started with the Terminal
Getting started with the TerminalGetting started with the Terminal
Getting started with the Terminal
 
01 linux basics
01 linux basics01 linux basics
01 linux basics
 
10.8.2018
10.8.201810.8.2018
10.8.2018
 
01_linux_basics.ppt
01_linux_basics.ppt01_linux_basics.ppt
01_linux_basics.ppt
 
Tomáš Čorej: Configuration management & CFEngine3
Tomáš Čorej: Configuration management & CFEngine3Tomáš Čorej: Configuration management & CFEngine3
Tomáš Čorej: Configuration management & CFEngine3
 
Introduction to-linux
Introduction to-linuxIntroduction to-linux
Introduction to-linux
 
Linuxcommands 091018105536-phpapp01
Linuxcommands 091018105536-phpapp01Linuxcommands 091018105536-phpapp01
Linuxcommands 091018105536-phpapp01
 
Unix fundamentals and_shell scripting
Unix fundamentals and_shell scriptingUnix fundamentals and_shell scripting
Unix fundamentals and_shell scripting
 

Recently uploaded

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
 
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
 
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
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
DianaGray10
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 
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
 
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
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
RTTS
 
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
 
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
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
Elena Simperl
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
BookNet Canada
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
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
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
Product School
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
Ana-Maria Mihalceanu
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
Product School
 
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
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
Cheryl Hung
 

Recently uploaded (20)

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...
 
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
 
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
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 
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
 
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
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
 
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
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
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
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
 
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
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 

Dev day linux redu

  • 1. Tarcisio Coutinho 16 Nov 2012 Dev-day Linux - 101
  • 2. Timeline ● 1965 :: MULTICS :: MTI, Bell Labs (AT&T) e General Eletric ● 1969 :: Ken Thompson :: Unics (Assembly) ● 1971 :: Ken Thompson :: Rewrites the system on B language (to solve portability problems) ● 1973 :: Thompson and Denis Richie :: C programming language ● 1974 :: UNIX o/ ● 1983 :: AT&T closes the UNIX's source code ● 1983 :: Andrew Tanenbaum :: MINIX ● 1984 :: Richard Stallman :: GNU (GCC, Emacs) ● 1991 :: Linux Torvalds :: GNU/Linux
  • 7. What is Shell? ● Provides the command prompt and to interpret commands ● Provides user interface for the OS and Kernel
  • 8. Shell implementations ● bash (bourne again shell :: GNU implementation) ● ash (Almquist Shell :: BSD) ● csh (C shell :: BSD) ● tcsh (tee-shell) ● sh (Stephen Bourne) ● ksh (Korn shell)
  • 9. Shell Variable Basics ● bash maintains a set of shell variables ○ PS1 :: Prompt String 1 :: Default interaction ○ PS2 :: Prompt String 1 :: Continuation interactive prompt ○ PATH :: contains a list of all the directories that hold commands or other programs you are likely to execute ● bash variables are untyped
  • 10. Export Variables ● When a variable is exported to the environment, it is passed into the environment of all child processes ● let's go to the terminal ○ REDU="Redu Tech" ■ conventionally uppercase ○ echo $REDU or echo ${REDU} ■ $ prefix to interpret a shell var ○ echo "echo $REDU" | bash
  • 11. Fun with PS1 :: Information ● u - Username ● h - Hostname ● w - Full path of the current woking directory
  • 14. Fun with PS1 :: Colors ● e[ :: indicates the beginning of color ● x;ym :: indicates color code ● e[m :: indicates end of color prompt White 1;37 Green 1;32 Cyan 1;36 Yellow 1;33
  • 20. Streams ● Everything is a file. ○ a program reading from the terminal’s device file will receive characters typed at the keyboard ● When a program is launched, it is automatically provided with three file descriptors ○ Standard input (abbreviated stdin) :: 0 ○ Standard output (abbreviated stdout) :: 1 ○ Standard error (abbreviated stderr) :: 2 ● The standard input is different than parameters
  • 21. Pipes and Redirects ● Pipes | ○ provides communication inter-process ■ tie the output of one program to the input of another ■ e.g. echo "echo 'Hello Redu'" | bash ● Redirection ○ allows you to manage the origin of input streams and the destination of output streams ■ > :: Redirection operator ■ >> :: Append operator ■ < :: Receive stdin from file
  • 23. Tricks ● cd - :: go to the recent directory ○ Works with git branches ■ git checkout - ● !! :: call most recent command ○ bang-bang ● $( ) :: Command substitution or sub-shell ○ cd $(pwd)/..
  • 25. Sed ● Stream based processing text editor echo "sed tutorial. sed is a powerful text editor" | sed 's/sed/awk/' echo "sed tutorial. sed is a powerful text editor" | sed 's/sed/awk/g' echo "sed tutorial. sed is a powerful text editor" | sed 's/sed/awk/2g'
  • 26. Sed echo "line without numbers nline with numbers: 1 2 3 " | sed -r 's/[0-9]+/X/g' echo "line without numbers nline with numbers: 1 2 3 " | sed -rn 's/[0-9]+/X/g' echo "line without numbers nline with numbers: 1 2 3 " | sed -rn 's/[0-9]+/X/gp'
  • 27. Sed ● Delete lines ○ sed '1,2-3 d' [FILE] ○ sed '/[pattern]/d [FILE] ○ sed -i '1 d' [FILE] ● Add lines ○ sed '/[pattern]/ i [text]' [FILE] ○ sed '/[pattern]/ a [text]' [FILE] ○ sed "1s/^/[text]" [FILE]
  • 28. Awk ● AWK ○ processing text programming language ■ column based awk -F [pattern] '{ [CMD] }' $n -> variable from split by pattern match ls -l | awk -F ' ' '{print $0}'
  • 30. Fun with Seds ● Parse rails logs ○ Request count development.log ○ Top 10 most slow compound log job grep awk head wc uniq sort tail sed 'N;' sed cut nl expand tr