Introduc)on to Linux Session 2 Files/Filesystems/Data. Pete Ruprecht Research Compu)ng Group University of Colorado Boulder

Similar documents
Introduction to Linux

Files

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

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Introduction to the Linux Command Line

Introduction: What is Unix?

Linux Essentials. Programming and Data Structures Lab M Tech CS First Year, First Semester

Introduction to UNIX command-line

Chapter-3. Introduction to Unix: Fundamental Commands

Computer Systems and Architecture

Linux Command Line Primer. By: Scott Marshall

Processes. Shell Commands. a Command Line Interface accepts typed (textual) inputs and provides textual outputs. Synonyms:

Unix Filesystem. January 26 th, 2004 Class Meeting 2

Computer Systems and Architecture

CSCI 2132 Software Development. Lecture 4: Files and Directories

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

UNIX File Hierarchy: Structure and Commands

A Brief Introduction to Unix

Introduction to Unix: Fundamental Commands

Lab 2: Linux/Unix shell

Command-line interpreters

Unix System Architecture, File System, and Shell Commands

System Administration

CSE Linux VM. For Microsoft Windows. Based on opensuse Leap 42.2

Introduction to Linux (and the terminal)

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.

Working with Basic Linux. Daniel Balagué

CHAPTER 1 UNIX FOR NONPROGRAMMERS

Introduction to the Linux Command Line. Ken Weiss HITS Computational Research Consulting Division

The Unix Shell & Shell Scripts

Perl and R Scripting for Biologists

Files and Directories

CENG 334 Computer Networks. Laboratory I Linux Tutorial

Useful Unix Commands Cheat Sheet

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

Part 1: Basic Commands/U3li3es

Introduction to Linux

Unix Workshop Aug 2014

Set 1 MCQ Which command is used to sort the lines of data in a file in reverse order A) sort B) sh C) st D) sort -r

The Linux Command Line & Shell Scripting

Introduction to Linux Part 1. Anita Orendt and Wim Cardoen Center for High Performance Computing 24 May 2017

Unix Introduction to UNIX

Contents. Note: pay attention to where you are. Note: Plaintext version. Note: pay attention to where you are... 1 Note: Plaintext version...

The Unix Shell. Pipes and Filters

5/8/2012. Creating and Changing Directories Chapter 7

Unix as a Platform Exercises. Course Code: OS-01-UNXPLAT

Embedded Linux Systems. Bin Li Assistant Professor Dept. of Electrical, Computer and Biomedical Engineering University of Rhode Island

LAB 8 (Aug 4/5) Unix Utilities

LAB 8 (Aug 4/5) Unix Utilities

INTRODUCTION TO BIOINFORMATICS

1) Introduc,on to unix command line and perl. Ma5 Webster IMBIM, BMC

CS197U: A Hands on Introduction to Unix

Introduction to UNIX command-line II

AOS Linux Tutorial. Introduction to Linux. Michael Havas Dept. of Atmospheric and Oceanic Sciences McGill University. September 15, 2011

Unix/Linux Operating System. Introduction to Computational Statistics STAT 598G, Fall 2011

Introduction of Linux

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

CS197U: A Hands on Introduction to Unix

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

IBM AIX Basic Operations V5.

Practical Session 0 Introduction to Linux

CSE 303 Lecture 2. Introduction to bash shell. read Linux Pocket Guide pp , 58-59, 60, 65-70, 71-72, 77-80

Linux Shell Script. J. K. Mandal

Basic UNIX commands. HORT Lab 2 Instructor: Kranthi Varala

Crash Course in Unix. For more info check out the Unix man pages -orhttp:// -or- Unix in a Nutshell (an O Reilly book).

Chapter Two. Lesson A. Objectives. Exploring the UNIX File System and File Security. Understanding Files and Directories

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

National University of Computer and Emerging Sciences Operating System Lab - 02 Lab Manual

Introduction To Linux. Rob Thomas - ACRC

Python for Astronomers. Week 1- Basic Python

Open Source Computational Fluid Dynamics

Welcome to getting started with Ubuntu Server. This System Administrator Manual. guide to be simple to follow, with step by step instructions

Connecting to ICS Server, Shell, Vim CS238P Operating Systems fall 18

UNIX for Smar0es. compu0ng environments. Aaron J. Mackey Bill Pearson

Welcome. IT in AOS. Michael Havas Dept. of Atmospheric and Oceanic Sciences McGill University. September 21, 2012

Mills HPC Tutorial Series. Linux Basics I

Introduction to UNIX. Logging in. Basic System Architecture 10/7/10. most systems have graphical login on Linux machines

Introduction to the shell Part II

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

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

commandname flags arguments

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]

Appendix B WORKSHOP. SYS-ED/ Computer Education Techniques, Inc.

Introduction to Linux

CSC209. Software Tools and Systems Programming.

Unix File System. Learning command-line navigation of the file system is essential for efficient system usage

Operating Systems. Copyleft 2005, Binnur Kurt

Introduction to Linux

Introduction to UNIX. Introduction. Processes. ps command. The File System. Directory Structure. UNIX is an operating system (OS).

Introduction to UNIX. CSE 2031 Fall November 5, 2012

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

When talking about how to launch commands and other things that is to be typed into the terminal, the following syntax is used:

