Bioinformatics Spring Break Workshop Basic Unix Disclaimer: This set of slides is for educational use only. It contains original content as well as content.

Slides:



Advertisements
Similar presentations
LIS651 lecture 5 direct use of wotan Thomas Krichel
Advertisements

Learning Unix/Linux Bioinformatics Orientation 2008 Eric Bishop.
Chapter One The Essence of UNIX.
PacNOG 6: Nadi, Fiji Using Commands in Linux Hervey Allen Network Startup Resource Center.
1 Introduction to UNIX Ke Liu
NETW-240 Shells Last Update Copyright Kenneth M. Chipps Ph.D. 1.
Cosc 4750 Getting Started in UNIX Don’t be afraid of the prompt, in linux it can be your best friend. In some cases, the only way to do certain things.
Exploring the UNIX File System and File Security
1 Some basic Unix commands u Understand the concept of loggin into and out of a Unix shell u Interact with the system in a basic way through keyboard and.
1 SEEM3460 Tutorial Unix Introduction. 2 Introduction What is Unix? An operation system (OS), similar to Windows, MacOS X Why learn Unix? Greatest Software.
CS 141 Labs are mandatory. Attendance will be taken in each lab. Make account on moodle. Projects will be submitted via moodle.
Using Macs and Unix Nancy Griffeth January 6, 2014 Funding for this workshop was provided by the program “Computational Modeling and Analysis of Complex.
Introduction to Linux Workshop February Introduction Rob Lane & The HPC Support Team Research Computing Services CUIT.
Using the “CLI” Unix / Linux Preparation Course May 25 Djibouti.
CSC – 332 Data Structures Day 2: Unix and More! Dr. Curry Guinn.
Overview of Linux CS3530 Spring 2014 Dr. José M. Garrido Department of Computer Science.
1 THE UNIX FILE SYSTEM By Chokechai Chuensukanant ID COSC 513 Operating System.
The file structure and related utilities CS240 Computer Science II.
Unix Primer. Unix Shell The shell is a command programming language that provides an interface to the UNIX operating system. The shell is a “regular”
Lesson 7-Creating and Changing Directories. Overview Using directories to create order. Managing files in directories. Using pathnames to manage files.
Chapter 9 Part II Linux Command Line Access to Linux Authenticated login using a Linux account is required to access a Linux system. The Linux prompt will.
1 Unix Text Editors Creating files on the Unix system.
Unix Basics Chapter 4.
Cmsc 312 Operating Systems. UNIX? DOS – PC? VAX/VMS - mainframe Unix – PC, workstation, mainframe 1970 bell Lab For computer scientist? Why popular? Free.
CENT 305 Information Systems Security Linux Introduction.
1 SEEM3460 Tutorial Unix Introduction. 2 Introduction Unix-like system is everywhere Linux Android for smartphones Google Chrome OS for Chromebook Web.
Chapter Three The UNIX Editors. 2 Lesson A The vi Editor.
INTRODUCTION TO LINUX Jacob Chan. GNU/Linux Consists of Linux kernel, GNU utilities, and open source and commercial applications Works like Unix –Multi-user.
1 Operating Systems and Using Linux Topics What is an Operating System? Linux Overview Frequently Used Linux Commands Some content in this lecture added.
1 Operating Systems and Using Linux Topics What is an Operating System? Linux Overview Frequently Used Linux Commands Reading None.
Lesson 2-Touring Essential Programs. Overview Development of UNIX and Linux. Commands to execute utilities. Communicating instructions to the shell. Navigating.
Using Commands Unix / Linux Preparation Course May 6, 2012 Serrekunda, The Gambia.
BIF713 Basic Unix/Linux Commands Getting Help with Commands.
Welcome to CS323 Operating System lab 1 TA: Nouf Al-Harbi NoufNaief.net.
Chapter 1 : The Linux System Part 2 Lecture 2 11/14/
Log-in to the Unix Server A successful log-in allows access to the server through the Secure Shell. SSH, also known as Secure Shocket Shell, is a Unix.
Unix Editors. u Editors in Unix come in two general flavours: –modal editors have "modes" v generally input mode and command mode –input mode allows entry.
Unix and Samba By: IC Labs (Raj Kidambi). What is Unix?  Unix stands for UNiplexed Information and Computing System. (It was originally spelled "Unics.")
A Genomics View of Unix. General Unix Tips To use the command line start X11 and type commands into the “xterm” window A few things about unix commands:
Agenda Basic Unix Commands (Chapters 2 & 3) Miscellaneous Commands: whereis, which, whoami, finger, passwd, cal, date Working with Files: cat, more, less.
Unix/Linux for beginners:
Chapter Three The UNIX Editors.
Introduction to Programming Using C An Introduction to Operating Systems.
Lesson 3-Touring Utilities and System Features. Overview Employing fundamental utilities. Linux terminal sessions. Managing input and output. Using special.
Using the “CLI” Unix / Linux Preparation Course June 9, 2013 Lusaka, Zambia.
Linux Commands C151 Multi-User Operating Systems.
Unix File System Chapter 6.1 – Unix file system Home directory – A directory set aside for your personal use – The starting point when you log.
CS 245 – Part 1 Using Operating Systems and Networks for Programmers Jiang Guo Dept. of Computer Science California State University Los Angeles.
Unix Advanced Shells Chapter 10. Unix Shells u Command Line Interpreter –once logged in, login gives control to a shell –it prompts for input, then parses,
AN INTRO TO UNIX/LINUX COMMANDS BY: JIAYANG WANG.
Lecture 02 File and File system. Topics Describe the layout of a Linux file system Display and set paths Describe the most important files, including.
The Kernel At a high level, the kernel in an operating system serves as the bridge between applications and the actual data processing of the hardware.
1 CS3695 – Network Vulnerability Assessment & Risk Mitigation – Introduction to Unix & Linux.
CSC – 332 Data Structures Unix and Vi Dr. Curry Guinn.
Operating Systems and Using Linux Courtesy of John Y. Park 1.
Linux Tutorial Lesson Two *Getting Help in Linux *Data movement and manipulation *Relative and Absolute path *Processes Note: see chapter 1,2,3 from Linux.
CMSC 104, Version 8/061L03OperatingSystems.ppt Operating Systems and Using Linux Topics What is an Operating System? Linux Overview Frequently Used Linux.
CS 120 Extra: The CS1 Server Tarik Booker CS 120.
Learning Unix/Linux Based on slides from: Eric Bishop.
INTRODUCTION TO SHELL SCRIPTING By Byamukama Frank
CMSC 104, Version 9/011 Operating Systems and Using Linux Topics What is an Operating System? Linux Overview Frequently Used Linux Commands Reading None.
Unix Shells.
Some Linux Commands.
The Command Prompt Commands are the way to “do things” in Unix
Guide To UNIX Using Linux Third Edition
The Linux Operating System
Unix : Introduction and Commands
Operating Systems and Using Linux
Operating Systems and Using Linux
Web Programming Essentials:
Presentation transcript:

