David Notkin Autumn 2009 CSE303 Lecture 2 Dictionary.com, "bash," in Dictionary.com Unabridged. Source location: Random House, Inc.

Slides:



Advertisements
Similar presentations
NETW-240 Shells Last Update Copyright Kenneth M. Chipps Ph.D. 1.
Advertisements

1 CSE 390a Lecture 1 introduction to Linux/Unix environment slides created by Marty Stepp, modified by Josh Goodwin
Introducing the Command Line CMSC 121 Introduction to UNIX Much of the material in these slides was taken from Dan Hood’s CMSC 121 Lecture Notes.
1 CSE 390a Lecture 2 Exploring Shell Commands, Streams, and Redirection slides created by Marty Stepp, modified by Josh Goodwin
CSE 303 Lecture 2 Introduction to bash shell
Very Quick & Basic Unix Steven Newhouse Unix is user-friendly. It's just very selective about who its friends are.
CS 141 Labs are mandatory. Attendance will be taken in each lab. Make account on moodle. Projects will be submitted via moodle.
Using Macs and Unix Nancy Griffeth January 6, 2014 Funding for this workshop was provided by the program “Computational Modeling and Analysis of Complex.
Introduction to Linux Workshop February Introduction Rob Lane & The HPC Support Team Research Computing Services CUIT.
"Two of the most famous products of Berkeley are LSD and Unix. I don't think that this is a coincidence.” Anonymous.
COMP1070/2002/lec4/H.Melikian COMP1070 Lecture #5  Files and directories in UNIX  Various types of files  File attributes  Notion of pathname  Commands.
1 Day 3 Directories Files Moving & Copying. 2 Case Sensitive First thing to learn about UNIX is that everything is case sensitive. Thus the files: –enda.
Unix Primer. Unix Shell The shell is a command programming language that provides an interface to the UNIX operating system. The shell is a “regular”
Chapter 9 Part II Linux Command Line Access to Linux Authenticated login using a Linux account is required to access a Linux system. The Linux prompt will.
File Processing. Introduction More UNIX commands for handling files Regular Expressions and Searching files Redirection and pipes Bash facilities.
INTRODUCTION TO LINUX Jacob Chan. GNU/Linux Consists of Linux kernel, GNU utilities, and open source and commercial applications Works like Unix –Multi-user.
Second edition Your UNIX: The Ultimate Guide Das © 2006 The McGraw-Hill Companies, Inc. All rights reserved. UNIX Commands cal – will print a calendar.
Using Commands Unix / Linux Preparation Course May 6, 2012 Serrekunda, The Gambia.
BIF713 Basic Unix/Linux Commands Getting Help with Commands.
Chapter 1 : The Linux System Part 2 Lecture 2 11/14/
1 CSE 390a Lecture 1 introduction to Linux/Unix environment slides created by Marty Stepp, modified by Jessica Miller & Ruth Anderson
1 CSE 390a Lecture 1 introduction to Linux/Unix environment slides created by Marty Stepp, modified by Jessica Miller & Ruth Anderson
CSE 374 Programming Concepts & Tools Hal Perkins Fall 2015 Lecture 2a – A Unix Command Sampler (Courtesy of David Notkin, CSE 303)
Using the “CLI” Unix / Linux Preparation Course June 9, 2013 Lusaka, Zambia.
Linux Commands C151 Multi-User Operating Systems.
1 Lecture 2 Working with Files and Directories COP 3353 Introduction to UNIX.
Lecture 02 File and File system. Topics Describe the layout of a Linux file system Display and set paths Describe the most important files, including.
The Kernel At a high level, the kernel in an operating system serves as the bridge between applications and the actual data processing of the hardware.
1 CS3695 – Network Vulnerability Assessment & Risk Mitigation – Introduction to Unix & Linux.
1 CSE 390a Lecture 2 Exploring Shell Commands, Streams, and Redirection slides created by Marty Stepp, modified by Jessica Miller & Ruth Anderson
introduction to Linux/Unix environment
Linux Tutorial Lesson Two *Getting Help in Linux *Data movement and manipulation *Relative and Absolute path *Processes Note: see chapter 1,2,3 from Linux.
Learning Unix/Linux Based on slides from: Eric Bishop.
Exploring Shell Commands, Streams, and Redirection
introduction to Linux/Unix environment
introduction to Linux/Unix environment
introduction to Linux/Unix environment
introduction to Linux/Unix environment
Some Linux Commands.
introduction to Linux/Unix environment
Exploring Shell Commands, Streams, and Redirection
CSE 374 Programming Concepts & Tools
introduction to Linux/Unix environment
Exploring Shell Commands, Streams, and Redirection
Basic UNIX OLC Training.
CSE 390a Lecture 2 Exploring Shell Commands, Streams, and Redirection
Introduction to Linux Week 0 - Thursday.
CSE 390a Lecture 1 introduction to Linux/Unix environment
Exploring Shell Commands, Streams, and Redirection
Exploring Shell Commands, Streams, and Redirection
Exploring Shell Commands, Streams, and Redirection
CSE 390a Lecture 1 introduction to Linux/Unix environment
introduction to Linux/Unix environment
introduction to Linux/Unix environment
Exploring Shell Commands, Streams, Redirection, and Processes
CSE 390a Lecture 2 Exploring Shell Commands, Streams, and Redirection
introduction to Linux/Unix environment
introduction to Linux/Unix environment
CSE 303 Concepts and Tools for Software Development
introduction to Linux/Unix environment
introduction to Linux/Unix environment
introduction to Linux/Unix environment
introduction to Linux/Unix environment
Exploring Shell Commands, Streams, and Redirection
Exploring Shell Commands, Streams, and Redirection
A shell is a user interface.
Exploring Shell Commands, Streams, and Redirection
introduction to Linux/Unix environment
Exploring Shell Commands, Streams, and Redirection
Presentation transcript:

