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

Similar documents
Introduction to UNIX command-line

Introduction to UNIX command-line II

Computer Systems and Architecture

CS CS Tutorial 2 2 Winter 2018

Lecture # 2 Introduction to UNIX (Part 2)

Introduction to Linux

Chapter-3. Introduction to Unix: Fundamental Commands

CHAPTER 1 UNIX FOR NONPROGRAMMERS

Introduction to the Linux Command Line

Unix Tools / Command Line

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

Introduction: What is Unix?

Introduction to Unix: Fundamental Commands

Mills HPC Tutorial Series. Linux Basics I

Using UNIX. -rwxr--r-- 1 root sys Sep 5 14:15 good_program

Lab 1 Introduction to UNIX and C

Computer Systems and Architecture

Introduction to Linux Workshop 1

Introduction to Linux

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

CS246 Spring14 Programming Paradigm Notes on Linux

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

CENG 334 Computer Networks. Laboratory I Linux Tutorial

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

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

Introduction To Linux. Rob Thomas - ACRC

commandname flags arguments

Unix Workshop Aug 2014

Lab Working with Linux Command Line

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

UoW HPC Quick Start. Information Technology Services University of Wollongong. ( Last updated on October 10, 2011)

Introduction to the UNIX command line

Files

Practical Session 0 Introduction to Linux

Week 2 Lecture 3. Unix

INTRODUCTION TO BIOINFORMATICS

Arkansas High Performance Computing Center at the University of Arkansas

Introduction to UNIX Command Line

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

Introduction. File System. Note. Achtung!

CSCI 2132 Software Development. Lecture 4: Files and Directories

Basic Unix Commands. CGS 3460, Lecture 6 Jan 23, 2006 Zhen Yang

CS Fundamentals of Programming II Fall Very Basic UNIX

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

Introduction to Linux

Introduction to Linux. Roman Cheplyaka

Read the relevant material in Sobell! If you want to follow along with the examples that follow, and you do, open a Linux terminal.

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

Working With Unix. Scott A. Handley* September 15, *Adapted from UNIX introduction material created by Dr. Julian Catchen

Getting your department account

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

Outline. Structure of a UNIX command

Perl and R Scripting for Biologists

A Brief Introduction to the Linux Shell for Data Science

Essential Linux Shell Commands

Intro to Linux. this will open up a new terminal window for you is super convenient on the computers in the lab

Introduction to Unix The Windows User perspective. Wes Frisby Kyle Horne Todd Johansen

Unix Basics. Systems Programming Concepts

Where can UNIX be used? Getting to the terminal. Where are you? most important/useful commands & examples. Real Unix computers

CENG393 Computer Networks Labwork 1

CS 3410 Intro to Unix, shell commands, etc... (slides from Hussam Abu-Libdeh and David Slater)

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

DATA 301 Introduction to Data Analytics Command Line. Dr. Ramon Lawrence University of British Columbia Okanagan

Why learn the Command Line? The command line is the text interface to the computer. DATA 301 Introduction to Data Analytics Command Line

Basic Linux Commands. Srihari Kalgi M.Tech, CSE (KReSIT), IIT Bombay. May 5, 2009

Useful Unix Commands Cheat Sheet

The Linux Command Line & Shell Scripting

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

C++ Programming on Linux

Oregon State University School of Electrical Engineering and Computer Science. CS 261 Recitation 1. Spring 2011

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

User Guide Version 2.0

Linux Command Line Primer. By: Scott Marshall

A Brief Introduction to Unix

CS 215 Fundamentals of Programming II Spring 2019 Very Basic UNIX

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

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.

Hitchhiker s Guide to VLSI Design with Cadence & Synopsys

Linux Exercise. pwd answer: We call this directory (into which you get when you log in) your home directory.

CISC 220 fall 2011, set 1: Linux basics

AN INTRODUCTION TO UNIX

