Introduction to UNIX I: Command Line 1 / 21

Similar documents
Running Programs in UNIX 1 / 30

Mills HPC Tutorial Series. Linux Basics I

Introduction: What is Unix?

Essential Linux Shell Commands

Files

Introduction to Linux

Introduction to UNIX command-line

Linux Systems Administration Getting Started with Linux

CSCI 2132 Software Development. Lecture 4: Files and Directories

Introduction to Linux

CSCI 2132 Software Development. Lecture 3: Unix Shells and Other Basic Concepts

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

Lec 1 add-on: Linux Intro

Virtual Machine. Linux flavor : Debian. Everything (except slides) preinstalled for you.

Chapter-3. Introduction to Unix: Fundamental Commands

Files and Directories

The Linux Command Line & Shell Scripting

Introduction to the Linux Command Line

Introduction to Linux. Roman Cheplyaka

Week 2 Lecture 3. Unix

CISC 220 fall 2011, set 1: Linux basics

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

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

Linux Kung Fu. Ross Ventresca UBNetDef, Fall 2017

Linux Bootcamp Fall 2015

EE516: Embedded Software Project 1. Setting Up Environment for Projects

UNIX COMMANDS AND SHELLS. UNIX Programming 2015 Fall by Euiseong Seo

Introduction to Unix: Fundamental Commands

Unix Tutorial. Beginner. CS Help Desk: Marc Jarvis (in spirit), Monica Ung, Corey Antoniuk 2015

Unix Workshop Aug 2014

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

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

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 File System. Class Meeting 2. * Notes adapted by Joy Mukherjee from previous work by other members of the CS faculty at Virginia Tech

Lecture # 2 Introduction to UNIX (Part 2)

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

Introduction to Linux Workshop 1

Lecture 3. Unix. Question? b. The world s best restaurant. c. Being in the top three happiest countries in the world.

CSCI 2132 Software Development. Lecture 5: File Permissions

Unix Handouts. Shantanu N Kulkarni

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

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

CHEM5302 Fall 2015: Introduction to Maestro and the command line

AN INTRODUCTION TO UNIX

PROGRAMMAZIONE I A.A. 2015/2016

Unix Filesystem. January 26 th, 2004 Class Meeting 2

Introduction of Linux

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

Unzip command in unix

Perl and R Scripting for Biologists

Outline. Structure of a UNIX command

commandname flags arguments

CS Fundamentals of Programming II Fall Very Basic UNIX

Linux Command Line Primer. By: Scott Marshall

Unix Shells and Other Basic Concepts

A Brief Introduction to Unix

EECS Software Tools. Lab 2 Tutorial: Introduction to UNIX/Linux. Tilemachos Pechlivanoglou

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

Introduction to Linux

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

CS 143A. Principles of Operating Systems. Instructor : Prof. Anton Burtsev

Linux Command Line Interface. December 27, 2017

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

First of all, these notes will cover only a small subset of the available commands and utilities, and will cover most of those in a shallow fashion.

Introduction. File System. Note. Achtung!

Student Remote Login Procedure (see picture below): 1. Start SSH Secure Shell 2. Click the computer icon (4 th on the toolbar) 3.

Command Line Interface The basics

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

CS Unix Tools. Lecture 2 Fall Hussam Abu-Libdeh based on slides by David Slater. September 10, 2010

genome[phd14]:/home/people/phd14/alignment >

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

Exercise sheet 1 To be corrected in tutorials in the week from 23/10/2017 to 27/10/2017

CHAPTER 1 UNIX FOR NONPROGRAMMERS

Introduction to the basics of UNIX

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

Unix Introduction to UNIX

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

Using the computational resources at the GACRC

An Introduction to Using the Command Line Interface (CLI) to Work with Files and Directories

Short Read Sequencing Analysis Workshop

CS 215 Fundamentals of Programming II Spring 2019 Very Basic UNIX

First of all, these notes will cover only a small subset of the available commands and utilities, and will cover most of those in a shallow fashion.

Getting your department account

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

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

Unix. 1 tblgrant projects 0 Jun 17 15:40 doc1.txt. documents]$ touch doc2.txt documents]$ ls -l total 0

Linux Essentials Objectives Topics:

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

Introduction to Linux

Linux Operating System Environment Computadors Grau en Ciència i Enginyeria de Dades Q2

COMS 6100 Class Notes 3

Introduction to UNIX command-line II

Getting started with Hugs on Linux

Exploring UNIX: Session 3

Operating Systems. Copyleft 2005, Binnur Kurt

-1- csh cd. cd alias!! ; set prompt=" pwd % " 16 cd. 17 cd.. 18 his /home% set prompt. alias. yasuoka : root :

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

Introduction Into Linux Lecture 1 Johannes Werner WS 2017

Introduction to Linux Basics Part I. Georgia Advanced Computing Resource Center University of Georgia Suchitra Pakala

Transcription:

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 2 / 21

Shell - Command Line Interface (CLI) Interactive interface of UNIX operating system (Linux and OSX are a type of UNIX) Access to this in the Terminal program on OSX. ** An alternative Terminal program is iterm2 - https://www.iterm2.com/ Windows: Use Cygwin. Windows10 does have a BASH shell. 3 / 21

How to get to the shell On Mac: Open the Terminal (Spotlight - search for Terminal) 4 / 21

Anatomy of a command line The Shell is the commandline program. There are several types, sh - Bourne shell bash - Bourne again shell will use in class csh - C shell zsh - Z-shell /Users/me $ ls /Users/me $ date /Users/me $ ping www.ucr.edu /Users/me $ echo "hello there" /Users/me $ python test.py /Users/me $ python cmdline.py i input o out d db 5 / 21