David Notkin Autumn 2009 CSE303 Lecture 2 Dictionary.com, "bash," in Dictionary.com Unabridged. Source location: Random House, Inc. Available: Accessed: October 01, Verb to strike with a crushing or smashing blow. Chiefly British, Canadian. to hurl harsh verbal abuse at Noun a crushing blow. Informal. a thoroughly enjoyable, lively party. Idioms have a bash (at), British. to attempt; make an attempt. on the bash, British. working as a prostitute. Bash (Origin: 1635–45)

Odds and ends Final is on Tuesday December 15 th – thanks for the good catch! Books Where and how to compute? –“Do I have to install Linux?” No –“Can I install Linux?” Yes –“Can I run on Windows?” Yes –“Can I run on a Mac?” Yes –“Can I run from home?” Yes –… CSE303 Au092

Rumors about 303: selection Big workload for a 3 credit class; harder than 143; Linux heavy; C is less friendly than Java Pointers in C and C++ may be confusing (or funnest thing since Slip and Slide); memory management is hard Learn [several|10] programming languages It is the 152nd odd number greater than zero. This does not worry me. Many of the group programming assignments are very challenging I have heard that the grading curve in CSE 303 is extraordinarily competitive and that it is typically dominated by a group of very experienced students who get perfect scores on nearly all assignments and tests making it very difficult for other students to attain good grades due to the curve. An [easy | fun |hard | not that bad |straightforward | awesome | time-consuming | useful | different ] class It's a lot of a mess of junk that they put in one class. Other people know way more than you. You will get lost really quickly if you aren't fast in picking up Unix. We have to use comments. CSE303 Au093

Rumors about Notkin: selection Software researcher. I heard you are an interesting guy. You are a strict grader He is a hard grader He appears to have glasses. He's a funny dude CSE303 Au094

Rumors about beard: selection Beardly things. EPIC BEARD The beard [ is old | grows mold | may come alive and swallow you whole | would make Moses cower | has existed since the 80s (“this worries me”) | is over 25 years old (“incredibly awesome”) | is fake | is kick ass (“confirmed true”) | is nice | is long | was cursed by the Linux penguin | is older than myself]. He keeps students he doesn't like trapped in his beard. No one knows what's hidden in his beard. Tiny gnomes hide in his beard, and that's where he gets his powers I haven't heard any rumors about David Notkin, but I have been told that the possesion of a beard of such calibre indicates a mastery of Unix. That a portal to an alien world is hiding in his beard, and the aliens (Nortkinians) may decide to overrun our planet at any time. CSE303 Au095

Tend to learn best? 16% From watching others do something 63% From trying it myself 6% From reading manuals 15% Other CSE303 Au096

Experience with Unix? 49% None 37% A little 11% Quite a bit 3% Pays my tuition CSE303 Au097

Experience with C/C++? 52% None 37% A little 9% Quite a bit 2% Pays my tuition CSE303 Au098