UNIX. The Very 10 Short Howto for beginners. Soon-Hyung Yook. March 27, Soon-Hyung Yook UNIX March 27, / 29

Introduction to Linux. Fundamentals of Computer Science

The Unix Shell. Permissions

COSC UNIX. Textbook. Grading Scheme

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

CSC209. Software Tools and Systems Programming.

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

Basic Shell Commands

History. Terminology. Opening a Terminal. Introduction to the Unix command line GNOME

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

CS 460 Linux Tutorial

COL100 Lab 2. I semester Week 2, Open the web-browser and visit the page and visit the COL100 course page.

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

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

Brief Linux Presentation. July 10th, 2006 Elan Borenstein

Lab 1 Introduction to UNIX and C

The Command Line. Matthew Bender. September 10, CMSC Command Line Workshop. Matthew Bender (2015) The Command Line September 10, / 25

Introduction to the shell Part II

UNIX Basics. UNIX Basics CIS 218 Oakton Community College

Transcription:

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 now also underlying operating system for Macs Linux: open source version of unix (mostly for PCs) 2 / 21

Directory Structure directory = folder directory structure: tree structure Important directories: home directory: your private directory (/Users/guest) root node: / important directories on a Mac: /Applications /Users /Volumes /Volumes/Data/Corpora (on jones!) 3 / 21

Graphical Representation / Applications Users Volumes mdickinson guest... Data Corpora ar en de multilingual 4 / 21

for list files in current directory: ls list files with more information: ls -l 5 / 21

for list files in current directory: ls list files with more information: ls -l change directories: cd <to> two possibilities to specify <to>: from root: cd /Users/mdickinson 5 / 21

for list files in current directory: ls list files with more information: ls -l change directories: cd <to> two possibilities to specify <to>: from root: cd /Users/mdickinson from where we are: cd../mdickinson.. means go up 5 / 21

for list files in current directory: ls list files with more information: ls -l change directories: cd <to> two possibilities to specify <to>: from root: cd /Users/mdickinson from where we are: cd../mdickinson.. means go up go back to home directory: cd 5 / 21

for list files in current directory: ls list files with more information: ls -l change directories: cd <to> two possibilities to specify <to>: from root: cd /Users/mdickinson from where we are: cd../mdickinson.. means go up go back to home directory: cd show the directory where you are: pwd 5 / 21

Useful Shortcuts TAB completion If you st typing a command or filename, then press TAB, the shell will complete the word for you as far as possible. Command history The shell keeps a history of your commands. To scroll through them, simply press the up arrow key. 6 / 21

Looking at display contents of file in terminal: cat <filename> 7 / 21

Looking at display contents of file in terminal: cat <filename> display page by page: less <filename> 7 / 21

Looking at display contents of file in terminal: cat <filename> display page by page: less <filename> next page: space bar quit:q 7 / 21

Looking at display contents of file in terminal: cat <filename> display page by page: less <filename> next page: space bar quit:q go to beginning of file:g go to end of file:g 7 / 21

Looking at display contents of file in terminal: cat <filename> display page by page: less <filename> next page: space bar quit:q go to beginning of file:g go to end of file:g search forward:/<expression> + hit return search backward:?<expression> + hit return in search: next found occurrence: n 7 / 21

Looking at display contents of file in terminal: cat <filename> display page by page: less <filename> next page: space bar quit:q go to beginning of file:g go to end of file:g search forward:/<expression> + hit return search backward:?<expression> + hit return in search: next found occurrence: n Likewise, there is the more <filename> command 7 / 21

Looking at display beginning of file (normally 10): head <filename> 8 / 21

Looking at display beginning of file (normally 10): head <filename> display X beginning lines of file: head -n X <filename> 8 / 21

Looking at display beginning of file (normally 10): head <filename> display X beginning lines of file: head -n X <filename> display end of file (normally 10): tail <filename> 8 / 21

