SlideShare a Scribd company logo
Why and How PowerShell will rule the command line ilya haykinson / ilya@hulu.com
/Text
/Text/Provides
/Text/Provides/Context
/Text/Provides/Structure
/Text/Provides/Uniformity
# echo “ text is comfortable ”
# echo “ the inputs are limited by the keys on the keyboard ”
# echo “ there’s nothing to click ”
$ echo “ text interfaces were around in our early computers ”
[user@localhost ~]$ echo “ they’re still around now ”
mysql> select ‘ we talk text to our databases ’
(gdb) print “ and to debuggers ”
A:> echo  to systems that are old
C:sersdministrator> echo  even to systems that are new
“ we use text to command our computers to do our bidding ”
“ we’ve created little programs ”
“ commands ”
“ with funny names ”
“ like ‘tar’ or ‘finger’ or ‘mount’ ”
“ with cryptic names ”
“ or ‘ps’ or ‘cacls’ or ‘fsck’ or ‘df’ ”
“ we created ways for these programs ”
cat  to_talk  | grep -e “.* to one another ” >>  using_pipes
# echo “ we added $variables ”
# echo “ and `functions` ”
# echo " and  `(cat -s /tmp/ other  ) && (echo '  concepts ')`"
Set  or_Special  = Wscript.CreateObject("Scripting.FileSystemObject") strFolder = “ programming languages ”  or_Special.DeleteFolder(strFolder) Wscript.Echo “ to solve every day problems and run our computers well ”
“ and then we did something strange and rather confusing ”
“ we made all these programs ”
“ talk text to one another ”
“ this text is fine for us, humans ”
22:39:55 up 21 days, 18:39,  4 users,  load average: 0.05, 0.14, 0.15 USER  TTY  FROM  LOGIN@  IDLE  JCPU  PCPU WHAT we_know  pts/0  pool-72-71-240-1 00:58  21:41m  4.39s  4.35s pine user123  pts/2  lgb-static-66.18 Fri17  29:11m  0.01s  0.01s -bash how_to   pts/3  understand 33-22l 21:38  0.00s  0.29s  0.03s sshd: howto [priv] what_we  pts/4  lgb-static-66.18 Fri12  29:22m  0.04s  0.04s  see
“ but a computer has to parse ”
“ so we build a command ”
“ we give it a lot of intelligence ”
“ we empower it to do one thing, and do it really, really well ”
“ using brilliant data structures to store the data during processing ”
“ it comes up with great output ”
“ that ends up as text ”
“ and then the next command ”
“ in our pipeline ”
“ has to understand that text ”
“ figure out how to separate the ”
/dev/ important  / ext3 rw 0 0 /dev/md1 /usr/ from  proc rw 0 0 #/dev/ the  / not so much  0 0
“ so that it can get this data ”
“ back into brilliant data structures for processing ”
 
“ doing one thing well does not mean that we have to deal with text ”
“ doing one thing well does not mean having your own command line parameter syntax ”
ps -ef ps -aux ps aux
ls -a ls --all wget -e wget --execute
“ a command does not live on its own, even if it’s single-purposed ”
“ it lives in a shell environment ”
“ and interacts, indirectly, with other commands ”
“ so enter PowerShell ”
“ it’s a command shell for Windows operating systems ”
“ and an evolved approach to how commands can interact ”
“ it holds that each command ”
“ should do only one thing ”
“ and do it very well ”
“ and that anyone should be able to write a new command ”
“ and that commands are to be connected by pipes ”
“ and that you need variables and control structures ”
“ it’s really a fully-fledged programming language ”
“ you talk to it using text ”
“ but it talks to you using objects ”
“ and talks to itself using objects ”
“ you can see those objects ”
“ or just see the text that represents them ”
 
