Command Line for Nonprogrammers and Beginners

@cecycorrea

I'm Cecy Correa

Software Engineer Return Path / Context.IO

Why this talk?

There are a lot of misconceptions of what the command line can do.

Representations of tech in the media

Made me feel learning the command line was something I'd never do

If you're a beginner,
don't be afraid

If you're not a programmer,
you can work with the command line too!

Command line is for everyone
❤️

What is Unix?

Unix is

  • An operating system for operating systems
  • A type of file system
  • A set of "philosophies"

Unix and Unix-like systems

  • MacOS is Unix
  • Linux is Unix-like

PC users, I will cover you in a bit!

Terminal or
command line or
shell?

Terminal

The application / GUI

  • Terminal (comes with MacOS)
  • iTerm
  • Hyper

Shell

Program processes the commands

A Terminal runs a Shell

Shells🐚

There are different types of shells!

shell (sh)

Developed by Stephen Bourne in 1977!

Not the first shell ever, but the one that most other shells are "based" on.

So bored right now!

Other shells

  • c-shell (csh)
  • Korn shell (ksh)

bash

bash = Bourne Again Shell (1989)

Get it? Because the inventor of sh is Stephen Bourne?

Other other shells

  • z-shell, zsh (1990)
  • fish (2005)

We'll come back to those!

Why bash

  • bash is found in most systems (definitely MacOs, Linux)
  • Now available on Windows™!
  • Also useful when accessing a remote server

Further word on Windows

  • cygwin

Let's get to the fun stuff!

Demo time

Review

Command line basics

$ pwd

Print Working Directory

Don't be afraid to use it! Use it all the time!

Command line basics

$ ls

LiSt files in a directory

Command line basics

$ ls -a

LiSt files and hidden 👻 files in a directory

Navigation

$ pwd
$ ls
$ cd

REPEAT

Demo time

Review

Make things!

$mkdir

MaKe a DIRectory

Make things!

$ touch

Create a file

Daisy chaining

$ mkdir test && cd test && pwd && touch test.txt && ls

Demo time

Review

Other cool commands

  • cal
  • date
  • top
  • kill

Advanced awesomesauce

Hide desktop files

defaults write com.apple.finder CreateDesktop -bool false;killall Finder

Show desktop files

defaults write com.apple.finder CreateDesktop -bool true;killall Finder

No way I'll rememeber that!

Use aliases for that!

Aliases

Like custom "autocorrect" in iOS

Alias example

alias hideDesktop="defaults write com.apple.finder AppleShowAllFiles NO; killall Finder /System/Library/CoreServices/Finder.app"

Set this in a .bash_profile

Super level up time!

Customize your Terminal

Demo time

  • Select themes
  • Make your own theme
  • Download themes
  • Change fonts
  • Save / switch different profiles

Make your Terminal a place you want to spend time in!

Super level up!

Homebrew 🍺

http://brew.sh

Install and manage tons of stuff!

Brew Cask

$ brew cask install google-chrome

Easy computer setup

Create a simple bash script that installs applications
setup.sh

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew cask install google-chrome
brew cask install spotify
brew cask install iterm2
brew cask install sublime-text

Other shells!

zsh

  • Created in 1990
  • Autocompletion
  • Spelling correction
  • Not case sensitive
  • Themable
  • Plugins!

fish

  • Created in 2005!
  • Stands for Friendly Interactive Shell
  • Lightweight
  • Autocompletion
  • Suggestions
  • Themes
  • Plugins
  • Syntax is more different from bash than zsh

Further reading

  • Bash pocket guide (O'Reilly)
  • Learning Unix for Mac OS (O'Reilly)
  • The Linux Command Line (No Starch Press)
Grab the slides: cecy.co/cli-for-n00bs

Thank you!