Bioinformatics Spring Break Workshop Basic Unix Disclaimer: This set of slides is for educational use only. It contains original content as well as content adapted from a variety of sources including material found on the Web; the copyright symbol, ©, on copyrighted material has been retained.

Basic Unix Mark A. Pauley © Why Learn Unix?  Many high end-client server systems are Unix based; Unix/Linux skills are much in demand (job skills).  Excellent software-development platform  Much of the software is free (unique culture)  You are an engineer, a mathematician, a scientist, a movie producer: many fields are Unix-centric; i.e., a working knowledge of Unix is required.  Most really exciting Computer Science stuff is done on Unix systems (personal growth).  A good way to learn fundamental computer OS concepts (files, processes, etc.).  A understanding of Unix can  Impress your friends  Make new friends  Destroy and utterly crush your enemies

Basic Unix Mark A. Pauley © Unix Advantages  It is very popular, so it is easy to find information and get help  Pick up books at the local bookstore  Plenty of helpful websites  Most Computer Science students know Unix  Can run on virtually any computer (IBM, Sun, Compaq, Macintosh,etc)  Free or nearly free  Linux/open source software movement  RedHat, FreeBSD, MKLinux, LinuxPPC, etc.

Basic Unix Mark A. Pauley © Unix Advantages (cont.)  Very stable – computers running Unix almost never crash  Very efficient  Gets maximum number-crunching power out of your processor (and multiple processors)  Can smoothly manage extremely huge amounts of data  Can give new life to otherwise obsolete Macs and PCs

Basic Unix Mark A. Pauley © Unix Disadvantages  Unix computers are controlled by a command line interface  Not user-friendly  Steep learning curve; takes a long time to truly master  Hackers love Unix  There are lots of security holes – although probably not as many as Windows ( )  Most computers on the Internet run Unix, so hackers can apply the same tricks to many different computers  Different flavors of Unix have subtle, and sometimes not-so- subtle, differences

Basic Unix Mark A. Pauley © Unix Help on the Web  Some online Unix tutorials (there are many more):  Unix for Beginners   A basic Unix tutorial (Idaho State University)   Unix Guru Universe   Getting Started With The Unix Operating System (Leeds, UK) 

Basic Unix Mark A. Pauley © General Unix Tips  Unix is case sensitive!!  myfile.txt and MyFile.txt would be different files  ls and LS (if it existed) would be different commands  Every program is independent  The core operating system (known as the kernel) manages each program as a distinct process with its own little chunk of dedicated memory.  If one program runs into trouble, it dies, but does not affect the affect the kernel or the other programs running on the computer.

