Main index

Introducing UNIX and Linux


Introduction to shells

Overview
Why do we need a shell?
Shell syntax
      Types of shell command
      Simple commands
      Pipelines
      Grouping commands
      Exit status
      List commands
Arithmetic
      Operators and functions
Making decisions
      The 'test' statement
            Operators used by 'test'
      The 'if' statement
Loops
      'For' loops
      'While' and 'until' loops
Searching for files
      Arguments to 'find'
Formatted output
      Arguments to 'printf'
Passing information to scripts
      Scripts with arguments
      Parameter expansion
Summary
Exercises

Arguments to 'find'

Tests

-empty file is empty, either a regular file or a directory
-gid n file's group ID is n
-group name file's group name is name
-inum n file's inode is n
-links n file has n hard links
-name pattern filename matches pattern
-perm mode file's permissions are (exactly) mode
-size n file has size n blocks of 512 bytes
-type c file's type is c
-user name file's owner is name

Actions

-exec command execute command
-printf format display the filename

Copyright © 2002 Mike Joy, Stephen Jarvis and Michael Luck