“ in PowerShell, the command is called a ‘cmdlet’ ”
“ pronounced ‘commandlet’ ”
“ commands have a common naming pattern ”
“ ’ verb-noun’ ”
Get-ChildItem Move-Item Sort-Object Set-Location Where-Object
“ these commands can also have easier to remember aliases ”
Get-ChildItem = dir, ls, gci Move-Item = move, mv, mi Sort-Object = sort Set-Location = cd, chdir, sl Where-Object = where, ?
“ each command manipulates objects ”
“ for example, ‘dir c: gets a listing of files in the root directory ”
“ but you can also say ‘dir HKLM:oftwareicrosoft to iterate the registry ”
“ because ‘dir’ just means ‘Get-ChildItem’ – get a list of children of an object that is a container ”
“ the file system’s directories are considered containers ”
“ as are registry keys ”
PS C:indowsystem32riverstc>  dir   Directory: Microsoft.PowerShell.CoreileSystem::C:indowsystem32riverstc Mode  LastWriteTime  Length Name ----  -------------  ------ ---- -a---  4/2/2007  3:51 AM  829 hosts -a---  9/18/2006  2:41 PM  3683 lmhosts.sam -a---  9/18/2006  2:41 PM  407 networks -a---  9/18/2006  2:41 PM  1358 protocol -a---  9/18/2006  2:41 PM  17244 services
“ actually, the whole command line operates on objects ”
“ if you do nothing else with them, they will be displayed as text ”
“ if you pass them on, they will be processed as objects ”
PS C:indowsystem32riverstc>  $x = dir PS C:indowsystem32riverstc>  $x   Directory: Microsoft.PowerShell.CoreileSystem::C:indowsystem32riverstc Mode  LastWriteTime  Length Name ----  -------------  ------ ---- -a---  4/2/2007  3:51 AM  829 hosts -a---  9/18/2006  2:41 PM  3683 lmhosts.sam -a---  9/18/2006  2:41 PM  407 networks -a---  9/18/2006  2:41 PM  1358 protocol -a---  9/18/2006  2:41 PM  17244 services
PS C:indowsystem32riverstc>  $x[0]   Directory: Microsoft.PowerShell.CoreileSystem::C:indowsystem32riverstc Mode  LastWriteTime  Length Name ----  -------------  ------ ---- -a---  4/2/2007  3:51 AM  829 hosts
PS C:indowsystem32riverstc>  $x[0].Name hosts
PS C:indowsystem32riverstc>  dir | where { $_.Name -eq "hosts" }   Directory: Microsoft.PowerShell.CoreileSystem::C:indowsystem32riverstc Mode  LastWriteTime  Length Name ----  -------------  ------ ---- -a---  4/2/2007  3:51 AM  829 hosts
Get-ChildItem | Where-Object { $_.Name -eq "hosts" } Dir | Where { $_.Name -eq “hosts” } ls|?{ $_.Name -eq “hosts”}
PS C:indowsystem32riverstc>  dir | foreach { "The file $($_.Name) is $($_.Length) bytes long" } The file hosts is 829 bytes long The file lmhosts.sam is 3683 bytes long The file networks is 407 bytes long The file protocol is 1358 bytes long The file services is 17244 bytes long
PS C:indowsystem32riverstc>  dir | measure-object -property Length -Sum Count  : 5 Average  : Sum  : 23521 Maximum  : Minimum  : Property : Length
PS C:indowsystem32riverstc>  dir | foreach { $_.Length } | Measure-Object -Sum Count  : 5 Average  : Sum  : 23521 Maximum  : Minimum  : Property :
PS C:gt;  get-process | where { $_.WorkingSet -gt 150MB } Handles  NPM(K)  PM(K)  WS(K) VM(M)  CPU(s)  Id ProcessName -------  ------  -----  ----- -----  ------  -- -----------   658  19  175704  155676  470  506.77  36964 firefox PS C:gt;  get-process | where { $_.WorkingSet -gt 150MB } | stop-process
PS C:gt;  get-process | where { $_.Name -eq 'firefox' } | format-list * __NounName  : Process Name  : firefox Handles  : 333 VM  : 207273984 WS  : 101548032 PM  : 84729856 NPM  : 18560 Path  : C:rogram Filesozilla Firefoxirefox.exe Company  : Mozilla Corporation CPU  : 11.9028763 FileVersion  : 1.8.1.9: 2007102514 ProductVersion  : 2.0.0.9 Description  : Firefox Product  : Firefox Id  : 6052 PriorityClass  : Normal HandleCount  : 333 WorkingSet  : 101548032 PagedMemorySize  : 84729856 ...
PS C:gt;  function multBy2 { $_ * 2 } PS C:gt;  1..10 | foreach { multBy2 } 2 4 6 8 10 12 14 16 18 20
PS C:gt;  function concat($a, $b) { "$a-$b" } PS C:gt;  concat "hello" "there" hello-there PS C:gt;   concat -a "hello" -b "there" hello-there PS C:gt;  concat -b "hello" -a "there" there-hello
PS C:gt;  [System.Net.Dns]::GetHostByName("localhost") | fl HostName  : TARDIS Aliases  : {} AddressList : {127.0.0.1}
PS C:gt;  $rssUrl = "http://twitter.com/statuses/friends_timeline/766734.rss" PS C:gt;  $blog = [xml] (new-object system.net.webclient).DownloadString($rssUrl) PS C:gt;  $blog.rss.channel.item | select title -first 8 title ----- ori: @ori thinks there's a lot of drunk-twittering going on at barcampla. Yeah I just referred to myself in the thir... Zadi: Going to curl up and watch Eraserhead, finally. 'Night guys. Remember to turn back the clock. annieisms: i can haz crochet mouse? http://tinyurl.com/3ylmj7 ccg: hey BarCampers (and others) remember to set your clocks (and by clocks, I mean phones) back an hour tonight, Ya... Mickipedia: Everyone follow @egredman for some great music! Mickipedia: ...and party every day! heathervescent: Omg theses french djs blown mah mind. groby: @barcampla Clearly, you guys don't know what's good! Salty Black Licorice FTW! ;)
 