Basic Unix Mark A. Pauley © The Unix Shell  You communicate with a Unix computer through a command program known as a shell.  The shell interprets the commands that you type on the keyboard.  There are actually many different shells available for Unix computers, and on some systems you can choose the shell in which you wish to work.  You can use shell commands to write simple programs (scripts) to automate many tasks.

Basic Unix Mark A. Pauley © Unix Shells  Many shells to choose from...  sh: The Bourne Shell  The original Unix shell  S.R. Bourne designed it at Bell Labs  Not very "user friendly”, but good for programming  sh or a reasonable facsimile comes packaged with virtually every Unix system  csh: The C-shell  A shell whose syntax is more “C”-like  Command history and job control  Make it very popular as a CLI  Comes with most Unix systems

Basic Unix Mark A. Pauley © Unix Shells (cont.)  tcsh: The T C-Shell  Updated C-shell with better “line-editing”, access to command history, and command and filename completion  bash: The Bourne Again Shell  Aimed at providing a public domain version of the Bourne shell  Default shell for Linux  Implemented as a part of GNU project by public efforts  ksh, zsh, tsh,...

Basic Unix Mark A. Pauley © Unix Commands - exit and passwd  Unix commands are short and cryptic; e.g., vi, rm.  Computer geeks like it that way; you will get used to it.  Two commands of immediate interest  exit - exit the shell (log off)  passwd - Changes your password (follow the prompts)

Basic Unix Mark A. Pauley © In-class Practice  Now you try!  Change your password to something different (the system will enforce certain rules).  Exit the system and log back in

Basic Unix Mark A. Pauley © The Unix Directory Structure  Windows, MacIntosh use the concept of folders.  Unix uses the concept of directories  Both are hierarchical (folders can have subfolders, directories can have sudirectories, etc.)

Basic Unix Mark A. Pauley © The Unix Directory Structure (cont.)  Directory terminology:  Home directory  Where your files live.  You always go there when you log in.  Working directory  Whatever directory you are currently in.

Basic Unix Mark A. Pauley © Unix Directory Structure  Different flavors of Unix (including Linux) have a fairly consistent directory structure. root (/) binetcvartmp continentsoceans bats marsupials bandicoot kangaroowombat dev homeusr jack jill opossum wombat

Basic Unix Mark A. Pauley © Typical Directories  bin : Software for the shell and most common Unix commands.  dev : Short for devices, holds the software necessary to operate peripherals such as printers and terminals.  etc : Contains various administrative files such as lists of user names and passwords.  home : Contains the home directories of users.  tmp : A directory used to hold temporary files.  var : Files that contain information that varies frequently; most commonly, mail directories.

Basic Unix Mark A. Pauley © Unix Commands - pwd, ls and who  More useful commands:  pwd – Prints the working directory  ls – Lists the contents of the current directory  who – Lists the users currently on the system

Basic Unix Mark A. Pauley © In-class Practice  Now you try!  Print out your current directory – You should get something like /home/mpauley  List the files in the current directory – Your current directory should appear empty.  Determine who is currently logged into the system. Find your login, and a neighbor’s, in the list.

Basic Unix Mark A. Pauley © Moving Around  Move around the directory structure using the command cd.  Basic syntax: cd [dir]  dir can be either relative or absolute.  Directory “abbreviations”  ~ Your home directory  Use cd ~ to return to your home directory .. The parent directory; the directory “one up” from the current directory.  Use cd.. to move to the directory “one up” from the current directory. . The current directory  Shortcut  Use cd - to return to the previous directory (where you just were).

Basic Unix Mark A. Pauley © Creating Directories ( mkdir )  mkdir = (make directory)  Creates a directory.  mkdir [new directory name]  mkdir calendar  Inverse command is rmdir (remove directory) – Directory must be empty.

Basic Unix Mark A. Pauley © In-class Practice  Now you try!  Navigate to /  Return to your home directory  Navigate to /usr. How many subdirectories are there?  Return to your home directory  Navigate to /usr/local/bin. How many subdirectories are there?  Return to your home directory.  Create a directory called tmp in your home directory  Verify that you created the directory (use ls )  Remove the tmp directory  Verifying that you removed the directory

Basic Unix Mark A. Pauley © Unix Text Editors  What is a text editor?  Like a word processor but it does not apply formatting styles (bold, italics, different fonts, etc.).  Several text editors installed on hal:  nano – Easy! (the one we’ll start with)  emacs – A heavily-featured editor commonly used in programming  vi/vim – Another heavily-featured editor commonly used in programming  Which text editor is “best” is a holy war. Pick one and get comfortable with it.