Week 2 Lecture 3. Unix

Introduction to Linux

Operating Systems. Engr. Abdul-Rahman Mahmood MS, PMP, MCP, QMR(ISO9001:2000) alphapeeler.sf.net/pubkeys/pkey.htm

Unix as a Platform Exercises + Solutions. Course Code: OS 01 UNXPLAT

Week Overview. Simple filter commands: head, tail, cut, sort, tr, wc grep utility stdin, stdout, stderr Redirection and piping /dev/null file

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

Week Overview. Unix file system File types and file naming Basic file system commands: pwd,cd,ls,mkdir,rmdir,mv,cp,rm man pages

Introduction to UNIX Command Line

Transcription:

Introduc)on to Linux Session 2 Files/Filesystems/Data Pete Ruprecht Research Compu)ng Group University of Colorado Boulder www.rc.colorado.edu

Outline LeHover from last week redirec)on Filesystem layout Permissions PaJern matching (regular expressions) Stream edi)ng and column opera)ons Links Finding files How full is a disk? Slides available at hjps://github.com/researchcompu)ng/meetup- Fall- 2013

Pipes and redirec)on Input and output redirec)on Send output from a command to a new file with > Append output to an exis)ng file with >> Use a file as input to a command with < Pipes: sends output of one command to another command ps ef grep ruprech!

File- and directory- related commands pwd prints full path to current directory cd changes directory; can use full or rela)ve path as target mkdir creates a subdirectory in the current directory rmdir removes an empty directory rm removes a file (rm r removes a directory and all of its contents) cp copies a file mv moves (or renames) a file ls lists the contents of a directory (ls l gives detailed lis)ng) chmod/chown change permissions or ownership df displays filesystems and their sizes du shows disk usage (du sk shows size of a directory and all of its contents in KB)

File- viewing commands less displays a file one screen at a )me cat prints en)re file to the screen head prints the first few lines of a file tail prints the last few lines of a file (with f shows in real )me the end of a file that may be changing) diff shows differences between two files grep prints lines containing a string or other regular expression tee prints the output of a command and also copies the output to a file sort sorts lines in a file find searches for files that meet specified criteria wc count words, lines, or characters in a file

Filesystem / Multiple Users bin usr home Relative path /local /<username>../../usr/local /bin /documents /hpc /usr/local/bin Absolute path /notes.txt /home/<username>/documents/hpc/notes.txt Research Computing @ CU Boulder

Research Compu)ng storage Please take a look at hjps://www.rc.colorado.edu/services/storage/ filesystemstorage for details on using different types of storage systems in the RC environment.

Modes (permissions) 3 classes of users: User (u) aka owner Group (g) Other (o) 3 types of permissions: Read (r) Write (w) Execute (x)

Modes (con)nued) chmod changes modes: To add write and execute permission for your group: chmod g+wx filename! To set only read and execute for your group and others: chmod go=rx filename!

Regular expressions string match string exactly. Match single character 19.3 (matches 1903, 1913, 19A3) * Match zero or more of preceding character bugs* (matches bug, bugs, bugsss) ^ Match beginning of line ^data (line starts with data) $ Match end of line ^ $ (line with exactly 3 chars) [] Match from set Jun[0-9]*_201[01] (Jun followed by any number of integers followed by _2010 or _2011)

Stream edi)ng (with sed) sed s/kr/krypton/g < input.txt > output.txt (global find- and- replace of Kr with krypton) cat input.txt sed /^$/d > output.txt (remove all blank lines) sed e s/^/ / input.txt > output.txt (add 3 spaces to beginning of each line)

Column opera)ons (with awk) awk {print $3} (print 3 rd field or column) awk F: {print $1,$3} (print 1 st and 3 rd fields; fields delimited by : ) awk {print $NF} (print last column; NF means number of fields) awk {print NF} (print number of fields)

More with awk awk {total = total + $1}END{print total} (sums the first column) grep ^[0-9] data.txt \! awk {print $2, 3.14*$1} (for lines beginning with a number, print the 2 nd column followed by the 1 st column )mes pi)

How full is a disk? df displays filesystem informa)on Check if your disk is filling Find where a filesystem is physically located The - h flag gives human readable units du shows disk usage du sk * sort n is useful for finding large directories

Finding files (with find) find /somedir name *.pdf (find files ending in.pdf in /somedir (& subdirs)) find ~ -mtime +3 (find files in homdir modified over 3 days ago) find. perm 644 exec chmod g+w {} \; (find files with rw- r- - r- - ; change to rw- rw- r- - ) Find. name *.ps a mtime -3 (find.ps files modified less than 3 days ago)

Data transfer www.rc.colorado.edu/services/ filetransfer Globus Online Large file transfers with drag and drop interface to move data between Globus or GridHp endpoints U)li)es scp, shp, rsync Work best with smaller files

File edi)ng nano simple and intui)ve to get started with; not powerful; keyboard driven vi/vim universal; keyboard driven; powerful but some learning curve required emacs keyboard or GUI versions; helpful extensions for programmers; well- documented OpenOffice / LibreOffice for WYSIWYG hjp://xkcd.com/378/

Thank you! Next session )me and place More info: www.rc.colorado.edu