Quiz 15 minutes Open note, open book, open computer Finding the answer – working to get it – is what helps you learn I don’t care how you find the answer,

Slides:



Advertisements
Similar presentations
ITR3 lecture 7: more introduction to UNIX Thomas Krichel
Advertisements

Learning Unix/Linux Bioinformatics Orientation 2008 Eric Bishop.
UNIX Chapter 12 Redirection and Piping Mr. Mohammad Smirat.
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
There are 4 Unix servers, fiji, sumatra, tahiti and ceylon Remote Access: telnet (bad!!!) ssh (Teraterm/putty) \\ \ (eg. \\fiji\awong) XDMCP “XWindows.
Information Networking Security and Assurance Lab National Chung Cheng University 1 What Linux is? Free Unix Like Open Source Network operating system.
BIF703 Redirection Continued: Pipes. Redirection Recall from the previous slides we defined stdin, stdout, and stderr and we learned how to redirect these.
Lecture 02CS311 – Operating Systems 1 1 CS311 – Lecture 02 Outline UNIX/Linux features – Redirection – pipes – Terminating a command – Running program.
Introduction to UNIX A User’s Perspective: Day 2 – Command Basics.
Introduction to Unix – CS 21 Lecture 5. Lecture Overview Lab Review Useful commands that will illustrate today’s lecture Streams of input and output File.
CS 141 Labs are mandatory. Attendance will be taken in each lab. Make account on moodle. Projects will be submitted via moodle.
1. This presentation covers :  User Interface Administration  Files System and Services Management 2.
Introduction to Linux Workshop February Introduction Rob Lane & The HPC Support Team Research Computing Services CUIT.
Using the “CLI” Unix / Linux Preparation Course May 25 Djibouti.
Introduction to UNIX/Linux Exercises Dan Stanzione.
BILKENT UNIVERSITY DEPARTMENT OF COMPUTER TECHNOLOGY AND INFORMATION SYSTEMS CTIS156 INFORMATION TECHNOLOGIES II CHAPTER 10: ADVANCED FILE PROCESSING.
COMP1070/2002/lec4/H.Melikian COMP1070 Lecture #5  Files and directories in UNIX  Various types of files  File attributes  Notion of pathname  Commands.
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”
Agenda User Profile File (.profile) –Keyword Shell Variables Linux (Unix) filters –Purpose –Commands: grep, sort, awk cut, tr, wc, spell.
Unix Basics Chapter 4.
BIF703 stdin, stdout, stderr Redirection. stdin, stdout, stderr Recall the Unix philosophy “do one thing well”. Unix has over one thousand commands (utilities)
The “File System” Under UNIX, (almost) everything is a “file”: –Normal files –Directories –Hardware –Sockets –Pipes Things that are not files: –Users –Groups.
Advanced UNIX Shell Dr. Tran, Van Hoai Faculty of Computer Science and Engineering HCMC Uni. of Technology
– Introduction to the Shell 10/1/2015 Introduction to the Shell – Session Introduction to the Shell – Session 2 · Permissions · Users.
Grades Please hand in your homework Quizzes coming back today Current grade on back with missing assignments Anything missing can be turned in late There.
Shell Scripting Todd Kelley CST8207 – Todd Kelley1.
Computer Programming for Biologists Oct 30 th – Dec 11 th, 2014 Karsten Hokamp  Fill out.
Guide to Linux Installation and Administration, 2e1 Chapter 7 The Role of the System Administrator.
Module 6 – Redirections, Pipes and Power Tools.. STDin 0 STDout 1 STDerr 2 Redirections.
Agenda Link of the week Use of Virtual Machine Review week one lab assignment This week’s expected outcomes Review next lab assignments Break Out Problems.
Pipes and Redirection in Linux ASFA Programming III C. Yarbrough.
Quiz 30 minutes 10 questions No talking, texting, collaboration, etc…
Unix/Linux cs3353. The Shell The shell is a program that acts as the interface between the user and the kernel. –The shell is fully programmable and will.
I/O and Redirection. Standard I/O u Standard Output (stdout) –default place to which programs write u Standard Input (stdin) –default place from which.
Using Commands Unix / Linux Preparation Course May 6, 2012 Serrekunda, The Gambia.
Review Please hand in your practicals and homework Regular Expressions with grep.
Homework & Review Questions? Everything after this is for accuracy – “All your permanent teeth are in, okay? You’re playing for keeps now!” -Psych Review:
Review Please hand in any homework and practicals Vim Scripting Inter-device communication.
Week 9 - Nov 7, Week 9 Agenda I/O redirection I/O redirection pipe pipe tee tee.
Agenda Basic Unix Commands (Chapters 2 & 3) Miscellaneous Commands: which, passwd, date, ps / kill Working with Files: file, touch, cat, more, less, grep,
Using the “CLI” Unix / Linux Preparation Course June 9, 2013 Lusaka, Zambia.
CS 245 – Part 1 Using Operating Systems and Networks for Programmers Jiang Guo Dept. of Computer Science California State University Los Angeles.
A Brief Overview of Unix Brandon Bohrer. Topics What is Unix? – Quick introduction Documentation – Where to get it, how to use it Text Editors – Know.
Review Please turn in your homework and practicals Packages, installation, rpm command Apache – Quick and easy way to set up a web server to play around.
Agenda The Bourne Shell – Part I Redirection ( >, >>,
1 CSE 390a Lecture 2 Exploring Shell Commands, Streams, and Redirection slides created by Marty Stepp, modified by Jessica Miller & Ruth Anderson
Learning Unix/Linux Based on slides from: Eric Bishop.
Using Linux Kaya Oğuz Room: 310.
Introduction to the Linux Commandline
Process API COMP 755.
Linux 101 Training Module Linux Basics.
Some Linux Commands.
The Linux Operating System
stdin, stdout, stderr Redirection
Exploring Shell Commands, Streams, and Redirection
CSE 303 Concepts and Tools for Software Development
Exploring Shell Commands, Streams, and Redirection
CSE 390a Lecture 2 Exploring Shell Commands, Streams, and Redirection
Exploring Shell Commands, Streams, and Redirection
Exploring Shell Commands, Streams, and Redirection
More advanced BASH usage
CSE 390a Lecture 2 Exploring Shell Commands, Streams, and Redirection
CSE 303 Concepts and Tools for Software Development
Exploring Shell Commands, Streams, and Redirection
Exploring Shell Commands, Streams, and Redirection
Exploring Shell Commands, Streams, and Redirection
LPI Linux Certification
Exploring Shell Commands, Streams, and Redirection
Presentation transcript:

Quiz 15 minutes Open note, open book, open computer Finding the answer – working to get it – is what helps you learn I don’t care how you find the answer, except for: No collaboration ( /text/chat/forums/facebook/etc…) or copying (plagiarism)

Review Please hand in your homework & practical with your quiz Directories - /bin & /sbin, /dev, /etc, home, /var Flags – different between commands Questions?

Today We already had a quiz Redirection Grep /var and /tmp

Folders /tmp – called ‘temp’ Directory for short-term storage, scratch space, and staging areas Is always the first place to have stuff deleted Don’t plan on having anything in this folder last /var – variable files that change during runtime Mail files, log files, web files, etc… Files that should change with the system Most accessed file: /var/log/messages

Grep Grep is a lot of power in a single command We’re only going to start looking for ‘static’ strings Static strings are things that don’t change (match 1:1) grep grep sea teams.txt grep -i sea teams.txt To the manual pages! (For the next slide)

Your Turn grep -i sea teams.txt grep -n Bears teams.txt grep Sea* teams.txt grep Sea teams*

Redirection Quick jump to another topic, but they tie together Redirection is the process of taking output and sending it to another location Almost useless example: ls > lsoutput.txt The > takes the STDOUT of the ls command (the listing of files), and instead of printing it to the screen, it redirects it into a file called lsoutput.txt

Redirection Characters STDOUT, STDIN, and STDERR are important because you can chain commands together What if we want to search a logfile for the word error? grep syntax is grep We ‘redirect’ the cat output to grep cat /var/log/messages | grep error can also do: grep error /var/log/messages

Style Note Grep’s syntax is grep string file You could easily grep error /var/log/messages However I do not – I always do: cat file | grep string This is a stylistic deviation, both do the same This is why I drinking scotch while grading And by drinking scotch I mean I don’t care if you do it my way or your way If it runs on the shell and answers the question, it will be counted as correct

Redirection Characters and | < is useless Not really, but we won’t cover it in this class I’ve been an admin for over a decade and never seen it outside of people in courses like this trying to contrive examples for it | is called pipe and chains commands together In the previous slide I posted cat file | grep string This takes the standard output of the cat command, and turns it into the standard input of the grep command

Redirection With > > will take STDOUT and put it into a file cat teams.txt > tmp The tmp file now contains a copy of the teams.txt file Often used to capture the output of a script ls > tmp The tmp was overwritten and now contains ONLY the output of the ls command (it deleted the teams.txt info before putting the ls output in there)

Quick Aside The ps command prints out the processes running on the system Think of it as a simple, text-based task manager You run scripts in Linux by putting./ in front of the script file./script.sh would execute the script.sh file These may or may not be practical (useful) applications of redirection and used as examples in the next slide

Redirection, Your Turn /etc/init.d]#./network > ~/network.out Command: Redirection character: Output: Description: ~]# ps –ef | grep bash Command: Redirection character: Output: Description:

One Last Aside - Sudo Wednesday we talked about su – switch user su student su ndillon su sudo is the utility that lets you (as another user) run a single command as root ~]$ sudo cat /var/log/messages As the user ndillon I can run one command as the root user

Sudo, pt2 Sudo config file is /etc/sudoers Inside this file you can set who can use sudo, as well as what commands they can use sudo with Yes on cat, no on grep or ip You will have to put your password in

Practical Question on directories, grep, or redirection? Today: You’ll grep the directories and play around with redirecting the output to files and commands

Own Study Directories – Sobell p82 /tmp /var Grep – Sobell, p56, 144, 438, 450, And flags Redirection – Sobell, p135 < (just kidding on the above) > |