ats programming short course i introductory concepts tuesday, feb 3 rd, 2009 essential unix commands...

15
ATS Programming Short ATS Programming Short Course I Course I INTRODUCTORY CONCEPTS Tuesday, Feb 3 rd , 2009 Essential Unix Commands …the second half

Upload: dorthy-morgan

Post on 18-Jan-2018

218 views

Category:

Documents


0 download

DESCRIPTION

du - Disk Usage Show how much disk space is being used. Examples: (1)> (2)> (3)> du –k directoryName Command example 2 Command example 3 Display the amount of space used by directoryName in kilobytes. Command example 2 description. Command example 3 description.

TRANSCRIPT

Page 1: ATS Programming Short Course I INTRODUCTORY CONCEPTS Tuesday, Feb 3 rd, 2009 Essential Unix Commands …the second half

ATS Programming Short ATS Programming Short Course ICourse I

INTRODUCTORY CONCEPTS

Tuesday, Feb 3rd, 2009

Essential Unix Commands

…the second half

Page 2: ATS Programming Short Course I INTRODUCTORY CONCEPTS Tuesday, Feb 3 rd, 2009 Essential Unix Commands …the second half

df -df -Disk space FreeShows amount of free disk space.

Examples:(1)>

(2)>

(3)>

df –k /dev/devicename

Command example 2

Command example 3

Report the amount of free space in kilobytes on the specified device.

Command example 2 description.

Command example 3 description.

Page 3: ATS Programming Short Course I INTRODUCTORY CONCEPTS Tuesday, Feb 3 rd, 2009 Essential Unix Commands …the second half

du -du -Disk UsageShow how much disk space is being used.

Examples:(1)>

(2)>

(3)>

du –k directoryName

Command example 2

Command example 3

Display the amount of space used by directoryName in kilobytes.

Command example 2 description.

Command example 3 description.

Page 4: ATS Programming Short Course I INTRODUCTORY CONCEPTS Tuesday, Feb 3 rd, 2009 Essential Unix Commands …the second half

ps -ps -ProcesSShow processes.

Examples:(1)>

(2)>

(3)>

ps -ef

Command example 2

Command example 3

List all processes in long format.

Command example 2 description.

Command example 3 description.

Page 5: ATS Programming Short Course I INTRODUCTORY CONCEPTS Tuesday, Feb 3 rd, 2009 Essential Unix Commands …the second half

kill -kill -KILL a commandTerminates a running job/process.

Examples:(1)>

(2)>

(3)>

kill processID1

kill -9 processID6

Command example 3

Kills the command identified by processID1.

Kills processID6 forcefully. Ie, if processID6 is not responding to the kill signal, the -9 give the kill signal a bit more weight.

Command example 3 description.

Page 6: ATS Programming Short Course I INTRODUCTORY CONCEPTS Tuesday, Feb 3 rd, 2009 Essential Unix Commands …the second half

tar -tar -Tape ARchiveBundle (tar) files together.

Examples:(1)>

(2)>

(3)>

tar cvf dir1.tar ./dir1

tar rvf filename.tar ./dir3

tar xvf filename.tar

Creates a tar file called dir1.tar with the contents of dir1. verbose.

Appends contents of dir3 in already existing tar file, filename.tar. Verbose.

Extracts contents of filename.tar. The output is structured as it was put in.

Page 7: ATS Programming Short Course I INTRODUCTORY CONCEPTS Tuesday, Feb 3 rd, 2009 Essential Unix Commands …the second half

gzip -gzip -Gnu(?) ZIPZip a file (compress)

Examples:(1)>

(2)>

(3)>

gzip filename.tar

Command example 2

Command example 3

Compresses filename.tar, resulting in the file filename.tar.gz

Command example 2 description.

Command example 3 description.

Page 8: ATS Programming Short Course I INTRODUCTORY CONCEPTS Tuesday, Feb 3 rd, 2009 Essential Unix Commands …the second half

gunzip -gunzip -Gnu(?) UNZIPUnzip a gzipped file.

Examples:(1)>

(2)>

(3)>

gunzip filename.tar.gz

Command example 2

Command example 3

Uncompresses the above file. Leaves filename.tar

Command example 2 description.

Command example 3 description.

Page 9: ATS Programming Short Course I INTRODUCTORY CONCEPTS Tuesday, Feb 3 rd, 2009 Essential Unix Commands …the second half

man -man -MANuel pageShow the manuel page for a command.

Examples:(1)>

(2)>

(3)>

man ls

Command example 2

Command example 3

Display lots of information about the ls command.

Command example 2 description.

Command example 3 description.

Page 10: ATS Programming Short Course I INTRODUCTORY CONCEPTS Tuesday, Feb 3 rd, 2009 Essential Unix Commands …the second half

lpq -lpq -Line Printer QueueDisplay the items in the printer queue.

Examples:(1)>

(2)>

(3)>

lpq –P printerName

Command example 2

Command example 3

Displays queue information (jobID’s) for printer printerName.

Command example 2 description.

Command example 3 description.

Page 11: ATS Programming Short Course I INTRODUCTORY CONCEPTS Tuesday, Feb 3 rd, 2009 Essential Unix Commands …the second half

lpr -lpr -Line PRinterSend a job (file) to be printed.

Examples:(1)>

(2)>

(3)>

lpr –P printerName fileName

Command example 2

Command example 3

Send fileName to be printed on the printer PrinterName.

Command example 2 description.

Command example 3 description.

Page 12: ATS Programming Short Course I INTRODUCTORY CONCEPTS Tuesday, Feb 3 rd, 2009 Essential Unix Commands …the second half

lprm -lprm -Line Printer ReMoveRemove a job that has been sent to a printer.

Examples:(1)>

(2)>

(3)>

lprm –P printerName jobID

Command example 2

Command example 3

Removes the print job identified by jobID from printerName’s queue.

Command example 2 description.

Command example 3 description.

Page 13: ATS Programming Short Course I INTRODUCTORY CONCEPTS Tuesday, Feb 3 rd, 2009 Essential Unix Commands …the second half

echo -echo -ECHO to outputDisplay to screen.

Examples:(1)>

(2)>

(3)>

echo ${SHELL}

Command example 2

Command example 3

Displays the value of the variable ${SHELL}

Command example 2 description.

Command example 3 description.

Page 14: ATS Programming Short Course I INTRODUCTORY CONCEPTS Tuesday, Feb 3 rd, 2009 Essential Unix Commands …the second half

find -find -FIND filesSearch for files by filename.

Examples:(1)>

(2)>

(3)>

find . \! –name ‘[A-Z]*’ -print

find /work –name chapter1 -print

Command example 3

Find all files in the current directory that don’t begin with a capital letter.

Find all files under the directory /work that are named chapter1.

Command example 3 description.

Page 15: ATS Programming Short Course I INTRODUCTORY CONCEPTS Tuesday, Feb 3 rd, 2009 Essential Unix Commands …the second half

grep -grep -? Look for files containing text patterns (Note: text

patterns in the file contents as opposed to filename).

Examples:(1)>

(2)>

(3)>

grep –l ‘^#include’ /usr/include/*

Command example 2

Command example 3

List all files under /usr/include that contain at least one #include directive.

Command example 2 description.

Command example 3 description.