1 of 25

CSE 391

Syllabus

Introduction to Linux

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

Now Playing: Sharou

Before class: Say hi to your neighbor! Introduce yourself and something you’re excited about for this quarter!

2 of 25

AGENDA

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

3 of 25

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

4 of 25

ASSESSMENT

  • Homework Assignments
    • There will be 10 assignments, each worth 2 points
    • Released after lecture, due the following Tuesday at 1:00pm
    • 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 20 possible points, you need 14 to pass the class
    • You may earn one extra point by doing the intro survey!
    • Recommend doing early assignments! Assignments build off concepts from earlier topics

5 of 25

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 - Ed
    • You are encouraged to help other students by pitching into the discussion on their questions!
  • For personal questions, you can post privately on the Ed discussion board. Otherwise, all questions should be posted to Ed. You may post anonymously to your classmates if you prefer!
    • If you’re facing a serious personal situation, you can always email Hunter directly.

6 of 25

COURSE STAFF

  • Email: hschafer@cs.washington.edu
  • OH:
    • Mon: 2:00 - 4:00, CSE 530 and Zoom

Instructor: Hunter Schafer

  • Email: evanhao@cs.washington.edu
  • OH:
    • Mon: 12:00 - 2:00, CSE 5th floor breakout and Zoom

TA: Evan Hao

7 of 25

CLASS STRUCTURE

  • Lecture content will be pre-recorded and hosted on a tool called ItemPool.
    • No account needed to use it!
    • All the course content is on these videos you can watch at your own pace.
    • Test your understanding questions to help you learn.
    • Note: Recorded in a previous quarter, ignore “administrative” details (e.g., due dates) in videos. All correct dates will be shared over EdStem/course website.
  • Class Sessions
    • Hunter will host Q&A sessions during the scheduled lecture time. Encouraged to come prepared after watching the pre-recorded lectures to discuss concepts as a class.
  • Access:
    • Lessons on ItemPool will be linked on the course calendar.
    • Class sessions will also be recorded and can be found in the Panopto tab, but those are going to be less useful unless you are there live.
    • You can attend Office hours in-person or remotely.

8 of 25

How many points are necessary to earn credit for this course? Enter a number.

14 (out of 20 possible)

9 of 25

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 (for all students in 391)
  • For detailed information, see the Working-At-Home tab on the course website.

There are so many options available out there since Linux is all over the place! However, we do not guarantee any support for using Linux outside of these provided options.

10 of 25

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
  • Industry applications of Linux (TBD)

11 of 25

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 25

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 25

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 25

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 25

RELATIVE DIRECTORIES

directory

description

.

References the working directory

..

References the parent of working directory

~username

username’s home directory

~/Desktop

Your desktop

16 of 25

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 25

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 25

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 25

Assume you are currently in the lecture1 directory. How could you list all of the files in dir1 (including hidden files) such that you get all of the long-form information in human-readable format.

Hint: Check the man pages to see what human-readable might mean!

ls -lah dir1

20 of 25

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

21 of 25

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

22 of 25

TEXT EDITORS

  • In many instances, you will be interacting with a Linux system with 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

23 of 25

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

24 of 25

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

25 of 25

Can a program write code?

We need YOU!

  • Assists you in Bash programming tasks
  • Translates English to Bash
  • Helps you to learn by example

Reasons to join

  • Exposure to state-of-the-art research
  • We pay YOU ($15 Amazon gift card)
  • Your data is completely anonymous

Requirements

  • 18 years old

Give executable permission for all *.sh files in dir/

find /dir/ -type f -name "*.sh" -exec chmod +x {} \;

Questions? @Thomas Schweizer on

Interested? http://bit.ly/en2bash-signup

Sign-up with this link by April 1st