Cole Geissinger

Senior Web Engineer @ 10up

@colegeissinger

$ CONQUERING OUR FEAR OF THE COMMAND LINE

NOTE: Focuses on the command line using unix based commands.

What Is this command line thing?

A means of interacting with a computer program where the user issues text based commands to the program in the form of successive lines of text

- Wikipedia

The Command line to most people

Command line IRL

  • Was the primary means of interaction with most computer systems until the mid-1960's when the video display terminal was introduced.
     
  • We use an interface that is known as a "shell" to enter text commands that are then converted to appropriate operating system functions.
Photo Credit: blakespot via Compfight cc

Why even bother?

CLI is a thing of the past!

“People drive cars with steering wheels and gas pedals. Does that mean you don’t need wrenches?”

- Rob Pike

Best suited for

  • Web Developers/Engineers
  • Software Engineers
  • Systems Admins
Photo Credit: Tailord4WP photo by Florian Ziegler

of the command line

Pros

  • It's Faster
    Typing is much faster than pointing and clicking.
  • Automation
    Run redundant tasks through scripts.
  • More Powerful
    In most cases, CLI is more powerful because it has complete access to the system while GUI's can only provide access to so much.
  • Less Memory
    GUI's require more computer resources to run.

Cons

  • Requires Experience
    You gotta know what you're doing. Other wise CLI will fail on your commands.
  • Not as Intuitive
    Lack of a user interface.
  • Not Appropriate for Everything
    While you can use CLI for everything (even view images!), a GUI is best for most high level uses.

Start with the basics

Shell

Prompt

OUR FIRST STEPS

$ echo "Hello World"

Example

Hello World

Outputs

NAVIGATING THE PROMPT

CONTROL + A

MOVES CURSOR TO THE BEGINNING OF THE PROMPT

CONTROL + E

MOVES CURSOR TO THE END OF THE PROMPT

TAB COMPLETION = WIN

Pressing the tab key will perform an auto complete

UP ARROW TO GO 
BACK IN HISTORY

COMMAND + K TO CLEAR THE SHELL

'MAN' COMMAND

Navigating the file system

LS ALL THE THINGS

List current directory contents

OUTPUT CURRENT PATH

USING THE COMMAND 'PWD' TO PRINT THE WORKING DIRECTORY

CHANGE DIRECTORY

USE THE 'CD' COMMAND TO MOVE AROUND

OPEN IN FINDER

USING THE 'OPEN' COMMAND TO OPEN ITEMS IN FINDER

$ open .

Open current directory

$ open FILENAME

Open file in current directory

$ open -a APP NAME

Open current directory

$ open -R FILENAME

Open file with preview pane open

SEARCHING

USE THE 'FIND' COMMAND TO SEARCH YOUR COMPUTER

$ find . -type f

Searches for all files in current path

$ find . -name "FILENAME"

Searches for that exact file name

$ find . -iname "NameCaseInsensitive"

Open current directory

$ find . -type f -name "FILENAME"

Open file with preview pane open

TIP: Change the period "." after find to your search term

FIle Management

CREATE FILES WITH 'TOUCH'

EDITING FILES

USING TOOLS LIKE NANO OR VIM

CREATE A NEW DIRECTORY

USING THE 'MKDIR' COMMAND

COPY FILES

USING THE 'CP' COMMAND

MOVE FILES

USE MV TO MOVE FILES

REMOVE FILES

RM COMMAND TO REMOVE FILES

OR RM -R FOR DIRECTORIES

STOP. DEMO TIME.

On to becoming a Command Line Master

$ exit

@colegeissinger

colegeissinger.com

10up.com

Questions?

Conquering Our Fears of the Command Line

By Cole Geissinger

Conquering Our Fears of the Command Line

  • 1,327