Looking at display beginning of file (normally 10): head <filename> display X beginning lines of file: head -n X <filename> display end of file (normally 10): tail <filename> count number of lines, words, characters in a file: wc <filename> 8 / 21

More list files that end in.txt : ls *.txt 9 / 21

More list files that end in.txt : ls *.txt make directory: mkdir <path/><dirname> 9 / 21

More list files that end in.txt : ls *.txt make directory: mkdir <path/><dirname> subdirectory: mkdir results in your home directory: mkdir /results 9 / 21

More list files that end in.txt : ls *.txt make directory: mkdir <path/><dirname> subdirectory: mkdir results in your home directory: mkdir /results copy a file from one location to another: cp <filename> <path/> 9 / 21

More list files that end in.txt : ls *.txt make directory: mkdir <path/><dirname> subdirectory: mkdir results in your home directory: mkdir /results copy a file from one location to another: cp <filename> <path/> copy a file to the directory results in your home directory: cp dates.txt /results 9 / 21

More (2) sort your file: sort <filename> 10 / 21

More (2) sort your file: sort <filename> sort (numbers) in numeric order: sort -n <filename> 10 / 21

More (2) sort your file: sort <filename> sort (numbers) in numeric order: sort -n <filename> find a word in a file and display all the lines in which it occurred: grep <word> <fromfile> 10 / 21

More (2) sort your file: sort <filename> sort (numbers) in numeric order: sort -n <filename> find a word in a file and display all the lines in which it occurred: grep <word> <fromfile> find a word in a file and display all the lines in which it occurred and save results into a file in your home directory: grep <word> <fromfile> > /<tofile> 10 / 21

More (2) sort your file: sort <filename> sort (numbers) in numeric order: sort -n <filename> find a word in a file and display all the lines in which it occurred: grep <word> <fromfile> find a word in a file and display all the lines in which it occurred and save results into a file in your home directory: grep <word> <fromfile> > /<tofile> example: grep linguistic mycorp.txt > /res.txt 10 / 21

More (3) delete lines (adjacent) with identical content: uniq <filename> 11 / 21

More (3) delete lines (adjacent) with identical content: uniq <filename> delete lines (adjacent) with identical content, but list how many were there: uniq -c <filename> 11 / 21

More (3) delete lines (adjacent) with identical content: uniq <filename> delete lines (adjacent) with identical content, but list how many were there: uniq -c <filename> display differences between two files diff <filename1> <filename2> 11 / 21

Permission System ls -l -rw-r--r-- 1 root admin 168724 Nov 9 2003 Jokes.pdf drwxr-xr-x 15 root admin 510 Aug 31 2006 ar drwxr-xr-x 3 root admin 102 Aug 4 2004 cs drwxr-xr-x 4 root admin 136 Mar 2 2007 de drwxr-xr-x 35 root admin 1190 Feb 18 15:23 en 12 / 21

Permission System ls -l -rw-r--r-- 1 root admin 168724 Nov 9 2003 Jokes.pdf drwxr-xr-x 15 root admin 510 Aug 31 2006 ar drwxr-xr-x 3 root admin 102 Aug 4 2004 cs drwxr-xr-x 4 root admin 136 Mar 2 2007 de drwxr-xr-x 35 root admin 1190 Feb 18 15:23 en change permissions: chmod <who><+/-><what> <file/dir> <who>: user =u; group=g; others =o; all =a; <what>: read =r; write =w; execute =x; 12 / 21

Permission System ls -l -rw-r--r-- 1 root admin 168724 Nov 9 2003 Jokes.pdf drwxr-xr-x 15 root admin 510 Aug 31 2006 ar drwxr-xr-x 3 root admin 102 Aug 4 2004 cs drwxr-xr-x 4 root admin 136 Mar 2 2007 de drwxr-xr-x 35 root admin 1190 Feb 18 15:23 en change permissions: chmod <who><+/-><what> <file/dir> <who>: user =u; group=g; others =o; all =a; <what>: read =r; write =w; execute =x; example: give user write permissions for file hello.txt : chmod u+w hello.txt 12 / 21

