Introduction to unix
Download
1 / 20

Introduction to UNIX - PowerPoint PPT Presentation


  • 60 Views
  • Uploaded on

Introduction to UNIX. Meta Characters. Special Characters with Special Meaning Used to Save Time / \ “ ` * ; ? { } ( ) [ ] ~ ! $ < > | & # # Comment Line Turning Off Meta Characters Display a Line of **** echo *** Doesn’t Work!. Meta Characters. Turning Off Meta Characters \

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about ' Introduction to UNIX' - nolcha


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

Meta characters
Meta Characters

  • Special Characters with Special Meaning

  • Used to Save Time

    • / \ “ ` * ; ? { } ( ) [ ] ~ ! $ < > | & #

    • # Comment Line

  • Turning Off Meta Characters

    • Display a Line of ****

    • echo ***

      • Doesn’t Work!


Meta characters1
Meta Characters

  • Turning Off Meta Characters

    • \

    • Turns Off One Meta Character

$ echo \*\*\*

***


Meta characters2
Meta Characters

  • Turning Off Meta Characters

    • ‘ ‘

    • Turn off all Meta Characters between the ‘ ‘

$ echo ‘***’

***


Meta characters3
Meta Characters

  • Turning Off Meta Characters

    • “ “

    • Turn off Meta Characters between the “ “

    • $ \ ` remainactive

$ echo “My home is $HOME”

My home is /home/rdefe


Meta characters4
Meta Characters

  • Turning Off Meta Characters with “ “

    • $ \ ` remainactive

$ echo -e “My home is $HOME\nNext Line”

My home is /home/rdefe

Next Line

$

\n New Line

\t Tab


Meta characters5
Meta Characters

  • Turning Off Meta Characters

    • “ “

    • Turn off Meta Characters between the “ “

    • $ \ ` remainactive

$ echo “Today is `date`”

Today is Mon Jan 22 22:04:46 EST 1996


Unix commands
Unix Commands

  • wc [-lwc] File1 File2 … FileN

    • Word Count

    • -lDisplay Number of Lines

    • -wDisplay Number of Words

    • -cDisplay Number of Characters

$ wc mbox

59 279 1473 mbox

$ wc mbox ls.file

59 279 1473 mbox

1 1 12 ls.file

60 280 1485 total


Unix commands1
Unix Commands

  • cmp File1 File2

    • Compare Two Files (binary or text)

$cmp s1 mbox

s1 mbox differ: char 1, line 1

$ cmp p1 p2

$


Unix commands2
Unix Commands

  • sort [-fnr]File1 File2 … FileN

    • Sort the Contents of a File

    • -fIgnore Case

    • -nSort Numbers Based on Value

    • -rReverse Order

$ cat words

sand

box

zoo

xray

sam

jones

$ sort words

box

jones

sam

sand

xray

zoo


Unix commands3
Unix Commands

  • uniq [-d]File1 File2 … FileN

    • Read a Sorted File Reject or Report Duplicates

    • -dDisplay Duplicates

$ cat stuff

dos

mac

mvs

mvs

unix

unix

windows95

$ uniq stuff

dos

mac

mvs

unix

windows95

$ uniq -d stuff

mvs

unix


Unix commands4
Unix Commands

  • compress File1 File2 … FileN

  • uncompress File1 File2 … FileN

    • Used to compress Large Files

$ ls -s datafile

297 datafile

$ compress datafile

$ ls -s datafile*

177 datafile.Z

$ uncompress datafile

$ ls -s datafile

297 datafile


Unix commands5
Unix Commands

  • cut -c[col number] FileName

    • Cut columns and display to screen

$ cat names

Jones John

Smith Rober

Doe John

$ cut -c1-3 names

Jon

Smi

Doe

$ cut -c1-3,11-13 names

JonJoh

SmiRob

DoeJoh


Unix commands6
Unix Commands

  • find LocationCriteriaAction

    • Locate Files Based on a Search Criteria

$find /home -name mbox -print

/home/mbox

/home/rdefe/mbox

/home/ssmith/mbox

$

$find /home -name “mbox*” -print

$


Unix commands7
Unix Commands

  • find LocationCriteriaAction

    • Specify Multiple Search Locations

$find /home /usr -name mbox -print

/home/mbox

/home/rdefe/mbox

/home/ssmith/mbox

/usr/mbox

/usr/tmp/mbox

$


Unix commands8
Unix Commands

  • find LocationCriteriaAction

    • -user [login]

    • -group [GroupName]

$find /home -user rdefe -print

/home/rdefe/mbox

/home/rdefe/doc

$

$find /home -group unix -print

/home/rdefe/mbox

/home/rdefe/doc

/home/jsmith/p1

$


Unix commands9

$find /home -mtime +7 -print

Files modified greater than 7 days ago

$find /home -mtime -7 -print

Files modified less than 7 days ago

Unix Commands

  • find LocationCriteriaAction

    • -mtime [+|-] Days

    • -links [+|-] Number

Files modified exactly 7 days ago

$find /home -mtime 7 -print


Unix commands10
Unix Commands

  • find LocationCriteriaAction

    • -inum [InodeNumber]

    • -type [f|d]

Find file with inode number 10203

$find /home -inum 10203 -print

$find /home -type d -print

Find all directories in /home


Unix commands11
Unix Commands

  • find LocationCriteriaAction

    • -print Display File Location

    • -exec UnixCmds Execute Unix Command(s)

    • -ok UnixCmds Interactive Unix Command(s)

$find /home -user rdefe -exec pr {} \;

$find /home -user rdefe -ok pr {} \;

/home/rdefe/mbox?

Prompt for Each File


Unix commands12

Implied “and”

$find /home -user rdefe -links 2 -print

$find /home -user rdefe -o -links 2 -print

“or”

Unix Commands

  • find Examples

$find /home

\( -user rdefe -o -user jdoe \) -links 2

-print


ad