. Linux. Windows, . , , . , . , , .
, Linux, , . Linux , , . . 1 , ( , : bash csh) Linux.
Linux , . Lmux , /bin/sh GNU, bash (GNU Bourne-Again SHell). bash 3, , POSIX.
. 1. Linux
, ( ) Linux.
, , :
$ ls -l > lsoutput.txt
ls lsoutput.txt.
, . C , 0 , 1 , 2 . . , , , , : 0, 1 2.
>. , , . >>. ,
|
|
$ ps >> lsoutput.txt
ps . $ Linux.
> , . 2, 2>. , .
, kill . , , kill. , kill , . , kill .
$ kill -HUP 1234 > killout.txt 2>killer.txt
.
, >2 . ,
$ kill -1 1234 > killerr.txt 2>41
. . " killerr.txt, , ". , , .
kill , . , " " Linux, /dev/null, :
$ kill -1 1234 >/dev/null 2>fil
. $ more < killout.txt
|. , sort ps.
, , :
$ ps > psout.txt
$ sort psout.txt > pasoirt.out
:
$ ps | sort > pssort.out
, , , more:
$ ps | sort | more
, , . :
$ ps -x comm | sort | uniq | grep -v sh | more
ps, , uniq, grep -v sh sh . , , .
. .
|
|
.
, , posix. grep , :
$ for file in *
> do
> if grep -l POSIX $file
> then
> more $file
> fi
> done posix
This is a file with POSIX in it - treat it well
$
, $, , >, . , , , .
grep , posix, more . . , , . i, file .
( ). , * - , , ? . {} , . ,
$ ls my_{finger, toe}s
my_figers my_toes .
. , , .
, , . mc . mc Shift+F4. first :
#!/bin/sh
# first
#
# POSIX, .
for file in *
do
if grep -q POSIX $file
then
echo $file
fi
done
exit 0
# . # . #! /bin/sh ; #! , , . /bin/sh , .
exit , . , , , . , .
. - , .
; Linux UNIX, , .