Utilities. September 8, 2015

Similar documents
Fall Lecture 5. Operating Systems: Configuration & Use CIS345. The Linux Utilities. Mostafa Z. Ali.

Lecture # 2 Introduction to UNIX (Part 2)

Shell Programming Overview

Handling Ordinary Files

Lab 2: Linux/Unix shell

A Brief Introduction to the Linux Shell for Data Science

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

BIOINFORMATICS POST-DIPLOMA PROGRAM SUBJECT OUTLINE Subject Title: OPERATING SYSTEMS AND PROJECT MANAGEMENT Subject Code: BIF713 Subject Description:

5/20/2007. Touring Essential Programs

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]

Contents. xxvii. Preface

Basic Unix Command. It is used to see the manual of the various command. It helps in selecting the correct options

Unix/Linux Primer. Taras V. Pogorelov and Mike Hallock School of Chemical Sciences, University of Illinois

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.

List of Linux Commands in an IPm

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

Basics. I think that the later is better.

Introduction To Linux. Rob Thomas - ACRC

22-Sep CSCI 2132 Software Development Lecture 8: Shells, Processes, and Job Control. Faculty of Computer Science, Dalhousie University

CSC UNIX System, Spring 2015

UNIX Essentials Featuring Solaris 10 Op System

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

Introduction to Linux Organizing Files

Unzip command in unix

Computer Systems and Architecture

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.

Common File System Commands

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

Files

COMS 6100 Class Notes 3

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.

2) clear :- It clears the terminal screen. Syntax :- clear

Introduction to Unix: Fundamental Commands

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

Session: Shell Programming Topic: Additional Commands

Introduction to Linux

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.

CSE 390a Lecture 2. Exploring Shell Commands, Streams, and Redirection

Open up a terminal, make sure you are in your home directory, and run the command.

Reading and manipulating files

Scripting Languages Course 1. Diana Trandabăț

Chapter-3. Introduction to Unix: Fundamental Commands

Common UNIX Utilities Alphabetical List

UNIX and Linux Essentials Student Guide

EECS2301. Lab 1 Winter 2016

Linux 系统介绍 (I) 袁华

Chapter 1 - Introduction. September 8, 2016

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

Linux Command Line Primer. By: Scott Marshall

File Commands. Objectives

Shell Programming Systems Skills in C and Unix

CSE 390a Lecture 2. Exploring Shell Commands, Streams, Redirection, and Processes

Computer Systems and Architecture

UNIX files searching, and other interrogation techniques

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

Topic 2: More Shell Skills

Unix Introduction to UNIX

Lecture 3. Essential skills for bioinformatics: Unix/Linux

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

Contents. xxix. Preface

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

5/8/2012. Exploring Utilities Chapter 5

Cloud Computing and Unix: An Introduction. Dr. Sophie Shaw University of Aberdeen, UK

Cloud Computing and Unix: An Introduction. Dr. Sophie Shaw University of Aberdeen, UK

Useful Unix Commands Cheat Sheet

Essential Skills for Bioinformatics: Unix/Linux

The Unix Shell. Pipes and Filters

UNIX Basics. UNIX Basics CIS 218 Oakton Community College

A Brief Introduction to Unix

ITST Searching, Extracting & Archiving Data

Basic Linux Command Line Interface Guide

IMPORTANT: Logging Off LOGGING IN

Computer Architecture Lab 1 (Starting with Linux)

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

Using Linux as a Virtual Machine

Table Of Contents. 1. Zoo Information a. Logging in b. Transferring files 2. Unix Basics 3. Homework Commands

Lab #1 Installing a System Due Friday, September 6, 2002

CSC209. Software Tools and Systems Programming.

CENG 334 Computer Networks. Laboratory I Linux Tutorial

Running Programs in UNIX 1 / 30

On successful completion of the course, the students will be able to attain CO: Experiment linked. 2 to 4. 5 to 8. 9 to 12.

for more :-

UNIX Quick Reference

CSE 390a Lecture 6. bash scripting continued; remote X windows; unix tidbits

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

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

Unix Tools / Command Line

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

Some useful UNIX Commands written down by Razor for newbies to get a start in UNIX

Essentials for Scientific Computing: Bash Shell Scripting Day 3

Linux Shell Script. J. K. Mandal


CS Unix Tools & Scripting

QUESTION BANK ON UNIX & SHELL PROGRAMMING-502 (CORE PAPER-2)

Unix - Basics Course on Unix and Genomic Data Prague, January 2017

CS 460 Linux Tutorial

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

Basic Linux Command Line Interface Guide

7. Archiving and compressing 7.1 Introduction

Transcription:

Utilities September 8, 2015

Useful ideas Listing files and display text and binary files Copy, move, and remove files Search, sort, print, compare files Using pipes Compression and archiving Your fellow users Communicating with other users

