FreeBSD的man指令



贊助商連結


repsol
2001-10-09, 12:22 AM
相信有玩UNIX的人一定都曾經使用過man 這個指令,man這個指令就是manual page的縮寫,ㄊ提供了系統中指令或是設定的方法,各類設定檔的說明,更重要的事還提供了寫程式所需要的資訊,UNIX的系統指令集繁雜,純命令列的console,一大串的command,如果不常用,粉快滴...下次要用的時候,就給他回憶不起來了.
man的命令放在/usr/bin/man
使用方法
ex :
man df
就會出現以下畫面

DF(1) FreeBSD General Commands Manual DF(1)

NAME
df - display free disk space

SYNOPSIS
df [-b | -h | -H | -k | -m | -P] [-ailn] [-t type]
[file | filesystem ...]

DESCRIPTION
Df displays statistics about the amount of free disk space on the speci?
fied filesystem or on the filesystem of which file is a part. Values are
displayed in 512-byte per block counts. If neither a file or a filesys?
tem operand is specified, statistics for all mounted filesystems are dis?
played (subject to the -t option below).

The following options are available:


中間略刪....


ENVIRONMENT
BLOCKSIZE If the environment variable BLOCKSIZE is set, the block counts
will be displayed in units of that size block.

BUGS
The -n and -t flags are ignored if a file or filesystem is specified.

SEE ALSO
lsvfs(1), quota(1), fstatfs(2), getfsstat(2), statfs(2), getmntinfo(3),
fstab(5), mount(8), quot(8)

HISTORY
A df command appeared in Version 1 AT&T UNIX.

FreeBSD 4.4 May 8, 1995 FreeBSD 4.4

============================= 到此結束 ========================================
看到第一行DF(1)
每個man page都一定會有那個括弧和數字
數字的意義以下介紹...
1 代表使用者命令 : df(1)
2 系統呼叫 ex :syscall(2)
3 函式庫 ex : stdio(3)
4 硬體裝置ex : ad(4)
5 系統設定檔ex: rc.conf(5)
6 遊戲 ex: worms(6)
7 Miscellaneous Information Manual 其他 ex: ports(7)
8 FreeBSD System Manager's Manual 系統管理 ex : vipw(8)
9 FreeBSD Kernel Developer's Manual 系統 kernel 開發 ex : MICROTIME(9)
==============================================================================
NAME
df - display free disk space
指令名稱 - 簡短敘述
==============================================================================
SYNOPSIS
df [-b | -h | -H | -k | -m | -P] [-ailn] [-t type]
[file | filesystem ...]
指令參數
==============================================================================
DESCRIPTION
詳細描述
Df displays statistics about the amount of free disk space on the speci?
fied filesystem or on the filesystem of which file is a part. Values are
displayed in 512-byte per block counts. If neither a file or a filesys?
tem operand is specified, statistics for all mounted filesystems are dis?
played (subject to the -t option below).
==============================================================================
OPTIONS
指令參數詳細說明
The following options are available:
-a Show all mount points, including those that were mounted with the
MNT_IGNORE flag.

-b Use 512-byte blocks rather than the default. Note that this
overrides the BLOCKSIZE specification from the environment.

-g Use 1073741824-byte (1-Gbyte) blocks rather than the default.
Note that this overrides the BLOCKSIZE specification from the
environment.

-H "Human-readable" output. Use unit suffixes: Byte, Kilobyte,
Megabyte, Gigabyte, Terabyte and Petabyte in order to reduce the
number of digits to three or less using base 10 for sizes.

-h "Human-readable" output. Use unit suffixes: Byte, Kilobyte,
Megabyte, Gigabyte, Terabyte and Petabyte in order to reduce the
number of digits to three or less using base 2 for sizes.

-i Include statistics on the number of free inodes.

-k Use 1024-byte (1-Kbyte) blocks rather than the default. Note
that this overrides the BLOCKSIZE specification from the environ?
以下略
==============================================================================
ENVIRONMENT
環境變數(BLOCKSIZE)
BLOCKSIZE If the environment variable BLOCKSIZE is set, the block counts
will be displayed in units of that size block.
==============================================================================
BUGS
臭虫
The -n and -t flags are ignored if a file or filesystem is specified.
==============================================================================
SEE ALSO(小弟覺得這個最好用)
lsvfs(1), quota(1), fstatfs(2), getfsstat(2), statfs(2), getmntinfo(3),
fstab(5), mount(8), quot(8)
與df(1)相關的指令或是相關的設定檔,UNIX的指令繁雜,設定檔也很多,SEE ALSO可以看到與df指令相關的
可以了解的更深 ,學習到的也可以更廣
==============================================================================
HISTORY
指令的起源
A df command appeared in Version 1 AT&T UNIX.

