The Linux Command Line & Shell Scripting

Size: px
Start display at page:

Download "The Linux Command Line & Shell Scripting"

Transcription

1 The Linux Command Line & Shell Scripting [web] [ ] portal.biohpc.swmed.edu 1 Updated for

2 Study Resources : A Free Book 500+ pages * Some of the materials covered in today s training is from this book 2

3 3 Study Resources : Tutorial Website

4 Study Resources : Cheat Sheets On the portal Training -> Slides & Handouts 4

5 Study Resources: Man pages Get a command s help page: man <command> Press q or Ctrl-C to exit the man page 5

6 Study Resources : Follow Along You can follow along using: 1. the Nucleus Web terminal on the BioHPC portal: 2. Putty or SSH from your PC 3. Terminal from your MacBook ssh <username>@nucleus.biohpc.swmed.edu 6

7 The Shell and Command Line Interfaces The interaction between user and the operating system is provide by a shell Graphic User Interfaces & Command Line Interfaces By far the most common shell on Linux is bash (Bourne Again SHell) It has a lot of built-in commands user name arguments machine name current directory options/switches name of the command 7

8 Linux Basics: The File System Files on a Linux system are arranged in a hierarchical directory structure. / apps bin tmp home2 project work {uid} {department} shared shared {department} shared {PI_lab} {uid} shared shared {uid or project_name} 8

9 Linux Command Line: Files and Directories Relative path v.s. Absolute path (full path) / home2 ydu (I am here) Training Relative path path related to the present working directory (pwd) If my current directory is /home2/ydu, relative path is: Training pwd will return : /home2/ydu If change directory to home2, relative path becomes ydu/training pwd will return: /home2 Absolute path specify the location of a file or directory from the root directory (/) /home2/ydu/training 9

10 Linux Command Line: Files and Directories Editors vi / vim Cryptic commands! Cheat sheet on the portal. Quick tutorial: Emacs An extensible, customizable text editor Quick tutorial: nano Easier to use. Quick tutorial: Any text editor from your PC or Mac Mount your directories as network drives 10

11 Demo Example 1: Manage Files/Folders Example 2: Wildcards Example 3: Disk Usage Example 4: Create Shared Folder/Files Example 5: Text File Manipulation with Linux Tools (view/find patterns/sort/replace) as important as knowing how to use Linux itself popular and convenient in BioData processing and Analysis 11

12 Example 1: Manage Files/Folders Command What does it do? pwd Print Working Directory where am I? ls List files in current directory ls -lah List files with detail (l = long format, a = all files including hidden, h = human readable file sizes) cd Training Change directory to today s training folder mkdir example1 touch example1/newfile.txt ls lah example1 mkdir new_example cp example1/newfile.txt new_example/ cp r example1 newer_example Make a directory called example1 Create an empty new file inside example1 folder List files inside the example1 directory Make the directory new_example Copy newfile.txt from example1 into new_example Copy example1 recursively (directory and everything inside) to a directory called newer_example) 12

13 Example 1: Manage Files/Folders Command mv new_example old_example rmdir old_example cd old_example ls -alh cd.. rmdir old_example rm r newer_example What does it do? Move/rename new_example directory to old_example Try to remove old_example Change directory into old_example List files with detail Change directory to parent folder Delete an empty folder Recursively delete all files and folders inside newer_example 13

14 Example 2: Wildcards * Match any number of characters ls * ls notes* ls *.txt ls *2015* Any file Any file beginning with notes Any file ending in.txt Any file with 2015 somewhere in its name? Match a single character ls data_00?.txt Matches data_001, data002, data_00a etc. [] Match a set of characters (bracket expression) ls data_00[ ].txt ls data_00[0-9].txt Matches data_001 data_009, not data_00a 14

15 Example 3: Disk Usage quota: display disk usage and limits (How much space do I have) 15

16 Example 3: Disk Usage du: estimate file space usage (How much space am I taking up) Total folder size: Detailed usage for each sub-folders: 16

17 Example 3: Disk Usage Archive files and folders will reduce both space usage and number of files We plan to limit the number of files for each user in the future. mysandybox mysandybox.tar.gz Space usage : 0.07T 0.02T Number of Files :

