Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
シェル芸入門
Search
ishiy1993
May 30, 2017
Programming
0
860
シェル芸入門
CAMPHOR- 「CLIについて語る会」における発表資料
ishiy1993
May 30, 2017
Tweet
Share
Other Decks in Programming
See All in Programming
Contemporary Test Cases
maaretp
0
130
エンジニアとして関わる要件と仕様(公開用)
murabayashi
0
280
AWS Lambdaから始まった Serverlessの「熱」とキャリアパス / It started with AWS Lambda Serverless “fever” and career path
seike460
PRO
1
250
リアーキテクチャxDDD 1年間の取り組みと進化
hsawaji
1
220
3 Effective Rules for Using Signals in Angular
manfredsteyer
PRO
0
110
Outline View in SwiftUI
1024jp
1
320
受け取る人から提供する人になるということ
little_rubyist
0
230
macOS でできる リアルタイム動画像処理
biacco42
9
2.4k
EventSourcingの理想と現実
wenas
6
2.3k
どうして僕の作ったクラスが手続き型と言われなきゃいけないんですか
akikogoto
1
120
Arm移行タイムアタック
qnighy
0
310
Less waste, more joy, and a lot more green: How Quarkus makes Java better
hollycummins
0
100
Featured
See All Featured
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
44
6.8k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
31
2.7k
Rebuilding a faster, lazier Slack
samanthasiow
79
8.7k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
226
22k
How To Stay Up To Date on Web Technology
chriscoyier
788
250k
The Power of CSS Pseudo Elements
geoffreycrofte
73
5.3k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
364
24k
Become a Pro
speakerdeck
PRO
25
5k
The Cost Of JavaScript in 2023
addyosmani
45
6.7k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
329
21k
Art, The Web, and Tiny UX
lynnandtonic
297
20k
StorybookのUI Testing Handbookを読んだ
zakiyama
27
5.3k
Transcript
γΣϧܳೖ ishiy 2017.05.28
$ whoami • Twitter: @ishiy1993 • Arch Linux • Zsh
• urxvt • Neovim ͜ͷεϥΠυதͷྫ্هͷڥͰςετ͍ͯ͠·͢ɻ Mac ͷਓɺ”GNU coreutils”ΛΠϯετʔϧͯ͠༻͍ͯͩ͘͠͞ɻ
͓͠ͳ͕͖ • γΣϧܳͱ • γΣϧܳͷجຊɺίπ • Α͘͏ίϚϯυ 8 બ •
͓͢͢Ίॻ੶ɺγΣϧܳษڧձ
γΣϧܳͱ ϚεΘͣɺιʔείʔυͣ͞ɺGUI πʔϧΛ্ཱͪ͛ Δؒͳ͘ɺ͋ΒΏΔௐࠪɾܭࢉɾςΩετॲཧΛ CLI ͷ ίϚϯυೖྗҰܸऴΘΒ͢͜ͱɻ͋Δ͍ͦͷͱ͖ͷίϚϯυೖ ྗͷ͜ͱɻ from https://blog.ueda.tech/?page
id=1434 ҰݴͰ͍͏ͱɺγΣϧϫϯϥΠφʔ
γΣϧܳͷجຊ ύΠϓ | ͰίϚϯυΛͭͳ͍ͰΓ͍ͨ͜ͱΛ࣮ݱ͢Δ ྫ: P ͔Β͡·Δϓϩάϥϛϯάݴޠ? $ cat programming
-languages.txt | grep ’^P’ PHP Perl Python PureScript ύΠϓʹΑͬͯ୯ػೳͳίϚϯυΛࣗ༝ʹΈ߹ͤΒΕΔ!!!
γΣϧܳͷίπ ଟ͘ͷίϚϯυߦʹରͯ͠࡞༻͢Δ ⇒ ͏·͘σʔλΛมܗͯ͠ѻ͏ ྫ: LICENSE ͱ͍͏ϑΝΠϧதʹ࠷සޠԿ͔? ·ͨԿݸ͋Δ͔? $ cat
LICENSE | tr ’A-Z’ ’a-z’ | xargs -n 1 | tr -d ’,.()’ | sort | uniq -c | sort -k1 ,1nr | head -1
Α͘͏ίϚϯυ8બ ࠓճհ͢Δͷ • cat • sort • uniq • grep
• xargs • tr • sed • awk
cat ϑΝΠϧͷதΛ࿈݁ͯ͠ग़ྗ͢Δ $ cat sample1.txt sample2.txt -Ͱඪ४ೖྗΛࢦఆͰ͖Δ $ date +%F
| cat sample1.txt sample2.txt -
sort, uniq sort: ೖྗΛιʔτͯ͠ग़ྗ͢Δ $ cat programming -languages.txt | sort
Α͘͏Φϓγϣϯ: k, n, r, s uniq: ॏෳΛݟ͚ͭΔɺআ͢Δ $ cat programming -languages.txt | sed ’s/\(.\).*/\1/ ’ | sort | uniq -c Α͘͏Φϓγϣϯ: u, d, c
grep ݅ʹϚον͢ΔߦΛग़ྗ͢Δ $ grep "^.*$" * Α͘͏Φϓγϣϯ: E, i, v,
o, A, B, C $ cat LICENSE | grep -o the $ seq 1 100 | grep -C 2 1
xargs ඪ४ೖྗΛίϚϯυͷҾʹ͢ $ ls *.txt | awk ’{print $1 ,$1".bak"}’
| xargs -n 2 cp γΣϧܳਓత͍ํ $ seq 1 9 | xargs -n 3
tr จࣈΛஔ͢Δɺআ͢Δ $ cat presen.csv | tr ’,’ ’ ’
Α͘͏Φϓγϣϯ: d, c $ cat /dev/urandom | tr -dc ’1-9’ | fold -w 4 | head -1
sed ετϦʔϜΤσΟλʔ ͍Ζ͍ΖͰ͖Δ͕ɺจࣈྻͷஔʹ͏͜ͱ͕ଟ͍ $ echo " x x ʹ ͭ
͍ ͯ ޠ Δ ձ " | sed ’s/xx/CLI/’ $ seq 1 100 | sed ’0~3s/.*/ Fizz/’ | sed ’0~5s/.*/ Buzz/’ | sed ’0~15s/.*/ Fizz Buzz/’
awk ϓϩάϥϛϯάݴޠ جຊతͳ͍ํ $ cat presen.csv | tr ’,’ ’
’ | awk ’{print $1" ʮ" $2" ʯ ʹ ͭ ͍ ͯ ͠ · ͢"} ’ $ seq 1 10 | awk ’NR >=5’ $ seq 1 10 | awk ’NR %3==0{ print $1*$1}’ $ seq 1 100 | factor | awk ’NF ==2{ print $2}’
հͰ͖ͳ͔ͬͨίϚϯυͨͪ ࠓճհͨ͠Ҏ֎ʹ͞·͟·ͳίϚϯυ͕͋Δɻ ͦͷҰ෦Λྻڍ͓ͯ͘͠ɻ • find • diff • paste •
curl • wget • jq • nkf • ͳͲͳͲ
͓͢͢Ίॻ੶ • ্ా ོҰ ʮγΣϧϓϩάϥϛϯά࣮༻ςΫχοΫʯ • Piro(݁༸ࢤ) ʮ·Μ͕ͰΘ͔Δ Linux γεܥঁࢠʯ
• Piro(݁༸ࢤ) ʮ·Μ͕ͰΘ͔Δ Linux γεܥঁࢠ 2ʯ ͬͱγΣϧͰ͍Ζ͍ΖΓ͍ͨͱ͍͏ํʹ 1 CLI Λ͍͡Ί͔ͨΓͱ͍͏ํʹ 2,3 Λ͓͢͢Ί͠·͢ɻ ͋ͱ man ΛಡΉͷ͓͢͢Ί͠·͢ɻ
γΣϧܳษڧձ • 2ϲ݄ʹ 1 ճ։࠵ (౦ژɺେࡕɺԬ) • γΣϧܳͰΛղ͘ • YouTube
ͰϥΠϒ৴͍ͯ͠Δ • Twitter(#γΣϧܳ) ͰΓ্͕͍ͬͯΔ • աڈҰཡ: https://blog.ueda.tech/?page id=684
·ͱΊ γΣϧܳΛۦͯ͠࡞ۀޮΛ্͠Α͏!!!
Thank you.