==============================================================================
man page雖然都是英文,但是想要的答案都在裡面
man一下,不用錢,然後自己try try..又可以學到東西
嘿嘿...真的很不錯...真的很好用
希望大家可以多用用

贊助商連結


leonchou
2001-10-11, 01:04 PM
謝謝分享~ :)
 
順便請教一下 --

man 指令是在知道指令名稱的情況下, 來查詢其用法和相關資訊.. 但是如果不知道或忘記了指令名稱呢? 怎麼辦? 如何得知什麼指令可以做什麼事, 有沒有一個速查表之類的..?
有一個指令叫「grep」, 可以在檔案裡找出指定的字串.. 但是它有檔案大小的限制~ 我們通常只搜尋純文字格式的檔案, 請問 (a) 如何限定搜尋的檔案格式/類型? (b) 可否一次搜尋一個以上的目錄, 而不需一個一個目錄去下grep ? grep 指令有沒有一個參數, 或是有其他指令可以達到這兩個需求的呢? (我有查過grep的說明, 但實在是看不懂 :()

不知明不明白我的問題.. 拜託了,
3Q very much~ ^^

repsol
2001-10-12, 12:34 AM
1.善加利用whatis
ex :
whatis 1 請依照我po的分類 1代表使用者命令

SHA_Init(3), SHA_Update(3), SHA_Final(3), SHA_End(3), SHA_File(3), SHA_Data(3), SHA1_Init(3), SHA1_Update(3), SHA1_Final(3), S
HA1_End(3), SHA1_File(3), SHA1_Data(3) - calculate the FIPS 160 and 160-1 ``SHA'' message digests
a2p(1) - Awk to Perl translator
addftinfo(1) - add information to troff font files for use with groff
addr2line(1) - convert addresses into file names and line numbers
afmtodit(1) - create font files for use with groff -Tps
apply(1) - apply a command to a set of arguments
apropos(1), whatis(1) - search the whatis database
ar(1) - create, modify, and extract from archives
as(1), GNU as(1) - the portable GNU assembler
at(1), batch(1), atq(1), atrm(1) - queue, examine or delete jobs for later execution
basename(1), dirname(1) - return filename or directory portion of pathname
bc(1) - An arbitrary precision calculator language
bdes(1) - encrypt/decrypt using the Data Encryption Standard
biff(1) - be notified if mail arrives and who it is from
brandelf(1) - mark an ELF binary for a specific ABI
builtin(1), alias(1), alloc(1), bg(1), bindkey(1), break(1), breaksw(1), builtins(1), case(1), cd(1), chdir(1), command(1), co
mplete(1), continue(1), default(1), dirs(1), do(1), done(1), echo(1), echotc(1), elif(1), else(1), end(1), endif(1), endsw(1),
esac(1), eval(1), exec(1), exit(1), export(1), fc(1), fg(1), filetest(1), fi(1), for(1), foreach(1), getopts(1), glob(1), got
o(1), hash(1), hashstat(1), history(1), hup(1), if(1), jobid(1), jobs(1), kill(1), limit(1), log(1), login(1), logout(1), ls-F
(1), nice(1), nohup(1), notify(1), onintr(1), popd(1), printf(1), printenv(1), pushd(1), pwd(1), read(1), readonly(1), rehash(
1), repeat(1), sched(1), set(1), setenv(1), settc(1), setty(1), setvar(1), shift(1), source(1), stop(1), suspend(1), switch(1)
, telltc(1), then(1), time(1), trap(1), type(1), ulimit(1), umask(1), unalias(1), uncomplete(1), unhash(1), unlimit(1), unset(
1), unsetenv(1), until(1), wait(1), where(1), which(1), while(1) - shell builtin commands
bzip2(1), bunzip2(1) - a block-sorting file compressor, v1.0 bzcat
c2ph(1), pstruct(1) - Dump C structures as generated from f(CWcc -g -S stabs
c89(1) - POSIX.2 C language compiler
cal(1), ncal(1) - displays a calendar and the date of easter
calendar(1) - reminder service
cap_mkdb(1) - create capability database
cat(1) - concatenate and print files
catman(1) - preformat man pages
cdcontrol(1) - compact disc control utility
checknr(1) - check nroff/troff files
chflags(1) - change file flags
chgrp(1) - change group
chio(1) - medium changer control utility
chkey(1) - change your encryption key
chmod(1) - change file modes
chpass(1), chfn(1), chsh(1), ypchpass(1), ypchfn(1), ypchsh(1) - add or change user database information
ci(1) - check in RCS revisions
ckdist(1) - check software distributions
cksum(1), sum(1) - display file checksums and block counts
cmp(1) - compare two files
co(1) - check out RCS revisions
col(1) - filter reverse line feeds from input
colcrt(1) - filter nroff output for CRT previewing
colldef(1) - convert collation sequence source definition
colrm(1) - remove columns from a file
column(1) - columnate lists
comm(1) - select or reject lines common to two files

.....略刪


whatis 2 2代表系統呼叫
accept(2) - accept a connection on a socket
access(2) - check access permissions of a file or pathname
acct(2) - enable or disable process accounting
adjtime(2) - correct the time to allow synchronization of the system clock
aio_cancel(2) - cancel an outstanding asynchronous I/O operation (REALTIME)
aio_error(2) - retrieve error status of asynchronous I/O operation (REALTIME)
aio_read(2) - asynchronous read from a file (REALTIME)
aio_return(2) - retrieve return status of asynchronous I/O operation (REALTIME)
aio_suspend(2) - suspend until asynchronous I/O operations or timeout complete (REALTIME)
aio_waitcomplete(2) - wait for the next completion of an aio request
aio_write(2) - asynchronous write to a file (REALTIME)
bind(2) - assign a local protocol address to a socket
brk(2), sbrk(2) - change data segment size
c89(1) - POSIX.2 C language compiler
chdir(2), fchdir(2) - change current working directory
chflags(2), fchflags(2) - set file flags
chmod(2), fchmod(2), lchmod(2) - change mode of file
chown(2), fchown(2), lchown(2) - change owner and group of a file
chroot(2) - change root directory
clock_gettime(2), clock_settime(2), clock_getres(2) - get/set/calibrate date and time
close(2) - delete a descriptor
connect(2) - initiate a connection on a socket
creat(2) - create a new file
dup(2), dup2(2) - duplicate an existing file descriptor
execve(2) - execute a file
fcntl(2) - file control
fhopen(2), fhstat(2), fhstatfs(2) - access file via file handle
flock(2) - apply or remove an advisory lock on an open file
fork(2) - create a new process
fsync(2) - synchronise changes to a file
gcc(1), g++(1) - GNU project C and C++ Compiler (gcc-2.95.3)
getdirentries(2), getdents(2) - get directory entries in a filesystem independent format
getdtablesize(2) - get descriptor table size
getfh(2) - get file handle
getfsstat(2) - get list of all mounted filesystems
getgid(2), getegid(2) - get group process identification
getgroups(2) - get group access list
getitimer(2), setitimer(2) - get/set value of interval timer
getlogin(2), getlogin_r(2), setlogin(2) - get/set login name
getpeername(2) - get name of connected peer
getpgrp(2) - get process group
getpid(2), getppid(2) - get parent or calling process identification
getpriority(2), setpriority(2) - get/set program scheduling priority
getrlimit(2), setrlimit(2) - control maximum system resource consumption
getrusage(2) - get information about resource utilization
getsid(2) - get process session
getsockname(2) - get socket name
getsockopt(2), setsockopt(2) - get and set options on sockets
gettimeofday(2), settimeofday(2) - get/set date and time
getuid(2), geteuid(2) - get user identification


略刪...
依此類推....


又有簡單的指令描述...這個應該是很夠用了...雖然有些會出現其他的分類的man page
也可以直接找man page的直接系統路徑/usr/share/man/,/usr/local/man/....
他也是依照分類 (1~9)來分類...一目了然...


2.

(1)grep一般都是用來search普通的文件檔的word....
(2)man grep

.....略刪

-r, --recursive
Read all files under each directory, recursively;
this is equivalent to the -d recurse option.
就是這個參數
如果你的grep版本沒有這鍋參數
請到gnu上download,
here

ftp.gnu.org/gnu/grep/grep-2.4.2.tar.gz

一般裝完...指令的位置應該會放在/usr/local/bin/grep

leonchou
2001-10-12, 01:40 AM
謝謝你的解答~~~ ^___^