Tutorial of Unix Command & shell scriptS 5027

Slides:



Advertisements
Similar presentations
Introduction to Linux command line for bioinformatics Wenjun Kang, MS Jorge Andrade, PhD 6/28/2013 Bioinformatics Core, Center.
Advertisements

Learning Unix/Linux Bioinformatics Orientation 2008 Eric Bishop.
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.
Introducing the Command Line CMSC 121 Introduction to UNIX Much of the material in these slides was taken from Dan Hood’s CMSC 121 Lecture Notes.
Linux+ Guide to Linux Certification, Second Edition
Guide To UNIX Using Linux Third Edition
T UTORIAL OF U NIX C OMMAND & SHELL SCRIPT S 5027 Professor: Dr. Shu-Ching Chen TA: Samira Pouyanfar Spring 2015.
Lecture 02CS311 – Operating Systems 1 1 CS311 – Lecture 02 Outline UNIX/Linux features – Redirection – pipes – Terminating a command – Running program.
Linux Commands LINUX COMMANDS.
L INUX C OMMAND L INE I NTERFACE G UNAANBAN.G
CS 141 Labs are mandatory. Attendance will be taken in each lab. Make account on moodle. Projects will be submitted via moodle.
COMP1070/2002/lec4/H.Melikian COMP1070 Lecture #5  Files and directories in UNIX  Various types of files  File attributes  Notion of pathname  Commands.
Advanced File Processing
Help session: Unix basics Keith 9/9/2011. Login in Unix lab  User name: ug0xx Password: ece321 (initial)  The password will not be displayed on the.
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”
CHAPTER 1 UNIX FOR NONPROGRAMMERS By U ğ ur Halıcı.
Linux environment ● Graphical interface – X-window + window manager ● Text interface – terminal + shell.
1 Lecture 2 Working with Files and Directories COP 3344 Introduction to UNIX.
Agenda User Profile File (.profile) –Keyword Shell Variables Linux (Unix) filters –Purpose –Commands: grep, sort, awk cut, tr, wc, spell.
File Processing. Introduction More UNIX commands for handling files Regular Expressions and Searching files Redirection and pipes Bash facilities.
Guide To UNIX Using Linux Fourth Edition
LIN 6932 Unix Lecture 6 Hana Filip. LIN 6932 HW6 - Part II solutions posted on my website see syllabus.
Basic unix commands that everyone should know (Even if you have a mac) Slightly more advanced:
Dedan Githae, BecA-ILRI Hub Introduction to Linux / UNIX OS MARI eBioKit Workshop; Nov , 2014.
Linux+ Guide to Linux Certification, Second Edition
Working with Linux Lab 1 1. Login and logout Account – username & password – Note: Linux is case-sensitive Administrator: username = root Logout: exit,
System Administration Introduction to Unix Session 2 – Fri 02 Nov 2007 Reference:  chapter 1, The Unix Programming Environment, Kernighan & Pike, ISBN.
Session 2 Wharton Summer Tech Camp Basic Unix. Agenda Cover basic UNIX commands and useful functions.
INTRODUCTION TO LINUX Jacob Chan. GNU/Linux Consists of Linux kernel, GNU utilities, and open source and commercial applications Works like Unix –Multi-user.
Second edition Your UNIX: The Ultimate Guide Das © 2006 The McGraw-Hill Companies, Inc. All rights reserved. UNIX Commands cal – will print a calendar.
Chapter Five Advanced File Processing. 2 Lesson A Selecting, Manipulating, and Formatting Information.
UNIX An Introduction. Brief History UNIX UNIX Created at Bell Labs, 1969 Created at Bell Labs, 1969 BSD during mid 70s BSD during mid 70s AT&T began offering.
Getting the most out of the workshop Ask questions!!! Don’t sit next to someone you already know Work with someone with a different skillset and different.
40 Years and Still Rocking the Terminal!
2 Manual & Filestore Mauro Jaskelioff. Introduction Using the manual The UNIX filestore File permissions.
1 Introduction to Unix. 2 What is UNIX?  UNIX is an Operating System (OS).  An operating system is a control program that helps the user communicate.
A Brief Overview of Unix Brandon Bohrer. Topics What is Unix? – Quick introduction Documentation – Where to get it, how to use it Text Editors – Know.
1 CS3695 – Network Vulnerability Assessment & Risk Mitigation – Introduction to Unix & Linux.
Basic Unix Commands. Listing files and directories ● ls:command is used to list the files and ● directories in present working directory ● ls command.
Lesson 6-Using Utilities to Accomplish Complex Tasks.
File Management commands cat Cat command cat cal.txt cat command displays the contents of a file here cal.txt on screen (or standard out).
+ Introduction to Unix Joey Azofeifa Dowell Lab Short Read Class Day 2 (Slides inspired by David Knox)
Learning Unix/Linux Based on slides from: Eric Bishop.
UNIX Basics Matt Hayward October 18, 2016 LS560 – Information Technology for information professionals.
UNIX To do work for the class, you will be using the Unix operating system. Once connected to the system, you will be presented with a login screen. Once.
Lesson 5-Exploring Utilities
Quality Thought Technologies
Getting started with CentOS Linux
Chapter 11 Command-Line Master Class
Commands Basic syntax of shell commands UNIX or shell commands have a basic structure command -options target command comes first (such as cd or ls) any.
Prepared by: Eng. Maryam Adel Abdel-Hady
Linux 101 Training Module Linux Basics.
Andy Wang Object Oriented Programming in C++ COP 3330
Some Linux Commands.
C151 Multi-User Operating Systems
Shell Script Assignment 1.
INTRODUCTION TO UNIX: The Shell Command Interface
Tutorial of Unix Command & shell scriptS 5027
Basic UNIX OLC Training.
Introduction to UNIX.
Tutorial of Unix Commands
Tutorial of Unix Command & shell scriptS 5027
Guide To UNIX Using Linux Third Edition
Web Programming Essentials:
Tutorial of Unix Command & shell scriptS 5027
A Brief Overview of Unix
Getting started with CentOS Linux
Tutorial Unix Command & Makefile CIS 5027
Lab 2: Terminal Basics.
Linux Commands LINUX COMMANDS.
Presentation transcript:

Tutorial of Unix Command & shell scriptS 5027 Professor: Dr. Shu-Ching Chen TA: Samira Pouyanfar Spring 2017

Outline Log in Unix Basic Commands Shell script

Outline Log in Unix Basic Commands Shell script

How to log in Download putty from http://www.chiark.greenend.org.uk/~sgtatham/putty/ download.html PuTTY is a free implementation of Telnet and SSH for Windows and Unix platforms

Connect to the server The host is margay.cs.fiu.edu 1 2 3 4

Log in / Account information Login as : Your FIU username Password : Your first initial + PantherID + Your last initial For exmaple, Steven Jackson with PID 1234567 should have password s1234567j

Log in in Mac systems Use the existing ssh tool in your mac called "Terminal" by following the steps: - Search for "Terminal" from spotlight, e.g., located on the upper right corner of your screen - Open Terminal - Connect to the server margay.cs.fiu.edu using following commands ssh hha001@margay.cs.fiu.edu replace hha001 with your fiu account - Type your password - Now, you are connected.

Log in in Mac systems

Outline Log in Unix Basic Commands Shell script

Commands about Files (1) ls : list the contents of your current directory. Format Options -a : list all the files include the hidden ones -l : list not only the files name but also the related info -t : list the contents by modified date ls [option] [directory][file]

Commands about Files (2) File permission Field1 : A set of ten permission flags Field2 : link count Field3 : owner of the file Field4 : associated group of the file Field5 : size Field 6-8 : Last modification date Field9 : file name

Commands about Files (3) chmod : change the permission flags of the files Format Example chmod g+w myfile chmod g-rw myfile chmod u=rw go= myfile chmod –R g+rw myfile chmod [option] [types][+/-][types of permission] filename Who: u=user, g=group, o=other, a=all (default) Opcode: + means add permission - means remove permission = means assign permission and remove the permission of unspecified fields Permission r=Read, w=write, x=Execute

Commands about Files (4) pwd : print out the current working directory cd : change directory cd . (.) means the current directory C (..) means the parent of current directory Cd cd with no argument will return you to your home directory cd . cd .. cd Use the commands cd, ls and pwd to explore the file system.

Commands about Files (5) cp : copy files Format Options -i : It can be used to avoid overwriting the original file -r : Copy the folder and all the files and subfolders under it. mv : move a file from one place to another or rename a file. cp [option] File1 File2 mv File1 File2

Commands about Files (6) mkdir : making directory Format rm : remove files or directories Option -i : ask before actually delete -r : delete the folders and all the files and subfolders under it mkdir Directory_name rm [option] file1 file2 file3…

Commands about Files (7) test : A command in Unix that evaluates conditional expressions. Format or The functions will return true if the object exist or the condition specified is true. File functions -d Filename : Filename is a directory -s Filename : Filename has a size greater than 0 -f Filename : Filename is a regular file test expression [ expression ]

Commands about File’s contents (1) cat : display the contents of a file on the screen Format head : display the first ten lines of a file to the screen tail : display the last ten lines of a file to the screen cat file1 head –n file1 tail –n file1

Commands about File’s contents (2) wc : word count Format Options -w : find out how many words the file has -l : find out how many lines the file has -m: find out how many characters the file has wc [options] file

Commands about File’s contents (3) grep : It searches files for the specified words or patterns. Format: Options: -c : Display the number of columns which satisfied the pattern. -i : Ignore case distinctions in both the PATTERN and the input files. -v : Invert the sense of matching, to select non-matching lines. grep [options] [pattern] file

Pipe : It cause the execution of multiple processes from one single line A | B | C

Commands about File’s contents (4) Redirection > and >> can be used on the output of most commands to direct their output to a file. Examples

Commands about Text processing (1) sort : sort lines of a text file or files Default : sort without any option will sort the file alphabetically Format uniq : remove duplicate adjacent lines from sorted file. sort [option] file

Commands about Text processing (2) sed: One ultimate stream editor Detail Tutorial : http://www.grymoire.com/Unix/Sed.html Important function -> Substitution Format : sed 's/term1/term2/g‘ filename

Commands about Text processing (3) cut : extract sections from each line of a file. Format Option -c : character -f : field -d “:” : delimiter (default is a tab) Range N-M N- -M cut [options] [range] filename

Outline Log in Unix Basic Commands Shell script

Shell script intro (1) Scripts are collections of commands that are stored in a file. Detail Tutorial http://www.freeos.com/guides/lsst/ Basic Vi commands vim filename i : switch to the editing(insert) mode Esc +:q! Leave the vim program without saving the file Esc +:w Save the file Esc +:wq Save the file and leave the vim program

Shell script intro (2) First shell script Note that to make a file executable, you must set the eXecutable bit, and for a shell script, the Readable bit must also be set.

Shell script intro (3) Variable

Shell script intro (4) IF LOOP

Shell script intro (5) For Loop

Shell Script Intro (6) Useful concept $( commands)