18 Example 3: Disk Usage Command gunzip mydata.txt.gz tar xvf archive.tar cd.. du sh example3 cd example3 tar cvzf new.tar.gz file1 folder1 What does it do? Extract a.gz gzipped file Extract (x) everything from a tar archive file (f). Show verbose output (v). Change directory into parent directory (CLI) Estimate space usage of folder example3 Change directory into parent directory example3 Create (c) a compressed tar.gz archive file (f) adding files and folders to it. gzip mydata.txt Compress a file using gzip becomes a.gz file cd.. du sh example3 tar zxvf example3/archive.tar.gz Change directory into parent directory (CLI) Estimate space usage of folder example3 Extract a compressed gzipped tar archive in one step 18

19 ls -l Permissions drwxr-xr-x 4 dtrudgian biohpc_admin 58 Feb 16 15:13 all_training drwxr-xr-x 7 dtrudgian biohpc_admin 140 Feb 12 10:36 Apps drwxr-xr-x 2 dtrudgian biohpc_admin 26 Feb 16 15:12 cli_training drwxr-xr-x 8 dtrudgian biohpc_admin 4.0K Feb 16 14:25 Cluster_Installs drwxr-xr-x 3 dtrudgian biohpc_admin 4.0K Feb 16 11:49 Desktop drwxr-xr-x 2 dtrudgian biohpc_admin 10 Feb 16 14:10 Documents drwxr-xr-x 9 dtrudgian biohpc_admin 135 Feb 16 14:32 Downloads -rw-r--r-- 1 dtrudgian biohpc_admin 336 Feb 16 15:16 error.txt drwxr-xr-x 10 dtrudgian biohpc_admin 4.0K Feb 9 12:45 Git drwxr-xr-x 17 dtrudgian biohpc_admin 4.0K Feb 16 15:17 owncloud drwxr-xr-x 2 dtrudgian biohpc_admin 10 Feb 16 14:18 Pictures drwxr-xr-x 5 dtrudgian biohpc_admin 102 Feb 4 11:19 portal_jobs Permissions Owner Group 19

20 20 File Permissions

21 Octal Permissions r = 4 w = 2 x = 1 Add up the permissions you need for each class, e.g. rx = 5 rw = 6 rwx = 7 -rw-r--r-- 1 dtrudgian biohpc_admin 336 Feb 16 15:16 error.txt Owner can read+write Group can read Others can read 21

22 Permissions chmod u/g/a +/- r/w/x filename Class: u = user (owner) g = group a = all + Add permission - Remove permission r w x read write execute chmod g+rw test.txt chmod a+x script.sh chmod g-x script.sh Add read/write permissions for the group Add execute permission for everyone Remove execute permission for the group chmod 700 script.sh -rwx chmod 640 script.sh rw-r

23 Example 4: Create Shared Folder Command cd /project/biohpcadmin/shared/ ls -al mkdir shared_data cd shared_data cp /project/biohpcadmin/ydu/ideas.txt. chmod g+w ideas.txt cd.. chmod g+w shared_data What does it do? Change directory to your lab s shared folder List files with detail to check permission Create shared folder Change directory to newly created shared_data folder Copy file to shared folder, you group members can read and copy it Grant write permission to allow group members edit the ideas.txt Change directory to parent folder Grant write permission to allow group members create new files inside shared_data folder You can only apply chmod command to the files/folders owned by you. Send to biohpc-help@utsouthwestern.edu if you need help to set up a shared folder 23

24 Example 5: Text File Manipulation Command cat story.txt less story.txt head n 15 story.txt tail n 5 story.txt head n 15 story.txt tail n 5 grep "elephant" story.txt grep i "mouse" story.txt grep c "at" story.txt grep ^The story.txt grep water\.$ story.txt What does it do? Show the content of story.txt in the terminal Show the content of story.txt in a pager that allows scrolling & searching Show the first 15 lines of story.txt Show the last 5 lines of story.txt Shows lines of story.txt. We take the first 15 lines from story.txt using head, and extract the bottom of that selection by piping it through tail. Find all lines in story.txt that contain elephant case-sensitive. Find all lines in story.txt that contain mouse non-case sensitive. Count the number of lines in story.txt that contain at. Find lines beginning with The Find lines ending with water. Note that. is a special character so we have to escape it. grep searches for patterns using regular expressions