“ there is more to PowerShell ”
“ you can write GUI apps in it, if you really want to ”
“ you can administer servers ”
“ you can completely replace your normal cmd.exe usage with it ”
“ but even if you ignore it ”
“ remember its lessons ”
“ about the power of text ”
“ and the power of objects ”
thank you

More Related Content

What's hot

Introduction To Windows Power Shell
Introduction To Windows Power ShellIntroduction To Windows Power Shell
Introduction To Windows Power Shell
Microsoft TechNet
 
Pycon - Python for ethical hackers
Pycon - Python for ethical hackers Pycon - Python for ethical hackers
Pycon - Python for ethical hackers
Mohammad Reza Kamalifard
 
Programming with Python and PostgreSQL
Programming with Python and PostgreSQLProgramming with Python and PostgreSQL
Programming with Python and PostgreSQL
Peter Eisentraut
 
Getting Started with PL/Proxy
Getting Started with PL/ProxyGetting Started with PL/Proxy
Getting Started with PL/Proxy
Peter Eisentraut
 
PM : code faster
PM : code fasterPM : code faster
PM : code faster
PHPPRO
 
PowerShell-1
PowerShell-1PowerShell-1
PowerShell-1
Saravanan G
 
Node.js API 서버 성능 개선기
Node.js API 서버 성능 개선기Node.js API 서버 성능 개선기
Node.js API 서버 성능 개선기
JeongHun Byeon
 
Final opensource record 2019
Final opensource record 2019Final opensource record 2019
Final opensource record 2019
Karthik Sekhar
 
Mastering power shell - Windows
Mastering power shell - WindowsMastering power shell - Windows
Mastering power shell - Windows
Ariel Devulsky
 
Non-Relational Postgres / Bruce Momjian (EnterpriseDB)
Non-Relational Postgres / Bruce Momjian (EnterpriseDB)Non-Relational Postgres / Bruce Momjian (EnterpriseDB)
Non-Relational Postgres / Bruce Momjian (EnterpriseDB)
Ontico
 
PostgreSQL and PL/Java
PostgreSQL and PL/JavaPostgreSQL and PL/Java
PostgreSQL and PL/Java
Peter Eisentraut
 
Psycopg2 - Connect to PostgreSQL using Python Script
Psycopg2 - Connect to PostgreSQL using Python ScriptPsycopg2 - Connect to PostgreSQL using Python Script
Psycopg2 - Connect to PostgreSQL using Python Script
Survey Department
 
Vagrant + Rouster at salesforce.com - PuppetConf 2013
Vagrant + Rouster at salesforce.com - PuppetConf 2013Vagrant + Rouster at salesforce.com - PuppetConf 2013
Vagrant + Rouster at salesforce.com - PuppetConf 2013
Puppet
 
Flask restfulservices
Flask restfulservicesFlask restfulservices
Flask restfulservices
Marcos Lin
 
Devinsampa nginx-scripting
Devinsampa nginx-scriptingDevinsampa nginx-scripting
Devinsampa nginx-scripting
Tony Fabeen
 
BUILDING MODERN PYTHON WEB FRAMEWORKS USING FLASK WITH NEIL GREY
BUILDING MODERN PYTHON WEB FRAMEWORKS USING FLASK WITH NEIL GREYBUILDING MODERN PYTHON WEB FRAMEWORKS USING FLASK WITH NEIL GREY
BUILDING MODERN PYTHON WEB FRAMEWORKS USING FLASK WITH NEIL GREY
CodeCore
 
"The little big project. From zero to hero in two weeks with 3 front-end engi...
"The little big project. From zero to hero in two weeks with 3 front-end engi..."The little big project. From zero to hero in two weeks with 3 front-end engi...
"The little big project. From zero to hero in two weeks with 3 front-end engi...
Fwdays
 
How to Design a Great API (using flask) [ploneconf2017]
How to Design a Great API (using flask) [ploneconf2017]How to Design a Great API (using flask) [ploneconf2017]
How to Design a Great API (using flask) [ploneconf2017]
Devon Bernard
 
Top Node.js Metrics to Watch
Top Node.js Metrics to WatchTop Node.js Metrics to Watch
Top Node.js Metrics to Watch
Sematext Group, Inc.
 
Resource-Oriented Web Services
Resource-Oriented Web ServicesResource-Oriented Web Services
Resource-Oriented Web Services
Bradley Holt
 

What's hot (20)

Introduction To Windows Power Shell
Introduction To Windows Power ShellIntroduction To Windows Power Shell
Introduction To Windows Power Shell
 
Pycon - Python for ethical hackers
Pycon - Python for ethical hackers Pycon - Python for ethical hackers
Pycon - Python for ethical hackers
 