Special characters The following lot tend to have meaning to the shell, so be careful when trying to use them: & ; *? " [ ] ( ) $ < > { } # / \! ~

Quoting special characters You can quote special characters in three ways Use the backslash Use single quotes Sometimes use double quotes, but some of the previous lot may still be interpreted $ echo $PATH $PATH $ echo $PATH /usr/sbin:/usr/bin:/sbin:/bin

Very useful utilities ls list directories and files rm remove files and directories cat catenate a file less, more, pg page through files hostname display what the kernel thinks of as a hostname

ls ls has a ton of options; some of the most useful are -b show non-graphical characters in a useful fashion -a show all directory entries, including those beginning with a period -d named directories are not descended into -l show long information -i show inode number

ls ls options -h human readable; this option has become quite common among utilities -t order by modification time -r reverse the ordering -1 only file per line

cat cat has very few options -n number all output lines -v show graphical characters

rm rm and its most useful options -i prompt before removal -r remove recursively -f don t ask questions and don t make comments (okay, the man page actually phrases this as ignore nonexistent files and arguments, never prompt )

less (another pager along the lines of more and pg) less - while less does indeed have some command line arguments, its most useful keyboard interactions are while it is displaying text SPACE - go forward one page b - go back one page d - go forward half a page u - go back half a page

less, continued less CTRL-L repaint the screen g go to a particular line /pattern search for a pattern (use * at the beginning of the pattern to search multiple files) :n go to the next file

Working with files Common commands for working with files cp mv lpr grep head tail sort uniq diff file pipes

cp cp has several very useful options -a archive mode; attempts to preserve as many attributes as possible in the copy -i prompt before overwriting -l just create a new hard link rather copying (rsnapshot uses this to cleverly make its snapshots) -r make a recursive copy

mv mv does not have a lot of very useful options, but -i -i inquire before overwrite

lpr lpr has two particularly useful options -P PRINTER specify a printer -# COUNT print COUNT copies of a file

a2ps ap2s has two very useful options -o FILENAME send output to a file rather than the default printer -P NAME send output to a printer NAME rather than the default printer

grep grep is a very powerful and useful program; there is a version fgrep that is also quite useful for fixed strings -i ignore case -v invert match -c count matching lines -l show files with matching lines -h suppress prefixing of files names -H print the file name for each match -C LINES print LINES of context for each match

head head prints initial lines -n LINES print LINES of the file

tail tail prints final lines -f follow a file as it changes -n LINES print LINES of the file

sort sort lets you sort a file -u print only unique lines -b ignore initial blank lines -n numerical sort -r reverse a sort -k specify a key -t field separator

uniq uniqueness -i ignore case -u print only unique lines

diff file and directory differences -r recursive diff

file no real useful options

pipes use the system call pipe(2), a distinguishing characteristic of Unix

Four more utilities echo date script unix2dos

echo echo is usually both a binary and a built-in, and what usually distinguishes the two is the -n option -n do not send an end-of-line

date date lets you display the date with a great deal of freedom iso-8601 specification formats +%A Tuesday $ date iso-8601 2015-09-08 $ date

date date also lets you change the system date

script script lets you record your session (but with lots of control characters... )

dos2unix, unix2dos Unix and Microsoft Windows use different conventions for end of line. One easy way to convert between the two is with dos2unix and unix2dos. I have never needed any options when doing this.

Compression and archiving bzip2 bzcat bunzip2 gzip zcat gunzip tar cpio

bzip2 Pretty much the standard these days. Excellent compression, with plenty of options. -1, -2, -3,... choose compression level (from least to most compressed; also least to most memory consumed during run) fast synonym for -1 (uses less memory during run) best synonym for -9 (uses more memory during run)

bunzip2 and bzcat Reverse bzip2; bzcat by default goes to stdout

gzip, zcat, gunzip Older standard, still pretty common

tar Originally tape archive. Allows you to package files together into an archive. Newer versions automatically recognize compression. The historical option syntax (no dashes) is a bit tricky to use. c create a tar file x extract from a tar file t print the contents of a tar file p preserve -C change directory for this process

User and system information top and htop w, who, last finger uptime df free write mesg

top and htop Show pretty comprehensive information about what is going on htop is not as common

w, who, last w and who let you see who else is on the system last lets you see login sessions, both current and older $ w 10:52:34 up 40 min, 3 users, load average: USER TTY FROM LOGIN@ langley tty8 :0 10:12 $ who langley tty8 2015-09-08 10:12 (:0)

uptime uptime gives you a very brief description of the system $ uptime 10:53:20 up 40 min, 3 users, load average:

free shows memory utilization for the entire system. use the -h option, it s the flexible and readable $ free -h total used free Mem: 15G 3.3G 12G -/+ buffers/cache: 1.8G 13G Swap: 59G 0B 59G

write write to another user

mesg allows or prevents write messages y for allow, n for don t allow