红联Linux门户
Linux帮助

linux common knowledge

发布时间:2008-01-17 11:04:43来源:红联作者:picolsa
1:Pipe and Socket Files
Pipe files are a special kind of file shared between two programs.The file acts as a buffer
for sharing information. One program writes to the pipe file and the other reads from
the pipe.When the pipe file reaches a certain size, Linux halts the writing program until
the reading program can “catch up.”
A similar kind of file is called a Unix domain socket file. A socket file acts like a pipe
but works using network sockets. However, this kind of file is not easily used in shell
scripts and it won’t be covered in this book.
2: /dev
/dev/tty--The terminal window (or console) your program is running under
/dev/dsp--The interface that plays AU sound files on your sound card
/dev/fd0--The first floppy drive
/dev/hda1--The first IDE drive partition
/dev/sda1--The first SCSI drive partition
3: command basics
3.1: filters
Filters are commands that take the results of one command and modify them in some
way, such as removing unwanted lines or substituting one word for another. Many com-
mands act as filters under the right circumstances.
3.2 arguments
Arguments are additional information supplied to a command to change its behavior.
The date command takes a format argument to change the appearance of the date and
time. eg: $ date ‘+%H:%M’
3.3 Switches
Switches (also called “options” or “flags”) are characters proceeded by a minus sign that
enable command features. eg: $ date -u
3.4 double minus sign - -
eg: $ date - -universal
The GNU and Linux convention is for longer, more readable options to be proceed-
ed by a double minus sign.The longer equivalent to the -u switch is --universal.
4: editing mode
vi and Emacs
eg: $ shopt -o emacs (to see if emacs if on)
$ shopt -o emacs
emacs on
$ shopt -o vi
vi off
5: Tab
$ dat
is completed when the Tab key is pressed to
$ date
6: colon 冒号 :
There are some places in shell programs where a statement is required. In those cases, you can use : to indicate nothing special should be done.
At the command prompt, : has no effect.
$ :
$
7: command switches
eg:
date has following switches:
-d, --date=STRING display time described by STRING, not `now'
-f, --file=DATEFILE like --date once for each line of DATEFILE
-r, --reference=FILE display the last modification time of FILE
-R, --rfc-2822 output date and time in RFC 2822 format
--rfc-3339=TIMESPEC output date and time in RFC 3339 format.
TIMESPEC=`date', `seconds', or `ns' for
date and time to the indicated precision.
-s, --set=STRING set time described by STRING
-u, --utc, --universal print or set Coordinated Universal Time
--help display this help and exit
--version output version information and exit
run in bash:
gangcai@gangcai-laptop:~$ date --rfc-3339='ns'
2008-01-16 10:55:59.861961023+08:00
gangcai@gangcai-laptop:~$ date --rfc-3339='date'
2008-01-16
文章评论

共有 0 条评论