Programming with Python and PostgreSQL
Programming with Python and PostgreSQLProgramming with Python and PostgreSQL
Programming with Python and PostgreSQL
 
Getting Started with PL/Proxy
Getting Started with PL/ProxyGetting Started with PL/Proxy
Getting Started with PL/Proxy
 
PM : code faster
PM : code fasterPM : code faster
PM : code faster
 
PowerShell-1
PowerShell-1PowerShell-1
PowerShell-1
 
Node.js API 서버 성능 개선기
Node.js API 서버 성능 개선기Node.js API 서버 성능 개선기
Node.js API 서버 성능 개선기
 
Final opensource record 2019
Final opensource record 2019Final opensource record 2019
Final opensource record 2019
 
Mastering power shell - Windows
Mastering power shell - WindowsMastering power shell - Windows
Mastering power shell - Windows
 
Non-Relational Postgres / Bruce Momjian (EnterpriseDB)
Non-Relational Postgres / Bruce Momjian (EnterpriseDB)Non-Relational Postgres / Bruce Momjian (EnterpriseDB)
Non-Relational Postgres / Bruce Momjian (EnterpriseDB)
 
PostgreSQL and PL/Java
PostgreSQL and PL/JavaPostgreSQL and PL/Java
PostgreSQL and PL/Java
 
Psycopg2 - Connect to PostgreSQL using Python Script
Psycopg2 - Connect to PostgreSQL using Python ScriptPsycopg2 - Connect to PostgreSQL using Python Script
Psycopg2 - Connect to PostgreSQL using Python Script
 
Vagrant + Rouster at salesforce.com - PuppetConf 2013
Vagrant + Rouster at salesforce.com - PuppetConf 2013Vagrant + Rouster at salesforce.com - PuppetConf 2013
Vagrant + Rouster at salesforce.com - PuppetConf 2013
 
Flask restfulservices
Flask restfulservicesFlask restfulservices
Flask restfulservices
 
Devinsampa nginx-scripting
Devinsampa nginx-scriptingDevinsampa nginx-scripting
Devinsampa nginx-scripting
 
BUILDING MODERN PYTHON WEB FRAMEWORKS USING FLASK WITH NEIL GREY
BUILDING MODERN PYTHON WEB FRAMEWORKS USING FLASK WITH NEIL GREYBUILDING MODERN PYTHON WEB FRAMEWORKS USING FLASK WITH NEIL GREY
BUILDING MODERN PYTHON WEB FRAMEWORKS USING FLASK WITH NEIL GREY
 
"The little big project. From zero to hero in two weeks with 3 front-end engi...
"The little big project. From zero to hero in two weeks with 3 front-end engi..."The little big project. From zero to hero in two weeks with 3 front-end engi...
"The little big project. From zero to hero in two weeks with 3 front-end engi...
 
How to Design a Great API (using flask) [ploneconf2017]
How to Design a Great API (using flask) [ploneconf2017]How to Design a Great API (using flask) [ploneconf2017]
How to Design a Great API (using flask) [ploneconf2017]
 
Top Node.js Metrics to Watch
Top Node.js Metrics to WatchTop Node.js Metrics to Watch
Top Node.js Metrics to Watch
 
Resource-Oriented Web Services
Resource-Oriented Web ServicesResource-Oriented Web Services
Resource-Oriented Web Services
 

Similar to Why and How Powershell will rule the Command Line - Barcamp LA 4

Get-Help: An intro to PowerShell and how to Use it for Evil
Get-Help: An intro to PowerShell and how to Use it for EvilGet-Help: An intro to PowerShell and how to Use it for Evil
Get-Help: An intro to PowerShell and how to Use it for Evil
jaredhaight
 
파이썬 개발환경 구성하기의 끝판왕 - Docker Compose
파이썬 개발환경 구성하기의 끝판왕 - Docker Compose파이썬 개발환경 구성하기의 끝판왕 - Docker Compose
파이썬 개발환경 구성하기의 끝판왕 - Docker Compose
raccoony
 
Ansible
AnsibleAnsible
Ansible
Michal Haták
 
Null Bachaav - May 07 Attack Monitoring workshop.
Null Bachaav - May 07 Attack Monitoring workshop.Null Bachaav - May 07 Attack Monitoring workshop.
Null Bachaav - May 07 Attack Monitoring workshop.
Prajal Kulkarni
 
Ch23 system administration
Ch23 system administration Ch23 system administration
Ch23 system administration
Raja Waseem Akhtar
 
Unix And Shell Scripting
Unix And Shell ScriptingUnix And Shell Scripting
Unix And Shell Scripting
Jaibeer Malik
 
PuppetDB: Sneaking Clojure into Operations
PuppetDB: Sneaking Clojure into OperationsPuppetDB: Sneaking Clojure into Operations
PuppetDB: Sneaking Clojure into Operations
grim_radical
 
