1 of 23

CSE 391

Syllabus

Introduction to Linux

Slides created by Josh Ervin. Based off slides made by Marty Stepp, Jessica Miller, Ruth Anderson, Brett Wortzman, and Zorah Fung

2 of 23

COURSE STAFF

Lecturer: Ryan Maas

TA: Wei (Ellen) Wu

  • Email: maas@cs.washington.edu
  • OH: TBD

  • Email: wuwei33@cs.washington.edu
  • OH: TBD

3 of 23

COURSE TOPICS

  • Linux command line interface (CLI)
  • Shell commands, input/output redirection
  • Version control using git
  • Users, groups, and permissions
  • Regular expressions, sed
  • Basic data processing
  • Shell scripting

4 of 23

AGENDA

  • Course introduction and syllabus
  • Learning remotely using Zoom
  • Unix and Linux operating systems
  • Introduction to Bash shell

5 of 23

COURSE INTRODUCTION

  • Course website: https://cs.washington.edu/391
  • Learning Objectives: A collection of tools and topics not addressed in other classes that all CSE majors should know
  • Credit/No Credit class, assessed on weekly homework assignments
  • Textbook - Linux Pocket Guide
    • Optional, but we can only recommend it

6 of 23

ASSESSMENT

  • Homework Assignments
    • There will be 9 assignments, each worth 2 points
    • Released after lecture, due the following Tuesday at 10:00am (before class)
    • 1 point for a reasonable attempt on most questions*
    • 2 points for attempting all questions and most are correct*
    • * For most assignments this is graded by the autograder, and you will receive your score immediately after submission
    • No late assignments accepted
    • Collaboration is encouraged, but all submitted work must be your own.
  • Passing the Class
    • Of the 18 possible points, you need 14 to pass the class

7 of 23

DISCUSSION BOARD

  • Outside of office hours, the best way for you to get help with the class is to post on the course discussion board - https://edstem.org/us/courses/23457/
  • For personal questions, email the course staff. Otherwise, all questions should be posted to Ed. You may post anonymously to your classmates if you prefer!

8 of 23

REMOTE LEARNING

  • All lectures will be held in our classroom DEM 102, with recordings available after
  • Lectures:
    • Ryan will be giving “live” lectures during the allocated lecture time on Tuesdays from 10:50-11:50
    • Attendance is not required, but it will be beneficial for you to ask questions during this time.
  • Access:
    • We understand that not everyone will be able to attend all lectures, especially given the circumstances. All lectures are recorded and will be available via the Panopto section on Canvas.

9 of 23

ACCESSING LINUX/UNIX

  • In a roughly suggested order
    • ssh into attu (CSE Majors), linuxNN(EE majors), or ovid (all UW students)
    • Use the Virtual Machine (VM) provided by the CS Department
    • Access basement lab computers via vdi
    • Install Linux on your own computer
  • With a Mac, you can open the Terminal application and then ssh
  • With Windows, you can install Git for Windows and use Git Bash, or Cygwin
    • Opening these applications will give you the terminal interface to ssh into attu
  • For detailed information, see the Working-At-Home tab on the course website.

10 of 23

COURSE TOPICS

  • Linux command line interface (CLI)
  • Shell commands, input/output redirection
  • Version control using git
  • Users, groups, and permissions
  • Regular expressions, sed
  • Basic data processing
  • Shell scripting

11 of 23

A BRIEF HISTORY OF LINUX AND UNIX

  • Unix
    • First developed in 1969 at Bell Labs by Dennis Ritchie and Ken Thompson
    • Many key ideas still used today
      • “Everything is a file”
      • Multiple users, hierarchical file system
      • “Glueing” together lots of smaller files
      • Documentation included
    • macOS is a unix operating system in disguise!
  • Linux
    • Developed in 1992 by Linus Torvalds, who also developed git!

12 of 23

THE SHELL

  • Shell: an interactive program that allows the user to interact with the operating system and its applications
  • Why use a shell vs. the GUI (Graphical User Interface)?
    • Many complicated tasks are easier to do on the command line
    • Useful for working on remote servers
    • Programmable
    • Customizable

13 of 23

BASIC SHELL COMMANDS

command

description

pwd

Print current working directory

cd

Change working directory

ls

List files in working directory

man

Bring up manual for a command

exit

Log out of shell

14 of 23

SYSTEM COMMANDS

command

description

clear

Clears all output from console

date

Output the system date

cal

Output a text calendar

uname

Print information about the current system

15 of 23

RELATIVE DIRECTORIES

directory

description

.

References the working directory

..

References the parent of working directory

~username

username’s home directory

~/Desktop

Your desktop

16 of 23

UNIX FILE SYSTEM

directory

description

/

Root directory that contains all directories

/bin

Applications/programs (i.e. binaries)

/dev

Hardware devices

/etc

Configuration files

/home

Contains user’s home directories

/proc

Running programs (processes)

/tmp, /var

Temporary files

/usr

Universal system resources

17 of 23

DIRECTORY COMMANDS

directory

description

ls

List files in working directory

pwd

Print current working directory

cd

Change working directory

mkdir

Make a new directory

rmdir

Remove the given directory (must be empty)

18 of 23

COMMAND LINE ARGUMENTS

  • There aren’t any consistent definitions when it comes to command line arguments, but for this class we will use the following way to describe the anatomy of a command

$ ls -al dir1

Command

Flags

Arguments

(Parameters)

19 of 23

COMMAND LINE ARGUMENTS

  • Much like methods in Java take arguments, so do commands on the command line
  • Flags are modifiers which change a programs behavior slightly, and they are usually prepended with a -
  • For example, to list all files in long-list format, run the following
    • $ ls -l
  • Flags can be combined, to list all files in long-list format and list hidden files
    • $ ls -la
  • Commands also take arguments, such as file names
  • To view all files , in long-listing format, inside of dir1
    • $ ls -l dir1

20 of 23

FILE COMMANDS

  • Warning: The above commands do not ask for confirmation. Be careful moving or copying files, as you might overwrite existing files!
  • Check the man pages for flags to prevent this behavior

directory

description

cp

Copy a file

mv

Move a file (also used to rename files)

rm

Remove the given file

touch

Create empty file, or change time-modified

21 of 23

TEXT EDITORS

  • In many instances, you will be interacting with a Linux system without a graphical environment so a command-line text-editor is necessary
  • vim/emacs are powerful text-editors preferred by many experienced Linux users. It’s up to you which one to focus on in this class.

command

description

nano

Very simple editor

vim

More advanced text-editor

emacs

More advanced text-editor

22 of 23

VIM BASICS

Key stroke

description

:w

Write (save) the current file

:wq

Write (save) the current file and exit

:q!

Quit, ignoring all changes

i

Go into insert mode

Esc

Go back to normal mode

hjkl

Move cursor left, down, up, right

u

Undo last change

x

Delete character

23 of 23

EMACS BASICS

C = control key

M = alt/meta key

Key stroke

description

C-x C-f

Read a file into emacs

C-x C-s

Save a file to disk

C-x C-c

Exit emacs

C-s

Search forward

C-r

Search backwards

C-v

Scroll to next screen

M-v

Scroll to previous screen

C-x u

Undu