CS 25200: Systems Programming. Lecture 11: *nix Commands and Shell Internals
|
|
- Veronica Lynch
- 6 years ago
- Views:
Transcription
1 CS 25200: Systems Programming Lecture 11: *nix Commands and Shell Internals Dr. Jef Turkstra 2018 Dr. Jeffrey A. Turkstra 1
2 Lecture 11 Shell commands Basic shell internals 2018 Dr. Jeffrey A. Turkstra 2
3 man Interface to reference manuals man [options] [section] file Examples man cp # manual page for copy cmd man -k printf # search pages for keyword man 3 exec # man page from section Dr. Jeffrey A. Turkstra 3
4 Sections 1: Executable programs or shells 2: System calls 3: Library calls 4: Special fles (usually in /dev) 5: File formats and coventions 6: Games 7: Miscellaneous 8: System administration commands 9: Kernel routines (non standard) 2018 Dr. Jeffrey A. Turkstra 4
5 ls List directory contents ls [options] [file(s)] Examples... ls # list files in pwd ls -al # hidden (all) files, long listing ls -R # recursive 2018 Dr. Jeffrey A. Turkstra 5
6 mkdir Make directories mkdir [options] directory Examples... mkdir bob mkdir -p bob/is/deep # leading path mkdir -m 700 bob # set the mode 2018 Dr. Jeffrey A. Turkstra 6
7 cp Copy fles and directories cp [options] src dest Examples... cp bob joe cp -r dir1 dir2 # recursive cp -rp dir1 dir2 # preserve perms/times/etc cp -x dir1 dir2 # do not cross filesystems 2018 Dr. Jeffrey A. Turkstra 7
8 mv Move (rename) fles mv [options] src dest Examples... mv bob mike mv dir1 dir2 mv -n bob exists # do not overwrite mv -i bob exists # interactive 2018 Dr. Jeffrey A. Turkstra 8
9 rm Remove fles or directories rm [options] file(s) Examples... rm a.txt b.txt rm -f a.txt # force, no error message rm -r dir1 # recursive rm -rf dir1 # be careful rm -rf ~ /some/path 2018 Dr. Jeffrey A. Turkstra 9
10 whereis Locates the binary, source, and manual fles for the given command whereis [options] name Only works if the requisite db has been generated Example whereis ls 2018 Dr. Jeffrey A. Turkstra 10
11 which Shows the full path to a command which [options] programname Examples which ps which ls which sudo 2018 Dr. Jeffrey A. Turkstra 11
12 tee Check out the unix tee command any_command tee save_out Saves a copy of all output (sent to standard out) in the fle save_out tee save_in any_command Saves a copy of all input (sent to standard in) in the fle save_in 2018 Dr. Jeffrey A. Turkstra 12
13 head Collects the frst n lines of a fle with n defaulting to 10 if unspecifed head [-n] file Examples head -30 yuk # top 30 lines head yuk # top 10 lines head * # top 10 lines of every file 2018 Dr. Jeffrey A. Turkstra 13
14 tail tail [+/-[n] [b c l] [-f]] file delivers n units from the fle +n counting from the top -n counting from the end n defaults to -10 if unspecifed counting by b blocks c characters l lines (default) -f means follow - infnite trailing output (use ctrl-c to stop) Has bufer limitations - see the man page 2018 Dr. Jeffrey A. Turkstra 14
15 Examples tail +10 yuk # all lines beyond line 10 tail -30 yuk # last 30 lines tail -30c yuk # last 30 characters tail -30f yuk # last 30 lines, continuing outputting any added lines tail -30 * # last 30 lines of all fles 2018 Dr. Jeffrey A. Turkstra 15
16 cut Used to make vertical cuts across a fle cut -flags columns or field filename Useful fags -c characters -d feld delimiter -f felds See man page for more information 2018 Dr. Jeffrey A. Turkstra 16
17 Examples Given a fle data, abcd efgb This is line one this is no big deal and this script, #! /bin/bash cut -c1-5,8- data echo '------' cut -d' ' -f2-3 data exit 0 We get this output: abcd efgb This line one this no big deal abcd is line is no 2018 Dr. Jeffrey A. Turkstra 17
18 Another example Here's another example: #! /bin/bash DAY_OF_WEEK="$(date cut -d' ' -f1-1)" MONTH="$(date cut -d' ' -f2-2)" DAY="$(date cut -d' ' -f3-3)" YEAR="$(date cut -d' ' -f6-)" echo "Date: $(date)" echo "Month: ${MONTH}" echo "Day: ${Day}" echo "Year: ${Year}" echo "Day of the week: ${DAY_OF_WEEK}" exit 0 Which outputs Date: Mon Jul 22 16:01:17 EST 1996 Month: Jul Day: 22 Year: 1996 Day of the week: Mon 2018 Dr. Jeffrey A. Turkstra 18
19 paste Used to combine lines from two fles together paste [-dlist] file1 file2 By default concatenates corresponding lines of the fles together using a tab as the separator Example: paste -d" " x y z concatenates the corresponding lines of the fles x, y, and z together using the list of separators circularly. In this case the list only contains a single space Dr. Jeffrey A. Turkstra 19
20 More examples paste -s [-d list] file1 file2 merges lines together serially (one fle at a time) paste -s -d" \n" yuk pastes each pair of lines in the fle yuk together the list specifed with -d is a space followed by a newline See man page for more options and information 2018 Dr. Jeffrey A. Turkstra 20
21 wc Word count wc -[c w l] file Used to count -c characters -l lines -w words (separated by whitespace) Default is all three 2018 Dr. Jeffrey A. Turkstra 21
22 Example #! /bin/bash Output: wc x.c wc -l x.c x.c wc -w x.c 301 x.c wc -c x.c 878 x.c NL=$(wc x.c) 8382 x.c echo ${NL} x.c echo "\"${NL}\"" " x.c" LL=$(wc -l < x.c) " 301" echo "\"${LL}\"" 301 echo ${LL} exit Dr. Jeffrey A. Turkstra 22
23 A quick look at sort Read the man page for more information A few very useful fags: -u unique lines only -txfeld separator x (default is whitespace) -b ignore leading blanks -r reverse sort -n numbers not characters -k sort on felds (up to 10 -k options allowed) Note: feld numbers begin with Dr. Jeffrey A. Turkstra 23
24 sort example This example, #! /bin/bash cat data echo sort data exit 0 Yields this output: 1 a 5 0 b 3 2 b 4 1 a 5 3 a 4 1 a 5 1 b 4 1 b 4 0 b 3 2 b 4 1 a 5 3 a Dr. Jeffrey A. Turkstra 24
25 Another example This example, #! /bin/bash cat data echo sort -u data exit 0 Yields this output: 1 a 5 0 b 3 2 b 4 1 a 5 3 a 4 1 b 4 1 b 4 2 b 4 0 b 3 3 a 4 1 a Dr. Jeffrey A. Turkstra 25
26 -u and -k example This example, #! /bin/bash cat data echo sort -u -k 2 data exit 0 Yields this output: 1 a 5 3 a 4 2 b 4 1 a 5 3 a 4 0 b 3 1 b 4 1 b 4 0 b 3 1 a Dr. Jeffrey A. Turkstra 26
27 Another -u and -k example This example, #! /bin/bash cat data echo sort -u -k 2,2 data exit 0 Yields this output: 1 a 5 1 a 5 2 b 4 0 b 3 3 a 4 1 b 4 0 b 3 1 a Dr. Jeffrey A. Turkstra 27
28 Specifying feld order This example, #! /bin/bash cat data echo sort -ur -k 2,2 -k 3,3 -k 1,1 data exit 0 Yields this output: 1 a 5 2 b 4 2 b 4 1 b 4 3 a 4 0 b 3 1 b 4 1 a 5 0 b 3 3 a 4 1 a Dr. Jeffrey A. Turkstra 28
29 Beating the dead horse This example, #! /bin/bash cat data echo sort -k 3,3 -k 1,1 -k 2,2 data echo sort -k 3bn,3 -k 1bn,1 -k 2b,2 data exit 0 Yields this output: 1 a 5 3 a b 4 11 b 4 11 b 4 1 a 5 12 c c 40 3 a 14 2 a 40 2 a 40 2 a c 51 1 a 5 12 c 40 3 a c c Dr. Jeffrey A. Turkstra 29
30 awk Pattern scanner and processing language Sequence of rules... pattern {action} default {action} Pattern is a regular expression Action is a sequence of statements to execute when pattern is matched 2018 Dr. Jeffrey A. Turkstra 30
31 awk Good for simple text manipulation awk {print $1} somefile.txt Google awk for some good tutorials 2018 Dr. Jeffrey A. Turkstra 31
32 sed Stream editor sed s/current/new/g somefile > newfile Replace all instances of current with new, output to newfle 2018 Dr. Jeffrey A. Turkstra 32
33 find Search for fles in a directory hierarchy find [options] starting_dir expression Search directory tree for expression, applying optional tests and actions Examples find. -name *.conf -print find. -name *.conf -exec chmod o+r {} \; 2018 Dr. Jeffrey A. Turkstra 33
34 UNIX Organization *nix has multiple components Scheduler decides when and for how long a process should run File system provides a persistent storage mechanism Virtual memory address space isolation Networking Windowing system Shells and applications 2018 Dr. Jeffrey A. Turkstra 34
35 Shells A shell is basically a command interpreter. It provides an interface between the user and the computer (operating system). Shells may be graphical (explorer.exe, for instance) or text- based - often times called a CLI or command line interface 2018 Dr. Jeffrey A. Turkstra 35
36 Shells cont When we write a shell script, the frst line of the fle tells the operating system which shell to use. Some common *NIX shells include: #! /bin/sh Bourne shell #! /bin/csh C-Shell #! /bin/ksh KornShell (more powerful) #! /bin/bash Bourne-Again SHell 2018 Dr. Jeffrey A. Turkstra 36
37 Shells A shell is a program. We interact with an instance of it a process. Just like malloc() or anything other software, we can write our own Basic shells are made up of a parser and an executor Most shells have other subsystems as well 2018 Dr. Jeffrey A. Turkstra 37
38 Parser The process of reading a string of symbols conforming to a grammar For our shell, it results in a command table: $ ls -al grep me > file1 ls grep In:dft -al me Out:fle1 Err:dft 2018 Dr. Jeffrey A. Turkstra 38
39 Executor Creates processes for the command table entries Juggles fle descriptors to create pipes between process inputs and outputs Also redirects stdin, stdout, and stderr $ A b c d > out < in 2018 Dr. Jeffrey A. Turkstra 39
40 Other subsystems Environment variables Setting, printing, expanding Wildcards E.g., expanding a*a Subshells Backticks ` ` and $( ) 2018 Dr. Jeffrey A. Turkstra 40
41 Shell project Three parts Parser read command line and print command table Executor create processes and connect them with pipes Also handle I/O redirection Other subsystems wildcards, environment vars, subshells 2018 Dr. Jeffrey A. Turkstra 41
42 Questions? 2018 Dr. Jeffrey A. Turkstra 42
CS 25200: Systems Programming. Lecture 10: Shell Scripting in Bash
CS 25200: Systems Programming Lecture 10: Shell Scripting in Bash Dr. Jef Turkstra 2018 Dr. Jeffrey A. Turkstra 1 Lecture 10 Getting started with Bash Data types Reading and writing Control loops Decision
More informationShell. SSE2034: System Software Experiment 3, Fall 2018, Jinkyu Jeong
Shell Prof. Jinkyu Jeong (Jinkyu@skku.edu) TA -- Minwoo Ahn (minwoo.ahn@csl.skku.edu) TA -- Donghyun Kim (donghyun.kim@csl.skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu
More informationTable of contents. Our goal. Notes. Notes. Notes. Summer June 29, Our goal is to see how we can use Unix as a tool for developing programs
Summer 2010 Department of Computer Science and Engineering York University Toronto June 29, 2010 1 / 36 Table of contents 1 2 3 4 2 / 36 Our goal Our goal is to see how we can use Unix as a tool for developing
More informationUnix/Linux Basics. Cpt S 223, Fall 2007 Copyright: Washington State University
Unix/Linux Basics 1 Some basics to remember Everything is case sensitive Eg., you can have two different files of the same name but different case in the same folder Console-driven (same as terminal )
More informationIntroduction: What is Unix?
Introduction Introduction: What is Unix? An operating system Developed at AT&T Bell Labs in the 1960 s Command Line Interpreter GUIs (Window systems) are now available Introduction: Unix vs. Linux Unix
More informationsottotitolo A.A. 2016/17 Federico Reghenzani, Alessandro Barenghi
Titolo presentazione Piattaforme Software per la Rete sottotitolo BASH Scripting Milano, XX mese 20XX A.A. 2016/17, Alessandro Barenghi Outline 1) Introduction to BASH 2) Helper commands 3) Control Flow
More informationShell Programming Systems Skills in C and Unix
Shell Programming 15-123 Systems Skills in C and Unix The Shell A command line interpreter that provides the interface to Unix OS. What Shell are we on? echo $SHELL Most unix systems have Bourne shell
More informationCST Algonquin College 2
The Shell Kernel (briefly) Shell What happens when you hit [ENTER]? Output redirection and pipes Noclobber (not a typo) Shell prompts Aliases Filespecs History Displaying file contents CST8207 - Algonquin
More informationEECS 470 Lab 5. Linux Shell Scripting. Friday, 1 st February, 2018
EECS 470 Lab 5 Linux Shell Scripting Department of Electrical Engineering and Computer Science College of Engineering University of Michigan Friday, 1 st February, 2018 (University of Michigan) Lab 5:
More informationThe Unix Shell. Pipes and Filters
The Unix Shell Copyright Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See http://software-carpentry.org/license.html for more information. shell shell pwd
More informationAdvanced Linux Commands & Shell Scripting
Advanced Linux Commands & Shell Scripting Advanced Genomics & Bioinformatics Workshop James Oguya Nairobi, Kenya August, 2016 Man pages Most Linux commands are shipped with their reference manuals To view
More informationWeek Overview. Simple filter commands: head, tail, cut, sort, tr, wc grep utility stdin, stdout, stderr Redirection and piping /dev/null file
ULI101 Week 05 Week Overview Simple filter commands: head, tail, cut, sort, tr, wc grep utility stdin, stdout, stderr Redirection and piping /dev/null file head and tail commands These commands display
More informationLec 1 add-on: Linux Intro
Lec 1 add-on: Linux Intro Readings: - Unix Power Tools, Powers et al., O Reilly - Linux in a Nutshell, Siever et al., O Reilly Summary: - Linux File System - Users and Groups - Shell - Text Editors - Misc
More informationUseful Unix Commands Cheat Sheet
Useful Unix Commands Cheat Sheet The Chinese University of Hong Kong SIGSC Training (Fall 2016) FILE AND DIRECTORY pwd Return path to current directory. ls List directories and files here. ls dir List
More informationLinux Essentials. Programming and Data Structures Lab M Tech CS First Year, First Semester
Linux Essentials Programming and Data Structures Lab M Tech CS First Year, First Semester Adapted from PDS Lab 2014 and 2015 Login, Logout, Password $ ssh mtc16xx@192.168.---.--- $ ssh X mtc16xx@192.168.---.---
More informationLinux Command Line Primer. By: Scott Marshall
Linux Command Line Primer By: Scott Marshall Draft: 10/21/2007 Table of Contents Topic Page(s) Preface 1 General Filesystem Background Information 2 General Filesystem Commands 2 Working with Files and
More informationIntroduction to UNIX. Logging in. Basic System Architecture 10/7/10. most systems have graphical login on Linux machines
Introduction to UNIX Logging in Basic system architecture Getting help Intro to shell (tcsh) Basic UNIX File Maintenance Intro to emacs I/O Redirection Shell scripts Logging in most systems have graphical
More informationThe UNIX Shells. Computer Center, CS, NCTU. How shell works. Unix shells. Fetch command Analyze Execute
Shells The UNIX Shells How shell works Fetch command Analyze Execute Unix shells Shell Originator System Name Prompt Bourne Shell S. R. Bourne /bin/sh $ Csh Bill Joy /bin/csh % Tcsh Ken Greer /bin/tcsh
More informationBasic Linux (Bash) Commands
Basic Linux (Bash) Commands Hint: Run commands in the emacs shell (emacs -nw, then M-x shell) instead of the terminal. It eases searching for and revising commands and navigating and copying-and-pasting
More informationLinux Refresher (1) 310/ Fourth Workshop on Distributed Laboratory Instrumentation Systems (30 October - 24 November 2006)
310/1779-4 Fourth Workshop on Distributed Laboratory Instrumentation Systems (30 October - 24 November 2006) Linux Refresher (1) Razaq Babalola IJADUOLA These lecture notes are intended only for distribution
More informationFiles and Directories
CSCI 2132: Software Development Files and Directories Norbert Zeh Faculty of Computer Science Dalhousie University Winter 2019 Files and Directories Much of the operation of Unix and programs running on
More information5/8/2012. Exploring Utilities Chapter 5
Exploring Utilities Chapter 5 Examining the contents of files. Working with the cut and paste feature. Formatting output with the column utility. Searching for lines containing a target string with grep.
More informationLab 2: Linux/Unix shell
Lab 2: Linux/Unix shell Comp Sci 1585 Data Structures Lab: Tools for Computer Scientists Outline 1 2 3 4 5 6 7 What is a shell? What is a shell? login is a program that logs users in to a computer. When
More informationChapter 1 - Introduction. September 8, 2016
Chapter 1 - Introduction September 8, 2016 Introduction Overview of Linux/Unix Shells Commands: built-in, aliases, program invocations, alternation and iteration Finding more information: man, info Help
More informationReading and manipulating files
Reading and manipulating files Goals By the end of this lesson you will be able to Read files without using text editors Access specific parts of files Count the number of words and lines in a file Sort
More informationCS 307: UNIX PROGRAMMING ENVIRONMENT KATAS FOR EXAM 2
CS 307: UNIX PROGRAMMING ENVIRONMENT KATAS FOR EXAM 2 Prof. Michael J. Reale Fall 2014 COMMAND KATA 7: VARIABLES Command Kata 7: Preparation First, go to ~/cs307 cd ~/cs307 Make directory dkata7 and go
More informationIntroduction to Unix: Fundamental Commands
Introduction to Unix: Fundamental Commands Ricky Patterson UVA Library Based on slides from Turgut Yilmaz Istanbul Teknik University 1 What We Will Learn The fundamental commands of the Unix operating
More informationUnix Guide. Meher Krishna Patel. Created on : Octorber, 2017 Last updated : December, More documents are freely available at PythonDSP
Unix Guide Meher Krishna Patel Created on : Octorber, 2017 Last updated : December, 2017 More documents are freely available at PythonDSP Table of contents Table of contents i 1 Unix commands 1 1.1 Unix
More informationGetting your department account
02/11/2013 11:35 AM Getting your department account The instructions are at Creating a CS account 02/11/2013 11:36 AM Getting help Vijay Adusumalli will be in the CS majors lab in the basement of the Love
More informationCS Unix Tools. Lecture 2 Fall Hussam Abu-Libdeh based on slides by David Slater. September 10, 2010
Lecture 2 Fall 2010 Hussam Abu-Libdeh based on slides by David Slater September 10, 2010 Last Time We had a brief discussion On The Origin of Species *nix systems Today We roll our sleeves and get our
More informationPart 1: Basic Commands/U3li3es
Final Exam Part 1: Basic Commands/U3li3es May 17 th 3:00~4:00pm S-3-143 Same types of questions as in mid-term 1 2 ls, cat, echo ls -l e.g., regular file or directory, permissions, file size ls -a cat
More informationIntroduction to the UNIX command line
Introduction to the UNIX command line Steven Abreu Introduction to Computer Science (ICS) Tutorial Jacobs University s.abreu@jacobs-university.de September 19, 2017 Overview What is UNIX? UNIX Shell Commands
More informationContents. Note: pay attention to where you are. Note: Plaintext version. Note: pay attention to where you are... 1 Note: Plaintext version...
Contents Note: pay attention to where you are........................................... 1 Note: Plaintext version................................................... 1 Hello World of the Bash shell 2 Accessing
More informationUNIX Basics. UNIX Basics CIS 218 Oakton Community College
UNIX Basics UNIX Basics CIS 218 Oakton Community College History UNIX was invented in 1969 at AT&T Bell Labs Ken Thompson and Dennis Ritchie are credited as the original architects and developers of C.
More information5/20/2007. Touring Essential Programs
Touring Essential Programs Employing fundamental utilities. Managing input and output. Using special characters in the command-line. Managing user environment. Surveying elements of a functioning system.
More informationUNIX COMMANDS AND SHELLS. UNIX Programming 2015 Fall by Euiseong Seo
UNIX COMMANDS AND SHELLS UNIX Programming 2015 Fall by Euiseong Seo What is a Shell? A system program that allows a user to execute Shell functions (internal commands) Other programs (external commands)
More informationUnix as a Platform Exercises + Solutions. Course Code: OS 01 UNXPLAT
Unix as a Platform Exercises + Solutions Course Code: OS 01 UNXPLAT Working with Unix Most if not all of these will require some investigation in the man pages. That's the idea, to get them used to looking
More informationReview of Fundamentals
Review of Fundamentals 1 The shell vi General shell review 2 http://teaching.idallen.com/cst8207/14f/notes/120_shell_basics.html The shell is a program that is executed for us automatically when we log
More informationCS 3410 Intro to Unix, shell commands, etc... (slides from Hussam Abu-Libdeh and David Slater)
CS 3410 Intro to Unix, shell commands, etc... (slides from Hussam Abu-Libdeh and David Slater) 28 January 2013 Jason Yosinski Original slides available under Creative Commons Attribution-ShareAlike 3.0
More informationModule 8 Pipes, Redirection and REGEX
Module 8 Pipes, Redirection and REGEX Exam Objective 3.2 Searching and Extracting Data from Files Objective Summary Piping and redirection Partial POSIX Command Line and Redirection Command Line Pipes
More informationCommon File System Commands
Common File System Commands ls! List names of all files in current directory ls filenames! List only the named files ls -t! List in time order, most recent first ls -l! Long listing, more information.
More informationIntroduction to Linux. Roman Cheplyaka
Introduction to Linux Roman Cheplyaka Generic commands, files, directories What am I running? ngsuser@ubuntu:~$ cat /etc/lsb-release DISTRIB_ID=Ubuntu DISTRIB_RELEASE=16.04 DISTRIB_CODENAME=xenial DISTRIB_DESCRIPTION="Ubuntu
More informationIntroduction to Linux
Introduction to Linux M Tech CS I 2015-16 Arijit Bishnu Debapriyo Majumdar Sourav Sengupta Mandar Mitra Login, Logout, Change password $ ssh, ssh X secure shell $ ssh www.isical.ac.in $ ssh 192.168 $ logout,
More informationConsider the following program.
Consider the following program. #include int do_sth (char *s); main(){ char arr [] = "We are the World"; printf ("%d\n", do_sth(arr)); } int do_sth(char *s) { char *p = s; while ( *s++!= \0 )
More informationPerl and R Scripting for Biologists
Perl and R Scripting for Biologists Lukas Mueller PLBR 4092 Course overview Linux basics (today) Linux advanced (Aure, next week) Why Linux? Free open source operating system based on UNIX specifications
More informationCommand Line Interface The basics
Command Line Interface The basics Marco Berghoff, SCC, KIT Steinbuch Centre for Computing (SCC) Funding: www.bwhpc-c5.de Motivation In the Beginning was the Command Line by Neal Stephenson In contrast
More informationIntroduction to Linux. Woo-Yeong Jeong Computer Systems Laboratory Sungkyunkwan University
Introduction to Linux Woo-Yeong Jeong (wooyeong@csl.skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu What is Linux? A Unix-like operating system of a computer What is an
More informationChapter-3. Introduction to Unix: Fundamental Commands
Chapter-3 Introduction to Unix: Fundamental Commands What You Will Learn The fundamental commands of the Unix operating system. Everything told for Unix here is applicable to the Linux operating system
More informationIntroduction to Linux
Introduction to Linux Prof. Jin-Soo Kim( jinsookim@skku.edu) TA - Kisik Jeong (kisik@csl.skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu What is Linux? A Unix-like operating
More informationBasics. I think that the later is better.
Basics Before we take up shell scripting, let s review some of the basic features and syntax of the shell, specifically the major shells in the sh lineage. Command Editing If you like vi, put your shell
More informationUnix Introduction to UNIX
Unix Introduction to UNIX Get Started Introduction The UNIX operating system Set of programs that act as a link between the computer and the user. Developed in 1969 by a group of AT&T employees Various
More informationIntroduction to UNIX Command Line
Introduction to UNIX Command Line Files and directories Some useful commands (echo, cat, grep, find, diff, tar) Redirection Pipes Variables Background processes Remote connections (e.g. ssh, curl) Scripts
More informationChapter 9. Shell and Kernel
Chapter 9 Linux Shell 1 Shell and Kernel Shell and desktop enviroment provide user interface 2 1 Shell Shell is a Unix term for the interactive user interface with an operating system A shell usually implies
More informationCS 307: UNIX PROGRAMMING ENVIRONMENT KATAS FOR EXAM 1
CS 307: UNIX PROGRAMMING ENVIRONMENT KATAS FOR EXAM 1 Prof. Michael J. Reale Fall 2014 COMMAND KATA 0 Command Kata 0: Preparation First, go to ~/cs307 cd ~/cs307 Make directory dkata0 and go to it mkdir
More informationIntroduction to UNIX. Introduction. Processes. ps command. The File System. Directory Structure. UNIX is an operating system (OS).
Introduction Introduction to UNIX CSE 2031 Fall 2012 UNIX is an operating system (OS). Our goals: Learn how to use UNIX OS. Use UNIX tools for developing programs/ software, specifically shell programming.
More informationIntroduction to UNIX. CSE 2031 Fall November 5, 2012
Introduction to UNIX CSE 2031 Fall 2012 November 5, 2012 Introduction UNIX is an operating system (OS). Our goals: Learn how to use UNIX OS. Use UNIX tools for developing programs/ software, specifically
More informationThe Unix Shell & Shell Scripts
The Unix Shell & Shell Scripts You should do steps 1 to 7 before going to the lab. Use the Linux system you installed in the previous lab. In the lab do step 8, the TA may give you additional exercises
More informationCSE 390a Lecture 2. Exploring Shell Commands, Streams, and Redirection
1 CSE 390a Lecture 2 Exploring Shell Commands, Streams, and Redirection slides created by Marty Stepp, modified by Jessica Miller & Ruth Anderson http://www.cs.washington.edu/390a/ 2 Lecture summary Unix
More informationUsing UNIX. -rwxr--r-- 1 root sys Sep 5 14:15 good_program
Using UNIX. UNIX is mainly a command line interface. This means that you write the commands you want executed. In the beginning that will seem inferior to windows point-and-click, but in the long run the
More informationScripting Languages Course 1. Diana Trandabăț
Scripting Languages Course 1 Diana Trandabăț Master in Computational Linguistics - 1 st year 2017-2018 Today s lecture Introduction to scripting languages What is a script? What is a scripting language
More informationIntroduction p. 1 Who Should Read This Book? p. 1 What You Need to Know Before Reading This Book p. 2 How This Book Is Organized p.
Introduction p. 1 Who Should Read This Book? p. 1 What You Need to Know Before Reading This Book p. 2 How This Book Is Organized p. 2 Conventions Used in This Book p. 2 Introduction to UNIX p. 5 An Overview
More informationCHAPTER 2 THE UNIX SHELLS
CHAPTER 2 THE UNIX SHELLS The layers in a UNIX system is shown in the following figure. system call interface library interface user interface Users Standard utility programs (shell, editors, compilers,
More informationWhen talking about how to launch commands and other things that is to be typed into the terminal, the following syntax is used:
Linux Tutorial How to read the examples When talking about how to launch commands and other things that is to be typed into the terminal, the following syntax is used: $ application file.txt
More informationIntroduction to Linux
Introduction to Linux Prof. Jin-Soo Kim( jinsookim@skku.edu) TA - Dong-Yun Lee (dylee@csl.skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu What is Linux? A Unix-like operating
More informationGNU/Linux 101. Casey McLaughlin. Research Computing Center Spring Workshop Series 2018
GNU/Linux 101 Casey McLaughlin Research Computing Center Spring Workshop Series 2018 rccworkshop IC;3df4mu bash-2.1~# man workshop Linux101 RCC Workshop L101 OBJECTIVES - Operating system concepts - Linux
More informationSTATS Data Analysis using Python. Lecture 15: Advanced Command Line
STATS 700-002 Data Analysis using Python Lecture 15: Advanced Command Line Why UNIX/Linux? As a data scientist, you will spend most of your time dealing with data Data sets never arrive ready to analyze
More informationAppendix B WORKSHOP. SYS-ED/ Computer Education Techniques, Inc.
Appendix B WORKSHOP SYS-ED/ Computer Education Techniques, Inc. 1 Introduction There are no workshops for this chapter. The instructor will provide demonstrations and examples. SYS-ED/COMPUTER EDUCATION
More informationIntroduction To. Barry Grant
Introduction To Barry Grant bjgrant@umich.edu http://thegrantlab.org Working with Unix How do we actually use Unix? Inspecting text files less - visualize a text file: use arrow keys page down/page up
More informationIntroduction to Unix The Windows User perspective. Wes Frisby Kyle Horne Todd Johansen
Introduction to Unix The Windows User perspective Wes Frisby Kyle Horne Todd Johansen What is Unix? Portable, multi-tasking, and multi-user operating system Software development environment Hardware independent
More informationSystem Programming. Introduction to Unix
Content : by Dr. B. Boufama School of Computer Science University of Windsor Instructor: Dr. A. Habed adlane@cs.uwindsor.ca http://cs.uwindsor.ca/ adlane/60-256 Content Content 1 Introduction 2 3 Introduction
More informationLecture 3 Tonight we dine in shell. Hands-On Unix System Administration DeCal
Lecture 3 Tonight we dine in shell Hands-On Unix System Administration DeCal 2012-09-17 Review $1, $2,...; $@, $*, $#, $0, $? environment variables env, export $HOME, $PATH $PS1=n\[\e[0;31m\]\u\[\e[m\]@\[\e[1;34m\]\w
More informationM2PGER FORTRAN programming. General introduction. Virginie DURAND and Jean VIRIEUX 10/13/2013 M2PGER - ALGORITHME SCIENTIFIQUE
M2PGER 2013-2014 FORTRAN programming General introduction Virginie DURAND and Jean VIRIEUX 1 Why learning programming??? 2 Why learning programming??? ACQUISITION numerical Recording on magnetic supports
More informationReview of Fundamentals. Todd Kelley CST8207 Todd Kelley 1
Review of Fundamentals Todd Kelley kelleyt@algonquincollege.com CST8207 Todd Kelley 1 GPL the shell SSH (secure shell) the Course Linux Server RTFM vi general shell review 2 These notes are available on
More informationFiles
http://www.cs.fsu.edu/~langley/cop3353-2013-1/reveal.js-2013-02-11/02.html?print-pdf 02/11/2013 10:55 AM Files A normal "flat" file is a collection of information. It's usually stored somewhere reasonably
More informationCSE Linux VM. For Microsoft Windows. Based on opensuse Leap 42.2
CSE Linux VM For Microsoft Windows Based on opensuse Leap 42.2 Dr. K. M. Flurchick February 2, 2017 Contents 1 Introduction 1 2 Requirements 1 3 Procedure 1 4 Usage 3 4.1 Start/Stop.................................................
More informationCS370 Operating Systems
CS370 Operating Systems Colorado State University Yashwant K Malaiya Fall 2016 Lecture 5 Slides based on Text by Silberschatz, Galvin, Gagne Various sources 1 1 User Operating System Interface - CLI CLI
More informationCSC209H Lecture 1. Dan Zingaro. January 7, 2015
CSC209H Lecture 1 Dan Zingaro January 7, 2015 Welcome! Welcome to CSC209 Comments or questions during class? Let me know! Topics: shell and Unix, pipes and filters, C programming, processes, system calls,
More informationSet 1 MCQ Which command is used to sort the lines of data in a file in reverse order A) sort B) sh C) st D) sort -r
1. Which symbol will be used with grep command to match the pattern pat at the beginning of a line? A) ^pat B) $pat C) pat$ D) pat^ 2. Which command is used to sort the lines of data in a file in reverse
More informationUnix/Linux Primer. Taras V. Pogorelov and Mike Hallock School of Chemical Sciences, University of Illinois
Unix/Linux Primer Taras V. Pogorelov and Mike Hallock School of Chemical Sciences, University of Illinois August 25, 2017 This primer is designed to introduce basic UNIX/Linux concepts and commands. No
More informationProcesses. Shell Commands. a Command Line Interface accepts typed (textual) inputs and provides textual outputs. Synonyms:
Processes The Operating System, Shells, and Python Shell Commands a Command Line Interface accepts typed (textual) inputs and provides textual outputs. Synonyms: - Command prompt - Shell - CLI Shell commands
More informationCSE 390a Lecture 2. Exploring Shell Commands, Streams, Redirection, and Processes
CSE 390a Lecture 2 Exploring Shell Commands, Streams, Redirection, and Processes slides created by Marty Stepp, modified by Jessica Miller & Ruth Anderson http://www.cs.washington.edu/390a/ 1 2 Lecture
More information2) clear :- It clears the terminal screen. Syntax :- clear
1) cal :- Displays a calendar Syntax:- cal [options] [ month ] [year] cal displays a simple calendar. If arguments are not specified, the current month is displayed. In addition to cal, the ncal command
More informationCENG 334 Computer Networks. Laboratory I Linux Tutorial
CENG 334 Computer Networks Laboratory I Linux Tutorial Contents 1. Logging In and Starting Session 2. Using Commands 1. Basic Commands 2. Working With Files and Directories 3. Permission Bits 3. Introduction
More informationCrash Course in Unix. For more info check out the Unix man pages -orhttp://www.cs.rpi.edu/~hollingd/unix. -or- Unix in a Nutshell (an O Reilly book).
Crash Course in Unix For more info check out the Unix man pages -orhttp://www.cs.rpi.edu/~hollingd/unix -or- Unix in a Nutshell (an O Reilly book). 1 Unix Accounts To access a Unix system you need to have
More informationLecture 3. Unix. Question? b. The world s best restaurant. c. Being in the top three happiest countries in the world.
Lecture 3 Unix Question? Denmark is famous for? a. LEGO. b. The world s best restaurant. c. Being in the top three happiest countries in the world. d. Having the highest taxes in Europe (57%). e. All of
More information22-Sep CSCI 2132 Software Development Lecture 8: Shells, Processes, and Job Control. Faculty of Computer Science, Dalhousie University
Lecture 8 p.1 Faculty of Computer Science, Dalhousie University CSCI 2132 Software Development Lecture 8: Shells, Processes, and Job Control 22-Sep-2017 Location: Goldberg CS 127 Time: 14:35 15:25 Instructor:
More informationCOMS 6100 Class Notes 3
COMS 6100 Class Notes 3 Daniel Solus September 1, 2016 1 General Remarks The class was split into two main sections. We finished our introduction to Linux commands by reviewing Linux commands I and II
More informationCS246 Spring14 Programming Paradigm Notes on Linux
1 Unix History 1965: Researchers from Bell Labs and other organizations begin work on Multics, a state-of-the-art interactive, multi-user operating system. 1969: Bell Labs researchers, losing hope for
More informationCSCI 2132 Software Development. Lecture 5: File Permissions
CSCI 2132 Software Development Lecture 5: File Permissions Instructor: Vlado Keselj Faculty of Computer Science Dalhousie University 14-Sep-2018 (5) CSCI 2132 1 Files and Directories Pathnames Previous
More informationCSCI 2132 Software Development. Lecture 4: Files and Directories
CSCI 2132 Software Development Lecture 4: Files and Directories Instructor: Vlado Keselj Faculty of Computer Science Dalhousie University 12-Sep-2018 (4) CSCI 2132 1 Previous Lecture Some hardware concepts
More informationIntroduction to UNIX command-line II
Introduction to UNIX command-line II Boyce Thompson Institute 2017 Prashant Hosmani Class Content Terminal file system navigation Wildcards, shortcuts and special characters File permissions Compression
More informationDATA 301 Introduction to Data Analytics Command Line. Dr. Ramon Lawrence University of British Columbia Okanagan
DATA 301 Introduction to Data Analytics Command Line Dr. Ramon Lawrence University of British Columbia Okanagan ramon.lawrence@ubc.ca Why learn the Command Line? The command line is the text interface
More informationWhy learn the Command Line? The command line is the text interface to the computer. DATA 301 Introduction to Data Analytics Command Line
DATA 301 Introduction to Data Analytics Command Line Why learn the Command Line? The command line is the text interface to the computer. DATA 301: Data Analytics (2) Understanding the command line allows
More informationProcesses and Shells
Shell ls pico httpd CPU Kernel Disk NIC Processes Processes are tasks run by you or the OS. Processes can be: shells commands programs daemons scripts Shells Processes operate in the context of a shell.
More informationUseful commands in Linux and other tools for quality control. Ignacio Aguilar INIA Uruguay
Useful commands in Linux and other tools for quality control Ignacio Aguilar INIA Uruguay 05-2018 Unix Basic Commands pwd ls ll mkdir d cd d show working directory list files in working directory as before
More informationIntroduction to the shell Part II
Introduction to the shell Part II Graham Markall http://www.doc.ic.ac.uk/~grm08 grm08@doc.ic.ac.uk Civil Engineering Tech Talks 16 th November, 1pm Last week Covered applications and Windows compatibility
More informationRecap From Last Time:
Recap From Last Time: BGGN 213 Working with UNIX Barry Grant http://thegrantlab.org/bggn213 Motivation: Why we use UNIX for bioinformatics. Modularity, Programmability, Infrastructure, Reliability and
More informationIntroduction. File System. Note. Achtung!
3 Unix Shell 1: Introduction Lab Objective: Explore the basics of the Unix Shell. Understand how to navigate and manipulate file directories. Introduce the Vim text editor for easy writing and editing
More informationComputer Systems and Architecture
Computer Systems and Architecture Introduction to UNIX Stephen Pauwels University of Antwerp October 2, 2015 Outline What is Unix? Getting started Streams Exercises UNIX Operating system Servers, desktops,
More informationBGGN 213 Working with UNIX Barry Grant
BGGN 213 Working with UNIX Barry Grant http://thegrantlab.org/bggn213 Recap From Last Time: Motivation: Why we use UNIX for bioinformatics. Modularity, Programmability, Infrastructure, Reliability and
More information