2009 cluster user training
2009 cluster user training2009 cluster user training
2009 cluster user training
Chris Dwan
 
fog or: How I Learned to Stop Worrying and Love the Cloud (OpenStack Edition)
fog or: How I Learned to Stop Worrying and Love the Cloud (OpenStack Edition)fog or: How I Learned to Stop Worrying and Love the Cloud (OpenStack Edition)
fog or: How I Learned to Stop Worrying and Love the Cloud (OpenStack Edition)
Wesley Beary
 
#WeSpeakLinux Session
#WeSpeakLinux Session#WeSpeakLinux Session
#WeSpeakLinux Session
Kellyn Pot'Vin-Gorman
 
fog or: How I Learned to Stop Worrying and Love the Cloud
fog or: How I Learned to Stop Worrying and Love the Cloudfog or: How I Learned to Stop Worrying and Love the Cloud
fog or: How I Learned to Stop Worrying and Love the Cloud
Wesley Beary
 
Puppet Camp 2012
Puppet Camp 2012Puppet Camp 2012
Puppet Camp 2012
Server Density
 
55 best linux tips, tricks and command lines
55 best linux tips, tricks and command lines55 best linux tips, tricks and command lines
55 best linux tips, tricks and command lines
Arif Wahyudi
 
PowerShell - Be A Cool Blue Kid
PowerShell - Be A Cool Blue KidPowerShell - Be A Cool Blue Kid
PowerShell - Be A Cool Blue Kid
Matthew Johnson
 
Going live with BommandBox and docker Into The Box 2018
Going live with BommandBox and docker Into The Box 2018Going live with BommandBox and docker Into The Box 2018
Going live with BommandBox and docker Into The Box 2018
Ortus Solutions, Corp
 
Into The Box 2018 Going live with commandbox and docker
Into The Box 2018 Going live with commandbox and dockerInto The Box 2018 Going live with commandbox and docker
Into The Box 2018 Going live with commandbox and docker
Ortus Solutions, Corp
 
Revoke-Obfuscation
Revoke-ObfuscationRevoke-Obfuscation
Revoke-Obfuscation
Daniel Bohannon
 
Postgres Vienna DB Meetup 2014
Postgres Vienna DB Meetup 2014Postgres Vienna DB Meetup 2014
Postgres Vienna DB Meetup 2014
Michael Renner
 
Nagios Conference 2014 - Rob Hassing - How To Maintain Over 20 Monitoring App...
Nagios Conference 2014 - Rob Hassing - How To Maintain Over 20 Monitoring App...Nagios Conference 2014 - Rob Hassing - How To Maintain Over 20 Monitoring App...
Nagios Conference 2014 - Rob Hassing - How To Maintain Over 20 Monitoring App...
Nagios
 
Having Fun with Play
Having Fun with PlayHaving Fun with Play
Having Fun with Play
Clinton Dreisbach
 

Similar to Why and How Powershell will rule the Command Line - Barcamp LA 4 (20)

Get-Help: An intro to PowerShell and how to Use it for Evil
Get-Help: An intro to PowerShell and how to Use it for EvilGet-Help: An intro to PowerShell and how to Use it for Evil
Get-Help: An intro to PowerShell and how to Use it for Evil
 
파이썬 개발환경 구성하기의 끝판왕 - Docker Compose
파이썬 개발환경 구성하기의 끝판왕 - Docker Compose파이썬 개발환경 구성하기의 끝판왕 - Docker Compose
파이썬 개발환경 구성하기의 끝판왕 - Docker Compose
 
Ansible
AnsibleAnsible
Ansible
 
Null Bachaav - May 07 Attack Monitoring workshop.
Null Bachaav - May 07 Attack Monitoring workshop.Null Bachaav - May 07 Attack Monitoring workshop.
Null Bachaav - May 07 Attack Monitoring workshop.
 
Ch23 system administration
Ch23 system administration Ch23 system administration
Ch23 system administration
 
Unix And Shell Scripting
Unix And Shell ScriptingUnix And Shell Scripting
Unix And Shell Scripting
 
PuppetDB: Sneaking Clojure into Operations
PuppetDB: Sneaking Clojure into OperationsPuppetDB: Sneaking Clojure into Operations
PuppetDB: Sneaking Clojure into Operations
 
2009 cluster user training
2009 cluster user training2009 cluster user training
2009 cluster user training
 
fog or: How I Learned to Stop Worrying and Love the Cloud (OpenStack Edition)
fog or: How I Learned to Stop Worrying and Love the Cloud (OpenStack Edition)fog or: How I Learned to Stop Worrying and Love the Cloud (OpenStack Edition)
fog or: How I Learned to Stop Worrying and Love the Cloud (OpenStack Edition)
 
#WeSpeakLinux Session
#WeSpeakLinux Session#WeSpeakLinux Session
#WeSpeakLinux Session
 
