Shell Programming Overview
|
|
- Clemence Reeves
- 6 years ago
- Views:
Transcription
1 Overview Shell programming is a way of taking several command line instructions that you would use in a Unix command prompt and incorporating them into one program. There are many versions of Unix. Some of the major ones include: AIX (IBM) HP/UX (Hewlett Packard) Linux (free and produced by numerous organizations including RedHat, Ubuntu and others) Solaris (Sun Microsystems) The most common way of accessing a Unix environment is to use a software tool to telnet or ssh into a server via a terminal. A terminal is similar to a Windows command prompt, however it is a command prompt to a remote computer (Unix server). The software used creates the connection and launches the terminal. Some of the terminal software products used are: PuTTy (shown below) Hummingbird Cygwin Remote terminal methods rlogin and rsh. These allow remote login and remote execution, but are not secure and do not provide a terminal. So, no further action can be taken telnet. Provides an unsecured terminal. ssh. Secure shell provides a secure (encrypted) terminal. Shell programming is referred to as scripting. Shell scripts, like all forms of scripting, are interpreted, not compiled. Unix does not have drives like Windows (C:, H:, etc.). Unix uses file systems, which are essentially the same thing as drives. The main difference is that in scripting you do not have to worry about drives, everything is relative to root. Page 1 of 19
2 Basic Shell s pwd cd <directoryname> cd / cd.. cd <directoryname/subdirname> cd /<directoryname> cd /<directoryname/subdirname> Present working directory. Answers the question, where am I? Change directory (folder). This is a relative change. If this directory does not exist where you currently are, then it will not work. Change to the root directory Go back (up) one directory Change to a directory (folder) more than one deep. This is a relative change. If this directory does not exist where you currently are, then it will not work. Change directory (folder). This is an absolute change. This directory must exist at the root. Change to a directory (folder) more than one deep. This is an absolute change. This directory must exist at the root. cd ~ Change to my home directory. Page 2 of 19
3 clear Clear the screen mkdir <directoryname> mkdir <dir1> <dir2> <dirn> ls Make one or more new directories List what s in this directory ls -l List in long format with more details Page 3 of 19
4 ls -lt ls -ltr List what s in this directory in long format in time order List what s in this directory in long format in reverse time order ls -R List this directory and its subdirectories. R stands for recursive. Page 4 of 19
5 rm <filename> Removes files. List multiple files (at the same level) if you want more than one file deleted. rm -r <directoryname> Removes recursively. This allows the removal of directories. cp <filename> <newfilename> cp R <dirname> <newdirname> Copies a file. If the file is copied to a different directory, the new file name is optional. Page 5 of 19
6 mv <filename> <newdirectory> mv <filename> <newfilename> Relocates a file. This can also be used to name the file in its new location. date Displays the date as a string (text). export <variable>=<value> echo <astring> echo $<avariable> Assigns a value to a variable. If the variable does not exist, it creates it and assigns the value. Export is NOT needed inside of a shell script. It is only used at the command line. Echoes (displays) the string or value of the variable. When using a Page 6 of 19
7 echo <astring> > <newfilename> echo $<avar> > <newfilename> echo <astring> >> <filename> echo $<avar> >> <filename> cat <filename> Echoes a string to a new file. If the file name already exists it replaces the file. Echoes and appends a string to a file. This means it adds it to the bottom Outputs the contents of a file to the screen. Shell Rules and Details Scripts (programs) are saved in a file. The file should have a.sh extension, however Linux will attempt to run anything you tell it to. The benefit of the extension is for user friendliness and organization. Relative vs. absolute paths. A path is a named location of a file or directory. If it does not include a drive letter or a starting \, it is a relative path. That means relative to the location it is referenced from. If it begins with a \, then it is absolute with respect to the drive I am currently located in. This means the path is relative to the root of the drive. Location and directional parameters Parameter Meaning / Directory separator or root directory. Current directory.. Parent directory See the examples below. Your Hypothetical Directory Structure Current Location Result /School cd homework Error. There is no homework directory here. /School/Math cd homework Changes to /School/Math/Homework /School/Math/Homework cd.. Goes back to /School/Math /School/Math/Homework cd /School/Science Changes to /School/Science Page 7 of 19
8 /School/Math/Homework cd School/Science Error. There is no School/Science directory here. /School/Math/Homework cd../ Goes back to /School/Math and down to /School/Math/ /School/Math/Homework cd / Error. There is no / directory. Wild Cards. Wild cards are like substitutions for characters. There are two wildcards: * means any number of characters? means exactly 1 character Wild cards can be used to make operations very efficient when naming conventions are used in conjunction with them. For instance, consider a situation where all homework filenames start with hwk whether they are Excel, Powerpoint or Word, and all report filenames start with rpt whether they are Excel, Powerpoint or Word. Furthermore, Imagine as part of the naming convention, all files had 4 digits in the name representing the date as mmdd. So, for example file names would look like this: File Name hwk0922math.xlsx hwk0928english.docx hwk1109ss.docx rpt0108english.docx rpt0310science.pptx Math homework for September 22 nd done in Excel English homework for September 28 th done in Word Social Studies homework for November 9 th done in Word English report for January 8 th done in Word Science report for March 10 th done in Powerpoint Using wild cards in conjunction with the naming convention would allow for some of the following efficient and powerful commands. See the examples below. Purpose rm hwk*.* Delete all homework files rm hwk*.xlsx Delete all homework done in Excel mv *.docx..\backups Move all Word files to the backups directory cp hwk110?ss.pptx..\backups Copy all Social Studies homework files done in Powerpoint from the first 9 days of November to the backups directory rm rpt1???*.* Delete all reports files of any kind for any class from any day in October, November or December. Syntax. Syntax is the grammar, vocabulary and spelling of any programming language. If you don t type commands, parameters and arguments the right way, your instructions can t be executed. In shell programming, because it is an interpreted language, there is no way of getting a syntax check ahead of time. Therefore, all scripts should get tested in a safe place first. You don t want a script that accidentally deleted the wrong things. The shell interpreter is case sensitive. Shell Syntax Tips. Follow the rules below for proper syntax. Directory separators are forward slashes, not back slashes. E.g., cd /school/math/homework Parameters (also called switches) are like arguments, but they are built in optional arguments that change the way a command will work. They often use dashes, but can also use forward slashes. Piping is a common way to pass the output from one command to another. To pipe use the character. ls l grep i customer Output can be used to create new files or append (add after bottom) of existing files. Use one or two greater than signs (>) to create (or recreate) or append. Create new file: ls ltr > filelist.txt Append to existing file: echo John,Jones,Bardonia,NY,10954 >> customers.csv White Space is any space between characters including blank lines, tabs, and spaces. Arguments need space before them. E.g., cp hwk0919ss.docx hwk0919ssbackup.docx Arguments passed into scripts can be referred to inside the script in numerical order with dollar signs. For instance, if you name your script createbackup.sh and call it like this: createbackup.sh d Page 8 of 19
9 Then inside the script, $1 has the value -d. This can be used to run a script with different options. Filenames can only have letters, numbers, underscores, dashes and a handful of other characters in them. The following characters are NOT allowed in filenames: < (less than) > (greater than) : (colon) " (double quote) / (forward slash) \ (backslash) (vertical bar or pipe)? (question mark) * (asterisk) ` (back quote or tic) Variables. When assigning a value to a variable on the command line we use the export command. From within a script export is not needed. line: export mytempvar=22 Script: mytempvar=22 When referencing a variable use $. See below. echo $mytempvar Special Characters. Some characters or strings have special meaning. New line: \n Tab: \t Wild cards: *?. Separators: \ / Delimiters: Pipes and output: > Beginning of Line: ^ End of Line: $ wrapper: ` In order to refer to these characters rather than have them be interpreted for what they mean, place a back slash before them. This is called escaping. See below. In this example a file contains names of customers separated by commas. If you wanted to display the list with slashes instead of commas you would need to escape the slashes because they are special characters which normally serve as separators. If they are not escaped they will give undesired results. The first time the command is run the / is properly escaped. In the second instance, it is not. See what happens. Page 9 of 19
10 Advanced Shell s date + <yourformat> Displays the date in a format of your choosing. %y represents year as 2 digits %Y represents year as 4 digits %m represents month as 2 digits %h represents month as a 3 letter abbreviation %d represents date as 2 digits %%H represents the hour as 2 digits %%M represents the minute as 2 digits %%S represents the second as 2 digits # Comments are created in shell scripts by beginning them with a #. Everything following the # on that line is ignored by the compiler. Page 10 of 19
11 cut f <fieldnumber> -d <delimiter> This must be used in conjunction with another command such as cat. The other command is piped into cut. The cut command treats each line it receives like a record in a database table. The f parameter provides the field you want cut out of the record by number. The d parameter tells cut how you want to delimit the fields. A delimiter is a character that separates data into fields. In examples where there are commands or files that when output to the screen produce rows and columns that use space to separate data of varying sizes, cut is not practical. In this case, use the awk command. This is explained later. In the example below, a file is displayed with cat. In the second window the cut command is used to separate the data with a comma delimiter and show only the state (5 th ) field. Page 11 of 19
12 sort sort r sort k <keyfieldnumber> -t <delimiter> The sort command is used in conjunction with other commands via a pipe. This sorts output in alphanumerical order. Numbers will come before letters. The r option sorts in reverse order. The k option allows you to pick a field by number as a key to sort by. The default is for the interpreter to assume the fields are separated by space. Use the t option to define your own delimiter to separate fields. uniq Provides a uniq version of the output. This is typically used with sort. You pipe into uniq. Page 12 of 19
13 grep <text> <filename> grep i <text> <filename> <command> grep <text> <command> grep v <text> The grep command is a filter used to pull lines out of files or command output. The i option makes it ignore case. The v option excludes text from the output. It can be used with wild cards. See below. Get all states starting with new or New from a file: grep -i new.* states.csv Exclude all blank lines from a file from a file: grep -v ^$ data.csv <command> sed s/<original>/<new>/g Sed is a powerful tool that can do many things. The most common use is to substitute one string for another. Everything between the first forward slash and the second forward slash will be replaced by everything between the second forward slash and the third forward slash. The s at the start tells sed that you want to substitute. The g tells sed to do this globally (all occurrences on the line). <command> awk print {$<fieldnumber>} Awk is another tool that can do many things. The most common use is to extract fields from output based on white space. It can pull pieces of data out of a command that produces columns and rows with varying sizes of data. This is more practical than cut in these situations. Page 13 of 19
14 wc wc -l ls l wc -l cat <filename> wc -l The wc command is a word counter. Words are anything separated by white space (blanks, tabs, etc.). The l option makes it a line counter. You can use this to get the number of lines in a file or the number of files in a directory or the number of rows of output. <command> bc `expr <somemathmaticalexpression>` The bc command converts text into a number which is critical when assigning values to a variable that may be used for calculation. You can also use bc to pipe in a mathematical expression that uses decimals. The syntax requires an echo of the expression as a string preceded by assigning an environment variable called scale a value equivalent to the number of decimal places. See the examples below. answer=`echo scale=2; 3.88 / 2.2 bc` answer=`echo scale=4; $x *.75 bc` The expr (expression) command is used to calculate using basic mathematical operators and integers only. This is often used to assign a value to a variable. The entire command and its arguments needs to be in back quotes. Page 14 of 19
15 id Displays the ID of the user running the command. who Displays a list of all instances of all users connected along with the time they logged in. netstat -n The netstat command provided network statistics. The n option provides this in numeric form. This means ip addresses instead of hostnames. The output is (from left to right): Proto This is the protocol of the connection. For example, tcp is the most common. Recv-Q This is the number of bytes received by the socket on this connection. Send-Q This is the number of bytes sent from the socket on this connection. Local Address This is the ip address of this host (server) and the socket. Foreign Address This is the ip address of the remote host connected to this host (server) and the socket. State This is the state of the connection. It could be waiting, closing, established, etc. iostat The iostat command provided io (input and output) statistics. IO is the reading and writing of data into and out of memory, disk, printers and other devices. Page 15 of 19
16 mpstat mpstat P <#> mpstat P ALL Displays statistics on multiple processors. You can choose a specific processor number from 0 to n where n is one less than the number of processors on the server. Alternatively use ALL to include all processer statistics. df -k The df command reports file system disk space usage. The k option shows usage in KB. free The free command reports the amount of total, used and free memory and swap space. Swap space is memory borrowed from disk temporarily. A computer generally uses this for items that are still open, but not in use in order to free up RAM (which is much faster) for active processes. Page 16 of 19
17 tail -<somenumberoflines> <filename> <command> tail -<somenumberoflines> <command> head -<somenumberoflines> head -<somenumberoflines> <filename> The tail command shows only the last n lines from your output. You can display the end of a file or pipe a command into tail. The head command shows only the first n lines from your output. You can display the top of a file or pipe a command into head. sleep <somenumberofseconds> if [<TrueFalseExpression>] then <command1> <commandn> else fi Pauses the shell script process for a defined number of seconds. This is a great way to run a script that monitors and writes output to a log. Use this to only execute certain commands when a condition is met. Use == when comparing strings. Use gt, -lt, -eq for >, <, == when comparing numbers. while [<TrueFalseExpression>] do <command1> <commandn> done Use this to only execute certain commands when a condition is met. Use == when comparing strings. Use gt, -lt, -eq for >, <, == when comparing numbers. Page 17 of 19
18 Examples Systems programmers are often tasked with producing reports and logs that help support and monitor the servers and applications an organization uses. Below are some examples of the tricks they employ to get information from the server. Get the percentage of CPU time currently being taken by users, converted from a string to a number. Get the number of logged in users, converted from a string to a number. Get the IP address of all remote tcp connections, the port of all remote tcp connections, and the local ports in use. Page 18 of 19
19 Get the number of bytes still available in the root file system. Page 19 of 19
Table 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 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 informationA Brief Introduction to the Linux Shell for Data Science
A Brief Introduction to the Linux Shell for Data Science Aris Anagnostopoulos 1 Introduction Here we will see a brief introduction of the Linux command line or shell as it is called. Linux is a Unix-like
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 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 informationUtilities. September 8, 2015
Utilities September 8, 2015 Useful ideas Listing files and display text and binary files Copy, move, and remove files Search, sort, print, compare files Using pipes Compression and archiving Your fellow
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 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 to UNIX command-line
Introduction to UNIX command-line Boyce Thompson Institute March 17, 2015 Lukas Mueller & Noe Fernandez Class Content Terminal file system navigation Wildcards, shortcuts and special characters File permissions
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 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 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 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 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 informationBasic Unix Command. It is used to see the manual of the various command. It helps in selecting the correct options
Basic Unix Command The Unix command has the following common pattern command_name options argument(s) Here we are trying to give some of the basic unix command in Unix Information Related man It is used
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 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 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 informationEssential Linux Shell Commands
Essential Linux Shell Commands Special Characters Quoting and Escaping Change Directory Show Current Directory List Directory Contents Working with Files Working with Directories Special Characters There
More informationShells and Shell Programming
Shells and Shell Programming 1 Shells A shell is a command line interpreter that is the interface between the user and the OS. The shell: analyzes each command determines what actions are to be performed
More informationShells and Shell Programming
Shells and Shell Programming Shells A shell is a command line interpreter that is the interface between the user and the OS. The shell: analyzes each command determines what actions are to be performed
More informationHistory. Terminology. Opening a Terminal. Introduction to the Unix command line GNOME
Introduction to the Unix command line History Many contemporary computer operating systems, like Microsoft Windows and Mac OS X, offer primarily (but not exclusively) graphical user interfaces. The user
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 informationWindshield. Language Reference Manual. Columbia University COMS W4115 Programming Languages and Translators Spring Prof. Stephen A.
Windshield Language Reference Manual Columbia University COMS W4115 Programming Languages and Translators Spring 2007 Prof. Stephen A. Edwards Team members Wei-Yun Ma wm2174 wm2174@columbia.edu Tony Wang
More informationChapter 4. Unix Tutorial. Unix Shell
Chapter 4 Unix Tutorial Users and applications interact with hardware through an operating system (OS). Unix is a very basic operating system in that it has just the essentials. Many operating systems,
More informationLinux Shell Script. J. K. Mandal
Linux Shell Script J. K. Mandal Professor, Department of Computer Science & Engineering, Faculty of Engineering, Technology & Management University of Kalyani Kalyani, Nadia, West Bengal E-mail: jkmandal@klyuniv.ac.in,
More informationCS/IT 114 Introduction to Java, Part 1 FALL 2016 CLASS 3: SEP. 13TH INSTRUCTOR: JIAYIN WANG
CS/IT 114 Introduction to Java, Part 1 FALL 2016 CLASS 3: SEP. 13TH INSTRUCTOR: JIAYIN WANG 1 Notice Reading Assignment Chapter 1: Introduction to Java Programming Homework 1 It is due this coming Sunday
More informationSession 1: Accessing MUGrid and Command Line Basics
Session 1: Accessing MUGrid and Command Line Basics Craig A. Struble, Ph.D. July 14, 2010 1 Introduction The Marquette University Grid (MUGrid) is a collection of dedicated and opportunistic resources
More informationUNIX Essentials Featuring Solaris 10 Op System
A Active Window... 7:11 Application Development Tools... 7:7 Application Manager... 7:4 Architectures - Supported - UNIX... 1:13 Arithmetic Expansion... 9:10 B Background Processing... 3:14 Background
More informationFile Commands. Objectives
File Commands Chapter 2 SYS-ED/Computer Education Techniques, Inc. 2: 1 Objectives You will learn: Purpose and function of file commands. Interrelated usage of commands. SYS-ED/Computer Education Techniques,
More informationUNIX, GNU/Linux and simple tools for data manipulation
UNIX, GNU/Linux and simple tools for data manipulation Dr Jean-Baka DOMELEVO ENTFELLNER BecA-ILRI Hub Basic Bioinformatics Training Workshop @ILRI Addis Ababa Wednesday December 13 th 2017 Dr Jean-Baka
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 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 informationIntroduction to Linux (and the terminal)
Introduction to Linux (and the terminal) 27/11/2018 Pierpaolo Maisano Delser mail: maisanop@tcd.ie ; pm604@cam.ac.uk Outline: What is Linux and the terminal? Why do we use the terminal? Pros and cons Basic
More informationCSE 303 Lecture 2. Introduction to bash shell. read Linux Pocket Guide pp , 58-59, 60, 65-70, 71-72, 77-80
CSE 303 Lecture 2 Introduction to bash shell read Linux Pocket Guide pp. 37-46, 58-59, 60, 65-70, 71-72, 77-80 slides created by Marty Stepp http://www.cs.washington.edu/303/ 1 Unix file system structure
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 informationC Shell Tutorial. Section 1
C Shell Tutorial Goals: Section 1 Learn how to write a simple shell script and how to run it. Learn how to use local and global variables. About CSH The Barkley Unix C shell was originally written with
More informationOperating System Interaction via bash
Operating System Interaction via bash bash, or the Bourne-Again Shell, is a popular operating system shell that is used by many platforms bash uses the command line interaction style generally accepted
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 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 informationLOG ON TO LINUX AND LOG OFF
EXPNO:1A LOG ON TO LINUX AND LOG OFF AIM: To know how to logon to Linux and logoff. PROCEDURE: Logon: To logon to the Linux system, we have to enter the correct username and password details, when asked,
More informationPractical Session 0 Introduction to Linux
School of Computer Science and Software Engineering Clayton Campus, Monash University CSE2303 and CSE2304 Semester I, 2001 Practical Session 0 Introduction to Linux Novell accounts. Every Monash student
More informationPython for Astronomers. Week 1- Basic Python
Python for Astronomers Week 1- Basic Python UNIX UNIX is the operating system of Linux (and in fact Mac). It comprises primarily of a certain type of file-system which you can interact with via the terminal
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 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 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 informationIntroduction to Linux
Introduction to Linux The command-line interface A command-line interface (CLI) is a type of interface, that is, a way to interact with a computer. Window systems, punched cards or a bunch of dials, buttons
More informationOverview of the UNIX File System
Overview of the UNIX File System Navigating and Viewing Directories Adapted from Practical Unix and Programming Hunter College Copyright 2006 Stewart Weiss The UNIX file system The most distinguishing
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 informationVi & Shell Scripting
Vi & Shell Scripting Comp-206 : Introduction to Week 3 Joseph Vybihal Computer Science McGill University Announcements Sina Meraji's office hours Trottier 3rd floor open area Tuesday 1:30 2:30 PM Thursday
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 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 information~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
(( )) (( )) [ x x ] cdc communications, inc. [ x x ] \ / presents... \ / (` ') (` ') (U) (U) Gibe's UNIX COMMAND Bible ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The latest file from the Cow's
More informationExamples: Directory pathname: File pathname: /home/username/ics124/assignments/ /home/username/ops224/assignments/assn1.txt
ULI101 Week 03 Week Overview Absolute and relative pathnames File name expansion Shell basics Command execution in detail Recalling and editing previous commands Quoting Pathnames A pathname is a list
More informationQUESTION BANK ON UNIX & SHELL PROGRAMMING-502 (CORE PAPER-2)
BANK ON & SHELL PROGRAMMING-502 (CORE PAPER-2) TOPIC 1: VI-EDITOR MARKS YEAR 1. Explain set command of vi editor 2 2011oct 2. Explain the modes of vi editor. 7 2013mar/ 2013 oct 3. Explain vi editor 5
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 informationCSC UNIX System, Spring 2015
CSC 352 - UNIX System, Spring 2015 Study guide for the CSC352 midterm exam (20% of grade). Dr. Dale E. Parson, http://faculty.kutztown.edu/parson We will have a midterm on March 19 on material we have
More informationINTRODUCTION TO BIOINFORMATICS
Introducing the LINUX Operating System BecA-ILRI INTRODUCTION TO BIOINFORMATICS Mark Wamalwa BecA- ILRI Hub, Nairobi, Kenya h"p://hub.africabiosciences.org/ h"p://www.ilri.org/ m.wamalwa@cgiar.org 1 What
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 informationAppendix A GLOSSARY. SYS-ED/ Computer Education Techniques, Inc.
Appendix A GLOSSARY SYS-ED/ Computer Education Techniques, Inc. $# Number of arguments passed to a script. $@ Holds the arguments; unlike $* it has the capability for separating the arguments. $* Holds
More informationOverview of the UNIX File System. Navigating and Viewing Directories
Overview of the UNIX File System Navigating and Viewing Directories Copyright 2006 Stewart Weiss The UNIX file system The most distinguishing characteristic of the UNIX file system is the nature of its
More informationAdvanced training. Linux components Command shell. LiLux a.s.b.l.
Advanced training Linux components Command shell LiLux a.s.b.l. alexw@linux.lu Kernel Interface between devices and hardware Monolithic kernel Micro kernel Supports dynamics loading of modules Support
More informationUnix Tutorial Haverford Astronomy 2014/2015
Unix Tutorial Haverford Astronomy 2014/2015 Overview of Haverford astronomy computing resources This tutorial is intended for use on computers running the Linux operating system, including those in the
More informationLING 408/508: Computational Techniques for Linguists. Lecture 5
LING 408/508: Computational Techniques for Linguists Lecture 5 Last Time Installing Ubuntu 18.04 LTS on top of VirtualBox Your Homework 2: did everyone succeed? Ubuntu VirtualBox Host OS: MacOS or Windows
More informationUnix as a Platform Exercises. Course Code: OS-01-UNXPLAT
Unix as a Platform Exercises Course Code: OS-01-UNXPLAT Working with Unix 1. Use the on-line manual page to determine the option for cat, which causes nonprintable characters to be displayed. Run the command
More informationIntroduction to Linux Part 1. Anita Orendt and Wim Cardoen Center for High Performance Computing 24 May 2017
Introduction to Linux Part 1 Anita Orendt and Wim Cardoen Center for High Performance Computing 24 May 2017 ssh Login or Interactive Node kingspeak.chpc.utah.edu Batch queue system kp001 kp002. kpxxx FastX
More informationCS Fundamentals of Programming II Fall Very Basic UNIX
CS 215 - Fundamentals of Programming II Fall 2012 - Very Basic UNIX This handout very briefly describes how to use Unix and how to use the Linux server and client machines in the CS (Project) Lab (KC-265)
More informationShells & Shell Programming (Part B)
Shells & Shell Programming (Part B) Software Tools EECS2031 Winter 2018 Manos Papagelis Thanks to Karen Reid and Alan J Rosenthal for material in these slides CONTROL STATEMENTS 2 Control Statements Conditional
More informationPractical Linux examples: Exercises
Practical Linux examples: Exercises 1. Login (ssh) to the machine that you are assigned for this workshop (assigned machines: https://cbsu.tc.cornell.edu/ww/machines.aspx?i=87 ). Prepare working directory,
More informationAssignment 3, Due October 4
Assignment 3, Due October 4 1 Summary This assignment gives you practice with writing shell scripts. Shell scripting is also known as bash programming. Your shell is bash, and when you write a shell script
More informationCisco IOS Shell. Finding Feature Information. Prerequisites for Cisco IOS.sh. Last Updated: December 14, 2012
Cisco IOS Shell Last Updated: December 14, 2012 The Cisco IOS Shell (IOS.sh) feature provides shell scripting capability to the Cisco IOS command-lineinterface (CLI) environment. Cisco IOS.sh enhances
More informationLecture 5. Essential skills for bioinformatics: Unix/Linux
Lecture 5 Essential skills for bioinformatics: Unix/Linux UNIX DATA TOOLS Text processing with awk We have illustrated two ways awk can come in handy: Filtering data using rules that can combine regular
More informationProgramming Studio #1 ECE 190
Programming Studio #1 ECE 190 Programming Studio #1 Announcements In Studio Assignment Introduction to Linux Command-Line Operations Recitation Floating Point Representation Binary & Hexadecimal 2 s Complement
More informationUNIX File Hierarchy: Structure and Commands
UNIX File Hierarchy: Structure and Commands The UNIX operating system organizes files into a tree structure with a root named by the character /. An example of the directory tree is shown below. / bin
More informationA Brief Introduction to Unix
A Brief Introduction to Unix Sean Barag Drexel University March 30, 2011 Sean Barag (Drexel University) CS 265 - A Brief Introduction to Unix March 30, 2011 1 / 17 Outline 1 Directories
More informationThe Directory Structure
The Directory Structure All the files are grouped together in the directory structure. The file-system is arranged in a hierarchical structure, like an inverted tree. The top of the hierarchy is traditionally
More informationOperating Systems and Using Linux. Topics What is an Operating System? Linux Overview Frequently Used Linux Commands
Operating Systems and Using Linux Topics What is an Operating System? Linux Overview Frequently Used Linux Commands 1 What is an Operating System? A computer program that: Controls how the CPU, memory
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 informationOperating Systems. Copyleft 2005, Binnur Kurt
3 Operating Systems Copyleft 2005, Binnur Kurt Content The concept of an operating system. The internal architecture of an operating system. The architecture of the Linux operating system in more detail.
More informationOperating Systems 3. Operating Systems. Content. What is an Operating System? What is an Operating System? Resource Abstraction and Sharing
Content 3 Operating Systems The concept of an operating system. The internal architecture of an operating system. The architecture of the Linux operating system in more detail. How to log into (and out
More informationIntroduction to Linux. Fundamentals of Computer Science
Introduction to Linux Fundamentals of Computer Science Outline Operating Systems Linux History Linux Architecture Logging in to Linux Command Format Linux Filesystem Directory and File Commands Wildcard
More informationUnix Tools / Command Line
Unix Tools / Command Line An Intro 1 Basic Commands / Utilities I expect you already know most of these: ls list directories common options: -l, -F, -a mkdir, rmdir make or remove a directory mv move/rename
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 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 informationLinux Shell Scripting. Linux System Administration COMP2018 Summer 2017
Linux Shell Scripting Linux System Administration COMP2018 Summer 2017 What is Scripting? Commands can be given to a computer by entering them into a command interpreter program, commonly called a shell
More informationCS 460 Linux Tutorial
CS 460 Linux Tutorial http://ryanstutorials.net/linuxtutorial/cheatsheet.php # Change directory to your home directory. # Remember, ~ means your home directory cd ~ # Check to see your current working
More information5/8/2012. Creating and Changing Directories Chapter 7
Creating and Changing Directories Chapter 7 Types of files File systems concepts Using directories to create order. Managing files in directories. Using pathnames to manage files in directories. Managing
More informationAssignment clarifications
Assignment clarifications How many errors to print? at most 1 per token. Interpretation of white space in { } treat as a valid extension, involving white space characters. Assignment FAQs have been updated.
More informationIntroduction to Linux Workshop 1
Introduction to Linux Workshop 1 The George Washington University SEAS Computing Facility Created by Jason Hurlburt, Hadi Mohammadi, Marco Suarez hurlburj@gwu.edu Logging In The lab computers will authenticate
More informationPart III. Shell Config. Tobias Neckel: Scripting with Bash and Python Compact Max-Planck, February 16-26,
Part III Shell Config Compact Course @ Max-Planck, February 16-26, 2015 33 Special Directories. current directory.. parent directory ~ own home directory ~user home directory of user ~- previous directory
More informationSystems Programming/ C and UNIX
Systems Programming/ C and UNIX Alice E. Fischer September 6, 2017 Alice E. Fischer Systems Programming Lecture 2... 1/28 September 6, 2017 1 / 28 Outline 1 Booting into Linux 2 The Command Shell 3 Defining
More informationThis lab exercise is to be submitted at the end of the lab session! passwd [That is the command to change your current password to a new one]
Data and Computer Security (CMPD414) Lab II Topics: secure login, moving into HOME-directory, navigation on Unix, basic commands for vi, Message Digest This lab exercise is to be submitted at the end of
More informationIntroduction To Linux. Rob Thomas - ACRC
Introduction To Linux Rob Thomas - ACRC What Is Linux A free Operating System based on UNIX (TM) An operating system originating at Bell Labs. circa 1969 in the USA More of this later... Why Linux? Free
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 informationCloud Computing and Unix: An Introduction. Dr. Sophie Shaw University of Aberdeen, UK
Cloud Computing and Unix: An Introduction Dr. Sophie Shaw University of Aberdeen, UK s.shaw@abdn.ac.uk Aberdeen London Exeter What We re Going To Do Why Unix? Cloud Computing Connecting to AWS Introduction
More informationIntroduction to the Linux Command Line
Introduction to the Linux Command Line May, 2015 How to Connect (securely) ssh sftp scp Basic Unix or Linux Commands Files & directories Environment variables Not necessarily in this order.? Getting Connected
More informationA Big Step. Shell Scripts, I/O Redirection, Ownership and Permission Concepts, and Binary Numbers
A Big Step Shell Scripts, I/O Redirection, Ownership and Permission Concepts, and Binary Numbers Copyright 2006 2009 Stewart Weiss What a shell really does Here is the scoop on shells. A shell is a program
More informationCloud Computing and Unix: An Introduction. Dr. Sophie Shaw University of Aberdeen, UK
Cloud Computing and Unix: An Introduction Dr. Sophie Shaw University of Aberdeen, UK s.shaw@abdn.ac.uk Aberdeen London Exeter What We re Going To Do Why Unix? Cloud Computing Connecting to AWS Introduction
More information