Using CLI Programs are run from the shell to interact with the filesystem, naviagate folders, read files launch programs like file editors, run tools cmd line programs can take arguments some arguments are named or some are just in particluar order $ date Fri Sep 21 14:21:12 PDT 2018 $ date help Usage: date [OPTION]... [+FORMAT] or: date [ u utc universal] [MMDDhhmm[[CC]YY][.ss]] Display the current time in the given FORMAT, or set the system date. 6 / 21

Filename Reminders Case MaTTerS File Extensions (e.g..txt.doc.docx) don't matter Avoid spaces in filenames Files starting with '.' are hidden by default Backup files created by some editors will be appended with ~ 7 / 21

Directories and listing 1. ls - shows a listing of the files and folders $ ls $ ls l 2. ls -d will display a directory name only 3. ls -F will give a different symbol for directories 4. ls -l shows long listing 5. ls -lt shows long listing, ordered by newest to oldest 6. ls -a shows hidden files 7. How to know all the options? 8 / 21

Use man to nd out more about a program $ man ls NAME ls list directory contents SYNOPSIS ls [ ABCFGHLOPRSTUW@abcdefghiklmnopqrstuwx1] [file...] DESCRIPTION For each operand that names a file of a type other than directory, ls displays its name as well as any requested, associated information. 9 / 21

cmdline help Many programs also have a help built in use -h or --help Sometimes can run the program without any arguments and will show help $ sort help sort help Usage: sort [OPTION]... [FILE]... or: sort [OPTION]... files0 from=f Write sorted concatenation of all FILE(s) to standard output. Mandatory arguments to long options are mandatory for short options too. Ordering options: 10 / 21

11 / 21 Navigating paths 1. to go into a directory use cd 2. to go back a level use 'cd..' Can specify a total path 'cd /tmp' 3. To go back to your home dir, type cd 4. Try to make a dir, go into it, make another directory. 5. On the Mac you can see the same directories and files organized graphically too 6. SWCarpentry has a nice intro with graphics here / root bin tmp data Users

Directories: Creating and Deleting 1. mkdir - make directory $ mkdir MyDir $ mkdir MyDir # will give warning $ mkdir MyDir/UnderDir/DeepDir # will not work, UnderDir not created $ mkdir p MyDir/UnderDir/DeepDir # p option will create intermediate 2. rmdir - remove directory $ rmdir MyDir # won't let you unless it is empty $ rmdir MyDir/UnderDir/DeepDir 12 / 21

Files 1. The whole point of all this is probably to create files with data 2. can make an empty file with $ touch file # will create an empty file 3. Running programs can generate files 4. We will discuss output later but you can direct output of a program to create a file. $ echo "hello world" > hello.txt $ echo "goodbye cruel world" > goodbye.txt 13 / 21

Permissions 1. ls l will show a long version of listing output jstajich@pigeon:/bigdata/gen220/shared/data_files$ ls l total 0 lrwxrwxrwx 1 jstajich gen220 25 Sep 25 13:53 Nc20H.expr.tab > expression/nc rw rw r 1 jstajich gen220 609183 Sep 25 13:52 Spellman.csv drwxrwxr x 2 jstajich gen220 4096 Jun 10 00:39 expression drwxr xr x 6 jstajich gen220 4096 Jun 10 00:39 sequences 2. There is info on the file/folder and 3 sets of permissions listed there 'd' -> It is a directory, 'l' -> it is a link, empty, it is a file User -> rwx or rw- permissions for the user Group All 3. what are permissions r - is it readable w - is it writeable x - is it executable 4. Directories have to be executable to be able to be used/entered. Programs/applications need to be executable to be able to run. 14 / 21

Deleting things (careful!) 1. rm - for removing files 2. rm r -- be careful removes recursively 3. rm f - removes without prompting you 4. rm rf - removes recurisvely without prompty Use with care 15 / 21

File content Want to read the content of a text file you can use these commands 1. cat - will spit out the whole file on the screen 2. more - a paginator - will display one page at a time (based on your screen) 3. less - similar to more, but has additional options 16 / 21

Editors 1. On Biocluster nano. On other systems it is pico Will be one of the easiest to try out on the command line Follow commands at bottom of screen to figure out how it works 1. emacs tutorial gnuguide 2. vi tutorial vim book 3. Atom, TextMate on OSX 4. Notepad++ 5. Syntax highlighting useful when doing programming. We will do more on this later. 17 / 21

Practice with editors 1. Open an editor 2. Write a file with three lines that list the names of 3 book titles 3. Save the file 18 / 21

Compressed and uncompressed Data files can be compressed to save disk space typical compression is zip, gzip, and bzip2 $ ls l 1008 Sep 28 14:29 file.txt $ gzip file.txt $ ls l 386 Sep 28 14:29 file.txt.gz $ gunzip file.txt.gz $ ls l 1008 Sep 28 14:29 file.txt Can substitute bzip2 and bunzip2 On some systems pigz and pbzip2 are parallelized compressors that can use multiple processors (go faster!) 19 / 21

Downloading data from web Cmdline tools curl and wget can download data from the web/ftp use O to tell curl to save the data to a file, named by the file link $ curl O http://www personal.umich.edu/~jlawler/wordlist $ curl o ucr_index.html https://www.ucr.edu # OR $ curl https://www.ucr.edu > ucr_index_again.html 20 / 21

Other resources 1. Introduction to UNIX Shell - Software Carpentry 21 / 21