25 Example 5: Text File Manipulation Command sort fruits.txt sort -r fruits.txt sort nr numbers.txt sort fruits.txt > sorted_fruits.txt sort fruits.txt >> sorted_fruits.txt sort fruits.txt 2 > error.txt What does it do? Sort the lines in a file alphabetically Sort the lines in a file in reverse alphabetical order Sort the lines in a file in reverse numerical order Send the output of the sort command into sorted_fruits.txt overwriting existing content. Send the output of the sort command into sorted_fruits.txt, appending to the end of the file. Send the error output of the sort command into error.txt sort fruits.txt 2 > /dev/null sort fruits.txt 2>&1 > output.txt sed "s/dog/cat/g" story.txt Discard the error output of the command which nonsense Combine the error output into the standard output, and direct into the file output.txt Change all instances of cat to dog, printing the result s(substitute)/old/new/g(lobal) sed can do a lot - awk can do even more

26 Bash Shell Scripting In addition to the interactive mode, bash shell script is a programing language in itself one command at a time run an entire script of commands A little knowledge can make difficult things easy, and time-consuming things quick. 26

27 Bash Shell Scripting : Variables script_varables.sh A variable holds information to be used later Set them using: Get their value using: name=value $name #!/bin/bash MY_NAME=dave echo Hello $MY_NAME Specify we are using bash shell Set the variable MY_NAME Run echo using the value in MY_NAME 27

28 Bash Shell Scripting : How to run How to run a bash script Method 1: convert scripts into an executable file chmod +x script_variables.sh./scripts_variable.sh Method 2: use bash or sh bash script_variables.sh -orsh script_variables.sh 28

29 Bash Shell Scripting : Input/Output script_io.sh We can assign the output of programs/commands into variables: #!/bin/bash NOW=$(date +%Y-%m-%d) DATA_DIR="data_$NOW" mkdir $DATA_DIR Put the date (YY-MM-DD) into NOW Create a directory with a name incorporating the date module load matlab matlab nodisplay -nosplash < hello.m > $DATA_DIR/output.txt Run matlab with input hello.m, and send the output into our data directory 29

30 Bash Shell Scripting : If-else Statement script_if.sh #!/bin/bash echo "This scripts checks for the dummy file." echo "Checking..." file exists test is -f if [ -f "dummy" ]; then echo "dummy exists." else echo "Could not find it! " fi Read about the available tests here 30

31 Bash Shell Scripting : Loops script_loops.sh This script lists all of the files in the current directory using a for loop: #!/bin/bash Set variable i to each value in the output of the ls command for i in $( ls ); do echo "item: $i" Echo the current value of $i done Read about the other loops here 31

32 Bash Shell Scripting : Pass Command Line Arguments script_arguments.sh #!/bin/bash echo "Script Name: $0 " echo "Total Number of Argument s: $#" echo "1st Argument: $1" echo "2nd Argument: $2 " echo "All Arguments are: $*" $* Store all command line arguments $# Store count of command line arguments $0 Store name of script itself $1 Store first command line argument $2 Store second command line argument $3 Store third command line argument 32

33 Bash Shell Scripting : Reorganize data to fit the software requirement Images generated by Total Internal Refraction Fluorescence Microscope Input data structure required by DeBias TEST_INPUT TEST_OUTPUT 1_10 1_11 1_12 folder_reorganize.sh img_ _tirf_488_000.tif img_ _tirf_561_000.tif 488.tif 561.tif 33

34 Bash Shell Scripting : Reorganize data to fit the software requirement #!/bin/bash INPUT_FOLDER=$1 # pass input folder name as 1 st argument from terminal OUTPUT_FOLDER=$2 # pass input folder name as 2 nd argument from terminal i=1 # initialize iterator as 1 for SUBFOLDER in $(ls $INPUT_FOLDER);do # loop through all folders echo $SUBFOLDER # display current sub folder name IMG488_ORG=$INPUT_FOLDER/$SUBFOLDER/img_ _TIRF_488_000.tif # define 488 image name IMG561_ORG=$INPUT_FOLDER/$SUBFOLDER/img_ _TIRF_561_000.tif # define 561 image name IMG_OUTPUT=${OUTPUT_FOLDER}/$i # display current sub folder name let "i=$i+1" # increment iterator mkdir $IMG_OUTPUT # create output folder for images if [ -f $IMG488_ORG ];then # if 486 image file exists, cp $IMG488_ORG $IMG_OUTPUT/488.tif # copy image file to output folder and rename else # if 486 image file not exists, echo "$IMG488_ORG do not exist" # display error message fi if [ -f $IMG561_ORG ];then cp $IMG561_ORG $IMG_OUTPUT/561.tif else echo "$IMG561_ORG do not exist fi done 34