fog or: How I Learned to Stop Worrying and Love the Cloud
fog or: How I Learned to Stop Worrying and Love the Cloudfog or: How I Learned to Stop Worrying and Love the Cloud
fog or: How I Learned to Stop Worrying and Love the Cloud
 
Puppet Camp 2012
Puppet Camp 2012Puppet Camp 2012
Puppet Camp 2012
 
55 best linux tips, tricks and command lines
55 best linux tips, tricks and command lines55 best linux tips, tricks and command lines
55 best linux tips, tricks and command lines
 
PowerShell - Be A Cool Blue Kid
PowerShell - Be A Cool Blue KidPowerShell - Be A Cool Blue Kid
PowerShell - Be A Cool Blue Kid
 
Going live with BommandBox and docker Into The Box 2018
Going live with BommandBox and docker Into The Box 2018Going live with BommandBox and docker Into The Box 2018
Going live with BommandBox and docker Into The Box 2018
 
Into The Box 2018 Going live with commandbox and docker
Into The Box 2018 Going live with commandbox and dockerInto The Box 2018 Going live with commandbox and docker
Into The Box 2018 Going live with commandbox and docker
 
Revoke-Obfuscation
Revoke-ObfuscationRevoke-Obfuscation
Revoke-Obfuscation
 
Postgres Vienna DB Meetup 2014
Postgres Vienna DB Meetup 2014Postgres Vienna DB Meetup 2014
Postgres Vienna DB Meetup 2014
 
Nagios Conference 2014 - Rob Hassing - How To Maintain Over 20 Monitoring App...
Nagios Conference 2014 - Rob Hassing - How To Maintain Over 20 Monitoring App...Nagios Conference 2014 - Rob Hassing - How To Maintain Over 20 Monitoring App...
Nagios Conference 2014 - Rob Hassing - How To Maintain Over 20 Monitoring App...
 
Having Fun with Play
Having Fun with PlayHaving Fun with Play
Having Fun with Play
 

Recently uploaded

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
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Speck&Tech
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
danishmna97
 
Data structures and Algorithms in Python.pdf
Data structures and Algorithms in Python.pdfData structures and Algorithms in Python.pdf
Data structures and Algorithms in Python.pdf
TIPNGVN2
 
How to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For FlutterHow to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For Flutter
Daiki Mogmet Ito
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
Alpen-Adria-Universität
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
shyamraj55
 
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfUnlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Malak Abu Hammad
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
Octavian Nadolu
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
innovationoecd
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
Matthew Sinclair
 
Full-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalizationFull-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalization
Zilliz
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
Uni Systems S.M.S.A.
 
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
Edge AI and Vision Alliance
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
Neo4j
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
 
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
SOFTTECHHUB
 
Large Language Model (LLM) and it’s Geospatial Applications
Large Language Model (LLM) and it’s Geospatial ApplicationsLarge Language Model (LLM) and it’s Geospatial Applications
Large Language Model (LLM) and it’s Geospatial Applications
Rohit Gautam
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
Aftab Hussain
 

Recently uploaded (20)

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
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
 
Data structures and Algorithms in Python.pdf
Data structures and Algorithms in Python.pdfData structures and Algorithms in Python.pdf
Data structures and Algorithms in Python.pdf
 
How to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For FlutterHow to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For Flutter
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
 
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfUnlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
 
Full-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalizationFull-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalization
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
 
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
 
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
 
Large Language Model (LLM) and it’s Geospatial Applications
Large Language Model (LLM) and it’s Geospatial ApplicationsLarge Language Model (LLM) and it’s Geospatial Applications
Large Language Model (LLM) and it’s Geospatial Applications
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
 

