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
910
シェル芸入門
CAMPHOR- 「CLIについて語る会」における発表資料
ishiy1993
May 30, 2017
Tweet
Share
Other Decks in Programming
See All in Programming
物語を動かす行動"量" #エンジニアニメ
konifar
14
5.5k
Kiroの仕様駆動開発から見えてきたAIコーディングとの正しい付き合い方
clshinji
1
150
AI OCR API on Lambdaを Datadogで可視化してみた
nealle
0
180
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
180
DockerからECSへ 〜 AWSの海に出る前に知っておきたいこと 〜
ota1022
5
1.8k
ゲームの物理
fadis
5
1.5k
マイコンでもRustのtestがしたい その2/KernelVM Tokyo 18
tnishinaga
2
2.3k
Claude Codeで実装以外の開発フロー、どこまで自動化できるか?失敗と成功
ndadayo
2
1.4k
技術的負債で信頼性が限界だったWordPress運用をShifterで完全復活させた話
rvirus0817
1
2.1k
Laravel Boost 超入門
fire_arlo
1
130
Constant integer division faster than compiler-generated code
herumi
2
700
自作OSでDOOMを動かしてみた
zakki0925224
1
1.4k
Featured
See All Featured
BBQ
matthewcrist
89
9.8k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
10
1k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
44
2.5k
Writing Fast Ruby
sferik
628
62k
A better future with KSS
kneath
239
17k
Building a Scalable Design System with Sketch
lauravandoore
462
33k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
46
7.6k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.4k
The Cult of Friendly URLs
andyhume
79
6.5k
Making Projects Easy
brettharned
117
6.3k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
17k
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
4k
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.