Introduction to the Linux Command Line

Introduction 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 information

Introduction to Linux

Introduction 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 information

Introduction: What is Unix?

Introduction: 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 information

Linux 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 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 information

Unix/Linux Basics. Cpt S 223, Fall 2007 Copyright: Washington State University

Unix/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 information

Mills HPC Tutorial Series. Linux Basics I

Mills HPC Tutorial Series. Linux Basics I Mills HPC Tutorial Series Linux Basics I Objectives Command Line Window Anatomy Command Structure Command Examples Help Files and Directories Permissions Wildcards and Home (~) Redirection and Pipe Create

More information

CISC 220 fall 2011, set 1: Linux basics

CISC 220 fall 2011, set 1: Linux basics CISC 220: System-Level Programming instructor: Margaret Lamb e-mail: malamb@cs.queensu.ca office: Goodwin 554 office phone: 533-6059 (internal extension 36059) office hours: Tues/Wed/Thurs 2-3 (this week

More information

Introduction to UNIX command-line

Introduction 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 information

commandname flags arguments

commandname flags arguments Unix Review, additional Unix commands CS101, Mock Introduction This handout/lecture reviews some basic UNIX commands that you should know how to use. A more detailed description of this and other commands

More information

Introduction to the shell Part II

Introduction 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 information

Chapter-3. Introduction to Unix: Fundamental Commands

Chapter-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 information

Contents. 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. 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 information

Introduction to UNIX I: Command Line 1 / 21

Introduction to UNIX I: Command Line 1 / 21 Introduction to UNIX I: Command Line 1 / 21 UNIX Command line The UNIX Shell: command line interface Navigating Directories and Files Running applications Reminder about helpful tutorial: http://korflab.ucdavis.edu/unix_and_perl/current.html

More information

Linux Command Line Primer. By: Scott Marshall

Linux 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

Linux Training. for New Users of Cluster. Georgia Advanced Computing Resource Center University of Georgia Suchitra Pakala

Linux Training. for New Users of Cluster. Georgia Advanced Computing Resource Center University of Georgia Suchitra Pakala Linux Training for New Users of Cluster Georgia Advanced Computing Resource Center University of Georgia Suchitra Pakala pakala@uga.edu 1 Overview GACRC Linux Operating System Shell, Filesystem, and Common

More information

Week 2 Lecture 3. Unix

Week 2 Lecture 3. Unix Lecture 3 Unix Terminal and Shell 2 Terminal Prompt Command Argument Result 3 Shell Intro A system program that allows a user to execute: shell functions (e.g., ls -la) other programs (e.g., eclipse) shell

More information

Introduction to Unix: Fundamental Commands

Introduction 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 information

A Brief Introduction to Unix

A 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 information

Computer Systems and Architecture

Computer Systems and Architecture Computer Systems and Architecture Stephen Pauwels Computer Systems Academic Year 2018-2019 Overview of the Semester UNIX Introductie Regular Expressions Scripting Data Representation Integers, Fixed point,

More information

Introduction to UNIX command-line II

Introduction 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 information

Computer Systems and Architecture

Computer 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 information

Quick Start Guide. by Burak Himmetoglu. Supercomputing Consultant. Enterprise Technology Services & Center for Scientific Computing

Quick Start Guide. by Burak Himmetoglu. Supercomputing Consultant. Enterprise Technology Services & Center for Scientific Computing Quick Start Guide by Burak Himmetoglu Supercomputing Consultant Enterprise Technology Services & Center for Scientific Computing E-mail: bhimmetoglu@ucsb.edu Linux/Unix basic commands Basic command structure:

More information

Unix File System. Class Meeting 2. * Notes adapted by Joy Mukherjee from previous work by other members of the CS faculty at Virginia Tech

Unix File System. Class Meeting 2. * Notes adapted by Joy Mukherjee from previous work by other members of the CS faculty at Virginia Tech Unix File System Class Meeting 2 * Notes adapted by Joy Mukherjee from previous work by other members of the CS faculty at Virginia Tech Unix File System The file system is your interface to: physical

More information

Introduction. File System. Note. Achtung!

Introduction. 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 information

DATA 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 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 information

Why learn the Command Line? The command line is the text interface to the computer. 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 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 information

CS Fundamentals of Programming II Fall Very Basic UNIX

CS 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 information

Introduction to Linux

Introduction 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 information

Files and Directories

Files 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 information

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

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 information

FREEENGINEER.ORG. 1 of 6 11/5/15 8:31 PM. Learn UNIX in 10 minutes. Version 1.3. Preface

FREEENGINEER.ORG. 1 of 6 11/5/15 8:31 PM. Learn UNIX in 10 minutes. Version 1.3. Preface FREEENGINEER.ORG Learn UNIX in 10 minutes. Version 1.3 Preface This is something that I had given out to students (CAD user training) in years past. The purpose was to have on one page the basics commands

More information

Common UNIX Commands. Unix. User Interfaces. Unix Commands Winter COMP 1270 Computer Usage II 9-1. Using UNIX. Unix has a command line interface

Common UNIX Commands. Unix. User Interfaces. Unix Commands Winter COMP 1270 Computer Usage II 9-1. Using UNIX. Unix has a command line interface Common UNIX Commands Using UNIX Unix Unix has a command line interface Unix commands must be typed Similar to the DOS operating system for PC s Compare to the Graphical User Interface (GUI) used by Windows,

More information

CS246 Spring14 Programming Paradigm Notes on Linux

CS246 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 information

CS CS Tutorial 2 2 Winter 2018

CS CS Tutorial 2 2 Winter 2018 CS CS 230 - Tutorial 2 2 Winter 2018 Sections 1. Unix Basics and connecting to CS environment 2. MIPS Introduction & CS230 Interface 3. Connecting Remotely If you haven t set up a CS environment password,

More information

Useful Unix Commands Cheat Sheet

Useful 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 information

Operating Systems. Copyleft 2005, Binnur Kurt

Operating 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 information

Operating Systems 3. Operating Systems. Content. What is an Operating System? What is an Operating System? Resource Abstraction and Sharing

Operating 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 information

CS 215 Fundamentals of Programming II Spring 2019 Very Basic UNIX

CS 215 Fundamentals of Programming II Spring 2019 Very Basic UNIX CS 215 Fundamentals of Programming II Spring 2019 Very Basic UNIX This handout very briefly describes how to use Unix and how to use the Linux server and client machines in the EECS labs that dual boot

More information

Introduction 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 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 information

Quick Start Guide. by Burak Himmetoglu. Supercomputing Consultant. Enterprise Technology Services & Center for Scientific Computing

Quick Start Guide. by Burak Himmetoglu. Supercomputing Consultant. Enterprise Technology Services & Center for Scientific Computing Quick Start Guide by Burak Himmetoglu Supercomputing Consultant Enterprise Technology Services & Center for Scientific Computing E-mail: bhimmetoglu@ucsb.edu Contents User access, logging in Linux/Unix

More information

Introduction to Linux Workshop 1

Introduction 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 information

Unix L555. Dept. of Linguistics, Indiana University Fall Unix. Unix. Directories. Files. Useful Commands. Permissions. tar.

Unix L555. Dept. of Linguistics, Indiana University Fall Unix. Unix. Directories. Files. Useful Commands. Permissions. tar. L555 Dept. of Linguistics, Indiana University Fall 2010 1 / 21 What is? is an operating system, like DOS or Windows developed in 1969 by Bell Labs works well for single computers as well as for servers

More information

Introduction to Linux. Woo-Yeong Jeong Computer Systems Laboratory Sungkyunkwan University

Introduction 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 information

Introduction 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 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 information

Introduction 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 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 information

Unix Workshop Aug 2014

Unix Workshop Aug 2014 Unix Workshop 2014 5 Aug 2014 What is Unix Multitasking, multiuser operating system Often the OS of choice for large servers, large clusters Unix Around You You re probably familiar with these: Linux Solaris

More information

Unix Essentials. BaRC Hot Topics Bioinformatics and Research Computing Whitehead Institute October 12 th

Unix Essentials. BaRC Hot Topics Bioinformatics and Research Computing Whitehead Institute October 12 th Unix Essentials BaRC Hot Topics Bioinformatics and Research Computing Whitehead Institute October 12 th 2016 http://barc.wi.mit.edu/hot_topics/ 1 Outline Unix overview Logging in to tak Directory structure

More information

CS 460 Linux Tutorial

CS 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 information

Overview LEARN. History of Linux Linux Architecture Linux File System Linux Access Linux Commands File Permission Editors Conclusion and Questions

Overview LEARN. History of Linux Linux Architecture Linux File System Linux Access Linux Commands File Permission Editors Conclusion and Questions Lanka Education and Research Network Linux Architecture, Linux File System, Linux Basic Commands 28 th November 2016 Dilum Samarasinhe () Overview History of Linux Linux Architecture Linux File System

More information

Unix Basics. Benjamin S. Skrainka University College London. July 17, 2010

Unix Basics. Benjamin S. Skrainka University College London. July 17, 2010 Unix Basics Benjamin S. Skrainka University College London July 17, 2010 Overview We cover basic Unix survival skills: Why you need some Unix in your life How to get some Unix in your life Basic commands

More information

GNU/Linux 101. Casey McLaughlin. Research Computing Center Spring Workshop Series 2018

GNU/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 information

Basic Linux (Bash) Commands

Basic 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 information

Unix Tools / Command Line

Unix 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 information

Introduction to remote command line Linux. Research Computing Team University of Birmingham

Introduction to remote command line Linux. Research Computing Team University of Birmingham Introduction to remote command line Linux Research Computing Team University of Birmingham Linux/UNIX/BSD/OSX/what? v All different v UNIX is the oldest, mostly now commercial only in large environments

More information

Short Read Sequencing Analysis Workshop

Short Read Sequencing Analysis Workshop Short Read Sequencing Analysis Workshop Day 2 Learning the Linux Compute Environment In-class Slides Matt Hynes-Grace Manager of IT Operations, BioFrontiers Institute Review of Day 2 Videos Video 1 Introduction

More information

CHAPTER 1 UNIX FOR NONPROGRAMMERS

CHAPTER 1 UNIX FOR NONPROGRAMMERS CHAPTER 1 UNIX FOR NONPROGRAMMERS The man command is used to display the manual entry associated with word entered as argument. The -k option is used displays a list of manual entries that contain entered

More information

Lec 1 add-on: Linux Intro

Lec 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 information

Cloud 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 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

Cloud 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 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

Introduction to Linux for BlueBEAR. January

Introduction to Linux for BlueBEAR. January Introduction to Linux for BlueBEAR January 2019 http://intranet.birmingham.ac.uk/bear Overview Understanding of the BlueBEAR workflow Logging in to BlueBEAR Introduction to basic Linux commands Basic file

More information

CS197U: A Hands on Introduction to Unix

CS197U: A Hands on Introduction to Unix CS197U: A Hands on Introduction to Unix Lecture 3: UNIX Operating System Organization Tian Guo CICS, Umass Amherst 1 Reminders Assignment 2 is due THURSDAY 09/24 at 3:45 pm Directions are on the website

More information

CENG 334 Computer Networks. Laboratory I Linux Tutorial

CENG 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 information

Linux Bootcamp Fall 2015

Linux Bootcamp Fall 2015 Linux Bootcamp Fall 2015 UWB CSS Based on: http://swcarpentry.github.io/shell-novice "Software Carpentry" and the Software Carpentry logo are registered trademarks of NumFOCUS. What this bootcamp is: A

More information

Introduction to Linux

Introduction to Linux Introduction to Linux Mukesh Pund Principal Scientist, NISCAIR, New Delhi, India History In 1969, a team of developers developed a new operating system called Unix which was written using C Linus Torvalds,

More information

Introduction to Linux

Introduction 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 information

Introduction to UNIX Command Line

Introduction 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 information

Introduction to Linux

Introduction 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 information

A Brief Introduction to the Linux Shell for Data Science

A 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 information

Shell. SSE2034: System Software Experiment 3, Fall 2018, Jinkyu Jeong

Shell. 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 information

DAVE LIDDAMENT INTRODUCTION TO BASH

DAVE LIDDAMENT INTRODUCTION TO BASH DAVE LIDDAMENT INTRODUCTION TO BASH @daveliddament FORMAT Short lectures Practical exercises (help each other) Write scripts LEARNING OBJECTIVES What is Bash When should you use Bash Basic concepts of

More information

Introduction to Linux

Introduction to Linux Introduction to Linux University of Bristol - Advance Computing Research Centre 1 / 47 Operating Systems Program running all the time Interfaces between other programs and hardware Provides abstractions

More information

Introduction to Unix and Linux. Workshop 1: Directories and Files

Introduction to Unix and Linux. Workshop 1: Directories and Files Introduction to Unix and Linux Workshop 1: Directories and Files Genomics Core Lab TEXAS A&M UNIVERSITY CORPUS CHRISTI Anvesh Paidipala, Evan Krell, Kelly Pennoyer, Chris Bird Genomics Core Lab Informatics

More information

Lezione 8. Shell command language Introduction. Sommario. Bioinformatica. Mauro Ceccanti e Alberto Paoluzzi

Lezione 8. Shell command language Introduction. Sommario. Bioinformatica. Mauro Ceccanti e Alberto Paoluzzi Lezione 8 Bioinformatica Mauro Ceccanti e Alberto Paoluzzi Dip. Informatica e Automazione Università Roma Tre Dip. Medicina Clinica Università La Sapienza Sommario Shell command language Introduction A

More information

CENG393 Computer Networks Labwork 1

CENG393 Computer Networks Labwork 1 CENG393 Computer Networks Labwork 1 Linux is the common name given to a large family of operating systems. All Linux-based operating systems are essentially a large set of computer software that are bound

More information

Linux Systems Administration Getting Started with Linux

Linux Systems Administration Getting Started with Linux Linux Systems Administration Getting Started with Linux Network Startup Resource Center www.nsrc.org These materials are licensed under the Creative Commons Attribution-NonCommercial 4.0 International

More information

CSE 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 , 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 information

Unix Introduction to UNIX

Unix 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 information

CSCI 2132 Software Development. Lecture 4: Files and Directories

CSCI 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 information

Introduction to the UNIX command line

Introduction 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 information

Introduction Into Linux Lecture 1 Johannes Werner WS 2017

Introduction Into Linux Lecture 1 Johannes Werner WS 2017 Introduction Into Linux Lecture 1 Johannes Werner WS 2017 Table of contents Introduction Operating systems Command line Programming Take home messages Introduction Lecturers Johannes Werner (j.werner@dkfz-heidelberg.de)

More information

Unix basics exercise MBV-INFX410

Unix basics exercise MBV-INFX410 Unix basics exercise MBV-INFX410 In order to start this exercise, you need to be logged in on a UNIX computer with a terminal window open on your computer. It is best if you are logged in on freebee.abel.uio.no.

More information

Introduction to Unix. University of Massachusetts Medical School. October, 2014

Introduction to Unix. University of Massachusetts Medical School. October, 2014 .. Introduction to Unix University of Massachusetts Medical School October, 2014 . DISCLAIMER For the sake of clarity, the concepts mentioned in these slides have been simplified significantly. Most of

More information

CSE 303 Lecture 4. users/groups; permissions; intro to shell scripting. read Linux Pocket Guide pp , 25-27, 61-65, , 176

CSE 303 Lecture 4. users/groups; permissions; intro to shell scripting. read Linux Pocket Guide pp , 25-27, 61-65, , 176 CSE 303 Lecture 4 users/groups; permissions; intro to shell scripting read Linux Pocket Guide pp. 19-20, 25-27, 61-65, 118-119, 176 slides created by Marty Stepp http://www.cs.washington.edu/303/ 1 Lecture

More information

Unix 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, 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 information

acmteam/unix.pdf How to manage your account (user ID, password, shell); How to compile C, C++, and Java programs;

acmteam/unix.pdf How to manage your account (user ID, password, shell); How to compile C, C++, and Java programs; Note: you can find this file under: http://www.cs.queensu.ca/ acmteam/unix.pdf Introduction to Unix Tutorial In this tutorial, you will learn: How to manage your account (user ID, password, shell); Navigating

More information

Open up a terminal, make sure you are in your home directory, and run the command.

Open up a terminal, make sure you are in your home directory, and run the command. More Linux Commands 0.1 wc The Linux command for acquiring size statistics on a file is wc. This command can provide information from line count, to bytes in a file. Open up a terminal, make sure you are

More information

Std: XI CHAPTER-3 LINUX

Std: XI CHAPTER-3 LINUX Commands: General format: Command Option Argument Command: ls - Lists the contents of a file. Option: Begins with minus sign (-) ls a Lists including the hidden files. Argument refers to the name of a

More information

Exercise 1: Basic Tools

Exercise 1: Basic Tools Exercise 1: Basic Tools This exercise is created so everybody can learn the basic tools we will use during this course. It is really more like a tutorial than an exercise and, you are not required to submit

More information

Bash, In A NutShell RUSTY MYERS - SYSTEMS ADMINISTRATOR, PENN STATE CHRIS LAWSON - IT CONSULTANT/SUPPORT SPECIALIST, PENN STATE ALTOONA

Bash, In A NutShell RUSTY MYERS - SYSTEMS ADMINISTRATOR, PENN STATE CHRIS LAWSON - IT CONSULTANT/SUPPORT SPECIALIST, PENN STATE ALTOONA Bash, In A NutShell RUSTY MYERS - SYSTEMS ADMINISTRATOR, PENN STATE CHRIS LAWSON - IT CONSULTANT/SUPPORT SPECIALIST, PENN STATE ALTOONA BASH, IN A NUTSHELL What is bash? Brian Fox 1989 Bourne Again Shell

More information

Arkansas High Performance Computing Center at the University of Arkansas

Arkansas High Performance Computing Center at the University of Arkansas Arkansas High Performance Computing Center at the University of Arkansas AHPCC Workshop Series Introduction to Linux for HPC Why Linux? Compatible with many architectures OS of choice for large scale computing

More information

Introduction to Linux. Roman Cheplyaka

Introduction 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 information

Lezione 8. Shell command language Introduction. Sommario. Bioinformatica. Esercitazione Introduzione al linguaggio di shell

Lezione 8. Shell command language Introduction. Sommario. Bioinformatica. Esercitazione Introduzione al linguaggio di shell Lezione 8 Bioinformatica Mauro Ceccanti e Alberto Paoluzzi Esercitazione Introduzione al linguaggio di shell Dip. Informatica e Automazione Università Roma Tre Dip. Medicina Clinica Università La Sapienza

More information

CHE3935. Lecture 1. Introduction to Linux

CHE3935. Lecture 1. Introduction to Linux CHE3935 Lecture 1 Introduction to Linux 1 Logging In PuTTY is a free telnet/ssh client that can be run without installing it within Windows. It will only give you a terminal interface, but used with a

More information

COMS 6100 Class Notes 3

COMS 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 information

Carnegie Mellon. Linux Boot Camp. Jack, Matthew, Nishad, Stanley 6 Sep 2016

Carnegie Mellon. Linux Boot Camp. Jack, Matthew, Nishad, Stanley 6 Sep 2016 Linux Boot Camp Jack, Matthew, Nishad, Stanley 6 Sep 2016 1 Connecting SSH Windows users: MobaXterm, PuTTY, SSH Tectia Mac & Linux users: Terminal (Just type ssh) andrewid@shark.ics.cs.cmu.edu 2 Let s

More information

Exercise Sheet 2. (Classifications of Operating Systems)

Exercise Sheet 2. (Classifications of Operating Systems) Exercise Sheet 2 Exercise 1 (Classifications of Operating Systems) 1. At any given moment, only a single program can be executed. What is the technical term for this operation mode? 2. What are half multi-user

More information

The Unix Shell & Shell Scripts

The 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 information

Unix Filesystem. January 26 th, 2004 Class Meeting 2

Unix Filesystem. January 26 th, 2004 Class Meeting 2 Unix Filesystem January 26 th, 2004 Class Meeting 2 * Notes adapted by Christian Allgood from previous work by other members of the CS faculty at Virginia Tech Unix Filesystem! The filesystem is your interface

More information

Chapter 4. Unix Tutorial. Unix Shell

Chapter 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 information

This 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]

This 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 information