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
Learn you some shell for your own good
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Mattia Gheda
July 03, 2014
Technology
210
4
Share
Learn you some shell for your own good
A Shell introduction for the Ember/Web Developer
Mattia Gheda
July 03, 2014
More Decks by Mattia Gheda
See All by Mattia Gheda
un-uploader-demo
ghedamat
1
4.4k
Other Decks in Technology
See All in Technology
【社内勉強会】新年度からコーディングエージェントを使いこなす - 構造と制約で引き出すClaude Codeの実践知
nwiizo
35
16k
不確実性と戦いながら見積もりを作成するプロセス/mitsumori-process
hirodragon112
1
170
QA組織のAI戦略とAIテスト設計システムAITASの実践
sansantech
PRO
1
300
Oracle AI Database@Google Cloud:サービス概要のご紹介
oracle4engineer
PRO
5
1.3k
OpenClawでPM業務を自動化
knishioka
2
360
【AWS】CloudTrail LakeとCloudWatch Logs Insightsの使い分け方針
tsurunosd
0
130
PostgreSQL 18のNOT ENFORCEDな制約とDEFERRABLEの関係
yahonda
0
150
来期の評価で変えようと思っていること 〜AI時代に変わること・変わらないこと〜
estie
0
130
最大のアウトプット術は問題を作ること
ryoaccount
0
250
FASTでAIエージェントを作りまくろう!
yukiogawa
4
180
互換性のある(らしい)DBへの移行など考えるにあたってたいへんざっくり
sejima
PRO
0
510
Zephyr(RTOS)でOpenPLCを実装してみた
iotengineer22
0
170
Featured
See All Featured
Optimising Largest Contentful Paint
csswizardry
37
3.6k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
1.1k
Rebuilding a faster, lazier Slack
samanthasiow
85
9.4k
Building a A Zero-Code AI SEO Workflow
portentint
PRO
0
420
Optimizing for Happiness
mojombo
378
71k
How to Get Subject Matter Experts Bought In and Actively Contributing to SEO & PR Initiatives.
livdayseo
0
92
Gemini Prompt Engineering: Practical Techniques for Tangible AI Outcomes
mfonobong
2
340
Color Theory Basics | Prateek | Gurzu
gurzu
0
270
The Curious Case for Waylosing
cassininazir
0
280
The Illustrated Children's Guide to Kubernetes
chrisshort
51
52k
世界の人気アプリ100個を分析して見えたペイウォール設計の心得
akihiro_kokubo
PRO
68
38k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
49
9.9k
Transcript
$ Learn you some shell for your own good (A
shell introduction* for Ember developers) * absolutely non exhaustive ** some concepts might be simplified
@ghedamat @unspace
Let’s talk about ember
Let’s talk about ember
Let’s talk about the shell #!/bin/bash sh — shell, the
standard command language interpreter (source $man shell)
What is it and why should I care? * Main
interface to the OS * It’s everywhere * You use it every day * Not just a task runner
There’s not only one * sh - the beginning *
bash (Bourne Again SHell) * zsh - it’s good * commands (like cd, ls, cp…)are separate * some commands can differ between Linux/OSX/bsd
Part 1 - Commands Do one thing and do it
well
$ man displays manual pages for commands (yes you can
do $ man man)
$ cd change (working) directory (if no directory given go
to $HOME) ($HOME is your usually /home/user) ($HOME is aliased to ~)
$ cd - go to previous directory every `cd` sets
$OLDPWD to the last visited directory
$ pwd print working directory in case you’re lost
$ ls list directory contents * -lh (list nicely and
human readable sizes) * -a (shows hidden files) * -t (sort by most recent)
$ cp copy files (cp -r mydir destdir/) * -r
recursive * copies mydir into destdir * beware OSX (cp mydir/ destdir/ copies content of mydir)
$ mv move files * no need for -r
$ which shows the path of a command * which
ls /bin/ls
$ watch executes a command periodically * useful to “watch”
for operations * watch ls -lh filename
$ cat concatenate files and print * get the content
of a file immediately * useful for scripting * `dog` is a valid alternative (no kidding)
$ less quickly read through a file * scroll around
with keyboard * vim keys * less - opposite of more (from the man)
$ tail output last part of a file * -n
lines from end of file * -f keep waiting for updates * --pid=ID stops watching when pid dies
$ touch change file timestamp (or create it)
$ df $ du monitor space usage of disk or
directory * -h is your friend
$ find find files * find PATH -name PATTERN
$ grep print lines matching a pattern * -r grep
in files recursively * -i case insensitive (slow)
$ ack $ ag grep for code * much better
use <TAB> tab completion is awesome * configure it properly
* completion for command’s options
$ pushd/popd - dirs change directory by using a stack
* pushd `cd` and pushes it onto the stack * popd pops the first one and `cd` to i * dirs shows the current stack * cd +N -N
There are MANY more rm, cut, tail, head, dd, echo...
1: Learn some commands just pick one and try to
use it
Part 2 - Navigation Don’t use the arrows (mostly emacs
navigation)
ctrl-f ctrl-b move to next/previous char on the line $
alt-a | alt-e moves by word
ctrl-a ctrl-e beginning/end of line
ctrl-s ctrl-r search forward/backward * you always have a command
history * $ cat ~/.bash_history
ctrl-p ctrl-n previous/next command in the history
2: Don’t use the arrows shortcuts are faster * tip:
remap CAPS to CTRL
Part 3 - Editing change the line
ctrl-u kill line * kill means delete
kill until end of line ctrl-k
* kill prev word * kill prev char * kill
next char ctrl-w ctrl-h ctrl-d
enter current line ctrl-o
clear screen * same as `clear` ctrl-l
switch chars * useful for typos * sl -> ls
ctrl-t
edit current line in $EDITOR * you can set a
default editor for the terminal * great for complex commands ctrl-x ctrl-e
3: Edit the line it’s ok to make mistakes *
psss: there’s a vim mode too...
Part 4 - Processes to kill or to sleep (ask
me about signals later)
kills current process * easy way out * sends SIGINT
* (it’s actually way more complicated than that) ctrl-c
suspend current process * returns you to the shell *
process is “on-hold” * sends SIGTSTP ctrl-z
sends <command> to the background * you can also suspend
and then call ‘bg’ $ <command> &
jobs: list jobs and their statuses fg [N]: resumes a
job $ jobs $ fg
$ ps $ top know your processes * ps aux
| print list of processes * top | interactive interface * htop | fancier top
4: Multitask you can do a lot in one shell
Summary 1: Learn some commands 2: Don’t use the arrows
3: Edit the line 4: Multitask
That’s it?
Not at all...
..but I’ll stop...
...for now :)
Thanks! @ghedamat (Unspace)
...
None
Extras:
Part 5 - Redirects & Pipes in and out
> redirect output to file * >> redirects and appends
to file * cat filename >> otherfile
< redirect input from file * sets the stdin for
a command * cat < filename
| “pipe” the output of a program into the input
of another $ ls -l | grep -i name
Part 6 - Replace change is good
$ cp file{.txt,.meow} bash string manipulation * can do MUCH
more than this
$ sed transform text * sed -i -r ‘s/wow/meow/g’ *
good for scripts
Part 7 - Tools add good stuff
get a shortcut opening a terminal should be FAST *
alt+x is my favorite
$ autojump $ fast remember where you cd gets you
there fast * j fuzzymatchagainstpath
$ screen $ tmux multiplex your terminal * great for
servers * even better for development * tiling is good
$ tmuxinator predefined tmux configurations * quickly boot a project
(webserver, test runner, logs, editor)
$ tmate tmux based pairing env * insanely good *
(you need to use a terminal editor)
Ok, Enough...
...but feel free to ask more!
Thanks!! @ghedamat (Unspace)