You are on page 1of 21

Intro to Shell

Daniel Kessler, Douglas Wong


Logistics
● Lab 1
○ AWS
■ If it doesn’t work try logging into tsunami first
● Sign in here: https://goo.gl/forms/eFqNzQu1V8AHfdVz2

● Ask questions during the presentation at https://slido.com


○ Event code is #L399
○ You can ask anonymously if you’d like and don’t have to remember
your question until the end or wait to ask at all
https://workplace.stackexchange.com/q/93696
Why use the shell?
● Can make you more productive
● Easier to automate-- instead of pointing and clicking things, just type!
● When managing remote machines, you usually won't have a GUI
Shell
Common Shells
● Bash
● Zsh

● Bunch of other less common ones (dash, csh, tcsh, fish, etc.)
Editors
Common Editors
● Vim
● Emacs
● Nano (easy to use)
https://triplebyte.com/blog/technical-interview-performance-by-editor-os-language
Commands
Common Commands
● mv: move files/directories
● cp: copy files
● rm: remove files
● grep: search through text for files
● ls: list directory
● mkdir: create a folder
● wc: word count
● chmod: change permissions
Flags
Questions
Wildcard
● ?: any single character
● *: zero or more characters
● []: a class of characters

reference: http://www.robelle.com/smugbook/wildcard.html
Wildcard
Pipe
● |
● program or utility
cat people_names

cat people_names
Alicia Fuentes
Jo-Ting Losev Standard output
Elena Edmonds (your screen)
Naydene Cabral
Dato Rosengren
Fernanda Serrano
Emiliano Wenk
Larry Lapin
Jakub Gondos
Derek Kazanin
...
cat people_names | grep Anna

cat people_names grep Anna


Standard output
Alicia Fuentes Anna Choi
Jo-Ting Losev Anna Menkov (your screen)
Elena Edmonds Annabel Sun
Naydene Cabral Anna Hosking
Dato Rosengren Anna Holzdeppe
Fernanda Serrano Anna Rosario
Emiliano Wenk Anna Jaskolka
Larry Lapin Anna Prucksakorn
Jakub Gondos Anna Tomic
Derek Kazanin Annari Simmonds
... ...
Redirect
● >
● file
cat people_names > test.txt

cat people_names

Alicia Fuentes
Jo-Ting Losev The file test.txt
Elena Edmonds
Naydene Cabral
Dato Rosengren
Fernanda Serrano
Emiliano Wenk
Larry Lapin
Jakub Gondos
Derek Kazanin
...
cat people_names | grep Anna > output.txt

cat people_names grep Anna


Alicia Fuentes Anna Choi The file output.txt
Jo-Ting Losev Anna Menkov
Elena Edmonds Annabel Sun
Naydene Cabral Anna Hosking
Dato Rosengren Anna Holzdeppe
Fernanda Serrano Anna Rosario
Emiliano Wenk Anna Jaskolka
Larry Lapin Anna Prucksakorn
Jakub Gondos Anna Tomic
Derek Kazanin Annari Simmonds
... ...

You might also like