Where do you compute? 11% CSE labs 11% Own computer using CSE cycles 68% Own computer almost entirely 10% Other CSE303 Au099

Practice Almost all abilities demand a significant amount of relatively rote practice: piano and scales, baseball and playing catch, painting and figure drawing, etc. Over time, the rote activities become second nature and it is possible to chunk/abstract those activities to make it far easier to do more complex things The next couple of lectures and assignments will, to some degree, focus on some of these rote activities in using Unix commands For those of you who have already developed these rote abilities, a refresher is good once in a while CSE303 Au0910

Demo: throughout today’s lecture CSE303 Au0911

Basics Basic shell commands Unix file system structure: “everything” is a file Commands for file manipulation, examination, searching Keyboard shortcuts and special characters CSE303 Au0912

Shell commands A name followed by an optional set of arguments/parameters –Example: cp (copy) accepts a source and destination file path A program uses three streams of information –stdin, stdio, stdout (standard in, out, error) –Defaults: input from the keyboard, output and errors to the console Parameters vs. input –parameters: before [Enter] is pressed; sent to the program by the shell –input: after [Enter] is pressed; sent to the program during execution by the user CSE303 Au0913

Directory commands CSE303 Au0914 commanddescription ls list files in a directory pwd output the current working directory cd change the working directory mkdir create a new directory rmdir delete a directory (must be empty)

Command line arguments Most options are given after the command name using a dash followed by a letter: -c, -h, -S, … Some options are longer words preceded by two dashes: --count, --help Parameters can be combined: ls -l -a -r can be ls –lar Many programs accept a –help parameter; others provide help if run with no arguments Many commands accept a file name parameter: if it is omitted, the program will read from standard input CSE303 Au0915

Relative naming CSE303 Au0916 directorydescription. the directory you are in ("working directory").. the parent of the working directory (../.. is grandparent, etc.) ~ your home directory (on many systems, this is /home/username ) ~username username 's home directory ~/Desktop your desktop

Shell/system commands "man pages" are a very important way to learn new commands commanddescription man or info get help on a command apropos (man –k) search for commands by keyword clear clears out the output from the console exit exits and logs out of the shell commanddescription date, time output the system date/time cal output a text calendar uname print information about the current system

File commands CAUTION: the above commands do not prompt for confirmation, so it’s easy to overwrite/delete a file This setting can be overridden (how?) commanddescription cp copy a file mv move or rename a file rm delete a file touch update a file’s last-modified time stamp (or create a new empty file)

Links hard link: two names for the same file –ln foo bar –This links bar as a duplicate name for foo –If one is modified, the other is too; if one is deleted, both will go away soft (symbolic) link: A reference to another file –ln -s snork fork –This creates a reference fork to the file snork fork can be used as though it were snork If fork is deleted, snork will be unaffected commanddescription ln create a link to a file unlink remove a link to a file

File examination Suppose you are writing a paper, and the teacher says it can be anything as long as it is at least 200 words long and mentions commanddescription cat output a file's contents on the console more or less output a file's contents, one page at a time head, tail output the first or last few lines of a file wc count words, characters, and lines in a file du report disk space used by a file(s) diff compare two files and report differences

Searching and sorting grep is a very powerful search tool; more later... Exercise : Given a text file students.txt, display the students arranged by the reverse alphabetical order of their last names. –Can we display them sorted by first name? commanddescription grep search a file for a given string sort convert an input into a sorted output by lines uniq strip duplicate lines find search for files within a given directory locate search for files on the entire system which shows the complete path of a command

Keyboard shortcuts ^KEY means hold Ctrl and press KEY keydescription Up arrow repeat previous commands Home / End or ^A / ^E move to start/end of current line " quotes surround multi-word arguments and arguments containing special characters * "wildcard", matches any files; can be used as a prefix, suffix, or partial name Tab auto-completes a partially typed file/command name ^C or ^\ terminates the currently running process ^D end of input; used when a program is reading input from your keyboard and you are finished typing ^Z suspends (pauses) the currently running process ^S don't use this; hides all output until ^G is pressed

File system CSE303 Au0923 directorydescription / root directory that contains all others (drives do not have letters in Unix) /bin programs /dev hardware devices /etc system configuration files  /etc/passwd stores user info  /etc/shadow stores passwords /home users' home directories /media,/mnt,... drives and removable disks that have been "mounted" for use on this computer /proc currently running processes (programs) /tmp, /var temporary files /usr user-installed programs

Questions? CSE303 Au0924