Why and How Powershell will rule the Command Line - Barcamp LA 4

  • 1. Why and How PowerShell will rule the command line ilya haykinson / ilya@hulu.com
  • 7. # echo “ text is comfortable ”
  • 8. # echo “ the inputs are limited by the keys on the keyboard ”
  • 9. # echo “ there’s nothing to click ”
  • 10. $ echo “ text interfaces were around in our early computers ”
  • 11. [user@localhost ~]$ echo “ they’re still around now ”
  • 12. mysql> select ‘ we talk text to our databases ’
  • 13. (gdb) print “ and to debuggers ”
  • 14. A:> echo to systems that are old
  • 15. C:sersdministrator> echo even to systems that are new
  • 16. “ we use text to command our computers to do our bidding ”
  • 17. “ we’ve created little programs ”
  • 19. “ with funny names ”
  • 20. “ like ‘tar’ or ‘finger’ or ‘mount’ ”
  • 21. “ with cryptic names ”
  • 22. “ or ‘ps’ or ‘cacls’ or ‘fsck’ or ‘df’ ”
  • 23. “ we created ways for these programs ”
  • 24. cat to_talk | grep -e “.* to one another ” >> using_pipes
  • 25. # echo “ we added $variables ”
  • 26. # echo “ and `functions` ”
  • 27. # echo " and `(cat -s /tmp/ other ) && (echo ' concepts ')`"
  • 28. Set or_Special = Wscript.CreateObject("Scripting.FileSystemObject") strFolder = “ programming languages ” or_Special.DeleteFolder(strFolder) Wscript.Echo “ to solve every day problems and run our computers well ”
  • 29. “ and then we did something strange and rather confusing ”
  • 30. “ we made all these programs ”
  • 31. “ talk text to one another ”
  • 32. “ this text is fine for us, humans ”
  • 33. 22:39:55 up 21 days, 18:39, 4 users, load average: 0.05, 0.14, 0.15 USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT we_know pts/0 pool-72-71-240-1 00:58 21:41m 4.39s 4.35s pine user123 pts/2 lgb-static-66.18 Fri17 29:11m 0.01s 0.01s -bash how_to pts/3 understand 33-22l 21:38 0.00s 0.29s 0.03s sshd: howto [priv] what_we pts/4 lgb-static-66.18 Fri12 29:22m 0.04s 0.04s see
  • 34. “ but a computer has to parse ”
  • 35. “ so we build a command ”
  • 36. “ we give it a lot of intelligence ”
  • 37. “ we empower it to do one thing, and do it really, really well ”
  • 38. “ using brilliant data structures to store the data during processing ”
  • 39. “ it comes up with great output ”
  • 40. “ that ends up as text ”
  • 41. “ and then the next command ”
  • 42. “ in our pipeline ”
  • 43. “ has to understand that text ”
  • 44. “ figure out how to separate the ”
  • 45. /dev/ important / ext3 rw 0 0 /dev/md1 /usr/ from proc rw 0 0 #/dev/ the / not so much 0 0
  • 46. “ so that it can get this data ”
  • 47. “ back into brilliant data structures for processing ”
  • 48.  
  • 49. “ doing one thing well does not mean that we have to deal with text ”
  • 50. “ doing one thing well does not mean having your own command line parameter syntax ”
  • 51. ps -ef ps -aux ps aux
  • 52. ls -a ls --all wget -e wget --execute
  • 53. “ a command does not live on its own, even if it’s single-purposed ”
  • 54. “ it lives in a shell environment ”
  • 55. “ and interacts, indirectly, with other commands ”
  • 56. “ so enter PowerShell ”
  • 57. “ it’s a command shell for Windows operating systems ”
  • 58. “ and an evolved approach to how commands can interact ”
  • 59. “ it holds that each command ”
  • 60. “ should do only one thing ”
  • 61. “ and do it very well ”
  • 62. “ and that anyone should be able to write a new command ”
  • 63. “ and that commands are to be connected by pipes ”
  • 64. “ and that you need variables and control structures ”
  • 65. “ it’s really a fully-fledged programming language ”
  • 66. “ you talk to it using text ”
  • 67. “ but it talks to you using objects ”
  • 68. “ and talks to itself using objects ”
  • 69. “ you can see those objects ”
  • 70. “ or just see the text that represents them ”
  • 71.  
  • 72. “ in PowerShell, the command is called a ‘cmdlet’ ”
  • 74. “ commands have a common naming pattern ”
  • 76. Get-ChildItem Move-Item Sort-Object Set-Location Where-Object
  • 77. “ these commands can also have easier to remember aliases ”
  • 78. Get-ChildItem = dir, ls, gci Move-Item = move, mv, mi Sort-Object = sort Set-Location = cd, chdir, sl Where-Object = where, ?
  • 79. “ each command manipulates objects ”
  • 80. “ for example, ‘dir c: gets a listing of files in the root directory ”
  • 81. “ but you can also say ‘dir HKLM:oftwareicrosoft to iterate the registry ”
  • 82. “ because ‘dir’ just means ‘Get-ChildItem’ – get a list of children of an object that is a container ”
  • 83. “ the file system’s directories are considered containers ”
  • 84. “ as are registry keys ”
  • 85. PS C:indowsystem32riverstc> dir Directory: Microsoft.PowerShell.CoreileSystem::C:indowsystem32riverstc Mode LastWriteTime Length Name ---- ------------- ------ ---- -a--- 4/2/2007 3:51 AM 829 hosts -a--- 9/18/2006 2:41 PM 3683 lmhosts.sam -a--- 9/18/2006 2:41 PM 407 networks -a--- 9/18/2006 2:41 PM 1358 protocol -a--- 9/18/2006 2:41 PM 17244 services
  • 86. “ actually, the whole command line operates on objects ”
  • 87. “ if you do nothing else with them, they will be displayed as text ”
  • 88. “ if you pass them on, they will be processed as objects ”
  • 89. PS C:indowsystem32riverstc> $x = dir PS C:indowsystem32riverstc> $x Directory: Microsoft.PowerShell.CoreileSystem::C:indowsystem32riverstc Mode LastWriteTime Length Name ---- ------------- ------ ---- -a--- 4/2/2007 3:51 AM 829 hosts -a--- 9/18/2006 2:41 PM 3683 lmhosts.sam -a--- 9/18/2006 2:41 PM 407 networks -a--- 9/18/2006 2:41 PM 1358 protocol -a--- 9/18/2006 2:41 PM 17244 services
  • 90. PS C:indowsystem32riverstc> $x[0] Directory: Microsoft.PowerShell.CoreileSystem::C:indowsystem32riverstc Mode LastWriteTime Length Name ---- ------------- ------ ---- -a--- 4/2/2007 3:51 AM 829 hosts
  • 91. PS C:indowsystem32riverstc> $x[0].Name hosts
  • 92. PS C:indowsystem32riverstc> dir | where { $_.Name -eq "hosts" } Directory: Microsoft.PowerShell.CoreileSystem::C:indowsystem32riverstc Mode LastWriteTime Length Name ---- ------------- ------ ---- -a--- 4/2/2007 3:51 AM 829 hosts
  • 93. Get-ChildItem | Where-Object { $_.Name -eq "hosts" } Dir | Where { $_.Name -eq “hosts” } ls|?{ $_.Name -eq “hosts”}
  • 94. PS C:indowsystem32riverstc> dir | foreach { "The file $($_.Name) is $($_.Length) bytes long" } The file hosts is 829 bytes long The file lmhosts.sam is 3683 bytes long The file networks is 407 bytes long The file protocol is 1358 bytes long The file services is 17244 bytes long
  • 95. PS C:indowsystem32riverstc> dir | measure-object -property Length -Sum Count : 5 Average : Sum : 23521 Maximum : Minimum : Property : Length
  • 96. PS C:indowsystem32riverstc> dir | foreach { $_.Length } | Measure-Object -Sum Count : 5 Average : Sum : 23521 Maximum : Minimum : Property :
  • 97. PS C:gt; get-process | where { $_.WorkingSet -gt 150MB } Handles NPM(K) PM(K) WS(K) VM(M) CPU(s) Id ProcessName ------- ------ ----- ----- ----- ------ -- ----------- 658 19 175704 155676 470 506.77 36964 firefox PS C:gt; get-process | where { $_.WorkingSet -gt 150MB } | stop-process
  • 98. PS C:gt; get-process | where { $_.Name -eq 'firefox' } | format-list * __NounName : Process Name : firefox Handles : 333 VM : 207273984 WS : 101548032 PM : 84729856 NPM : 18560 Path : C:rogram Filesozilla Firefoxirefox.exe Company : Mozilla Corporation CPU : 11.9028763 FileVersion : 1.8.1.9: 2007102514 ProductVersion : 2.0.0.9 Description : Firefox Product : Firefox Id : 6052 PriorityClass : Normal HandleCount : 333 WorkingSet : 101548032 PagedMemorySize : 84729856 ...
  • 99. PS C:gt; function multBy2 { $_ * 2 } PS C:gt; 1..10 | foreach { multBy2 } 2 4 6 8 10 12 14 16 18 20
  • 100. PS C:gt; function concat($a, $b) { "$a-$b" } PS C:gt; concat "hello" "there" hello-there PS C:gt; concat -a "hello" -b "there" hello-there PS C:gt; concat -b "hello" -a "there" there-hello
  • 101. PS C:gt; [System.Net.Dns]::GetHostByName("localhost") | fl HostName : TARDIS Aliases : {} AddressList : {127.0.0.1}
  • 102. PS C:gt; $rssUrl = "http://twitter.com/statuses/friends_timeline/766734.rss" PS C:gt; $blog = [xml] (new-object system.net.webclient).DownloadString($rssUrl) PS C:gt; $blog.rss.channel.item | select title -first 8 title ----- ori: @ori thinks there's a lot of drunk-twittering going on at barcampla. Yeah I just referred to myself in the thir... Zadi: Going to curl up and watch Eraserhead, finally. 'Night guys. Remember to turn back the clock. annieisms: i can haz crochet mouse? http://tinyurl.com/3ylmj7 ccg: hey BarCampers (and others) remember to set your clocks (and by clocks, I mean phones) back an hour tonight, Ya... Mickipedia: Everyone follow @egredman for some great music! Mickipedia: ...and party every day! heathervescent: Omg theses french djs blown mah mind. groby: @barcampla Clearly, you guys don't know what's good! Salty Black Licorice FTW! ;)
  • 103.  
  • 104. “ there is more to PowerShell ”
  • 105. “ you can write GUI apps in it, if you really want to ”
  • 106. “ you can administer servers ”
  • 107. “ you can completely replace your normal cmd.exe usage with it ”
  • 108. “ but even if you ignore it ”
  • 109. “ remember its lessons ”
  • 110. “ about the power of text ”
  • 111. “ and the power of objects ”