: paths -s setuid - , , , , . - , - . - . .  1. $ paths ls more who paths /bin/ls /usr/bin/more /bin/who /usr/russ/bin/paths ls, more, who, paths. - . , , - , . 2. $ more `paths gettydefs termcap paths` PATH /etc, . , . - paths, more. more, , . paths more : more /etc/gettydefs /etc/termcap /usr/russ/bin/paths . , paths - , . 3. $ ll `paths ll` ll, path. ( ll .) , - , , ll. 4. $ m `paths paths` paths m, more . ( m .)  4 FORMAT, - . , , path, . 6-19 - . , , . , "-xyz". "-x -y -z". , . - - . , , - , , - . , , , , - - . - . for . "-", case 9-17. "-l" - , . - , . "-s" . , - , , - "l". for , . , : , , . s , - . , l, s, (*) - . . , , , , . , , . , , - . , . 21 (:) . , - . - , . 23-40. for. , - , PATH. , , . , - , - . , - . , ls, set - , - . UNIX . ls , . ls , . : ll `path ll` ll, ls -l. paths -l ll , , ls -l . setuid 34 " " . , . - , PATH, . , . ls-grep. , . , ls -al $DIR : ------------------------------- | | -rws--x--x 1 root bin 16235 Sep 13 1985 /bin/su | | "^[^ ]*s[^ ]*" , , , - , s , - . - . s - ( , ), grep - . "" , PATH, . - , - PATH. - - .   - . - . - paths paths - . - paths, . - , set . paths . , - . 2.2.  2.2.1. lc - ------------------------------------------------------------- : lc ------------------------------------------------------------ lc  , . more.   lc [-m] [ls options] file [file ...]   lc -R $HOME - .   1 : 2 # @(#) lc v1.0 List files in a column Author: Russ Sage 2 4 if [ "$1" = "-m" ] 5 then MORE="| /usr/bin/more" 6 shift 7 else MORE="" 8 fi 10 eval "/bin/ls -a $@ | /bin/pr -5t" $MORE # pre System V 11 eval /bin/ls -aCF $@ $MORE # System V   MORE more  lc? , . , . ls UNIX, - . , , - . - ls, . , lc . - , , System V, - System V UNIX. , System V 2 ls, , . Berkeley ls, . XENIX System V . , UNIX, XENIX - - , , , . , , - . csh sh, - , , , lc (alias). , UNIX (, ls ). , - , . , - . sh - bin. , SCO XENIX System V , (lc, lf, l) ls . , . UNIX, - - , - shell. UNIX, - , , - . , , / , , shell . lc? , . , - - UNIX. - , - ls, . , -C. ls ? UNIX , - , , .profile, - ls -a. , , . . System V BSD ( , -F), - "/" "*" . - ls UNIX . - , "" , "x", , a.out . , - . , - , more. more , - -m. -m - , - , . , UNIX ls - . , - , (,). , .  1. $ lc `path lc` lc . 2. $ lc -m -R / , - more. : - , expose. "lc -m -R $@" . 3. $ lc -m -R /usr/lib , /usr/lib, more. 4. $ lc -m . | more - more, more. ? . , .  4-8 , - -m - more. , - MORE more. , - ls. . , ls, . -m, MORE , . 10 - , UNIX- Version 7 System III. (/) (*), . , pr UNIX. pr "-5t", ( , , ) . , 24- . , eval. shell, - , . shell , - - . MORE. , - . - , pr "|" "more", . , shell , eval. 10 . . shell , "|" ? , eval - . eval , - , , MORE , . , , - . , ls (System V, 2 BSD 4.2), . 11, ls, / * . $@ - , .. ls , . , ( a,C,F), ( R,t ..). , ls , - . z ?, "ls -z" "ls -?" : -------------------------------- | | ls: illegal option -- z | usage: -1ACFRabcdfgilmnopqrstux [files] | . - , lc, . , UNIX, , ? , , shell , PATH , - . , . lc, shell , lc ls, . more pr, . - shell ( , /), . - lc. , , , , , . paths, , . , , , - . 2.2.2. ll - ------------------------------------------------------------- : ll ------------------------------------------------------------- ll  (-l). more.   ll [-m] [ls options] file [file...]   ll *.c .   1 : 2 # @(#) ll v1.0 Long listing of files Author: Russ Sage 2 4 if [ "$1" = "-m" ] 5 then MORE="| /usr/bin/more" 6 shift 7 else MORE="" 8 fi 10 eval /bin/ls -al $@ MORE   MORE more  ll? ll , lc. ll . - , - - . ll? "ls -l". , , , , , , . (, , , stat(2).) , - -m. more. , , . , , shift, ls, . -m ( ) ll ls. . : * , ? - , [] - . ls, "ls -l", more - ls.  1. $ ll /etc/*mount* /etc, - - mount (, mount, umount, unmountable). 2. $ ll -i `who|awk '{print "/dev/" $2}'` who, - awk, - /dev/. , - , ls -li. - (inode) . 3. $ ll `kind -a /lib` /lib. - UNIX. ( kind, , - .) 4. $ ll -m -i /dev /dev. more.  -m, 4 MORE /usr/bin/more. ( , - , .) -m shift . -m, MORE , - , - eval ( 10). 10 eval - . ls -al ( ), - . ( - , -m, shift). - ls . MORE more, -m. - MORE - . , -m ( ) ? -m ls. ls " ", , . ls - -l, -m ls. more, - . 2.2.3. kind - ------------------------------------------------------------- : kind ------------------------------------------------------------- kind  (- ), . , .   kind [-a] [-d] [-t] [-x] [file...]   more `kind /etc/*` more , - /etc.   1 : 2 # @(#) kind v1.0 Prints files of the same kind Author: Russ Sage 2 4 if [ $# -gt 0 ] 5 then if [ `echo $1 | cut -c1` = "-" ] 6 then case #1 in 7 -a) KIND='archive' 8 shift;; 9 -d) KIND='data' 10 shift;; 11 -t) KIND='text' 12 shift;; 13 -x) KIND='executable' 14 shift;; 15 *) echo "kind: arg error" >&2 16 echo "usage: kind [-a] [-d] [-t] [-x] [file...]" >&2 17 echo " -a archive" >&2 18 echo " -d data" >&2 19 echo " -t text, default" >&2 20 echo " -x executable" >&2 21 echo " if no args, reads stdin" >&2 22 exit 1;; 23 esac 24 fi 25 fi 27 : ${KIND:='text'} 29 case $# in 30 0) while read FILE 31 do 32 file $FILE | fgrep $KIND | cut -d: -f1 33 done;; 34 *) file $@ | fgrep $KIND | cut -d: -f1;; 35 esac   FILE stdin ( ) KIND ,  kind? UNIX . : (, , - ), . , . , UNIX . ls - , . - file. , , , . file - , . , ls file, .. , . - . , , /etc. , . . - ls, size, nm file. od. more, wc, head, tail - . , - - . kind? kind - , , . , ls, .. . , , , cd. , - (/usr/russ) $ kind -d /etc/* : -------------------------------- | | /etc/mnttab | /etc/utmp | /etc/wtmp | , . : $ cd /etc $ kind -d * , - , : ----------------------------------------------- | | mnttab | utmp | wtmp | - . kind -a , -d , -t ( - ) -x . UNIX file. , , , file , - ls: ls x , - file , " ". - a.out (. /usr/include/a.out.h), " -". . UNIX. , kind - . ( - , " ", "". , shift , .) , , kind. , .  1. $ od `kind -d /etc/*` , , od - . . 2. $ ll `sh -x kind -a /lib/*` | m . , /lib. shell - , . more. 3. # find / -print | kind -x | while read FILE > do > ll $FILE > done > /tmp/filelist . "ls -l". , ll . find: # find / -perm -0111 -exec ll {} \; perm , a.out, . , , - file ( kind) , , . 4. $ for F in `kind /bin/* /usr/bin/* /etc/*` > do > fgrep "trap" $F /dev/null > done $ fgrep "trap" `kind /bin/* /usr/bin/* /etc/*` $ find /bin /usr/bin /etc -exec fgrep "trap" {} \; "trap" .  , , . , - . . , , , - . 4 , - . , . , 27. - - (-), case , . KIND - , - shift. , *, . - - , kind - . 27 , KIND . , - "text". KIND , . . , -t . -t , case. 29-35 case, , - . - - , KIND shift. , - . , , , . 30-33 , - , file fgrep , , file, ( - KIND). cut , . file , - . , , ":". , while , case . , case 34. - $@, file. , . - 32.   , kind - . , -a -d. , |. egrep, , "egrep 'archive|data'". , , . 2.2.4. m - more ------------------------------------------------------------- : m ------------------------------------------------------------- m more    m [more options] [file ...]   m * more   1 : 2 # @(#) m v1.0 Easy access to more 2 more 4 /usr/bin/more $@  m? UNIX - . . - , - more. , - . m. , , . . - , , "more datafile". . - - - , - more, "od -c . | more". - . , more , . ! ( (aliasing), , , alias: "alias m more".) m? , more - . . . more m. - . . , - more .