<<

- ‘count’

Even Commands  This will let you count the number of characters, words, and lines in wc a . To display the number of lines in a file: date $ wc -l filename

wc - ‘count’ wc - ‘count’

 This command will let you count the  This command will let you count the number of characters, words, and lines in number of characters, words, and lines in a file. a file. To display the number of words in a file: To display the number of characters in a file: $ wc - filename $ wc -m filename

wc Practice touch

 How many lines are in the shrodinger  Use touch to create an empty file. poem? (in dir1) $ wc -l shrodinger $ touch newfilename 57 shrodinger  How many words are in final.paper?  Using the touch command on an existing (in dir2) file will update the last modify . $ wc -w final.paper 118 final.paper

1

touch Practice date

 Create a new file in dir3  Typing date will give you the current called my.stuff day, date, time, and year and timezone.

$ ../dir3 $ date $ touch my.stuff

 Using the -u option will give you Greenwich Mean Time (universal time).

who find

 This command will display information  Use this command to find the location about who is currently logged onto the of a file. system.  This command has four parts to it. $ who

find find

$ find $ find directory  Specify the directory in to start your search (such as /home/userid). The find  Start with the command_name find command will start there and go down.

 If you want to start your search in the current directory, simply a period (.)here.

 Don’t start with the root directory (/).You would not be able to search through some UNIX directories.

2

find find

$ find directory -name $ find directory -name filename

 -name specifies that you are looking  Now you type the name of the file you for a filename. are looking for.  The find command can search for files by criteria other than the file name, such as modify time, size, or the file access permissions.

find Practice find Practice

$ find . -name grp.txt (or…)  What directory is catalyst in? $ find ~/UNIX_class -name grp.txt $ find . -name catalyst  UNIX_class your current directory ./dir2/cats/catalyst & ./dir3/cats/catalyst  You are looking for your file called  What directory is address.list in? grp.txt, starting in the current directory (UNIX_class) and searching in all of its $ find . -name address.list subdirectories. ./dir1/address.list  What subdirectory is grp.txt in? (remember the . means the current working directory so it is assumed that your current working directory is  dir1 UNIX_class)

find find practice

$ find /home/jsmith -name “rec*”  Find all the files that begin with sh in UNIX_class.  You can also use wildcards with find, $ find . -name sh* (you can’t remember if the name is ./dir1/shrodinger records, recordings, or just recs). ./Wildcards/shell.script.113

 If you are using a wildcard metacharacter ./Wildcards/shell.script.276 with find enclose the string with single or double quotes.

3

find Review Even More Commands

 If the program has already found the file •wc – count the characters, words, or lines in a file you wanted, but is still searching for •touch – create an empty file, modify the file's time more, then press Ctrl+C to stop the search. •date – tells you the current day, date, time, timezone, and year •who – see who is logged onto the system •find – find the location of a file

Even More Commands The End…

Next… Remember to check the man pages for each of the new The Internet commands you've learned so far.

4