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
採用事例の少ないSvelteを選んだ理由と それを正解にするためにやっていること
oekazuma
2
1.1k
Mermaid x AST x 生成AI = コードとドキュメントの完全同期への道
shibuyamizuho
1
270
命名をリントする
chiroruxx
1
450
return文におけるstd::moveについて
onihusube
1
1.3k
快速入門可觀測性
blueswen
0
410
なまけものオバケたち -PHP 8.4 に入った新機能の紹介-
tanakahisateru
1
130
KubeCon + CloudNativeCon NA 2024 Overviewat Kubernetes Meetup Tokyo #68 / amsy810_k8sjp68
masayaaoyama
0
260
Haze - Real time background blurring
chrisbanes
1
520
PHPとAPI Platformで作る本格的なWeb APIアプリケーション(入門編) / phpcon 2024 Intro to API Platform
ttskch
0
310
rails stats で紐解く ANDPAD のイマを支える技術たち
andpad
1
300
php-conference-japan-2024
tasuku43
0
360
CQRS+ES の力を使って効果を感じる / Feel the effects of using the power of CQRS+ES
seike460
PRO
0
160
Featured
See All Featured
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
159
15k
How STYLIGHT went responsive
nonsquared
96
5.2k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
95
17k
Practical Orchestrator
shlominoach
186
10k
Side Projects
sachag
452
42k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
38
1.9k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
507
140k
Visualization
eitanlees
146
15k
Being A Developer After 40
akosma
88
590k
Building Your Own Lightsaber
phodgson
103
6.1k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
47
5.1k
Agile that works and the tools we love
rasmusluckow
328
21k
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.