Command Line Crash Course For Unix

33 

Full text

(1)

Command Line Crash Course For Unix

Controlling Your Computer From The Terminal

Zed A. Shaw

(2)

How To Use This Course

Youcannotlearn to do this from videos alone. You can learnaboutthe subject from the video. But to really learnto dothis subject requires the book. The book "Command Line Crash Course" is included, and it’s meant to be a fast workbook that makes you do things. Do not just watch these videos and then think you’re done. Videos + Book is the way to go.

(3)

About Linux vs. OSX

Linux and Apple’s OSX use the same kind of Unix shell calledbash.

I’m going to use OSX because my screen capture system is on it.

But I’ll show you how to get to the terminal on Ubuntu when I cover Ex 1.

(4)

Introduction

Exercises 1-3

Ex 1: The Setup

Ex 2: Paths, Folders, Directories (pwd) Ex 3: Who Are You? (whoami)

(5)

Exercise 1

The Setup

Finding your terminal program and getting it to run. Go to the exercise.

(6)

Exercise 2

Paths, Folders, Directories (pwd)

Figure out where your terminal starts off using the "print workind directory" command.

See how that maps to your desktop file browser. Go to the exercise.

(7)

Exercise 3

Who Are You?

Figure out what username the computer thinks you use. Go to the exercise.

(8)

Directories

Exercises 4-8

Ex 4: Make A Directory (mkdir) Ex 5: Change Directory (cd) Ex 6: List Directory (ls)

Ex 7: Remove Directory (rmdir) Ex 8: Moving Around (pushd, popd) Go to this section.

(9)

Exercise 4

Make A Directory (mkdir)

Create new directories with the "make directory" command mkdir.

(10)

Exercise 5

Change Directory (cd)

Change to different directories with the "change directory" command cd.

(11)

Exercise 6

List Directory (ls)

List out the contents of a directory. Go to the exercise.

(12)

Exercise 7

Remove Directory (rmdir)

Remove a directory, but they have to be empty.

See how trying to remove a full directory causes an error. Go to the exercise.

(13)

Exercise 8

Moving Around (pushd, popd)

Temporarily moving to another directory with "push directory" (pushd).

Come back by "popping the directory" off with popd. Go to the exercise.

(14)

Files

Exercises 9-16

Ex 9: Making Empty Files (touch) Ex 10: Copy A File (cp)

Ex 11: Moving A File (mv) Ex 12: View A File (less) Ex 13: Stream A File (cat) Ex 14: Removing A File (rm) Ex 15: Pipes And Redirection Ex 16: Wildcard Matching Go to this section.

(15)

Exercise 9

Making Empty File (touch)

Sometimes you need to just make an empty file. The touch command does that.

(16)

Exercise 10

Copy A File (cp)

Copy a file’s contents to another file with the cp command. Go to the exercise.

(17)

Exercise 11

Moving A File (mv)

Move a file to a new place with the mv (move) command. This can also be considered "renaming" a file.

(18)

Exercise 12

View A File (less)

Take a quick look at a file with the less command. The less command is a modern version of an old unix command called more.

Get it? Ahhh, how droll. Go to the exercise.

(19)

Exercise 13

Stream A File (cat)

Dump the contents of a file to the terminal with cat. Go to the exercise.

(20)

Exercise 14

Removing A File (rm)

Remove a file, and also remove whole directories. DANGER! You can totally destroy your files if you’re not careful.

(21)

Exercise 15

Pipes And Redirection

Send the output of one command to the input of another. Chain inputs and outputs to multiple commands.

(22)

Exercise 16

Wildcard Matching

Run commands on whole batches of files with a "wildcard". The wildcard is also called a "regular expression".

If you want to learn about regular expressions, take a look at my other book, Learn Regex The Hard Way.

(23)

Searching

Exercises 17-18

Ex 17: Finding Files (find)

Ex 18: Looking Inside Files (grep) Go To This Section

(24)

Exercise 17

Finding Files (find)

Find files by their names and types with the find command. Go to the exercise.

(25)

Exercise 18

Looking Inside Files (grep)

Find files by their contents with the grep command. Go to the exercise.

(26)

Help

Exercises 19-20

Ex 19: Getting Command Help (man) Ex 20: Finding Help (apropos)

(27)

Exercise 19

Getting Command Help (man)

Why remember things when you can just look them up? The man command helps you get information on other commands.

You can also do –help or -h on many commands. Go to the exercise.

(28)

Exercise 20

Finding Help (apropos)

Sometimes you don’t even know the name of the command.

Searching online is usually better, but if you’re desperate, there’s apropos.

(29)

Sessions

Exercises 21-23

Ex 21: What’s In Your Environment (env, echo) Ex 22: Changing Environment Variables (export) Ex 23: Exiting Your Terminal (exit)

(30)

Exercise 21

What’s In Your Environment (env, echo)

What the environment is and what it does.

Find out what’s in your environment using env and echo. Go to the exercise.

(31)

Exercise 22

Changing Environment Variables (export)

Changing the environment contents using the export command.

Using unset to remove an environment variable. Go to the exercise.

(32)

Exercise 23

Exiting Your Terminal (exit)

Using exit to ... exit. Go to the exercise.

(33)

Next Steps

Where To Go From Here

Get the cheat sheet.

Print it out and keep it near you. Force yourself to use it every day. Go to this chapter.

Figure

Updating...

Related subjects :