Basic Unix Mark A. Pauley © Unix Text Editors: Design concepts  Editors in Unix come in two general flavors:  Modal editors have “modes”  Generally have input and command modes  Input mode allows entry of text  Command mode allows positioning within the file and more sophisticated text modification  Unix examples: ed and vi  Modeless editors  Have only one mode  Positioning and text manipulation are done by special key sequences (like arrow keys and function keys)  Could also be done by mouse actions or menus  Unix examples: emacs and nano

Basic Unix Mark A. Pauley © Starting nano  Basic syntax: nano [FILE]  [FILE] can be an existing file.  if [FILE] does not exist, it will be created.  The nano window: commands at the bottom, text area at the top ( ^ stands for the Ctrl key)

Basic Unix Mark A. Pauley © nano Navigation  Use arrow keys, otherwise:  Ctrl-f : move forward a character.  Ctrl-b : move backward a character.  Ctrl-n : move to the next line.  Ctrl-p : move to the previous line.  Ctrl-v : move forward one page.  Ctrl-y : move backward one page.

Basic Unix Mark A. Pauley © nano Editing  Inserting  Just type.  Deleting  Ctrl-k : deletes (cuts) the current line of text.  Use Ctrl-k repeatedly until all the lines you want to cut have been deleted (lines are stored in a buffer)  Ctrl-u : uncuts (i.e., pastes) the last cut text.  Pastes all of the lines in the buffer.  Use Ctrl-u repeatedly to simulate copy and paste.  To save your work  Ctrl-o (writeOut)  To exit:  Ctrl-x  If you haven’t yet saved your file, you will be prompted to do so.

In-class Practice  Now you try!!  Using the nano text editor, create a file (myInfo.txt) that contains the following information (one per line; start each line with “My name is...”, etc.)  Your name  Your age  The school you go to  What year of school you’re in (freshman, etc.)  The classes you are taking this year/semester/quarter.  Your career goals. Basic Unix Mark A. Pauley ©

Basic Unix Mark A. Pauley © Command Terminology  Most Unix commands have options and/or arguments – specifies the behavior of the command  Argument  Entered at the end of the command line  Usually a file on which the command will act  cat –n myGene.seq (myGene.seq is the argument)  Options  Entered between the command and its argument  Short options – Generally single letters and prefaced with a single hyphen; may be grouped  Long options – Prefaced with a long hyphen; cannot be grouped.  Case sensitive – In Unix, uppercase and lowercase letters are different.

Basic Unix Mark A. Pauley © Command Modifiers (cont.)  In the SYNOPSIS section of a man page  [] Optional option/argument  | Options are mutually exclusive ... Option/argument may be repeated  From its man page, ls has a number of possible options and one (optional) argument; nothing is mandatory,

Basic Unix Mark A. Pauley © Options for ls  Useful options for ls  -a, --all Do not hide entries starting with.  -F --classify Append indicator (one of ) to entries  -l Use a long listing format  -g Like - l, but do not list owner  [FILE] Information about just a particular file.  Examples:  ls -a List all the files in the current directory  ls -aF or ls -a -F List all the files in the current directory, appending an indicator  ls -al List all the files in the current directory in long format.  ls -al cat.txt List long format information for the file cat.txt

Basic Unix Mark A. Pauley © Viewing a file (without a editor)  What if you want to view the contents of a file (but not edit it)?  Use the cat command  cat [name of file]  Displays the contents of the entire file (bad for long files)  Use a pager  more [name of file]  Use return key to view the next line of text  Spacebar to read the next page of text  q to quit  / to search.  less [name of file]  Like more but better  Arrow keys to navigate by line  u to move up a page.  A useful option is -N, which numbers the line in the files.

Basic Unix Mark A. Pauley © In-class practice  Now you try!  Practice using the different option for ls.  Read the man page for cal  What does cal do?  What does the -3 option do?  What does the -m option do?  Display the contents of files in your public_html directory using  cat  less

Basic Unix Mark A. Pauley © Working with Files: cp  copy (vowels in a command are often omitted)  Copies the contents of one file to another.  cp [file to copy] [new file name]  Flags  -r : will copy directories and all their contents.  Without this flag, the directory will not be copied and you will get an error message.

Basic Unix Mark A. Pauley © Working with Files: mv  move  Better name could be the rename command.  Changes the name of a file.  mv [old file name] [new file name]  If the two files are in different locations, then the effect is that the file is moved from one directory to another.  Note, if [new file name] is a directory, you will move [old file name] to that directory and keep the original name.

Basic Unix Mark A. Pauley © Working with Files: rm  remove - Deletes the specified file or files  SYNOPSIS  rm [OPTION]... FILE...  Destructive! The file(s) are gone and cannot be retrieved.  Note: use rm –rf to remove a directory and all of its contents.

Basic Unix Mark A. Pauley © Working with Files: rmdir  remove (empty) directory  SYNOPSIS rmdir [OPTION]... DIRECTORY...  Deletes a directory (as opposed to the rm command which deletes a file).  The directory must be empty otherwise you will get an error.