Permission System ls -l -rw-r--r-- 1 root admin 168724 Nov 9 2003 Jokes.pdf drwxr-xr-x 15 root admin 510 Aug 31 2006 ar drwxr-xr-x 3 root admin 102 Aug 4 2004 cs drwxr-xr-x 4 root admin 136 Mar 2 2007 de drwxr-xr-x 35 root admin 1190 Feb 18 15:23 en change permissions: chmod <who><+/-><what> <file/dir> <who>: user =u; group=g; others =o; all =a; <what>: read =r; write =w; execute =x; example: give user write permissions for file hello.txt : chmod u+w hello.txt example: deny others write and execute permissions for directory test : chmod o-wx test 12 / 21

Packing and Unpacking pack a file: gzip <file> results in <file>.gz 13 / 21

Packing and Unpacking pack a file: gzip <file> results in <file>.gz unpack file: gunzip <file>.gz 13 / 21

Packing and Unpacking pack a file: gzip <file> results in <file>.gz unpack file: gunzip <file>.gz pack more than one file: cvf <resultfile>. <file or directory> unpack: xvf <file>. 13 / 21

Packing and Unpacking pack a file: gzip <file> results in <file>.gz unpack file: gunzip <file>.gz pack more than one file: cvf <resultfile>. <file or directory> unpack: xvf <file>. and gzip: cvzf <resultfile>.tgz <file directory> unpack: xvzf <file>.tgz 13 / 21

More on Copy and Move copy a file from one location to another: cp <path/filename> <path/filename> 14 / 21

More on Copy and Move copy a file from one location to another: cp <path/filename> <path/filename> move a file from one location to another: mv <filename> <path/> 14 / 21

More on Copy and Move copy a file from one location to another: cp <path/filename> <path/filename> move a file from one location to another: mv <filename> <path/> rename a file: mv <oldfilename> <newfilename> 14 / 21

More on Copy and Move copy a file from one location to another: cp <path/filename> <path/filename> move a file from one location to another: mv <filename> <path/> rename a file: mv <oldfilename> <newfilename> remove a file: rm <filename> 14 / 21

More on Copy and Move copy a file from one location to another: cp <path/filename> <path/filename> move a file from one location to another: mv <filename> <path/> rename a file: mv <oldfilename> <newfilename> remove a file: rm <filename> remove a directory including contents: rm -r <dir> 14 / 21

Important Shortcuts in Paths.. (go) up one directory. here home directory 15 / 21

Translate exchange characters for others: tr aeiou X < <filename> tr aeiou AEIOU < <filename> collapse characters (squeeze): tr -s J < <filename> exchange complement of characters for others: tr -c a-z \n < <filename> \n is a linebreak 16 / 21

Putting Commands Together < use following filename as input file > use following filename as output file use output of preceding command as input for following commands 17 / 21

Putting Commands Together < use following filename as input file > use following filename as output file use output of preceding command as input for following commands example: cat <infile> tr A-Z a-z sort > <outfile> 17 / 21

Find out More man <command> 18 / 21

Remote Login login: ssh username @ machinename e.g. ssh guest@jones.ling.indiana.edu logout: exit 19 / 21

Remote Copy to copy a local file to (your home directory) on another machine: scp <filename> <machine>: e.g. scp vm.pos jones.ling.indiana.edu: to copy a file from another machine to the current directory: scp <machine>:<path>/<filename>. e.g. scp jones.ling.indiana.edu:/volumes/data/ Corpora/en/penntreebankv3/readme.all. (in one line!) 20 / 21

emacs is a fairly basic text editor that can be run in a window or in the shell to st emacs: emacs <filename> to quit: Ctrl-x Ctrl-c save: Ctrl-x Ctrl-s search: Ctrl-s 21 / 21