UNIX file utilities: - PowerPoint PPT Presentation

1 / 11
About This Presentation
Title:

UNIX file utilities:

Description:

find. The find command searches for files (not within files). Syntax: ... Use the find command when you can't remember where you put that file ... – PowerPoint PPT presentation

Number of Views:20
Avg rating:3.0/5.0
Slides: 12
Provided by: sjf
Category:
Tags: unix | file | find | the | utilities

less

Transcript and Presenter's Notes

Title: UNIX file utilities:


1
UNIX file utilities
  • find wc wildcards

2
Review of Past Commands
  • echo
  • Useful for producing diagnostics in command files
  • For sending known data into a pipe
  • For displaying the contents of environment
    variables
  • echo
  • echo /

3
  • cat
  • Use to send output to the screen or to Display
    file contents.
  • Use to join files
  • lt gt redirect
  • gtgt append

4
find
  • The find command searches for files (not within
    files).
  • Syntax
  • find location options name, type, time
  • . current directory
  • /poems/ poems directory within current directory
  • ../ current directory and up one level

5
Finding files
  • Use the find command when you cant remember
    where you put that file-name is the most common
    option
  • Default path is the current directory
  • Default expression is -print

6
Finding files and programs
  • Syntax in current directory
  • find . name lostfile -print
  • Syntax in a specific directory
  • find public_html/ -name lostfile print
  • Syntax for multiple directories
  • find public_html/inls102 public_html/exercises
    -name lostfile print
  • Find by Date find directory ctime daysold
    -print
  • find / ctime 1 print

7
  • Hints
  • You do not have to include the print flag on
    ruby or isis
  • You can use quoted wildcards to find a file with
    a partially unknown titlefind . inls print

8
File information
  • Count the number of words
  • wc
  • Sort a file
  • sort
  • Split a file into different parts
  • split
  • Compare two files together
  • diff

9
wc
  • wc stands for "word count". It counts the number
    of characters, words, and lines that are
    contained in a specified file or files.
  • Wc with no options prints the following counts
    for a file

10
wc
  • Options
  • -c character count.
  • -l line count.
  • -w word count.
  • Examples
  • Count the number of words in a filewc w
    file.txt
  • Count the number of lines in a file wc l
    file.txt
  • Count the words in three essay fileswc -w
    test12345.txt or wc -w test1-5.txt
  • Count the number of users logged inwho wc -l

11
Questions?
Write a Comment
User Comments (0)
About PowerShow.com