aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2001-03-15 18:14:25 +0000
committerEric Andersen <andersen@codepoet.org>2001-03-15 18:14:25 +0000
commit0d3a02eba76772e59c7832da6108776f576e9f1c (patch)
tree48d31f686c050abe08cce28c6a1e25c5695c2b3f
parent670bea210e924b46b7cefc7036550dfb20437f5e (diff)
downloadbusybox-w32-0d3a02eba76772e59c7832da6108776f576e9f1c.tar.gz
busybox-w32-0d3a02eba76772e59c7832da6108776f576e9f1c.tar.bz2
busybox-w32-0d3a02eba76772e59c7832da6108776f576e9f1c.zip
Update the documentation so examples are autoincluded in the output text.
Fix up docs/busybox.pod with the latest autogenerated output. -Erik
-rw-r--r--applets.h2
-rw-r--r--applets/usage.h533
-rwxr-xr-xdocs/autodocifier.pl8
-rw-r--r--docs/busybox.pod2067
-rw-r--r--fbset.c6
-rw-r--r--include/applets.h2
-rw-r--r--include/usage.h533
-rw-r--r--usage.h533
-rw-r--r--util-linux/fbset.c6
9 files changed, 2708 insertions, 982 deletions
diff --git a/applets.h b/applets.h
index f85f45720..c8005f830 100644
--- a/applets.h
+++ b/applets.h
@@ -135,7 +135,7 @@
135 APPLET(false, false_main, _BB_DIR_BIN) 135 APPLET(false, false_main, _BB_DIR_BIN)
136#endif 136#endif
137#ifdef BB_FBSET 137#ifdef BB_FBSET
138 APPLET_NOUSAGE("fbset", fbset_main, _BB_DIR_USR_SBIN) 138 APPLET(fbset, fbset_main, _BB_DIR_USR_SBIN)
139#endif 139#endif
140#ifdef BB_FDFLUSH 140#ifdef BB_FDFLUSH
141 APPLET(fdflush, fdflush_main, _BB_DIR_BIN) 141 APPLET(fdflush, fdflush_main, _BB_DIR_BIN)
diff --git a/applets/usage.h b/applets/usage.h
index b60f1f911..3d4752cd2 100644
--- a/applets/usage.h
+++ b/applets/usage.h
@@ -15,11 +15,21 @@
15#define basename_full_usage \ 15#define basename_full_usage \
16 "Strips directory path and suffixes from FILE.\n" \ 16 "Strips directory path and suffixes from FILE.\n" \
17 "If specified, also removes any trailing SUFFIX." 17 "If specified, also removes any trailing SUFFIX."
18#define basename_example_usage \
19 "$ basename /usr/local/bin/foo\n" \
20 "foo\n" \
21 "$ basename /usr/local/bin/\n" \
22 "bin\n" \
23 "$ basename /foo/bar.txt .txt\n" \
24 "bar"
18 25
19#define cat_trivial_usage \ 26#define cat_trivial_usage \
20 "[FILE]..." 27 "[FILE]..."
21#define cat_full_usage \ 28#define cat_full_usage \
22 "Concatenates FILE(s) and prints them to stdout." 29 "Concatenates FILE(s) and prints them to stdout."
30#define cat_example_usage \
31 "$ cat /proc/uptime\n" \
32 "110716.72 17.67"
23 33
24#define chgrp_trivial_usage \ 34#define chgrp_trivial_usage \
25 "[OPTION]... GROUP FILE..." 35 "[OPTION]... GROUP FILE..."
@@ -27,6 +37,12 @@
27 "Change the group membership of each FILE to GROUP.\n" \ 37 "Change the group membership of each FILE to GROUP.\n" \
28 "\nOptions:\n" \ 38 "\nOptions:\n" \
29 "\t-R\tChanges files and directories recursively." 39 "\t-R\tChanges files and directories recursively."
40#define chgrp_example_usage \
41 "$ ls -l /tmp/foo\n" \
42 "-r--r--r-- 1 andersen andersen 0 Apr 12 18:25 /tmp/foo\n" \
43 "$ chgrp root /tmp/foo\n" \
44 "$ ls -l /tmp/foo\n" \
45 "-r--r--r-- 1 andersen root 0 Apr 12 18:25 /tmp/foo\n"
30 46
31#define chmod_trivial_usage \ 47#define chmod_trivial_usage \
32 "[-R] MODE[,MODE]... FILE..." 48 "[-R] MODE[,MODE]... FILE..."
@@ -35,6 +51,15 @@
35 "symbols +-= and one or more of the letters rwxst.\n\n" \ 51 "symbols +-= and one or more of the letters rwxst.\n\n" \
36 "Options:\n" \ 52 "Options:\n" \
37 "\t-R\tChanges files and directories recursively." 53 "\t-R\tChanges files and directories recursively."
54#define chmod_example_usage \
55 "$ ls -l /tmp/foo\n" \
56 "-rw-rw-r-- 1 root root 0 Apr 12 18:25 /tmp/foo\n" \
57 "$ chmod u+x /tmp/foo\n" \
58 "$ ls -l /tmp/foo\n" \
59 "-rwxrw-r-- 1 root root 0 Apr 12 18:25 /tmp/foo*\n" \
60 "$ chmod 444 /tmp/foo\n" \
61 "$ ls -l /tmp/foo\n" \
62 "-r--r--r-- 1 root root 0 Apr 12 18:25 /tmp/foo\n"
38 63
39#define chown_trivial_usage \ 64#define chown_trivial_usage \
40 "[OPTION]... OWNER[<.|:>[GROUP] FILE..." 65 "[OPTION]... OWNER[<.|:>[GROUP] FILE..."
@@ -42,11 +67,27 @@
42 "Change the owner and/or group of each FILE to OWNER and/or GROUP.\n" \ 67 "Change the owner and/or group of each FILE to OWNER and/or GROUP.\n" \
43 "\nOptions:\n" \ 68 "\nOptions:\n" \
44 "\t-R\tChanges files and directories recursively." 69 "\t-R\tChanges files and directories recursively."
70#define chown_example_usage \
71 "$ ls -l /tmp/foo\n" \
72 "-r--r--r-- 1 andersen andersen 0 Apr 12 18:25 /tmp/foo\n" \
73 "$ chown root /tmp/foo\n" \
74 "$ ls -l /tmp/foo\n" \
75 "-r--r--r-- 1 root andersen 0 Apr 12 18:25 /tmp/foo\n" \
76 "$ chown root.root /tmp/foo\n" \
77 "ls -l /tmp/foo\n" \
78 "-r--r--r-- 1 root root 0 Apr 12 18:25 /tmp/foo\n"
45 79
46#define chroot_trivial_usage \ 80#define chroot_trivial_usage \
47 "NEWROOT [COMMAND...]" 81 "NEWROOT [COMMAND...]"
48#define chroot_full_usage \ 82#define chroot_full_usage \
49 "Run COMMAND with root directory set to NEWROOT." 83 "Run COMMAND with root directory set to NEWROOT."
84#define chroot_example_usage \
85 "$ ls -l /bin/ls\n" \
86 "lrwxrwxrwx 1 root root 12 Apr 13 00:46 /bin/ls -> /BusyBox\n" \
87 "$ mount /dev/hdc1 /mnt -t minix\n" \
88 "$ chroot /mnt\n" \
89 "$ ls -l /bin/ls\n" \
90 "-rwxr-xr-x 1 root root 40816 Feb 5 07:45 /bin/ls*\n"
50 91
51#define chvt_trivial_usage \ 92#define chvt_trivial_usage \
52 "N" 93 "N"
@@ -85,6 +126,11 @@
85 "\t-s\t\tOutput only the lines containing delimiter\n" \ 126 "\t-s\t\tOutput only the lines containing delimiter\n" \
86 "\t-f N\t\tPrint only these fields\n" \ 127 "\t-f N\t\tPrint only these fields\n" \
87 "\t-n\t\tIgnored" 128 "\t-n\t\tIgnored"
129#define cut_example_usage \
130 "$ echo "Hello world" | cut -f 1 -d ' '\n" \
131 "Hello\n" \
132 "$ echo "Hello world" | cut -f 2 -d ' '\n" \
133 "world\n"
88 134
89#define date_trivial_usage \ 135#define date_trivial_usage \
90 "[OPTION]... [+FORMAT]" 136 "[OPTION]... [+FORMAT]"
@@ -95,6 +141,9 @@
95 "\t-d STRING\tdisplay time described by STRING, not `now'\n" \ 141 "\t-d STRING\tdisplay time described by STRING, not `now'\n" \
96 "\t-s\t\tSets time described by STRING\n" \ 142 "\t-s\t\tSets time described by STRING\n" \
97 "\t-u\t\tPrints or sets Coordinated Universal Time" 143 "\t-u\t\tPrints or sets Coordinated Universal Time"
144#define date_example_usage \
145 "$ date\n" \
146 "Wed Apr 12 18:52:41 MDT 2000\n"
98 147
99#define dc_trivial_usage \ 148#define dc_trivial_usage \
100 "expression ..." 149 "expression ..."
@@ -102,6 +151,17 @@
102 "This is a Tiny RPN calculator that understands the\n" \ 151 "This is a Tiny RPN calculator that understands the\n" \
103 "following operations: +, -, /, *, and, or, not, eor.\n" \ 152 "following operations: +, -, /, *, and, or, not, eor.\n" \
104 "i.e. 'dc 2 2 add' -> 4, and 'dc 8 8 \\* 2 2 + /' -> 16" 153 "i.e. 'dc 2 2 add' -> 4, and 'dc 8 8 \\* 2 2 + /' -> 16"
154#define dc_example_usage \
155 "$ dc 2 2 +\n" \
156 "4\n" \
157 "$ dc 8 8 \* 2 2 + /\n" \
158 "16\n" \
159 "$ dc 0 1 and\n" \
160 "0\n" \
161 "$ dc 0 1 or\n" \
162 "1\n" \
163 "$ echo 72 9 div 8 mul | dc\n" \
164 "64\n"
105 165
106#define dd_trivial_usage \ 166#define dd_trivial_usage \
107 "[if=FILE] [of=FILE] [bs=N] [count=N] [skip=N]\n" \ 167 "[if=FILE] [of=FILE] [bs=N] [count=N] [skip=N]\n" \
@@ -119,6 +179,10 @@
119 "\n" \ 179 "\n" \
120 "Numbers may be suffixed by c (x1), w (x2), b (x512), kD (x1000), k (x1024),\n" \ 180 "Numbers may be suffixed by c (x1), w (x2), b (x512), kD (x1000), k (x1024),\n" \
121 "MD (x1000000), M (x1048576), GD (x1000000000) or G (x1073741824)." 181 "MD (x1000000), M (x1048576), GD (x1000000000) or G (x1073741824)."
182#define dd_example_usage \
183 "$ dd if=/dev/zero of=/dev/ram1 bs=1M count=4\n" \
184 "4+0 records in\n" \
185 "4+0 records out\n"
122 186
123#define deallocvt_trivial_usage \ 187#define deallocvt_trivial_usage \
124 "N" 188 "N"
@@ -143,11 +207,24 @@
143 "\t-m\tprint sizes in megabytes\n" \ 207 "\t-m\tprint sizes in megabytes\n" \
144 "\t-k\tprint sizes in kilobytes(default)") USAGE_NOT_HUMAN_READABLE( \ 208 "\t-k\tprint sizes in kilobytes(default)") USAGE_NOT_HUMAN_READABLE( \
145 "\n\t-k\tprint sizes in kilobytes(compatability)") 209 "\n\t-k\tprint sizes in kilobytes(compatability)")
210#define df_example_usage \
211 "$ df\n" \
212 "Filesystem 1k-blocks Used Available Use% Mounted on\n" \
213 "/dev/sda3 8690864 8553540 137324 98% /\n" \
214 "/dev/sda1 64216 36364 27852 57% /boot\n" \
215 "$ df /dev/sda3\n" \
216 "Filesystem 1k-blocks Used Available Use% Mounted on\n" \
217 "/dev/sda3 8690864 8553540 137324 98% /\n"
146 218
147#define dirname_trivial_usage \ 219#define dirname_trivial_usage \
148 "[FILENAME ...]" 220 "[FILENAME ...]"
149#define dirname_full_usage \ 221#define dirname_full_usage \
150 "Strips non-directory suffix from FILENAME" 222 "Strips non-directory suffix from FILENAME"
223#define dirname_example_usage \
224 "$ dirname /tmp/foo\n" \
225 "/tmp\n" \
226 "$ dirname /tmp/foo/\n" \
227 "/tmp\n"
151 228
152#define dmesg_trivial_usage \ 229#define dmesg_trivial_usage \
153 "[-c] [-n LEVEL] [-s SIZE]" 230 "[-c] [-n LEVEL] [-s SIZE]"
@@ -184,6 +261,8 @@
184 "\t-e\tExtract control files to directory\n" \ 261 "\t-e\tExtract control files to directory\n" \
185 "\t-x\tExctract packages filesystem tree to directory\n" \ 262 "\t-x\tExctract packages filesystem tree to directory\n" \
186 "\t-X\tVerbose extract" 263 "\t-X\tVerbose extract"
264#define dpkg_deb_example_usage \
265 "$ dpkg-deb -X ./busybox_0.48-1_i386.deb /tmp\n"
187 266
188#define du_trivial_usage \ 267#define du_trivial_usage \
189 "[-ls" USAGE_HUMAN_READABLE("hm") USAGE_NOT_HUMAN_READABLE("") "k] [FILE]..." 268 "[-ls" USAGE_HUMAN_READABLE("hm") USAGE_NOT_HUMAN_READABLE("") "k] [FILE]..."
@@ -198,17 +277,40 @@
198 "\t-m\tprint sizes in megabytes\n" \ 277 "\t-m\tprint sizes in megabytes\n" \
199 "\t-k\tprint sizes in kilobytes(default)") USAGE_NOT_HUMAN_READABLE( \ 278 "\t-k\tprint sizes in kilobytes(default)") USAGE_NOT_HUMAN_READABLE( \
200 "\n\t-k\tprint sizes in kilobytes(compatability)") 279 "\n\t-k\tprint sizes in kilobytes(compatability)")
280#define du_example_usage \
281 "$ du\n" \
282 "16 ./CVS\n" \
283 "12 ./kernel-patches/CVS\n" \
284 "80 ./kernel-patches\n" \
285 "12 ./tests/CVS\n" \
286 "36 ./tests\n" \
287 "12 ./scripts/CVS\n" \
288 "16 ./scripts\n" \
289 "12 ./docs/CVS\n" \
290 "104 ./docs\n" \
291 "2417 .\n"
201 292
202#define dumpkmap_trivial_usage \ 293#define dumpkmap_trivial_usage \
203 "> keymap" 294 "> keymap"
204#define dumpkmap_full_usage \ 295#define dumpkmap_full_usage \
205 "Prints out a binary keyboard translation table to standard output." 296 "Prints out a binary keyboard translation table to standard output."
297#define dumpkmap_example_usage \
298 "$ dumpkmap > keymap\n"
206 299
207#define dutmp_trivial_usage \ 300#define dutmp_trivial_usage \
208 "[FILE]" 301 "[FILE]"
209#define dutmp_full_usage \ 302#define dutmp_full_usage \
210 "Dump utmp file format (pipe delimited) from FILE\n" \ 303 "Dump utmp file format (pipe delimited) from FILE\n" \
211 "or stdin to stdout. (i.e. 'dutmp /var/run/utmp')" 304 "or stdin to stdout. (i.e. 'dutmp /var/run/utmp')"
305#define dutmp_example_usage \
306 "$ dutmp /var/run/utmp\n" \
307 "8|7||si|||0|0|0|955637625|760097|0\n" \
308 "2|0|~|~~|reboot||0|0|0|955637625|782235|0\n" \
309 "1|20020|~|~~|runlevel||0|0|0|955637625|800089|0\n" \
310 "8|125||l4|||0|0|0|955637629|998367|0\n" \
311 "6|245|tty1|1|LOGIN||0|0|0|955637630|998974|0\n" \
312 "6|246|tty2|2|LOGIN||0|0|0|955637630|999498|0\n" \
313 "7|336|pts/0|vt00andersen|andersen|:0.0|0|0|0|955637763|0|0\n"
212 314
213#define echo_trivial_usage \ 315#define echo_trivial_usage \
214 "[-neE] [ARG ...]" 316 "[-neE] [ARG ...]"
@@ -218,6 +320,15 @@
218 "\t-n\tsuppress trailing newline\n" \ 320 "\t-n\tsuppress trailing newline\n" \
219 "\t-e\tinterpret backslash-escaped characters (i.e. \\t=tab etc)\n" \ 321 "\t-e\tinterpret backslash-escaped characters (i.e. \\t=tab etc)\n" \
220 "\t-E\tdisable interpretation of backslash-escaped characters" 322 "\t-E\tdisable interpretation of backslash-escaped characters"
323#define echo_example_usage \
324 "$ echo "Erik is cool"\n" \
325 "Erik is cool\n" \
326 "$ echo -e "Erik\nis\ncool"\n" \
327 "Erik\n" \
328 "is\n" \
329 "cool\n" \
330 "$ echo "Erik\nis\ncool"\n" \
331 "Erik\nis\ncool\n"
221 332
222#define expr_trivial_usage \ 333#define expr_trivial_usage \
223 "EXPRESSION" 334 "EXPRESSION"
@@ -257,6 +368,24 @@
257 "" 368 ""
258#define false_full_usage \ 369#define false_full_usage \
259 "Return an exit code of FALSE (1)." 370 "Return an exit code of FALSE (1)."
371#define false_example_usage \
372 "$ false\n" \
373 "$ echo $?\n" \
374 "1\n"
375
376#define fbset_trivial_usage \
377 "[options] [mode]"
378#define fbset_full_usage \
379 "Show and modify frame buffer settings"
380#define fbset_example_usage \
381 "$ fbset\n" \
382 "mode "1024x768-76"\n" \
383 "\t# D: 78.653 MHz, H: 59.949 kHz, V: 75.694 Hz\n" \
384 "\tgeometry 1024 768 1024 768 16\n" \
385 "\ttimings 12714 128 32 16 4 128 4\n" \
386 "\taccel false\n" \
387 "\trgba 5/11,6/5,5/0,0/0\n" \
388 "endmode\n"
260 389
261#define fdflush_trivial_usage \ 390#define fdflush_trivial_usage \
262 "DEVICE" 391 "DEVICE"
@@ -293,16 +422,27 @@
293 "\n\t-perm PERMS\tPermissions match any of (+NNN); all of (-NNN);\n\t\t\tor exactly (NNN)" \ 422 "\n\t-perm PERMS\tPermissions match any of (+NNN); all of (-NNN);\n\t\t\tor exactly (NNN)" \
294) USAGE_FIND_MTIME( \ 423) USAGE_FIND_MTIME( \
295 "\n\t-mtime TIME\tModified time is greater than (+N); less than (-N);\n\t\t\tor exactly (N) days") 424 "\n\t-mtime TIME\tModified time is greater than (+N); less than (-N);\n\t\t\tor exactly (N) days")
425#define find_example_usage \
426 "$ find / -name /etc/passwd\n" \
427 "/etc/passwd\n"
296 428
297#define free_trivial_usage \ 429#define free_trivial_usage \
298 "" 430 ""
299#define free_full_usage \ 431#define free_full_usage \
300 "Displays the amount of free and used system memory" 432 "Displays the amount of free and used system memory"
433#define free_example_usage \
434 "$ free\n" \
435 " total used free shared buffers\n" \
436 " Mem: 257628 248724 8904 59644 93124\n" \
437 " Swap: 128516 8404 120112\n" \
438 "Total: 386144 257128 129016\n" \
301 439
302#define freeramdisk_trivial_usage \ 440#define freeramdisk_trivial_usage \
303 "DEVICE" 441 "DEVICE"
304#define freeramdisk_full_usage \ 442#define freeramdisk_full_usage \
305 "Frees all memory used by the specified ramdisk." 443 "Frees all memory used by the specified ramdisk."
444#define freeramdisk_example_usage \
445 "$ freeramdisk /dev/ram2\n"
306 446
307#define fsck_minix_trivial_usage \ 447#define fsck_minix_trivial_usage \
308 "[-larvsmf] /dev/name" 448 "[-larvsmf] /dev/name"
@@ -330,6 +470,26 @@
330 "\t-s, --shell=shell Set shell quoting conventions\n" \ 470 "\t-s, --shell=shell Set shell quoting conventions\n" \
331 "\t-T, --test Test for getopt(1) version\n" \ 471 "\t-T, --test Test for getopt(1) version\n" \
332 "\t-u, --unqote Do not quote the output" 472 "\t-u, --unqote Do not quote the output"
473#define getopt_example_usage \
474 "$ cat getopt.test\n" \
475 "#!/bin/sh\n" \
476 "GETOPT=`getopt -o ab:c:: --long a-long,b-long:,c-long:: \\\n" \
477 " -n 'example.busybox' -- "$@"`\n" \
478 "if [ $? != 0 ] ; then exit 1 ; fi\n" \
479 "eval set -- "$GETOPT"\n" \
480 "while true ; do\n" \
481 " case $1 in\n" \
482 " -a|--a-long) echo \"Option a\" ; shift ;;\n" \
483 " -b|--b-long) echo \"Option b, argument \`$2'\" ; shift 2 ;;\n" \
484 " -c|--c-long)\n" \
485 " case "$2" in\n" \
486 " \"\") echo \"Option c, no argument\"; shift 2 ;;\n" \
487 " *) echo \"Option c, argument \`$2'\" ; shift 2 ;;\n" \
488 " esac ;;\n" \
489 " --) shift ; break ;;\n" \
490 " *) echo \"Internal error!\" ; exit 1 ;;\n" \
491 " esac\n" \
492 "done\n"
333 493
334#define grep_trivial_usage \ 494#define grep_trivial_usage \
335 "[-ihHnqvs] pattern [files...]" 495 "[-ihHnqvs] pattern [files...]"
@@ -343,9 +503,11 @@
343 "\t-q\tbe quiet. Returns 0 if result was found, 1 otherwise\n" \ 503 "\t-q\tbe quiet. Returns 0 if result was found, 1 otherwise\n" \
344 "\t-v\tselect non-matching lines\n" \ 504 "\t-v\tselect non-matching lines\n" \
345 "\t-s\tsuppress file open/read error messages" 505 "\t-s\tsuppress file open/read error messages"
346 506#define grep_example_usage \
347#define egrep_trivial_usage grep_trivial_usage 507 "$ grep root /etc/passwd\n" \
348#define egrep_full_usage grep_full_usage 508 "root:x:0:0:root:/root:/bin/bash\n" \
509 "$ grep ^[rR]oo. /etc/passwd\n" \
510 "root:x:0:0:root:/root:/bin/bash\n"
349 511
350#define gunzip_trivial_usage \ 512#define gunzip_trivial_usage \
351 "[OPTION]... FILE" 513 "[OPTION]... FILE"
@@ -354,6 +516,12 @@
354 "Options:\n" \ 516 "Options:\n" \
355 "\t-c\tWrite output to standard output\n" \ 517 "\t-c\tWrite output to standard output\n" \
356 "\t-t\tTest compressed file integrity" 518 "\t-t\tTest compressed file integrity"
519#define gunzip_example_usage \
520 "$ ls -la /tmp/BusyBox*\n" \
521 "-rw-rw-r-- 1 andersen andersen 557009 Apr 11 10:55 /tmp/BusyBox-0.43.tar.gz\n" \
522 "$ gunzip /tmp/BusyBox-0.43.tar.gz\n" \
523 "$ ls -la /tmp/BusyBox*\n" \
524 "-rw-rw-r-- 1 andersen andersen 1761280 Apr 14 17:47 /tmp/BusyBox-0.43.tar\n"
357 525
358#define gzip_trivial_usage \ 526#define gzip_trivial_usage \
359 "[OPTION]... FILE" 527 "[OPTION]... FILE"
@@ -363,6 +531,12 @@
363 "Options:\n" \ 531 "Options:\n" \
364 "\t-c\tWrite output to standard output instead of FILE.gz\n" \ 532 "\t-c\tWrite output to standard output instead of FILE.gz\n" \
365 "\t-d\tdecompress" 533 "\t-d\tdecompress"
534#define gzip_example_usage \
535 "$ ls -la /tmp/BusyBox*\n" \
536 "-rw-rw-r-- 1 andersen andersen 1761280 Apr 14 17:47 /tmp/BusyBox-0.43.tar\n" \
537 "$ gzip /tmp/BusyBox-0.43.tar\n" \
538 "$ ls -la /tmp/BusyBox*\n" \
539 "-rw-rw-r-- 1 andersen andersen 554058 Apr 14 17:49 /tmp/BusyBox-0.43.tar.gz\n"
366 540
367#define halt_trivial_usage \ 541#define halt_trivial_usage \
368 "" 542 ""
@@ -377,6 +551,10 @@
377 "file name. With no FILE, or when FILE is -, read standard input.\n\n" \ 551 "file name. With no FILE, or when FILE is -, read standard input.\n\n" \
378 "Options:\n" \ 552 "Options:\n" \
379 "\t-n NUM\t\tPrint first NUM lines instead of first 10" 553 "\t-n NUM\t\tPrint first NUM lines instead of first 10"
554#define head_example_usage \
555 "$ head -n 2 /etc/passwd\n" \
556 "root:x:0:0:root:/root:/bin/bash\n" \
557 "daemon:x:1:1:daemon:/usr/sbin:/bin/sh\n"
380 558
381#define hostid_trivial_usage \ 559#define hostid_trivial_usage \
382 "" 560 ""
@@ -393,6 +571,9 @@
393 "\t-i\t\tAddresses for the hostname\n" \ 571 "\t-i\t\tAddresses for the hostname\n" \
394 "\t-d\t\tDNS domain name\n" \ 572 "\t-d\t\tDNS domain name\n" \
395 "\t-F, --file FILE\tUse the contents of FILE to specify the hostname" 573 "\t-F, --file FILE\tUse the contents of FILE to specify the hostname"
574#define hostname_example_usage \
575 "$ hostname\n" \
576 "slag \n"
396 577
397#define id_trivial_usage \ 578#define id_trivial_usage \
398 "[OPTIONS]... [USERNAME]" 579 "[OPTIONS]... [USERNAME]"
@@ -403,6 +584,9 @@
403 "\t-u\tprints only the user ID\n" \ 584 "\t-u\tprints only the user ID\n" \
404 "\t-n\tprint a name instead of a number (with for -ug)\n" \ 585 "\t-n\tprint a name instead of a number (with for -ug)\n" \
405 "\t-r\tprints the real user ID instead of the effective ID (with -ug)" 586 "\t-r\tprints the real user ID instead of the effective ID (with -ug)"
587#define id_example_usage \
588 "$ id\n" \
589 "uid=1000(andersen) gid=1000(andersen)\n"
406 590
407#ifdef BB_FEATURE_IFCONFIG_SLIP 591#ifdef BB_FEATURE_IFCONFIG_SLIP
408 #define USAGE_SIOCSKEEPALIVE(a) a 592 #define USAGE_SIOCSKEEPALIVE(a) a
@@ -443,8 +627,116 @@
443#define init_trivial_usage \ 627#define init_trivial_usage \
444 "" 628 ""
445#define init_full_usage \ 629#define init_full_usage \
446 "Init is the parent of all processes.\n\n" \ 630 "Init is the parent of all processes."
447 "This version of init is designed to be run only by the kernel." 631#define init_notes_usage \
632"This version of init is designed to be run only by the kernel.\n" \
633"\n" \
634"BusyBox init doesn't support multiple runlevels. The runlevels field of\n" \
635"the /etc/inittab file is completely ignored by BusyBox init. If you want \n" \
636"runlevels, use sysvinit.\n" \
637"\n" \
638"BusyBox init works just fine without an inittab. If no inittab is found, \n" \
639"it has the following default behavior:\n" \
640"\n" \
641" ::sysinit:/etc/init.d/rcS\n" \
642" ::askfirst:/bin/sh\n" \
643"\n" \
644"if it detects that /dev/console is _not_ a serial console, it will also run:\n" \
645"\n" \
646" tty2::askfirst:/bin/sh\n" \
647"\n" \
648"If you choose to use an /etc/inittab file, the inittab entry format is as follows:\n" \
649"\n" \
650" <id>:<runlevels>:<action>:<process>\n" \
651"\n" \
652" <id>: \n" \
653"\n" \
654" WARNING: This field has a non-traditional meaning for BusyBox init!\n" \
655" The id field is used by BusyBox init to specify the controlling tty for\n" \
656" the specified process to run on. The contents of this field are\n" \
657" appended to "/dev/" and used as-is. There is no need for this field to\n" \
658" be unique, although if it isn't you may have strange results. If this\n" \
659" field is left blank, the controlling tty is set to the console. Also\n" \
660" note that if BusyBox detects that a serial console is in use, then only\n" \
661" entries whose controlling tty is either the serial console or /dev/null\n" \
662" will be run. BusyBox init does nothing with utmp. We don't need no\n" \
663" stinkin' utmp.\n" \
664"\n" \
665" <runlevels>: \n" \
666"\n" \
667" The runlevels field is completely ignored.\n" \
668"\n" \
669" <action>: \n" \
670"\n" \
671" Valid actions include: sysinit, respawn, askfirst, wait, \n" \
672" once, and ctrlaltdel.\n" \
673"\n" \
674" The available actions can be classified into two groups: actions\n" \
675" that are run only once, and actions that are re-run when the specified\n" \
676" process exits.\n" \
677"\n" \
678" Run only-once actions:\n" \
679"\n" \
680" 'sysinit' is the first item run on boot. init waits until all\n" \
681" sysinit actions are completed before continuing. Following the\n" \
682" completion of all sysinit actions, all 'wait' actions are run.\n" \
683" 'wait' actions, like 'sysinit' actions, cause init to wait until\n" \
684" the specified task completes. 'once' actions are asyncronous,\n" \
685" therefore, init does not wait for them to complete. 'ctrlaltdel'\n" \
686" actions are run immediately before init causes the system to reboot\n" \
687" (unmounting filesystems with a 'ctrlaltdel' action is a very good\n" \
688" idea).\n" \
689"\n" \
690" Run repeatedly actions:\n" \
691"\n" \
692" 'respawn' actions are run after the 'once' actions. When a process\n" \
693" started with a 'respawn' action exits, init automatically restarts\n" \
694" it. Unlike sysvinit, BusyBox init does not stop processes from\n" \
695" respawning out of control. The 'askfirst' actions acts just like\n" \
696" respawn, except that before running the specified process it\n" \
697" displays the line "Please press Enter to activate this console."\n" \
698" and then waits for the user to press enter before starting the\n" \
699" specified process. \n" \
700"\n" \
701" Unrecognized actions (like initdefault) will cause init to emit an\n" \
702" error message, and then go along with its business. All actions are\n" \
703" run in the reverse order from how they appear in /etc/inittab.\n" \
704"\n" \
705" <process>: \n" \
706"\n" \
707" Specifies the process to be executed and it's command line.\n" \
708"\n" \
709"Example /etc/inittab file:\n" \
710" # This is run first except when booting in single-user mode.\n" \
711" #\n" \
712" ::sysinit:/etc/init.d/rcS\n" \
713" \n" \
714" # /bin/sh invocations on selected ttys\n" \
715" #\n" \
716" # Start an "askfirst" shell on the console (whatever that may be)\n" \
717" ::askfirst:-/bin/sh\n" \
718" # Start an "askfirst" shell on /dev/tty2-4\n" \
719" tty2::askfirst:-/bin/sh\n" \
720" tty3::askfirst:-/bin/sh\n" \
721" tty4::askfirst:-/bin/sh\n" \
722" \n" \
723" # /sbin/getty invocations for selected ttys\n" \
724" #\n" \
725" tty4::respawn:/sbin/getty 38400 tty5\n" \
726" tty5::respawn:/sbin/getty 38400 tty6\n" \
727" \n" \
728" \n" \
729" # Example of how to put a getty on a serial line (for a terminal)\n" \
730" #\n" \
731" #::respawn:/sbin/getty -L ttyS0 9600 vt100\n" \
732" #::respawn:/sbin/getty -L ttyS1 9600 vt100\n" \
733" #\n" \
734" # Example how to put a getty on a modem line.\n" \
735" #::respawn:/sbin/getty 57600 ttyS2\n" \
736" \n" \
737" # Stuff to do before rebooting\n" \
738" ::ctrlaltdel:/bin/umount -a -r\n" \
739" ::ctrlaltdel:/sbin/swapoff -a\n"
448 740
449#define insmod_trivial_usage \ 741#define insmod_trivial_usage \
450 "[OPTION]... MODULE [symbol=value]..." 742 "[OPTION]... MODULE [symbol=value]..."
@@ -463,6 +755,15 @@
463 "Send a signal (default is SIGTERM) to the specified process(es).\n\n"\ 755 "Send a signal (default is SIGTERM) to the specified process(es).\n\n"\
464 "Options:\n" \ 756 "Options:\n" \
465 "\t-l\tList all signal names and numbers." 757 "\t-l\tList all signal names and numbers."
758#define kill_example_usage \
759 "$ ps | grep apache\n" \
760 "252 root root S [apache]\n" \
761 "263 www-data www-data S [apache]\n" \
762 "264 www-data www-data S [apache]\n" \
763 "265 www-data www-data S [apache]\n" \
764 "266 www-data www-data S [apache]\n" \
765 "267 www-data www-data S [apache]\n" \
766 "$ kill 252\n"
466 767
467#define killall_trivial_usage \ 768#define killall_trivial_usage \
468 "[-signal] process-name [process-name ...]" 769 "[-signal] process-name [process-name ...]"
@@ -470,6 +771,8 @@
470 "Send a signal (default is SIGTERM) to the specified process(es).\n\n"\ 771 "Send a signal (default is SIGTERM) to the specified process(es).\n\n"\
471 "Options:\n" \ 772 "Options:\n" \
472 "\t-l\tList all signal names and numbers." 773 "\t-l\tList all signal names and numbers."
774#define killall_example_usage \
775 "$ killall apache\n"
473 776
474#define klogd_trivial_usage \ 777#define klogd_trivial_usage \
475 "-n" 778 "-n"
@@ -482,6 +785,9 @@
482 "STRING" 785 "STRING"
483#define length_full_usage \ 786#define length_full_usage \
484 "Prints out the length of the specified STRING." 787 "Prints out the length of the specified STRING."
788#define length_example_usage \
789 "$ length "Hello"\n" \
790 "5\n"
485 791
486#define ln_trivial_usage \ 792#define ln_trivial_usage \
487 "[OPTION] TARGET... LINK_NAME|DIRECTORY" 793 "[OPTION] TARGET... LINK_NAME|DIRECTORY"
@@ -492,21 +798,31 @@
492 "\t-s\tmake symbolic links instead of hard links\n" \ 798 "\t-s\tmake symbolic links instead of hard links\n" \
493 "\t-f\tremove existing destination files\n" \ 799 "\t-f\tremove existing destination files\n" \
494 "\t-n\tno dereference symlinks - treat like normal file" 800 "\t-n\tno dereference symlinks - treat like normal file"
801#define ln_example_usage \
802 "$ ln -s BusyBox /tmp/ls\n" \
803 "$ ls -l /tmp/ls\n" \
804 "lrwxrwxrwx 1 root root 7 Apr 12 18:39 ls -> BusyBox*\n"
495 805
496#define loadacm_trivial_usage \ 806#define loadacm_trivial_usage \
497 "< mapfile" 807 "< mapfile"
498#define loadacm_full_usage \ 808#define loadacm_full_usage \
499 "Loads an acm from standard input." 809 "Loads an acm from standard input."
810#define loadacm_example_usage \
811 "$ loadacm < /etc/i18n/acmname\n"
500 812
501#define loadfont_trivial_usage \ 813#define loadfont_trivial_usage \
502 "< font" 814 "< font"
503#define loadfont_full_usage \ 815#define loadfont_full_usage \
504 "Loads a console font from standard input." 816 "Loads a console font from standard input."
817#define loadfont_example_usage \
818 "$ loadfont < /etc/i18n/fontname\n"
505 819
506#define loadkmap_trivial_usage \ 820#define loadkmap_trivial_usage \
507 "< keymap" 821 "< keymap"
508#define loadkmap_full_usage \ 822#define loadkmap_full_usage \
509 "Loads a binary keyboard translation table from standard input." 823 "Loads a binary keyboard translation table from standard input."
824#define loadkmap_example_usage \
825 "$ loadkmap < /etc/i18n/lang-keymap\n"
510 826
511#define logger_trivial_usage \ 827#define logger_trivial_usage \
512 "[OPTION]... [MESSAGE]" 828 "[OPTION]... [MESSAGE]"
@@ -517,11 +833,16 @@
517 "\t-t\tLog using the specified tag (defaults to user name).\n" \ 833 "\t-t\tLog using the specified tag (defaults to user name).\n" \
518 "\t-p\tEnter the message with the specified priority.\n" \ 834 "\t-p\tEnter the message with the specified priority.\n" \
519 "\t\tThis may be numerical or a ``facility.level'' pair." 835 "\t\tThis may be numerical or a ``facility.level'' pair."
836#define logger_example_usage \
837 "$ logger "hello"\n"
520 838
521#define logname_trivial_usage \ 839#define logname_trivial_usage \
522 "" 840 ""
523#define logname_full_usage \ 841#define logname_full_usage \
524 "Print the name of the current user." 842 "Print the name of the current user."
843#define logname_example_usage \
844 "$ logname\n" \
845 "root\n"
525 846
526#define logread_trivial_usage \ 847#define logread_trivial_usage \
527 "" 848 ""
@@ -612,6 +933,11 @@
612 "For example:\n" \ 933 "For example:\n" \
613 "\tmakedevs /dev/ttyS c 4 66 2 63 -> ttyS2-ttyS63\n" \ 934 "\tmakedevs /dev/ttyS c 4 66 2 63 -> ttyS2-ttyS63\n" \
614 "\tmakedevs /dev/hda b 3 0 0 8 s -> hda,hda1-hda8" 935 "\tmakedevs /dev/hda b 3 0 0 8 s -> hda,hda1-hda8"
936#define makedevs_example_usage \
937 "$ makedevs /dev/ttyS c 4 66 2 63\n" \
938 "[creates ttyS2-ttyS63]\n" \
939 "$ makedevs /dev/hda b 3 0 0 8 s\n" \
940 "[creates hda,hda1-hda8]\n"
615 941
616#define md5sum_trivial_usage \ 942#define md5sum_trivial_usage \
617 "[OPTION] [FILE]...\n" \ 943 "[OPTION] [FILE]...\n" \
@@ -627,6 +953,15 @@
627 "\nThe following two options are useful only when verifying checksums:\n" \ 953 "\nThe following two options are useful only when verifying checksums:\n" \
628 "\t-s\tdon't output anything, status code shows success\n" \ 954 "\t-s\tdon't output anything, status code shows success\n" \
629 "\t-w\twarn about improperly formated MD5 checksum lines" 955 "\t-w\twarn about improperly formated MD5 checksum lines"
956#define md5sum_example_usage \
957 "$ md5sum < busybox\n" \
958 "6fd11e98b98a58f64ff3398d7b324003\n" \
959 "$ md5sum busybox\n" \
960 "6fd11e98b98a58f64ff3398d7b324003 busybox\n" \
961 "$ md5sum -c -\n" \
962 "6fd11e98b98a58f64ff3398d7b324003 busybox\n" \
963 "busybox: OK\n" \
964 "^D\n"
630 965
631#define mkdir_trivial_usage \ 966#define mkdir_trivial_usage \
632 "[OPTION] DIRECTORY..." 967 "[OPTION] DIRECTORY..."
@@ -635,6 +970,13 @@
635 "Options:\n" \ 970 "Options:\n" \
636 "\t-m\tset permission mode (as in chmod), not rwxrwxrwx - umask\n" \ 971 "\t-m\tset permission mode (as in chmod), not rwxrwxrwx - umask\n" \
637 "\t-p\tno error if existing, make parent directories as needed" 972 "\t-p\tno error if existing, make parent directories as needed"
973#define mkdir_example_usage \
974 "$ mkdir /tmp/foo\n" \
975 "$ mkdir /tmp/foo\n" \
976 "/tmp/foo: File exists\n" \
977 "$ mkdir /tmp/foo/bar/baz\n" \
978 "/tmp/foo/bar/baz: No such file or directory\n" \
979 "$ mkdir -p /tmp/foo/bar/baz\n"
638 980
639#define mkfifo_trivial_usage \ 981#define mkfifo_trivial_usage \
640 "[OPTIONS] name" 982 "[OPTIONS] name"
@@ -664,6 +1006,9 @@
664 "\tb:\tMake a block (buffered) device.\n" \ 1006 "\tb:\tMake a block (buffered) device.\n" \
665 "\tc or u:\tMake a character (un-buffered) device.\n" \ 1007 "\tc or u:\tMake a character (un-buffered) device.\n" \
666 "\tp:\tMake a named pipe. MAJOR and MINOR are ignored for named pipes." 1008 "\tp:\tMake a named pipe. MAJOR and MINOR are ignored for named pipes."
1009#define mknod_example_usage \
1010 "$ mknod /dev/fd0 b 2 0 \n" \
1011 "$ mknod -m 644 /tmp/pipe p\n"
667 1012
668#define mkswap_trivial_usage \ 1013#define mkswap_trivial_usage \
669 "[-c] [-v0|-v1] device [block-count]" 1014 "[-c] [-v0|-v1] device [block-count]"
@@ -680,11 +1025,18 @@
680#define mktemp_full_usage \ 1025#define mktemp_full_usage \
681 "Creates a temporary file with its name based on TEMPLATE.\n" \ 1026 "Creates a temporary file with its name based on TEMPLATE.\n" \
682 "TEMPLATE is any name with six `Xs' (i.e. /tmp/temp.XXXXXX)." 1027 "TEMPLATE is any name with six `Xs' (i.e. /tmp/temp.XXXXXX)."
1028#define mktemp_example_usage \
1029 "$ mktemp /tmp/temp.XXXXXX\n" \
1030 "/tmp/temp.mWiLjM\n" \
1031 "$ ls -la /tmp/temp.mWiLjM\n" \
1032 "-rw------- 1 andersen andersen 0 Apr 25 17:10 /tmp/temp.mWiLjM\n"
683 1033
684#define more_trivial_usage \ 1034#define more_trivial_usage \
685 "[FILE ...]" 1035 "[FILE ...]"
686#define more_full_usage \ 1036#define more_full_usage \
687 "More is a filter for viewing FILE one screenful at a time." 1037 "More is a filter for viewing FILE one screenful at a time."
1038#define more_example_usage \
1039 "$ dmesg | more\n"
688 1040
689#ifdef BB_FEATURE_MOUNT_LOOP 1041#ifdef BB_FEATURE_MOUNT_LOOP
690 #define USAGE_MOUNT_LOOP(a) a 1042 #define USAGE_MOUNT_LOOP(a) a
@@ -724,6 +1076,13 @@
724 "\tro/rw:\t\tMount for read-only / read-write.\n" \ 1076 "\tro/rw:\t\tMount for read-only / read-write.\n" \
725 "\nThere are EVEN MORE flags that are specific to each filesystem.\n" \ 1077 "\nThere are EVEN MORE flags that are specific to each filesystem.\n" \
726 "You'll have to see the written documentation for those." 1078 "You'll have to see the written documentation for those."
1079#define mount_example_usage \
1080 "$ mount\n" \
1081 "/dev/hda3 on / type minix (rw)\n" \
1082 "proc on /proc type proc (rw)\n" \
1083 "devpts on /dev/pts type devpts (rw)\n" \
1084 "$ mount /dev/fd0 /mnt -t msdos -o ro\n" \
1085 "$ mount /tmp/diskimage /opt -t ext2 -o loop\n"
727 1086
728#define mt_trivial_usage \ 1087#define mt_trivial_usage \
729 "[-f device] opcode value" 1088 "[-f device] opcode value"
@@ -740,16 +1099,34 @@
740 "or: mv SOURCE... DIRECTORY" 1099 "or: mv SOURCE... DIRECTORY"
741#define mv_full_usage \ 1100#define mv_full_usage \
742 "Rename SOURCE to DEST, or move SOURCE(s) to DIRECTORY." 1101 "Rename SOURCE to DEST, or move SOURCE(s) to DIRECTORY."
1102#define mv_example_usage \
1103 "$ mv /tmp/foo /bin/bar\n"
743 1104
744#define nc_trivial_usage \ 1105#define nc_trivial_usage \
745 "[IP] [port]" 1106 "[IP] [port]"
746#define nc_full_usage \ 1107#define nc_full_usage \
747 "Netcat opens a pipe to IP:port" 1108 "Netcat opens a pipe to IP:port"
1109#define nc_example_usage \
1110 "$ nc foobar.somedomain.com 25\n" \
1111 "220 foobar ESMTP Exim 3.12 #1 Sat, 15 Apr 2000 00:03:02 -0600\n" \
1112 "help\n" \
1113 "214-Commands supported:\n" \
1114 "214- HELO EHLO MAIL RCPT DATA AUTH\n" \
1115 "214 NOOP QUIT RSET HELP\n" \
1116 "quit\n" \
1117 "221 foobar closing connection\n"
748 1118
749#define nslookup_trivial_usage \ 1119#define nslookup_trivial_usage \
750 "[HOST]" 1120 "[HOST]"
751#define nslookup_full_usage \ 1121#define nslookup_full_usage \
752 "Queries the nameserver for the IP address of the given HOST" 1122 "Queries the nameserver for the IP address of the given HOST"
1123#define nslookup_example_usage \
1124 "$ nslookup localhost\n" \
1125 "Server: default\n" \
1126 "Address: default\n" \
1127 "\n" \
1128 "Name: debian\n" \
1129 "Address: 127.0.0.1\n"
753 1130
754#ifdef BB_FEATURE_SIMPLE_PING 1131#ifdef BB_FEATURE_SIMPLE_PING
755#define ping_trivial_usage "host" 1132#define ping_trivial_usage "host"
@@ -765,6 +1142,14 @@
765 "\t-q\t\tQuiet mode, only displays output at start\n" \ 1142 "\t-q\t\tQuiet mode, only displays output at start\n" \
766 "\t\t\tand when finished." 1143 "\t\t\tand when finished."
767#endif 1144#endif
1145#define ping_example_usage \
1146 "$ ping localhost\n" \
1147 "PING slag (127.0.0.1): 56 data bytes\n" \
1148 "64 bytes from 127.0.0.1: icmp_seq=0 ttl=255 time=20.1 ms\n" \
1149 "\n" \
1150 "--- debian ping statistics ---\n" \
1151 "1 packets transmitted, 1 packets received, 0% packet loss\n" \
1152 "round-trip min/avg/max = 20.1/20.1/20.1 ms\n"
768 1153
769#define pivot_root_trivial_usage \ 1154#define pivot_root_trivial_usage \
770 "new_root put_old" 1155 "new_root put_old"
@@ -782,17 +1167,35 @@
782#define printf_full_usage \ 1167#define printf_full_usage \
783 "Formats and prints ARGUMENT(s) according to FORMAT,\n" \ 1168 "Formats and prints ARGUMENT(s) according to FORMAT,\n" \
784 "Where FORMAT controls the output exactly as in C printf." 1169 "Where FORMAT controls the output exactly as in C printf."
1170#define printf_example_usage \
1171 "$ printf "Val=%d\n" 5\n" \
1172 "Val=5\n"
785 1173
786#define ps_trivial_usage \ 1174#define ps_trivial_usage \
787 "" 1175 ""
788#define ps_full_usage \ 1176#define ps_full_usage \
789 "Report process status\n" \ 1177 "Report process status\n" \
790 "\nThis version of ps accepts no options." 1178 "\nThis version of ps accepts no options."
1179#define ps_example_usage \
1180 "$ ps\n" \
1181 " PID Uid Gid State Command\n" \
1182 " 1 root root S init\n" \
1183 " 2 root root S [kflushd]\n" \
1184 " 3 root root S [kupdate]\n" \
1185 " 4 root root S [kpiod]\n" \
1186 " 5 root root S [kswapd]\n" \
1187 " 742 andersen andersen S [bash]\n" \
1188 " 743 andersen andersen S -bash\n" \
1189 " 745 root root S [getty]\n" \
1190 " 2990 andersen andersen R ps\n"
791 1191
792#define pwd_trivial_usage \ 1192#define pwd_trivial_usage \
793 "" 1193 ""
794#define pwd_full_usage \ 1194#define pwd_full_usage \
795 "Print the full filename of the current working directory." 1195 "Print the full filename of the current working directory."
1196#define pwd_example_usage \
1197 "$ pwd\n" \
1198 "/root\n"
796 1199
797#define rdate_trivial_usage \ 1200#define rdate_trivial_usage \
798 "[OPTION] HOST" 1201 "[OPTION] HOST"
@@ -838,11 +1241,15 @@
838 USAGE_RM_INTERACTIVE("\t-i\t\talways prompt before removing each destinations\n") \ 1241 USAGE_RM_INTERACTIVE("\t-i\t\talways prompt before removing each destinations\n") \
839 "\t-f\t\tremove existing destinations, never prompt\n" \ 1242 "\t-f\t\tremove existing destinations, never prompt\n" \
840 "\t-r or -R\tremove the contents of directories recursively" 1243 "\t-r or -R\tremove the contents of directories recursively"
1244#define rm_example_usage \
1245 "$ rm -rf /tmp/foo\n"
841 1246
842#define rmdir_trivial_usage \ 1247#define rmdir_trivial_usage \
843 "[OPTION]... DIRECTORY..." 1248 "[OPTION]... DIRECTORY..."
844#define rmdir_full_usage \ 1249#define rmdir_full_usage \
845 "Remove the DIRECTORY(ies), if they are empty." 1250 "Remove the DIRECTORY(ies), if they are empty."
1251#define rmdir_example_usage \
1252 "# rmdir /tmp/foo\n"
846 1253
847#define rmmod_trivial_usage \ 1254#define rmmod_trivial_usage \
848 "[OPTION]... [MODULE]..." 1255 "[OPTION]... [MODULE]..."
@@ -850,6 +1257,8 @@
850 "Unloads the specified kernel modules from the kernel.\n\n" \ 1257 "Unloads the specified kernel modules from the kernel.\n\n" \
851 "Options:\n" \ 1258 "Options:\n" \
852 "\t-a\tTry to remove all unused kernel modules." 1259 "\t-a\tTry to remove all unused kernel modules."
1260#define rmmod_example_usage \
1261 "$ rmmod tulip\n"
853 1262
854#define route_trivial_usage \ 1263#define route_trivial_usage \
855 "[{add|del|flush}]" 1264 "[{add|del|flush}]"
@@ -873,6 +1282,9 @@
873 "If no -e or -f is given, the first non-option argument is taken as the\n" \ 1282 "If no -e or -f is given, the first non-option argument is taken as the\n" \
874 "sed script to interpret. All remaining arguments are names of input\n" \ 1283 "sed script to interpret. All remaining arguments are names of input\n" \
875 "files; if no input files are specified, then the standard input is read." 1284 "files; if no input files are specified, then the standard input is read."
1285#define sed_example_usage \
1286 "$ echo "foo" | sed -e 's/f[a-zA-Z]o/bar/g'\n" \
1287 "bar\n"
876 1288
877#define setkeycodes_trivial_usage \ 1289#define setkeycodes_trivial_usage \
878 "SCANCODE KEYCODE ..." 1290 "SCANCODE KEYCODE ..."
@@ -881,17 +1293,31 @@
881 "allowing unusual keyboards to generate usable keycodes.\n\n" \ 1293 "allowing unusual keyboards to generate usable keycodes.\n\n" \
882 "SCANCODE may be either xx or e0xx (hexadecimal),\n" \ 1294 "SCANCODE may be either xx or e0xx (hexadecimal),\n" \
883 "and KEYCODE is given in decimal" 1295 "and KEYCODE is given in decimal"
1296#define setkeycodes_example_usage \
1297 "$ setkeycodes e030 127\n"
884 1298
885#define sh_trivial_usage \ 1299#define sh_trivial_usage \
886 "[FILE]...\n" \ 1300 "[FILE]...\n" \
887 "or: sh -c command [args]..." 1301 "or: sh -c command [args]..."
888#define sh_full_usage \ 1302#define sh_full_usage \
889 "lash: The BusyBox command interpreter (shell)." 1303 "lash: The BusyBox LAme SHell (command interpreter)"
1304#define sh_notes_usage \
1305"This command does not yet have proper documentation.\n" \
1306"\n" \
1307"Use lash just as you would use any other shell. It properly handles pipes,\n" \
1308"redirects, job control, can be used as the shell for scripts, and has a\n" \
1309"sufficient set of builtins to do what is needed. It does not (yet) support\n" \
1310"Bourne Shell syntax. If you need things like "if-then-else", "while", and such\n" \
1311"use ash or bash. If you just need a very simple and extremely small shell,\n" \
1312"this will do the job."
890 1313
891#define sleep_trivial_usage \ 1314#define sleep_trivial_usage \
892 "N" 1315 "N"
893#define sleep_full_usage \ 1316#define sleep_full_usage \
894 "Pause for N seconds." 1317 "Pause for N seconds."
1318#define sleep_example_usage \
1319 "$ sleep 2\n" \
1320 "[2 second delay results]\n"
895 1321
896 1322
897#ifdef BB_FEATURE_SORT_REVERSE 1323#ifdef BB_FEATURE_SORT_REVERSE
@@ -903,6 +1329,14 @@
903 "[-n]" USAGE_SORT_REVERSE(" [-r]") " [FILE]..." 1329 "[-n]" USAGE_SORT_REVERSE(" [-r]") " [FILE]..."
904#define sort_full_usage \ 1330#define sort_full_usage \
905 "Sorts lines of text in the specified files" 1331 "Sorts lines of text in the specified files"
1332#define sort_example_usage \
1333 "$ echo -e "e\nf\nb\nd\nc\na" | sort\n" \
1334 "a\n" \
1335 "b\n" \
1336 "c\n" \
1337 "d\n" \
1338 "e\n" \
1339 "f\n"
906 1340
907#define stty_trivial_usage \ 1341#define stty_trivial_usage \
908 "[-a|g] [-F device] [SETTING]..." 1342 "[-a|g] [-F device] [SETTING]..."
@@ -952,6 +1386,9 @@
952 USAGE_REMOTE_LOG( \ 1386 USAGE_REMOTE_LOG( \
953 "\n\t-R HOST[:PORT]\tLog to IP or hostname on PORT (default PORT=514/UDP)\n" \ 1387 "\n\t-R HOST[:PORT]\tLog to IP or hostname on PORT (default PORT=514/UDP)\n" \
954 "\t-L\t\tLog locally and via network logging (default is network only)") 1388 "\t-L\t\tLog locally and via network logging (default is network only)")
1389#define syslogd_example_usage \
1390 "$ syslogd -R masterlog:514\n" \
1391 "$ syslogd -R 192.168.1.1:601\n"
955 1392
956 1393
957#ifdef BB_FEATURE_SIMPLE_TAIL 1394#ifdef BB_FEATURE_SIMPLE_TAIL
@@ -969,14 +1406,15 @@
969 USAGE_UNSIMPLE_TAIL("\t-c N[kbm]\toutput the last N bytes\n") \ 1406 USAGE_UNSIMPLE_TAIL("\t-c N[kbm]\toutput the last N bytes\n") \
970 "\t-n N[kbm]\tprint last N lines instead of last 10\n" \ 1407 "\t-n N[kbm]\tprint last N lines instead of last 10\n" \
971 "\t-f\t\toutput data as the file grows" \ 1408 "\t-f\t\toutput data as the file grows" \
972 USAGE_UNSIMPLE_TAIL( \ 1409 USAGE_UNSIMPLE_TAIL( "\n\t-q\t\tnever output headers giving file names\n" \
973 "\n\t-q\t\tnever output headers giving file names\n" \
974 "\t-s SEC\t\twait SEC seconds between reads with -f\n" \ 1410 "\t-s SEC\t\twait SEC seconds between reads with -f\n" \
975 "\t-v\t\talways output headers giving file names\n\n" \ 1411 "\t-v\t\talways output headers giving file names\n\n" \
976 "If the first character of N (bytes or lines) is a `+', output begins with \n" \ 1412 "If the first character of N (bytes or lines) is a '+', output begins with \n" \
977 "the Nth item from the start of each file, otherwise, print the last N items\n" \ 1413 "the Nth item from the start of each file, otherwise, print the last N items\n" \
978 "in the file. N bytes may be suffixed by k (x1024), b (x512), or m (1024^2)." \ 1414 "in the file. N bytes may be suffixed by k (x1024), b (x512), or m (1024^2)." )
979 ) 1415#define tail_example_usage \
1416 "$ tail -n 1 /etc/resolv.conf\n" \
1417 "nameserver 10.0.0.1\n"
980 1418
981#ifdef BB_FEATURE_TAR_CREATE 1419#ifdef BB_FEATURE_TAR_CREATE
982 #define USAGE_TAR_CREATE(a) a 1420 #define USAGE_TAR_CREATE(a) a
@@ -1007,6 +1445,9 @@
1007 ) \ 1445 ) \
1008 "\nInformative output:\n" \ 1446 "\nInformative output:\n" \
1009 "\tv\t\tverbosely list files processed" 1447 "\tv\t\tverbosely list files processed"
1448#define tar_example_usage \
1449 "$ zcat /tmp/tarball.tar.gz | tar -xf -\n" \
1450 "$ tar -cf /tmp/tarball.tar /usr/local\n"
1010 1451
1011#define tee_trivial_usage \ 1452#define tee_trivial_usage \
1012 "[OPTION]... [FILE]..." 1453 "[OPTION]... [FILE]..."
@@ -1014,6 +1455,10 @@
1014 "Copy standard input to each FILE, and also to standard output.\n\n" \ 1455 "Copy standard input to each FILE, and also to standard output.\n\n" \
1015 "Options:\n" \ 1456 "Options:\n" \
1016 "\t-a\tappend to the given FILEs, do not overwrite" 1457 "\t-a\tappend to the given FILEs, do not overwrite"
1458#define tee_example_usage \
1459 "$ echo "Hello" | tee /tmp/foo\n" \
1460 "$ cat /tmp/foo\n" \
1461 "Hello\n"
1017 1462
1018#define telnet_trivial_usage \ 1463#define telnet_trivial_usage \
1019 "host [port]" 1464 "host [port]"
@@ -1026,6 +1471,19 @@
1026#define test_full_usage \ 1471#define test_full_usage \
1027 "Checks file types and compares values returning an exit\n" \ 1472 "Checks file types and compares values returning an exit\n" \
1028 "code determined by the value of EXPRESSION." 1473 "code determined by the value of EXPRESSION."
1474#define test_example_usage \
1475 "$ test 1 -eq 2\n" \
1476 "$ echo $?\n" \
1477 "1\n" \
1478 "$ test 1 -eq 1\n" \
1479 "$ echo $? \n" \
1480 "0\n" \
1481 "$ [ -d /etc ]\n" \
1482 "$ echo $?\n" \
1483 "0\n" \
1484 "$ [ -d /junk ]\n" \
1485 "$ echo $?\n" \
1486 "1\n"
1029 1487
1030#ifdef BB_FEATURE_TFTP_GET 1488#ifdef BB_FEATURE_TFTP_GET
1031 #define USAGE_TFTP_GET(a) a 1489 #define USAGE_TFTP_GET(a) a
@@ -1057,6 +1515,12 @@
1057 "Update the last-modified date on the given file[s].\n\n" \ 1515 "Update the last-modified date on the given file[s].\n\n" \
1058 "Options:\n" \ 1516 "Options:\n" \
1059 "\t-c\tDo not create any files" 1517 "\t-c\tDo not create any files"
1518#define touch_example_usage \
1519 "$ ls -l /tmp/foo\n" \
1520 "/bin/ls: /tmp/foo: No such file or directory\n" \
1521 "$ touch /tmp/foo\n" \
1522 "$ ls -l /tmp/foo\n" \
1523 "-rw-rw-r-- 1 andersen andersen 0 Apr 15 01:11 /tmp/foo\n"
1060 1524
1061#define tr_trivial_usage \ 1525#define tr_trivial_usage \
1062 "[-cds] STRING1 [STRING2]" 1526 "[-cds] STRING1 [STRING2]"
@@ -1067,11 +1531,18 @@
1067 "\t-c\ttake complement of STRING1\n" \ 1531 "\t-c\ttake complement of STRING1\n" \
1068 "\t-d\tdelete input characters coded STRING1\n" \ 1532 "\t-d\tdelete input characters coded STRING1\n" \
1069 "\t-s\tsqueeze multiple output characters of STRING2 into one character" 1533 "\t-s\tsqueeze multiple output characters of STRING2 into one character"
1534#define tr_example_usage \
1535 "$ echo "gdkkn vnqkc" | tr [a-y] [b-z]\n" \
1536 "hello world\n"
1070 1537
1071#define true_trivial_usage \ 1538#define true_trivial_usage \
1072 "" 1539 ""
1073#define true_full_usage \ 1540#define true_full_usage \
1074 "Return an exit code of TRUE (0)." 1541 "Return an exit code of TRUE (0)."
1542#define true_example_usage \
1543 "$ true\n" \
1544 "$ echo $?\n" \
1545 "0\n"
1075 1546
1076#define tty_trivial_usage \ 1547#define tty_trivial_usage \
1077 "" 1548 ""
@@ -1079,6 +1550,9 @@
1079 "Print the file name of the terminal connected to standard input.\n\n"\ 1550 "Print the file name of the terminal connected to standard input.\n\n"\
1080 "Options:\n" \ 1551 "Options:\n" \
1081 "\t-s\tprint nothing, only return an exit status" 1552 "\t-s\tprint nothing, only return an exit status"
1553#define tty_example_usage \
1554 "$ tty\n" \
1555 "/dev/tty2\n"
1082 1556
1083#ifdef BB_FEATURE_MOUNT_FORCE 1557#ifdef BB_FEATURE_MOUNT_FORCE
1084 #define USAGE_MOUNT_FORCE(a) a 1558 #define USAGE_MOUNT_FORCE(a) a
@@ -1094,6 +1568,8 @@
1094 "\n\t-r:\tTry to remount devices as read-only if mount is busy" \ 1568 "\n\t-r:\tTry to remount devices as read-only if mount is busy" \
1095 USAGE_MOUNT_FORCE("\n\t-f:\tForce filesystem umount (i.e. unreachable NFS server)") \ 1569 USAGE_MOUNT_FORCE("\n\t-f:\tForce filesystem umount (i.e. unreachable NFS server)") \
1096 USAGE_MOUNT_LOOP("\n\t-l:\tDo not free loop device (if a loop device has been used)") 1570 USAGE_MOUNT_LOOP("\n\t-l:\tDo not free loop device (if a loop device has been used)")
1571#define umount_example_usage \
1572 "$ umount /dev/hdc1 \n"
1097 1573
1098#define uname_trivial_usage \ 1574#define uname_trivial_usage \
1099 "[OPTION]..." 1575 "[OPTION]..."
@@ -1107,6 +1583,9 @@
1107 "\t-s\tprint the operating system name\n" \ 1583 "\t-s\tprint the operating system name\n" \
1108 "\t-p\tprint the host processor type\n" \ 1584 "\t-p\tprint the host processor type\n" \
1109 "\t-v\tprint the operating system version" 1585 "\t-v\tprint the operating system version"
1586#define uname_example_usage \
1587 "$ uname -a\n" \
1588 "Linux debian 2.2.15pre13 #5 Tue Mar 14 16:03:50 MST 2000 i686 unknown\n"
1110 1589
1111#define uniq_trivial_usage \ 1590#define uniq_trivial_usage \
1112 "[OPTION]... [INPUT [OUTPUT]]" 1591 "[OPTION]... [INPUT [OUTPUT]]"
@@ -1117,6 +1596,11 @@
1117 "\t-c\tprefix lines by the number of occurrences\n" \ 1596 "\t-c\tprefix lines by the number of occurrences\n" \
1118 "\t-d\tonly print duplicate lines\n" \ 1597 "\t-d\tonly print duplicate lines\n" \
1119 "\t-u\tonly print unique lines" 1598 "\t-u\tonly print unique lines"
1599#define uniq_example_usage \
1600 "$ echo -e "a\na\nb\nc\nc\na" | sort | uniq\n" \
1601 "a\n" \
1602 "b\n" \
1603 "c\n"
1120 1604
1121#define unix2dos_trivial_usage \ 1605#define unix2dos_trivial_usage \
1122 "[option] [file]" 1606 "[option] [file]"
@@ -1136,11 +1620,17 @@
1136 "" 1620 ""
1137#define uptime_full_usage \ 1621#define uptime_full_usage \
1138 "Display the time since the last boot." 1622 "Display the time since the last boot."
1623#define uptime_example_usage \
1624 "$ uptime\n" \
1625 " 1:55pm up 2:30, load average: 0.09, 0.04, 0.00\n"
1139 1626
1140#define usleep_trivial_usage \ 1627#define usleep_trivial_usage \
1141 "N" 1628 "N"
1142#define usleep_full_usage \ 1629#define usleep_full_usage \
1143 "Pause for N microseconds." 1630 "Pause for N microseconds."
1631#define usleep_example_usage \
1632 "$ usleep 1000000\n" \
1633 "[pauses for 1 second]\n"
1144 1634
1145#define uudecode_trivial_usage \ 1635#define uudecode_trivial_usage \
1146 "[FILE]..." 1636 "[FILE]..."
@@ -1148,6 +1638,10 @@
1148 "Uudecode a file that is uuencoded.\n\n" \ 1638 "Uudecode a file that is uuencoded.\n\n" \
1149 "Options:\n" \ 1639 "Options:\n" \
1150 "\t-o FILE\tdirect output to FILE" \ 1640 "\t-o FILE\tdirect output to FILE" \
1641#define uudecode_example_usage \
1642 "$ uudecode -o busybox busybox.uu\n" \
1643 "$ ls -l busybox\n" \
1644 "-rwxr-xr-x 1 ams ams 245264 Jun 7 21:35 busybox\n"
1151 1645
1152#define uuencode_trivial_usage \ 1646#define uuencode_trivial_usage \
1153 "[OPTION] [INFILE] REMOTEFILE" 1647 "[OPTION] [INFILE] REMOTEFILE"
@@ -1155,6 +1649,12 @@
1155 "Uuencode a file.\n\n" \ 1649 "Uuencode a file.\n\n" \
1156 "Options:\n" \ 1650 "Options:\n" \
1157 "\t-m\tuse base64 encoding as of RFC1521" 1651 "\t-m\tuse base64 encoding as of RFC1521"
1652#define uuencode_example_usage \
1653 "$ uuencode busybox busybox\n" \
1654 "begin 755 busybox\n" \
1655 "<encoded file snipped>\n" \
1656 "$ uudecode busybox busybox > busybox.uu\n" \
1657 "$\n"
1158 1658
1159#define watchdog_trivial_usage \ 1659#define watchdog_trivial_usage \
1160 "DEV" 1660 "DEV"
@@ -1171,6 +1671,9 @@
1171 "\t-l\tprint the newline counts\n" \ 1671 "\t-l\tprint the newline counts\n" \
1172 "\t-L\tprint the length of the longest line\n" \ 1672 "\t-L\tprint the length of the longest line\n" \
1173 "\t-w\tprint the word counts" 1673 "\t-w\tprint the word counts"
1674#define wc_example_usage \
1675 "$ wc /etc/passwd\n" \
1676 " 31 46 1365 /etc/passwd\n"
1174 1677
1175#define wget_trivial_usage \ 1678#define wget_trivial_usage \
1176 "[-c] [-O file] url" 1679 "[-c] [-O file] url"
@@ -1184,6 +1687,9 @@
1184 "[COMMAND ...]" 1687 "[COMMAND ...]"
1185#define which_full_usage \ 1688#define which_full_usage \
1186 "Locates a COMMAND." 1689 "Locates a COMMAND."
1690#define which_example_usage \
1691 "$ which login\n" \
1692 "/bin/login\n"
1187 1693
1188#define whoami_trivial_usage \ 1694#define whoami_trivial_usage \
1189 "" 1695 ""
@@ -1194,11 +1700,14 @@
1194 "[COMMAND] [ARGS...]" 1700 "[COMMAND] [ARGS...]"
1195#define xargs_full_usage \ 1701#define xargs_full_usage \
1196 "Executes COMMAND on every item given by standard input." 1702 "Executes COMMAND on every item given by standard input."
1703#define xargs_example_usage \
1704 "$ ls | xargs gzip\n" \
1705 "$ find . -name '*.c' -print | xargs rm\n"
1197 1706
1198#define yes_trivial_usage \ 1707#define yes_trivial_usage \
1199 "[OPTION]... [STRING]..." 1708 "[OPTION]... [STRING]..."
1200#define yes_full_usage \ 1709#define yes_full_usage \
1201 "Repeatedly outputs a line with all specified STRING(s), or `y'." 1710 "Repeatedly outputs a line with all specified STRING(s), or 'y'."
1202 1711
1203#define zcat_trivial_usage \ 1712#define zcat_trivial_usage \
1204 "FILE" 1713 "FILE"
diff --git a/docs/autodocifier.pl b/docs/autodocifier.pl
index 9e18dc3c8..e967568e1 100755
--- a/docs/autodocifier.pl
+++ b/docs/autodocifier.pl
@@ -62,6 +62,11 @@ sub pod_for_usage {
62 } 62 }
63 my $full = join("\n", @f1); 63 my $full = join("\n", @f1);
64 64
65 # prepare notes if they exists
66 my $notes = (defined $usage->{notes})
67 ? "$usage->{notes}\n\n"
68 : "";
69
65 # prepare example if one exists 70 # prepare example if one exists
66 my $example = (defined $usage->{example}) 71 my $example = (defined $usage->{example})
67 ? "Example:\n\n$usage->{example}\n\n" 72 ? "Example:\n\n$usage->{example}\n\n"
@@ -74,6 +79,7 @@ sub pod_for_usage {
74 "\n\n" . 79 "\n\n" .
75 $full . 80 $full .
76 "\n\n" . 81 "\n\n" .
82 $notes .
77 $example. 83 $example.
78 "-------------------------------". 84 "-------------------------------".
79 "\n\n" 85 "\n\n"
@@ -216,4 +222,4 @@ John BEPPU <beppu@lineo.com>
216 222
217=cut 223=cut
218 224
219# $Id: autodocifier.pl,v 1.14 2001/03/06 19:25:25 beppu Exp $ 225# $Id: autodocifier.pl,v 1.15 2001/03/15 18:14:25 andersen Exp $
diff --git a/docs/busybox.pod b/docs/busybox.pod
index 4c0810234..d7786dd22 100644
--- a/docs/busybox.pod
+++ b/docs/busybox.pod
@@ -55,766 +55,789 @@ terse runtime description of their behavior.
55 55
56Currently defined functions include: 56Currently defined functions include:
57 57
58ar, basename, cat, chgrp, chmod, chown, chroot, chvt, clear, cp, cut, date, dc, 58ar, basename, busybox, cat, chgrp, chmod, chown, chroot, chvt, clear, cmp, cp,
59dd, deallocvt, df, dirname, dmesg, dos2unix, dpkg-deb, du, dumpkmap, dutmp, 59cut, date, dc, dd, deallocvt, df, dirname, dmesg, dos2unix, dpkg, dpkg-deb, du,
60echo, false, fbset, fdflush, find, free, freeramdisk, fsck.minix, getopt, grep, 60dumpkmap, dutmp, echo, expr, false, fbset, fdflush, find, free, freeramdisk,
61gunzip, gzip, halt, head, hostid, hostname, id, init, insmod, kill, killall, 61fsck.minix, getopt, grep, gunzip, gzip, halt, head, hostid, hostname, id,
62length, ln, loadacm, loadfont, loadkmap, logger, logname, ls, lsmod, makedevs, 62ifconfig, init, insmod, kill, killall, klogd, length, ln, loadacm, loadfont,
63mkdir, mkfifo, mkfs.minix, mknod, mkswap, mktemp, more, mount, mt, mv, nc, 63loadkmap, logger, logname, ls, lsmod, makedevs, md5sum, mkdir, mkfifo,
64nslookup, ping, poweroff, printf, ps, pwd, rdate, reboot, renice, reset, rm, 64mkfs.minix, mknod, mkswap, mktemp, more, mount, mt, mv, nc, nslookup, ping,
65rmdir, rmmod, sed, setkeycodes, sh, sleep, sort, swapoff, swapon, sync, 65pivot_root, poweroff, printf, ps, pwd, rdate, readlink, reboot, renice, reset,
66syslogd, tail, tar, tee, telnet, test, touch, tr, true, tty, umount, uname, 66rm, rmdir, rmmod, route, rpmunpack, sed, setkeycodes, sh, sleep, sort, stty,
67uniq, unix2dos, unrpm, update, uptime, usleep, uudecode, uuencode, watchdog, 67swapoff, swapon, sync, syslogd, tail, tar, tee, telnet, test, tftp, touch, tr,
68wc, which, whoami, xargs, yes, zcat, [ 68true, tty, umount, uname, uniq, unix2dos, update, uptime, usleep, uudecode,
69uuencode, watchdog, wc, wget, which, whoami, xargs, yes, zcat, [
69 70
70------------------------------- 71-------------------------------
71 72
72=over 4 73=over 4
73 74
74=item ar
75 75
76Usage: ar [optxvV] archive [filenames] 76=item I<ar>
77
78ar -[ovR]{ptx} archive filenames
77 79
78Extract or list files from an ar archive. 80Extract or list files from an ar archive.
79 81
80Options: 82Options:
81 83
82 o preserve original dates 84 -o preserve original dates
83 p extract to stdout 85 -p extract to stdout
84 t list 86 -t list
85 x extract 87 -x extract
86 v verbosely list files processed 88 -v verbosely list files processed
89 -R recursive action
87 90
88------------------------------- 91-------------------------------
89 92
90=item basename 93=item I<basename>
91 94
92Usage: basename FILE [SUFFIX] 95basename FILE [SUFFIX]
93 96
94Strips directory path and suffixes from FILE. 97Strips directory path and suffixes from FILE.
95If specified, also removes any trailing SUFFIX. 98If specified, also removes any trailing SUFFIX.
96 99
97Example: 100Example:
98 101
99 $ basename /usr/local/bin/foo 102$ basename /usr/local/bin/foo
100 foo 103foo
101 $ basename /usr/local/bin/ 104$ basename /usr/local/bin/
102 bin 105bin
103 $ basename /foo/bar.txt .txt 106$ basename /foo/bar.txt .txt
104 bar 107bar
105 108
106------------------------------- 109-------------------------------
107 110
108=item cat 111=item I<cat>
109 112
110Usage: cat [FILE ...] 113cat [FILE]...
111 114
112Concatenates FILE(s) and prints them to the standard output. 115Concatenates FILE(s) and prints them to stdout.
113 116
114Example: 117Example:
115 118
116 $ cat /proc/uptime 119$ cat /proc/uptime
117 110716.72 17.67 120110716.72 17.67
118 121
119------------------------------- 122-------------------------------
120 123
121=item chgrp 124=item I<chgrp>
122 125
123Usage: chgrp [OPTION]... GROUP FILE... 126chgrp [OPTION]... GROUP FILE...
124 127
125Change the group membership of each FILE to GROUP. 128Change the group membership of each FILE to GROUP.
126 129
127Options: 130Options:
128 131
129 -R change files and directories recursively 132 -R Changes files and directories recursively.
130 133
131Example: 134Example:
132 135
133 $ ls -l /tmp/foo 136$ ls -l /tmp/foo
134 -r--r--r-- 1 andersen andersen 0 Apr 12 18:25 /tmp/foo 137-r--r--r-- 1 andersen andersen 0 Apr 12 18:25 /tmp/foo
135 $ chgrp root /tmp/foo 138$ chgrp root /tmp/foo
136 $ ls -l /tmp/foo 139$ ls -l /tmp/foo
137 -r--r--r-- 1 andersen root 0 Apr 12 18:25 /tmp/foo 140-r--r--r-- 1 andersen root 0 Apr 12 18:25 /tmp/foo
138
139-------------------------------
140
141=item chmod
142
143Usage: chmod [B<-R>] MODE[,MODE]... FILE...
144
145Changes file access permissions for the specified FILE(s) (or directories).
146Each MODE is defined by combining the letters for WHO has access to the file,
147an OPERATOR for selecting how the permissions should be changed, and a
148PERMISSION for FILE(s) (or directories).
149
150WHO may be chosen from
151
152 u User who owns the file
153 g Users in the file's Group
154 o Other users not in the file's group
155 a All users
156 141
157OPERATOR may be chosen from
158 142
159 + Add a permission 143-------------------------------
160 - Remove a permission
161 = Assign a permission
162
163PERMISSION may be chosen from
164
165 r Read
166 w Write
167 x Execute (or access for directories)
168 s Set user (or group) ID bit
169 t Sticky bit (for directories prevents removing files by non-owners)
170
171Alternately, permissions can be set numerically where the first three
172numbers are calculated by adding the octal values, such as
173 144
174 4 Read 145=item I<chmod>
175 2 Write
176 1 Execute
177 146
178An optional fourth digit can also be used to specify 147chmod [B<-R>] MODE[,MODE]... FILE...
179 148
180 4 Set user ID 149Each MODE is one or more of the letters ugoa, one of the
181 2 Set group ID 150symbols +-= and one or more of the letters rwxst.
182 1 Sticky bit
183 151
184Options: 152Options:
185 153
186 -R Change files and directories recursively. 154 -R Changes files and directories recursively.
187 155
188Example: 156Example:
189 157
190 $ ls -l /tmp/foo 158$ ls -l /tmp/foo
191 -rw-rw-r-- 1 root root 0 Apr 12 18:25 /tmp/foo 159-rw-rw-r-- 1 root root 0 Apr 12 18:25 /tmp/foo
192 $ chmod u+x /tmp/foo 160$ chmod u+x /tmp/foo
193 $ ls -l /tmp/foo 161$ ls -l /tmp/foo
194 -rwxrw-r-- 1 root root 0 Apr 12 18:25 /tmp/foo* 162-rwxrw-r-- 1 root root 0 Apr 12 18:25 /tmp/foo*
195 $ chmod 444 /tmp/foo 163$ chmod 444 /tmp/foo
196 $ ls -l /tmp/foo 164$ ls -l /tmp/foo
197 -r--r--r-- 1 root root 0 Apr 12 18:25 /tmp/foo 165-r--r--r-- 1 root root 0 Apr 12 18:25 /tmp/foo
166
198 167
199------------------------------- 168-------------------------------
200 169
201=item chown 170=item I<chown>
202 171
203Usage: chown [OPTION]... OWNER[<.|:>[GROUP] FILE... 172chown [OPTION]... OWNER[<.|:>[GROUP] FILE...
204 173
205Changes the owner and/or group of each FILE to OWNER and/or GROUP. 174Change the owner and/or group of each FILE to OWNER and/or GROUP.
206 175
207Options: 176Options:
208 177
209 -R Changes files and directories recursively 178 -R Changes files and directories recursively.
210 179
211Example: 180Example:
212 181
213 $ ls -l /tmp/foo 182$ ls -l /tmp/foo
214 -r--r--r-- 1 andersen andersen 0 Apr 12 18:25 /tmp/foo 183-r--r--r-- 1 andersen andersen 0 Apr 12 18:25 /tmp/foo
215 $ chown root /tmp/foo 184$ chown root /tmp/foo
216 $ ls -l /tmp/foo 185$ ls -l /tmp/foo
217 -r--r--r-- 1 root andersen 0 Apr 12 18:25 /tmp/foo 186-r--r--r-- 1 root andersen 0 Apr 12 18:25 /tmp/foo
218 $ chown root.root /tmp/foo 187$ chown root.root /tmp/foo
219 ls -l /tmp/foo 188ls -l /tmp/foo
220 -r--r--r-- 1 root root 0 Apr 12 18:25 /tmp/foo 189-r--r--r-- 1 root root 0 Apr 12 18:25 /tmp/foo
190
221 191
222------------------------------- 192-------------------------------
223 193
224=item chroot 194=item I<chroot>
225 195
226Usage: chroot NEWROOT [COMMAND...] 196chroot NEWROOT [COMMAND...]
227 197
228Run COMMAND with root directory set to NEWROOT. 198Run COMMAND with root directory set to NEWROOT.
229 199
230Example: 200Example:
231 201
232 $ ls -l /bin/ls 202$ ls -l /bin/ls
233 lrwxrwxrwx 1 root root 12 Apr 13 00:46 /bin/ls -> /BusyBox 203lrwxrwxrwx 1 root root 12 Apr 13 00:46 /bin/ls -> /BusyBox
234 $ mount /dev/hdc1 /mnt -t minix 204$ mount /dev/hdc1 /mnt -t minix
235 $ chroot /mnt 205$ chroot /mnt
236 $ ls -l /bin/ls 206$ ls -l /bin/ls
237 -rwxr-xr-x 1 root root 40816 Feb 5 07:45 /bin/ls* 207-rwxr-xr-x 1 root root 40816 Feb 5 07:45 /bin/ls*
208
238 209
239------------------------------- 210-------------------------------
240 211
241=item chvt 212=item I<chvt>
242 213
243Usage: chvt N 214chvt N
244 215
245Changes the foreground virtual terminal to /dev/ttyN 216Changes the foreground virtual terminal to /dev/ttyN
246 217
247------------------------------- 218-------------------------------
248 219
249=item clear 220=item I<clear>
221
222clear
250 223
251Clears the screen. 224Clear screen.
252 225
253------------------------------- 226-------------------------------
254 227
255=item cp 228=item I<cmp>
256 229
257Usage: cp [OPTION]... SOURCE DEST 230cmp FILE1 [FILE2]
258 231
259 or: cp [OPTION]... SOURCE... DIRECTORY 232Compare files.
260 233
261Copies SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY. 234-------------------------------
262 235
263Options: 236=item I<cp>
237
238cp [OPTION]... SOURCE DEST
264 239
265 -a Same as -dpR 240Copies SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY.
266 -d Preserves links 241
267 -p Preserves file attributes if possible 242 -a Same as -dpR
268 -R Copies directories recursively 243 -d Preserves links
244 -p Preserves file attributes if possible
245 -f force (implied; ignored) - always set
246 -R Copies directories recursively
269 247
270------------------------------- 248-------------------------------
271 249
272=item cut 250=item I<cut>
273 251
274Usage: cut [OPTION]... [FILE]... 252cut [OPTION]... [FILE]...
275 253
276Prints selected fields from each input FILE to standard output. 254Prints selected fields from each input FILE to standard output.
277 255
278Options: 256Options:
279 257
280 -b LIST Output only bytes from LIST 258 -b LIST Output only bytes from LIST
281 -c LIST Output only characters from LIST 259 -c LIST Output only characters from LIST
282 -d CHAR Use CHAR instead of tab as the field delimiter 260 -d CHAR Use CHAR instead of tab as the field delimiter
283 -s Output only the lines containing delimiter 261 -s Output only the lines containing delimiter
284 -f N Print only these fields 262 -f N Print only these fields
285 -n Ignored 263 -n Ignored
286 264
287Example: 265Example:
288 266
289 $ echo "Hello world" | cut -f 1 -d ' ' 267$ echo Hello world | cut -f 1 -d ' '
290 Hello 268Hello
291 $ echo "Hello world" | cut -f 2 -d ' ' 269$ echo Hello world | cut -f 2 -d ' '
292 world 270world
293 271
294 272
295------------------------------- 273-------------------------------
296 274
297=item date 275=item I<date>
298 276
299Usage: date [OPTION]... [+FORMAT] 277date [OPTION]... [+FORMAT]
300
301 or: date [OPTION] [MMDDhhmm[[CC]YY][.ss]]
302 278
303Displays the current time in the given FORMAT, or sets the system date. 279Displays the current time in the given FORMAT, or sets the system date.
304 280
305Options: 281Options:
306 282
307 -R Outputs RFC-822 compliant date string 283 -R Outputs RFC-822 compliant date string
308 -s Sets time described by STRING 284 -d STRING display time described by STRING, not `now'
309 -u Prints or sets Coordinated Universal Time 285 -s Sets time described by STRING
286 -u Prints or sets Coordinated Universal Time
310 287
311Example: 288Example:
312 289
313 $ date 290$ date
314 Wed Apr 12 18:52:41 MDT 2000 291Wed Apr 12 18:52:41 MDT 2000
292
315 293
316------------------------------- 294-------------------------------
317 295
318=item dc 296=item I<dc>
319 297
320Usage: dc expression ... 298dc expression ...
321 299
322This is a Tiny RPN calculator that understands the 300This is a Tiny RPN calculator that understands the
323following operations: +, -, /, *, and, or, not, eor. 301following operations: +, -, /, *, and, or, not, eor.
324If no arguments are given, dc will process input from STDIN. 302i.e. 'dc 2 2 add' -> 4, and 'dc 8 8 \* 2 2 + /' -> 16
325
326The behaviour of BusyBox/dc deviates (just a little ;-) from
327GNU/dc, but this will be remedied in the future.
328 303
329Example: 304Example:
330 305
331 $ dc 2 2 + 306$ dc 2 2 +
332 4 3074
333 $ dc 8 8 \* 2 2 + / 308$ dc 8 8 * 2 2 + /
334 16 30916
335 $ dc 0 1 and 310$ dc 0 1 and
336 0 3110
337 $ dc 0 1 or 312$ dc 0 1 or
338 1 3131
339 $ echo 72 9 div 8 mul | dc 314$ echo 72 9 div 8 mul | dc
340 64 31564
316
341 317
342------------------------------- 318-------------------------------
343 319
344=item dd 320=item I<dd>
345 321
346Usage: dd [if=name] [of=name] [bs=n] [count=n] [skip=n] [seek=n] 322dd [if=FILE] [of=FILE] [bs=N] [count=N] [skip=N]
323 [seek=N] [conv=notrunc|sync]
347 324
348Copy a file, converting and formatting according to options 325Copy a file, converting and formatting according to options
349 326
350 if=FILE read from FILE instead of stdin 327 if=FILE read from FILE instead of stdin
351 of=FILE write to FILE instead of stdout 328 of=FILE write to FILE instead of stdout
352 bs=n read and write n bytes at a time 329 bs=N read and write N bytes at a time
353 count=n copy only n input blocks 330 count=N copy only N input blocks
354 skip=n skip n input blocks 331 skip=N skip N input blocks
355 seek=n skip n output blocks 332 seek=N skip N output blocks
333 conv=notrunc don't truncate output file
334 conv=sync pad blocks with zeros
356 335
357Numbers may be suffixed by w (x2), k (x1024), b (x512), or M (x1024^2) 336Numbers may be suffixed by c (x1), w (x2), b (x512), kD (x1000), k (x1024),
337MD (x1000000), M (x1048576), GD (x1000000000) or G (x1073741824).
358 338
359Example: 339Example:
360 340
361 $ dd if=/dev/zero of=/dev/ram1 bs=1M count=4 341$ dd if=/dev/zero of=/dev/ram1 bs=1M count=4
362 4+0 records in 3424+0 records in
363 4+0 records out 3434+0 records out
344
364 345
365------------------------------- 346-------------------------------
366 347
367=item deallocvt 348=item I<deallocvt>
368 349
369Usage: deallocvt N 350deallocvt N
370 351
371Deallocates unused virtual terminal /dev/ttyN 352Deallocate unused virtual terminal /dev/ttyN
372 353
373------------------------------- 354-------------------------------
374 355
375=item df 356=item I<df>
376 357
377Usage: df [filesystem ...] 358df [B<-hmk>] [filesystem ...]
378 359
379Prints the filesystem space used and space available. 360Print the filesystem space used and space available.
361
362Options:
363
364 -h print sizes in human readable format (e.g., 1K 243M 2G )
365 -m print sizes in megabytes
366 -k print sizes in kilobytes(default)
380 367
381Example: 368Example:
382 369
383 $ df 370$ df
384 Filesystem 1k-blocks Used Available Use% Mounted on 371Filesystem 1k-blocks Used Available Use% Mounted on
385 /dev/sda3 8690864 8553540 137324 98% / 372/dev/sda3 8690864 8553540 137324 98% /
386 /dev/sda1 64216 36364 27852 57% /boot 373/dev/sda1 64216 36364 27852 57% /boot
387 $ df /dev/sda3 374$ df /dev/sda3
388 Filesystem 1k-blocks Used Available Use% Mounted on 375Filesystem 1k-blocks Used Available Use% Mounted on
389 /dev/sda3 8690864 8553540 137324 98% / 376/dev/sda3 8690864 8553540 137324 98% /
377
390 378
391------------------------------- 379-------------------------------
392 380
393=item dirname 381=item I<dirname>
394 382
395Usage: dirname NAME 383dirname [FILENAME ...]
396 384
397Strip non-directory suffix from file name 385Strips non-directory suffix from FILENAME
398 386
399Example: 387Example:
400 388
401 $ dirname /tmp/foo 389$ dirname /tmp/foo
402 /tmp 390/tmp
403 $ dirname /tmp/foo/ 391$ dirname /tmp/foo/
404 /tmp 392/tmp
393
405 394
406------------------------------- 395-------------------------------
407 396
408=item dmesg 397=item I<dmesg>
398
399dmesg [B<-c>] [B<-n> LEVEL] [B<-s> SIZE]
409 400
410Usage: dmesg [B<-c>] [B<-n> level] [B<-s> bufsize] 401Prints or controls the kernel ring buffer
402
403Options:
411 404
412Print or controls the kernel ring buffer. 405 -c Clears the ring buffer's contents after printing
406 -n LEVEL Sets console logging level
407 -s SIZE Use a buffer of size SIZE
413 408
414------------------------------- 409-------------------------------
415 410
416=item dos2unix 411=item I<dos2unix>
412
413dos2unix [option] [file]
414
415Converts a text file to/from dos format to unix format.
416
417Options:
417 418
418Usage: dos2unix < dosfile > unixfile 419 -u output will be in UNIX format
420 -d output will be in DOS format
419 421
420Converts a text file from dos format to unix format. 422- when no option is given then input format will be automaticaly detected
423
424 and converted to the oposite format on output
425- when no file is given, then stdin is used as input and stdout as output
421 426
422------------------------------- 427-------------------------------
423 428
424=item dpkg-deb 429=item I<dpkg>
425 430
426Usage: dpkg-deb [-cexX] archive-file [directory] 431dpkg [B<-i>|B<-r>|-B<-unpack>|-B<-configure>] my.deb
427 432
428Debian package archive (.deb) manipulation tool 433WORK IN PROGRESS, only usefull for debian-installer
429 434
430Options: 435-------------------------------
431 436
432 -c Lists the contents of the filesystem tree archive 437=item I<dpkg_deb>
433 portion of the package archive.
434 438
435 -e Extracts the control information files from a package 439dpkg_deb [B<-cexX>] file directory
436 archive into the specified directory. 440
437 441Perform actions on debian packages (.debs)
438 -x Silently extracts the filesystem tree from a package 442
439 archive into the specified directory. 443Options:
440 444
441 -X Extracts the filesystem tree from a package archive 445 -c List contents of filesystem tree (verbose)
442 into the specified directory, list files as it goes. 446 -l List contents of filesystem tree (.list format)
447 -e Extract control files to directory
448 -x Exctract packages filesystem tree to directory
449 -X Verbose extract
443 450
444Example: 451Example:
445 452
446 dpkg-deb -X ./busybox_0.48-1_i386.deb /tmp 453$ dpkg-deb -X ./busybox_0.48-1_i386.deb /tmp
454
447 455
448------------------------------- 456-------------------------------
449 457
450=item du 458=item I<du>
451 459
452Usage: du [OPTION]... [FILE]... 460du [B<-lshmk>] [FILE]...
453 461
454Summarize disk space used for each FILE and/or directory. 462Summarizes disk space used for each FILE and/or directory.
455Disk space is printed in units of 1k (i.e. 1024 bytes). 463Disk space is printed in units of 1024 bytes.
456 464
457Options: 465Options:
458 466
459 -l count sizes many times if hard linked 467 -l count sizes many times if hard linked
460 -s display only a total for each argument 468 -s display only a total for each argument
469 -h print sizes in human readable format (e.g., 1K 243M 2G )
470 -m print sizes in megabytes
471 -k print sizes in kilobytes(default)
461 472
462Example: 473Example:
463 474
464 $ ./BusyBox du 475$ du
465 16 ./CVS 47616 ./CVS
466 12 ./kernel-patches/CVS 47712 ./kernel-patches/CVS
467 80 ./kernel-patches 47880 ./kernel-patches
468 12 ./tests/CVS 47912 ./tests/CVS
469 36 ./tests 48036 ./tests
470 12 ./scripts/CVS 48112 ./scripts/CVS
471 16 ./scripts 48216 ./scripts
472 12 ./docs/CVS 48312 ./docs/CVS
473 104 ./docs 484104 ./docs
474 2417 . 4852417 .
486
475 487
476------------------------------- 488-------------------------------
477 489
478=item dumpkmap 490=item I<dumpkmap>
479 491
480Usage: dumpkmap 492dumpkmap > keymap
481 493
482Prints out a binary keyboard translation table to standard output. 494Prints out a binary keyboard translation table to standard output.
483 495
484Example: 496Example:
485 497
486 $ dumpkmap > keymap 498$ dumpkmap > keymap
499
487 500
488------------------------------- 501-------------------------------
489 502
490=item dutmp 503=item I<dutmp>
491 504
492Usage: dutmp [FILE] 505dutmp [FILE]
493 506
494Dump utmp file format (pipe delimited) from FILE 507Dump utmp file format (pipe delimited) from FILE
495or stdin to stdout. 508or stdin to stdout. (i.e. 'dutmp /var/run/utmp')
496 509
497Example: 510Example:
498 511
499 $ dutmp /var/run/utmp 512$ dutmp /var/run/utmp
500 8|7||si|||0|0|0|955637625|760097|0 5138|7||si|||0|0|0|955637625|760097|0
501 2|0|~|~~|reboot||0|0|0|955637625|782235|0 5142|0|~|~~|reboot||0|0|0|955637625|782235|0
502 1|20020|~|~~|runlevel||0|0|0|955637625|800089|0 5151|20020|~|~~|runlevel||0|0|0|955637625|800089|0
503 8|125||l4|||0|0|0|955637629|998367|0 5168|125||l4|||0|0|0|955637629|998367|0
504 6|245|tty1|1|LOGIN||0|0|0|955637630|998974|0 5176|245|tty1|1|LOGIN||0|0|0|955637630|998974|0
505 6|246|tty2|2|LOGIN||0|0|0|955637630|999498|0 5186|246|tty2|2|LOGIN||0|0|0|955637630|999498|0
506 7|336|pts/0|vt00andersen|andersen|:0.0|0|0|0|955637763|0|0 5197|336|pts/0|vt00andersen|andersen|:0.0|0|0|0|955637763|0|0
520
507 521
508------------------------------- 522-------------------------------
509 523
510=item echo 524=item I<echo>
511 525
512Usage: echo [-neE] [ARG ...] 526echo [B<-neE>] [ARG ...]
513 527
514Prints the specified ARGs to stdout 528Prints the specified ARGs to stdout
515 529
516Options: 530Options:
517 531
518 -n suppress trailing newline 532 -n suppress trailing newline
519 -e interpret backslash-escaped characters (i.e. \t=tab etc) 533 -e interpret backslash-escaped characters (i.e. \t=tab etc)
520 -E disable interpretation of backslash-escaped characters 534 -E disable interpretation of backslash-escaped characters
521 535
522Example: 536Example:
523 537
524 $ echo "Erik is cool" 538$ echo Erik is cool
525 Erik is cool 539Erik is cool
526 $ echo -e "Erik\nis\ncool" 540$ echo -e Erik
527 Erik 541is
528 is 542cool
529 cool 543Erik
530 $ echo "Erik\nis\ncool" 544is
531 Erik\nis\ncool 545cool
546$ echo Erik
547is
548cool
549Erik
550is
551cool
552
532 553
533------------------------------- 554-------------------------------
534 555
535=item expr 556=item I<egrep>
557
558egrep
536 559
537 560
538Usage: expr EXPRESSION 561
562-------------------------------
563
564=item I<expr>
565
566expr EXPRESSION
539 567
540Prints the value of EXPRESSION to standard output. 568Prints the value of EXPRESSION to standard output.
541 569
542EXPRESSION may be: 570EXPRESSION may be:
543 571
544 ARG1 | ARG2 ARG1 if it is neither null nor 0, otherwise ARG2 572 ARG1 | ARG2 ARG1 if it is neither null nor 0, otherwise ARG2
545 ARG1 & ARG2 ARG1 if neither argument is null or 0, otherwise 0 573 ARG1 & ARG2 ARG1 if neither argument is null or 0, otherwise 0
546 ARG1 < ARG2 ARG1 is less than ARG2 574 ARG1 < ARG2 ARG1 is less than ARG2
547 ARG1 <= ARG2 ARG1 is less than or equal to ARG2 575 ARG1 <= ARG2 ARG1 is less than or equal to ARG2
548 ARG1 = ARG2 ARG1 is equal to ARG2 576 ARG1 = ARG2 ARG1 is equal to ARG2
549 ARG1 != ARG2 ARG1 is unequal to ARG2 577 ARG1 != ARG2 ARG1 is unequal to ARG2
550 ARG1 >= ARG2 ARG1 is greater than or equal to ARG2 578 ARG1 >= ARG2 ARG1 is greater than or equal to ARG2
551 ARG1 > ARG2 ARG1 is greater than ARG2 579 ARG1 > ARG2 ARG1 is greater than ARG2
552 ARG1 + ARG2 arithmetic sum of ARG1 and ARG2 580 ARG1 + ARG2 arithmetic sum of ARG1 and ARG2
553 ARG1 - ARG2 arithmetic difference of ARG1 and ARG2 581 ARG1 - ARG2 arithmetic difference of ARG1 and ARG2
554 ARG1 * ARG2 arithmetic product of ARG1 and ARG2 582 ARG1 * ARG2 arithmetic product of ARG1 and ARG2
555 ARG1 / ARG2 arithmetic quotient of ARG1 divided by ARG2 583 ARG1 / ARG2 arithmetic quotient of ARG1 divided by ARG2
556 ARG1 % ARG2 arithmetic remainder of ARG1 divided by ARG2 584 ARG1 % ARG2 arithmetic remainder of ARG1 divided by ARG2
557 STRING : REGEXP anchored pattern match of REGEXP in STRING 585 STRING : REGEXP anchored pattern match of REGEXP in STRING
558 match STRING REGEXP same as STRING : REGEXP 586 match STRING REGEXP same as STRING : REGEXP
559 substr STRING POS LENGTH substring of STRING, POS counted from 1 587 substr STRING POS LENGTH substring of STRING, POS counted from 1
560 index STRING CHARS index in STRING where any CHARS is found, or 0 588 index STRING CHARS index in STRING where any CHARS is found,
589 or 0
561 length STRING length of STRING 590 length STRING length of STRING
562 quote TOKEN interpret TOKEN as a string, even if it is a 591 quote TOKEN interpret TOKEN as a string, even if
563 keyword like `match' or an operator like `/' 592 it is a keyword like `match' or an
593 operator like `/'
564 ( EXPRESSION ) value of EXPRESSION 594 ( EXPRESSION ) value of EXPRESSION
565 595
566Beware that many operators need to be escaped or quoted for shells. 596Beware that many operators need to be escaped or quoted for shells.
567Comparisons are arithmetic if both ARGs are numbers, else 597Comparisons are arithmetic if both ARGs are numbers, else
568lexicographical. Pattern matches return the string matched between 598lexicographical. Pattern matches return the string matched between
569\( and \) or null; if \( and \) are not used, they return the number 599\( and \) or null; if \( and \) are not used, they return the number
570of characters matched or 0. 600of characters matched or 0.
571 601
572------------------------------- 602-------------------------------
573 603
574=item false 604=item I<false>
575 605
576Returns an exit code of FALSE (1) 606false
577 607
578Example: 608Return an exit code of FALSE (1).
579 609
580 $ false 610Example:
581 $ echo $?
582 1
583 611
584------------------------------- 612$ false
613$ echo $?
6141
585 615
586=item fbset
587 616
588Usage: fbset [options] [mode] 617-------------------------------
589 618
590Show and modify frame buffer device settings 619=item I<fbset>
591 620
592Options: 621fbset [options] [mode]
593 622
594 -h 623Show and modify frame buffer settings
595 -fb
596 -db
597 -a
598 -i
599 -g
600 -t
601 -accel
602 -hsync
603 -vsync
604 -laced
605 -double
606 624
607Example: 625Example:
608 626
609 $ fbset 627$ fbset
610 mode "1024x768-76" 628mode 1024x768-76
611 # D: 78.653 MHz, H: 59.949 kHz, V: 75.694 Hz 629 geometry 1024 768 1024 768 16
612 geometry 1024 768 1024 768 16 630 timings 12714 128 32 16 4 128 4
613 timings 12714 128 32 16 4 128 4 631 accel false
614 accel false 632 rgba 5/11,6/5,5/0,0/0
615 rgba 5/11,6/5,5/0,0/0 633endmode
616 endmode 634
617 635
618------------------------------- 636-------------------------------
619 637
620=item fdflush 638=item I<fdflush>
621 639
622Usage: fdflush device 640fdflush DEVICE
623 641
624Force floppy disk drive to detect disk change 642Forces floppy disk drive to detect disk change
625 643
626------------------------------- 644-------------------------------
627 645
628=item find 646=item I<find>
629 647
630Usage: find [PATH...] [EXPRESSION] 648find [PATH...] [EXPRESSION]
631 649
632Search for files in a directory hierarchy. The default PATH is 650Search for files in a directory hierarchy. The default PATH is
633the current directory; default EXPRESSION is '-print' 651the current directory; default EXPRESSION is 'B<-print>'
634
635 652
636EXPRESSION may consist of: 653EXPRESSION may consist of:
637 654
638 -follow Dereference symbolic links. 655 -follow Dereference symbolic links.
639 -name PATTERN File name (leading directories removed) matches PATTERN. 656 -name PATTERN File name (leading directories removed) matches PATTERN.
640 -print print the full file name followed by a newline to stdout. 657 -type X Filetype matches X (where X is one of: f,d,l,b,c,...)
658 -perm PERMS Permissions match any of (+NNN); all of (-NNN);
659 or exactly (NNN)
660 -mtime TIME Modified time is greater than (+N); less than (-N);
661 or exactly (N) days
641 662
642Example: 663Example:
643 664
644 $ find / -name /etc/passwd 665$ find / -name /etc/passwd
645 /etc/passwd 666/etc/passwd
667
646 668
647------------------------------- 669-------------------------------
648 670
649=item free 671=item I<free>
650 672
651Usage: free 673free
652 674
653Displays the amount of free and used system memory. 675Displays the amount of free and used system memory
654 676
655Example: 677Example:
656 678
657 $ free 679$ free
658 total used free shared buffers 680 total used free shared buffers
659 Mem: 257628 248724 8904 59644 93124 681 Mem: 257628 248724 8904 59644 93124
660 Swap: 128516 8404 120112 682 Swap: 128516 8404 120112
661 Total: 386144 257128 129016 683Total: 386144 257128 129016
684
662 685
663------------------------------- 686-------------------------------
664 687
665=item freeramdisk 688=item I<freeramdisk>
666 689
667Usage: freeramdisk DEVICE 690freeramdisk DEVICE
668 691
669Frees all memory used by the specified ramdisk. 692Frees all memory used by the specified ramdisk.
670 693
671Example: 694Example:
672 695
673 $ freeramdisk /dev/ram2 696$ freeramdisk /dev/ram2
697
674 698
675------------------------------- 699-------------------------------
676 700
677=item fsck.minix 701=item I<fsck_minix>
678 702
679Usage: fsck.minix [B<-larvsmf>] /dev/name 703fsck_minix [B<-larvsmf>] /dev/name
680 704
681Performs a consistency check for MINIX filesystems. 705Performs a consistency check for MINIX filesystems.
682 706
683Options: 707Options:
684 708
685 -l Lists all filenames 709 -l Lists all filenames
686 -r Perform interactive repairs 710 -r Perform interactive repairs
687 -a Perform automatic repairs 711 -a Perform automatic repairs
688 -v verbose 712 -v verbose
689 -s Outputs super-block information 713 -s Outputs super-block information
690 -m Activates MINIX-like "mode not cleared" warnings 714 -m Activates MINIX-like mode not cleared warnings
691 -f Force file system check. 715 -f Force file system check.
692 716
693------------------------------- 717-------------------------------
694 718
695=item getopt 719=item I<getopt>
696 720
697Usage: getopt [OPTIONS]... 721getopt [OPTIONS]...
698 722
699Parse command options 723Parse command options
700 724
701Options: 725 -a, --alternative Allow long options starting with single -
702 726 -l, --longoptions=longopts Long options to be recognized
703 -a, --alternative Allow long options starting with single -\n" 727 -n, --name=progname The name under which errors are reported
704 -l, --longoptions=longopts Long options to be recognized\n" 728 -o, --options=optstring Short options to be recognized
705 -n, --name=progname The name under which errors are reported\n" 729 -q, --quiet Disable error reporting by getopt(3)
706 -o, --options=optstring Short options to be recognized\n" 730 -Q, --quiet-output No normal output
707 -q, --quiet Disable error reporting by getopt(3)\n" 731 -s, --shell=shell Set shell quoting conventions
708 -Q, --quiet-output No normal output\n" 732 -T, --test Test for getopt(1) version
709 -s, --shell=shell Set shell quoting conventions\n" 733 -u, --unqote Do not quote the output
710 -T, --test Test for getopt(1) version\n"
711 -u, --unqote Do not quote the output\n"
712 734
713Example: 735Example:
714 736
715 $ cat getopt.test 737$ cat getopt.test
716 #!/bin/sh 738GETOPT=`getopt -o ab:c:: --long a-long,b-long:,c-long:: \
717 GETOPT=`getopt -o ab:c:: --long a-long,b-long:,c-long:: \ 739 -n 'example.busybox' -- $@`
718 -n 'example.busybox' -- "$@"` 740if [ $? != 0 ] ; then exit 1 ; fi
719 if [ $? != 0 ] ; then exit 1 ; fi 741eval set -- $GETOPT
720 eval set -- "$GETOPT" 742while true ; do
721 while true ; do 743 case $1 in
722 case $1 in 744 -a|--a-long) echo Option a ; shift ;;
723 -a|--a-long) echo "Option a" ; shift ;; 745 -b|--b-long) echo Option b, argument `$2' ; shift 2 ;;
724 -b|--b-long) echo "Option b, argument \`$2'" ; shift 2 ;; 746 -c|--c-long)
725 -c|--c-long) 747 case $2 in
726 case "$2" in 748 \) echo Option c, no argument; shift 2 ;;
727 "") echo "Option c, no argument"; shift 2 ;; 749 *) echo Option c, argument `$2' ; shift 2 ;;
728 *) echo "Option c, argument \`$2'" ; shift 2 ;; 750 esac ;;
729 esac ;; 751 --) shift ; break ;;
730 --) shift ; break ;; 752 *) echo Internal error! ; exit 1 ;;
731 *) echo "Internal error!" ; exit 1 ;; 753 esac
732 esac 754done
733 done
734 755
735 756
736------------------------------- 757-------------------------------
737 758
738=item grep 759=item I<grep>
739 760
740Usage: grep [OPTIONS]... PATTERN [FILE]... 761grep [B<-ihHnqvs>] pattern [files...]
741 762
742Search for PATTERN in each FILE or standard input. 763Search for PATTERN in each FILE or standard input.
743 764
744Options: 765Options:
745 766
746 -h suppress the prefixing filename on output 767 -H prefix output lines with filename where match was found
747 -i ignore case distinctions 768 -h suppress the prefixing filename on output
748 -n print line number with output lines 769 -i ignore case distinctions
749 -q be quiet. Returns 0 if result was found, 1 otherwise 770 -n print line number with output lines
750 -v select non-matching lines 771 -q be quiet. Returns 0 if result was found, 1 otherwise
751 772 -v select non-matching lines
752This version of grep matches full regular expressions. 773 -s suppress file open/read error messages
753 774
754Example: 775Example:
755 776
756 $ grep root /etc/passwd 777$ grep root /etc/passwd
757 root:x:0:0:root:/root:/bin/bash 778root:x:0:0:root:/root:/bin/bash
758 $ grep ^[rR]oo. /etc/passwd 779$ grep ^[rR]oo. /etc/passwd
759 root:x:0:0:root:/root:/bin/bash 780root:x:0:0:root:/root:/bin/bash
781
760 782
761------------------------------- 783-------------------------------
762 784
763=item gunzip 785=item I<gunzip>
764 786
765Usage: gunzip [OPTION]... FILE 787gunzip [OPTION]... FILE
766 788
767Uncompress FILE (or standard input if FILE is '-'). 789Uncompress FILE (or standard input if FILE is '-').
768 790
769Options: 791Options:
770 792
771 -c Write output to standard output 793 -c Write output to standard output
772 -t Test compressed file integrity 794 -t Test compressed file integrity
773 795
774Example: 796Example:
775 797
776 $ ls -la /tmp/BusyBox* 798$ ls -la /tmp/BusyBox*
777 -rw-rw-r-- 1 andersen andersen 557009 Apr 11 10:55 /tmp/BusyBox-0.43.tar.gz 799-rw-rw-r-- 1 andersen andersen 557009 Apr 11 10:55 /tmp/BusyBox-0.43.tar.gz
778 $ gunzip /tmp/BusyBox-0.43.tar.gz 800$ gunzip /tmp/BusyBox-0.43.tar.gz
779 $ ls -la /tmp/BusyBox* 801$ ls -la /tmp/BusyBox*
780 -rw-rw-r-- 1 andersen andersen 1761280 Apr 14 17:47 /tmp/BusyBox-0.43.tar 802-rw-rw-r-- 1 andersen andersen 1761280 Apr 14 17:47 /tmp/BusyBox-0.43.tar
803
781 804
782------------------------------- 805-------------------------------
783 806
784=item gzip 807=item I<gzip>
785 808
786Usage: gzip [OPTION]... FILE 809gzip [OPTION]... FILE
787 810
788Compress FILE with maximum compression. 811Compress FILE with maximum compression.
789When FILE is '-', reads standard input. Implies B<-c>. 812When FILE is '-', reads standard input. Implies B<-c>.
790 813
791Options: 814Options:
792 815
793 -c Write output to standard output instead of FILE.gz 816 -c Write output to standard output instead of FILE.gz
794 -d decompress 817 -d decompress
795 818
796Example: 819Example:
797 820
798 $ ls -la /tmp/BusyBox* 821$ ls -la /tmp/BusyBox*
799 -rw-rw-r-- 1 andersen andersen 1761280 Apr 14 17:47 /tmp/BusyBox-0.43.tar 822-rw-rw-r-- 1 andersen andersen 1761280 Apr 14 17:47 /tmp/BusyBox-0.43.tar
800 $ gzip /tmp/BusyBox-0.43.tar 823$ gzip /tmp/BusyBox-0.43.tar
801 $ ls -la /tmp/BusyBox* 824$ ls -la /tmp/BusyBox*
802 -rw-rw-r-- 1 andersen andersen 554058 Apr 14 17:49 /tmp/BusyBox-0.43.tar.gz 825-rw-rw-r-- 1 andersen andersen 554058 Apr 14 17:49 /tmp/BusyBox-0.43.tar.gz
803 826
804 827
805------------------------------- 828-------------------------------
806 829
807=item halt 830=item I<halt>
808 831
809Usage: halt 832halt
810 833
811This command halts the system. 834Halt the system.
812 835
813------------------------------- 836-------------------------------
814 837
815=item head 838=item I<head>
816 839
817Usage: head [OPTION] [FILE]... 840head [OPTION] [FILE]...
818 841
819Print first 10 lines of each FILE to standard output. 842Print first 10 lines of each FILE to standard output.
820With more than one FILE, precede each with a header giving the 843With more than one FILE, precede each with a header giving the
@@ -822,68 +845,90 @@ file name. With no FILE, or when FILE is -, read standard input.
822 845
823Options: 846Options:
824 847
825 -n NUM Print first NUM lines instead of first 10 848 -n NUM Print first NUM lines instead of first 10
826 849
827Example: 850Example:
828 851
829 $ head -n 2 /etc/passwd 852$ head -n 2 /etc/passwd
830 root:x:0:0:root:/root:/bin/bash 853root:x:0:0:root:/root:/bin/bash
831 daemon:x:1:1:daemon:/usr/sbin:/bin/sh 854daemon:x:1:1:daemon:/usr/sbin:/bin/sh
855
832 856
833------------------------------- 857-------------------------------
834 858
835=item hostid 859=item I<hostid>
836 860
837Usage: hostid 861hostid
838 862
839Prints out a unique 32-bit identifier for the current 863Print out a unique 32-bit identifier for the machine.
840machine. The 32-bit identifier is intended to be unique
841among all UNIX systems in existence.
842 864
843------------------------------- 865-------------------------------
844 866
845=item hostname 867=item I<hostname>
846 868
847Usage: hostname [OPTION] {hostname | B<-F> file} 869hostname [OPTION] {hostname | B<-F> file}
848 870
849Get or set the hostname or DNS domain name. If a hostname is given 871Get or set the hostname or DNS domain name. If a hostname is given
850(or a file with the B<-F> parameter), the host name will be set. 872(or a file with the B<-F> parameter), the host name will be set.
851 873
852Options: 874Options:
853 875
854 -s Short 876 -s Short
855 -i Addresses for the hostname 877 -i Addresses for the hostname
856 -d DNS domain name 878 -d DNS domain name
857 -F, --file FILE Use the contents of FILE to specify the hostname 879 -F, --file FILE Use the contents of FILE to specify the hostname
858 880
859Example: 881Example:
860 882
861 $ hostname 883$ hostname
862 slag 884slag
885
863 886
864------------------------------- 887-------------------------------
865 888
866=item id 889=item I<id>
890
891id [OPTIONS]... [USERNAME]
867 892
868Print information for USERNAME or the current user 893Print information for USERNAME or the current user
869 894
870Options: 895Options:
871 896
872 -g prints only the group ID 897 -g prints only the group ID
873 -u prints only the user ID 898 -u prints only the user ID
874 -n print a name instead of a number (with for -ug) 899 -n print a name instead of a number (with for -ug)
875 -r prints the real user ID instead of the effective ID (with -ug) 900 -r prints the real user ID instead of the effective ID (with -ug)
876 901
877Example: 902Example:
878 903
879 $ id 904$ id
880 uid=1000(andersen) gid=1000(andersen) 905uid=1000(andersen) gid=1000(andersen)
906
881 907
882------------------------------- 908-------------------------------
883 909
884=item init 910=item I<ifconfig>
911
912ifconfig [B<-a>] <interface> [<address>]
913
914configure a network interface
915
916Options:
917
918 [[-]broadcast [<address>]] [[-]pointopoint [<address>]]
919 [netmask <address>] [dstaddr <address>]
920 [outfill <NN>] [keepalive <NN>]
921 [hw ether <address>] [metric <NN>] [mtu <NN>]
922 [[-]trailers] [[-]arp] [[-]allmulti]
923 [multicast] [[-]promisc] [txqueuelen <NN>] [[-]dynamic]
924 [mem_start <NN>] [io_addr <NN>] [irq <NN>]
925 [up|down] ...
926
927-------------------------------
885 928
886Usage: init 929=item I<init>
930
931init
887 932
888Init is the parent of all processes. 933Init is the parent of all processes.
889 934
@@ -912,7 +957,7 @@ If you choose to use an /etc/inittab file, the inittab entry format is as follow
912 WARNING: This field has a non-traditional meaning for BusyBox init! 957 WARNING: This field has a non-traditional meaning for BusyBox init!
913 The id field is used by BusyBox init to specify the controlling tty for 958 The id field is used by BusyBox init to specify the controlling tty for
914 the specified process to run on. The contents of this field are 959 the specified process to run on. The contents of this field are
915 appended to "/dev/" and used as-is. There is no need for this field to 960 appended to /dev/ and used as-is. There is no need for this field to
916 be unique, although if it isn't you may have strange results. If this 961 be unique, although if it isn't you may have strange results. If this
917 field is left blank, the controlling tty is set to the console. Also 962 field is left blank, the controlling tty is set to the console. Also
918 note that if BusyBox detects that a serial console is in use, then only 963 note that if BusyBox detects that a serial console is in use, then only
@@ -929,7 +974,6 @@ If you choose to use an /etc/inittab file, the inittab entry format is as follow
929 Valid actions include: sysinit, respawn, askfirst, wait, 974 Valid actions include: sysinit, respawn, askfirst, wait,
930 once, and ctrlaltdel. 975 once, and ctrlaltdel.
931 976
932
933 The available actions can be classified into two groups: actions 977 The available actions can be classified into two groups: actions
934 that are run only once, and actions that are re-run when the specified 978 that are run only once, and actions that are re-run when the specified
935 process exits. 979 process exits.
@@ -953,7 +997,7 @@ If you choose to use an /etc/inittab file, the inittab entry format is as follow
953 it. Unlike sysvinit, BusyBox init does not stop processes from 997 it. Unlike sysvinit, BusyBox init does not stop processes from
954 respawning out of control. The 'askfirst' actions acts just like 998 respawning out of control. The 'askfirst' actions acts just like
955 respawn, except that before running the specified process it 999 respawn, except that before running the specified process it
956 displays the line "Please press Enter to activate this console." 1000 displays the line Please press Enter to activate this console.
957 and then waits for the user to press enter before starting the 1001 and then waits for the user to press enter before starting the
958 specified process. 1002 specified process.
959 1003
@@ -965,541 +1009,612 @@ If you choose to use an /etc/inittab file, the inittab entry format is as follow
965 1009
966 Specifies the process to be executed and it's command line. 1010 Specifies the process to be executed and it's command line.
967 1011
968
969Example /etc/inittab file: 1012Example /etc/inittab file:
970
971 # This is run first except when booting in single-user mode.
972 #
973 ::sysinit:/etc/init.d/rcS 1013 ::sysinit:/etc/init.d/rcS
974 1014
975 # /bin/sh invocations on selected ttys 1015 ::askfirst:-/bin/sh
976 # 1016 tty2::askfirst:-/bin/sh
977 # Start an "askfirst" shell on the console (whatever that may be)
978 ::askfirst:-/bin/sh
979 # Start an "askfirst" shell on /dev/tty2-4
980 tty2::askfirst:-/bin/sh
981 tty3::askfirst:-/bin/sh 1017 tty3::askfirst:-/bin/sh
982 tty4::askfirst:-/bin/sh 1018 tty4::askfirst:-/bin/sh
983 1019
984 # /sbin/getty invocations for selected ttys
985 #
986 tty4::respawn:/sbin/getty 38400 tty5 1020 tty4::respawn:/sbin/getty 38400 tty5
987 tty5::respawn:/sbin/getty 38400 tty6 1021 tty5::respawn:/sbin/getty 38400 tty6
988 1022
989 1023
990 # Example of how to put a getty on a serial line (for a terminal) 1024
991 # 1025 ::ctrlaltdel:/bin/umount -a -r
992 #::respawn:/sbin/getty -L ttyS0 9600 vt100
993 #::respawn:/sbin/getty -L ttyS1 9600 vt100
994 #
995 # Example how to put a getty on a modem line.
996 #::respawn:/sbin/getty 57600 ttyS2
997
998 # Stuff to do before rebooting
999 ::ctrlaltdel:/bin/umount -a -r
1000 ::ctrlaltdel:/sbin/swapoff -a 1026 ::ctrlaltdel:/sbin/swapoff -a
1001 1027
1028
1002------------------------------- 1029-------------------------------
1003 1030
1004=item insmod 1031=item I<insmod>
1005 1032
1006Usage: insmod [OPTION]... MODULE [symbol=value]... 1033insmod [OPTION]... MODULE [symbol=value]...
1007 1034
1008Loads the specified kernel modules into the kernel. 1035Loads the specified kernel modules into the kernel.
1009 1036
1010Options: 1037Options:
1011 1038
1012 -f Force module to load into the wrong kernel version. 1039 -f Force module to load into the wrong kernel version.
1013 -k Make module autoclean-able. 1040 -k Make module autoclean-able.
1014 -v verbose output 1041 -v verbose output
1015 -x do not export externs 1042 -L Lock to prevent simultaneous loads of a module
1016 -L Prevent simultaneous loads of the same module 1043 -x do not export externs
1017 1044
1018------------------------------- 1045-------------------------------
1019 1046
1020=item kill 1047=item I<kill>
1021 1048
1022Usage: kill [B<-signal>] process-id [process-id ...] 1049kill [B<-signal>] process-id [process-id ...]
1023 1050
1024Send a signal (default is SIGTERM) to the specified process(es). 1051Send a signal (default is SIGTERM) to the specified process(es).
1025 1052
1026Options: 1053Options:
1027 1054
1028 -l List all signal names and numbers. 1055 -l List all signal names and numbers.
1029 1056
1030Example: 1057Example:
1031 1058
1032 $ ps | grep apache 1059$ ps | grep apache
1033 252 root root S [apache] 1060252 root root S [apache]
1034 263 www-data www-data S [apache] 1061263 www-data www-data S [apache]
1035 264 www-data www-data S [apache] 1062264 www-data www-data S [apache]
1036 265 www-data www-data S [apache] 1063265 www-data www-data S [apache]
1037 266 www-data www-data S [apache] 1064266 www-data www-data S [apache]
1038 267 www-data www-data S [apache] 1065267 www-data www-data S [apache]
1039 $ kill 252 1066$ kill 252
1067
1040 1068
1041------------------------------- 1069-------------------------------
1042 1070
1043=item killall 1071=item I<killall>
1044 1072
1045Usage: killall [B<-signal>] process-name [process-name ...] 1073killall [B<-signal>] process-name [process-name ...]
1046 1074
1047Send a signal (default is SIGTERM) to the specified process(es). 1075Send a signal (default is SIGTERM) to the specified process(es).
1048 1076
1049Options: 1077Options:
1050 1078
1051 -l List all signal names and numbers. 1079 -l List all signal names and numbers.
1052 1080
1053Example: 1081Example:
1054 1082
1055 $ killall apache 1083$ killall apache
1084
1085
1086-------------------------------
1087
1088=item I<klogd>
1089
1090klogd B<-n>
1091
1092Kernel logger.
1093Options:
1094
1095 -n Run as a foreground process.
1056 1096
1057------------------------------- 1097-------------------------------
1058 1098
1059=item length 1099=item I<length>
1060 1100
1061Usage: length STRING 1101length STRING
1062 1102
1063Prints out the length of the specified STRING. 1103Prints out the length of the specified STRING.
1064 1104
1065Example: 1105Example:
1066 1106
1067 $ length "Hello" 1107$ length Hello
1068 5 11085
1109
1069 1110
1070------------------------------- 1111-------------------------------
1071 1112
1072=item ln 1113=item I<ln>
1073 1114
1074Usage: ln [OPTION] TARGET... LINK_NAME|DIRECTORY 1115ln [OPTION] TARGET... LINK_NAME|DIRECTORY
1075 1116
1076Create a link named LINK_NAME or DIRECTORY to the specified TARGET 1117Create a link named LINK_NAME or DIRECTORY to the specified TARGET
1118
1077You may use '--' to indicate that all following arguments are non-options. 1119You may use '--' to indicate that all following arguments are non-options.
1078 1120
1079Options: 1121Options:
1080 1122
1081 -s make symbolic links instead of hard links 1123 -s make symbolic links instead of hard links
1082 -f remove existing destination files 1124 -f remove existing destination files
1125 -n no dereference symlinks - treat like normal file
1083 1126
1084Example: 1127Example:
1085 1128
1086 $ ln -s BusyBox /tmp/ls 1129$ ln -s BusyBox /tmp/ls
1087 $ ls -l /tmp/ls 1130$ ls -l /tmp/ls
1088 lrwxrwxrwx 1 root root 7 Apr 12 18:39 ls -> BusyBox* 1131lrwxrwxrwx 1 root root 7 Apr 12 18:39 ls -> BusyBox*
1132
1089 1133
1090------------------------------- 1134-------------------------------
1091 1135
1092=item loadacm 1136=item I<loadacm>
1093 1137
1094Usage: loadacm 1138loadacm < mapfile
1095 1139
1096Loads an acm from standard input. 1140Loads an acm from standard input.
1097 1141
1098Example: 1142Example:
1099 1143
1100 $ loadacm < /etc/i18n/acmname 1144$ loadacm < /etc/i18n/acmname
1145
1101 1146
1102------------------------------- 1147-------------------------------
1103 1148
1104=item loadfont 1149=item I<loadfont>
1105 1150
1106Usage: loadfont 1151loadfont < font
1107 1152
1108Loads a console font from standard input. 1153Loads a console font from standard input.
1109 1154
1110Example: 1155Example:
1111 1156
1112 $ loadfont < /etc/i18n/fontname 1157$ loadfont < /etc/i18n/fontname
1158
1113 1159
1114------------------------------- 1160-------------------------------
1115 1161
1116=item loadkmap 1162=item I<loadkmap>
1117 1163
1118Usage: loadkmap 1164loadkmap < keymap
1119 1165
1120Loads a binary keyboard translation table from standard input. 1166Loads a binary keyboard translation table from standard input.
1121 1167
1122Example: 1168Example:
1123 1169
1124 $ loadkmap < /etc/i18n/lang-keymap 1170$ loadkmap < /etc/i18n/lang-keymap
1171
1125 1172
1126------------------------------- 1173-------------------------------
1127 1174
1128=item logger 1175=item I<logger>
1129 1176
1130Usage: logger [OPTION]... [MESSAGE] 1177logger [OPTION]... [MESSAGE]
1131 1178
1132Write MESSAGE to the system log. If MESSAGE is omitted, log stdin. 1179Write MESSAGE to the system log. If MESSAGE is omitted, log stdin.
1133 1180
1134Options: 1181Options:
1135 1182
1136 -s Log to stderr as well as the system log. 1183 -s Log to stderr as well as the system log.
1137 -t Log using the specified tag (defaults to user name). 1184 -t Log using the specified tag (defaults to user name).
1138 -p Enter the message with the specified priority. 1185 -p Enter the message with the specified priority.
1139 This may be numerical or a ``facility.level'' pair. 1186 This may be numerical or a ``facility.level'' pair.
1140 1187
1141Example: 1188Example:
1142 1189
1143 $ logger "hello" 1190$ logger hello
1191
1144 1192
1145------------------------------- 1193-------------------------------
1146 1194
1147=item logname 1195=item I<logname>
1148 1196
1149Usage: logname 1197logname
1150 1198
1151Print the name of the current user. 1199Print the name of the current user.
1152 1200
1153Example: 1201Example:
1154 1202
1155 $ logname 1203$ logname
1156 root 1204root
1205
1157 1206
1158------------------------------- 1207-------------------------------
1159 1208
1160=item ls 1209=item I<logread>
1210
1211logread
1212
1213Shows the messages from syslogd (using circular buffer).
1214
1215-------------------------------
1216
1217=item I<ls>
1218
1219ls [B<-1AacCdeFilnpLRrSsTtuvwxXhk>] [filenames...]
1161 1220
1162Usage: ls [B<-1acdelnpuxACFLR>] [filenames...] 1221List directory contents
1163 1222
1164Options: 1223Options:
1165 1224
1225 -1 list files in a single column
1226 -A do not list implied . and ..
1166 -a do not hide entries starting with . 1227 -a do not hide entries starting with .
1167 -c with -l: show ctime (the time of last 1228 -C list entries by columns
1168 modification of file status information) 1229 -c with -l: show ctime
1169 -d list directory entries instead of contents 1230 -d list directory entries instead of contents
1170 -e list both full date and full time 1231 -e list both full date and full time
1232 -F append indicator (one of */=@|) to entries
1233 -i list the i-node for each file
1171 -l use a long listing format 1234 -l use a long listing format
1172 -n list numeric UIDs and GIDs instead of names 1235 -n list numeric UIDs and GIDs instead of names
1173 -p append indicator (one of /=@|) to entries 1236 -p append indicator (one of /=@|) to entries
1174 -u with -l: show access time (the time of last 1237 -L list entries pointed to by symbolic links
1175 access of the file) 1238 -R list subdirectories recursively
1239 -r sort the listing in reverse order
1240 -S sort the listing by file size
1241 -s list the size of each file, in blocks
1242 -T NUM assume Tabstop every NUM columns
1243 -t with -l: show modification time
1244 -u with -l: show access time
1245 -v sort the listing by version
1246 -w NUM assume the terminal is NUM columns wide
1176 -x list entries by lines instead of by columns 1247 -x list entries by lines instead of by columns
1177 -A do not list implied . and .. 1248 -X sort the listing by extension
1178 -C list entries by columns 1249 -h print sizes in human readable format (e.g., 1K 243M 2G )
1179 -F append indicator (one of */=@|) to entries 1250 -k print sizes in kilobytes(default)
1180 -R list subdirectories recursively
1181 -L list entries pointed to by symbolic links
1182 1251
1183------------------------------- 1252-------------------------------
1184 1253
1185=item lsmod 1254=item I<lsmod>
1186 1255
1187Usage: lsmod 1256lsmod
1188 1257
1189Shows a list of all currently loaded kernel modules. 1258List the currently loaded kernel modules.
1190 1259
1191------------------------------- 1260-------------------------------
1192 1261
1193=item makedevs 1262=item I<makedevs>
1194 1263
1195Usage: makedevs NAME TYPE MAJOR MINOR FIRST LAST [s] 1264makedevs NAME TYPE MAJOR MINOR FIRST LAST [s]
1196 1265
1197Creates a range of block or character special files 1266Creates a range of block or character special files
1198 1267
1199TYPEs include: 1268TYPEs include:
1200 1269
1201 b: Make a block (buffered) device. 1270 b: Make a block (buffered) device.
1202 c or u: Make a character (un-buffered) device. 1271 c or u: Make a character (un-buffered) device.
1203 p: Make a named pipe. MAJOR and MINOR are ignored for named pipes. 1272 p: Make a named pipe. MAJOR and MINOR are ignored for named pipes.
1204 1273
1205FIRST specifies the number appended to NAME to create the first device. 1274FIRST specifies the number appended to NAME to create the first device.
1206LAST specifies the number of the last item that should be created. 1275LAST specifies the number of the last item that should be created.
1207If 's' is the last argument, the base device is created as well. 1276If 's' is the last argument, the base device is created as well.
1208 1277
1278For example:
1279
1280 makedevs /dev/ttyS c 4 66 2 63 -> ttyS2-ttyS63
1281 makedevs /dev/hda b 3 0 0 8 s -> hda,hda1-hda8
1282
1209Example: 1283Example:
1210 1284
1211 $ makedevs /dev/ttyS c 4 66 2 63 1285$ makedevs /dev/ttyS c 4 66 2 63
1212 [creates ttyS2-ttyS63] 1286[creates ttyS2-ttyS63]
1213 $ makedevs /dev/hda b 3 0 0 8 s 1287$ makedevs /dev/hda b 3 0 0 8 s
1214 [creates hda,hda1-hda8] 1288[creates hda,hda1-hda8]
1289
1215 1290
1216------------------------------- 1291-------------------------------
1217 1292
1218=item md5sum 1293=item I<md5sum>
1219 1294
1220Usage: md5sum [OPTION] [file ...] 1295md5sum [OPTION] [FILE]...
1296or: md5sum [OPTION] B<-c> [FILE]
1221 1297
1222Print or check MD5 checksums. 1298Print or check MD5 checksums.
1223 1299
1224Options: 1300Options:
1301With no FILE, or when FILE is -, read standard input.
1225 1302
1226 -b read files in binary mode 1303 -b read files in binary mode
1227 -c check MD5 sums against given list 1304 -c check MD5 sums against given list
1228 -t read files in text mode (default) 1305 -t read files in text mode (default)
1229 -g read a string 1306 -g read a string
1230 1307
1231The following two options are useful only when verifying checksums: 1308The following two options are useful only when verifying checksums:
1232 1309
1233 -s don't output anything, status code shows success 1310 -s don't output anything, status code shows success
1234 -w warn about improperly formated MD5 checksum lines 1311 -w warn about improperly formated MD5 checksum lines
1235 1312
1236Example: 1313Example:
1237 1314
1238 $ md5sum busybox 1315$ md5sum < busybox
1239 6fd11e98b98a58f64ff3398d7b324003 busybox 13166fd11e98b98a58f64ff3398d7b324003
1240 $ md5sum -c - 1317$ md5sum busybox
1241 6fd11e98b98a58f64ff3398d7b324003 busybox 13186fd11e98b98a58f64ff3398d7b324003 busybox
1242 busybox: OK 1319$ md5sum -c -
1243 ^D 13206fd11e98b98a58f64ff3398d7b324003 busybox
1321busybox: OK
1322^D
1323
1244 1324
1245------------------------------- 1325-------------------------------
1246 1326
1247=item mkdir 1327=item I<mkdir>
1248 1328
1249Usage: mkdir [OPTION] DIRECTORY... 1329mkdir [OPTION] DIRECTORY...
1250 1330
1251Create the DIRECTORY(ies), if they do not already exist 1331Create the DIRECTORY(ies), if they do not already exist
1252 1332
1253Options: 1333Options:
1254 1334
1255 -m set permission mode (as in chmod), not rwxrwxrwx - umask 1335 -m set permission mode (as in chmod), not rwxrwxrwx - umask
1256 -p no error if directory exists, make parent directories as needed 1336 -p no error if existing, make parent directories as needed
1257 1337
1258Example: 1338Example:
1259 1339
1260 $ mkdir /tmp/foo 1340$ mkdir /tmp/foo
1261 $ mkdir /tmp/foo 1341$ mkdir /tmp/foo
1262 /tmp/foo: File exists 1342/tmp/foo: File exists
1263 $ mkdir /tmp/foo/bar/baz 1343$ mkdir /tmp/foo/bar/baz
1264 /tmp/foo/bar/baz: No such file or directory 1344/tmp/foo/bar/baz: No such file or directory
1265 $ mkdir -p /tmp/foo/bar/baz 1345$ mkdir -p /tmp/foo/bar/baz
1346
1266 1347
1267------------------------------- 1348-------------------------------
1268 1349
1269=item mkfifo 1350=item I<mkfifo>
1270 1351
1271Usage: mkfifo [OPTIONS] name 1352mkfifo [OPTIONS] name
1272 1353
1273Creates a named pipe (identical to 'mknod name p') 1354Creates a named pipe (identical to 'mknod name p')
1274 1355
1275Options: 1356Options:
1276 1357
1277 -m create the pipe using the specified mode (default a=rw) 1358 -m create the pipe using the specified mode (default a=rw)
1278 1359
1279------------------------------- 1360-------------------------------
1280 1361
1281=item mkfs.minix 1362=item I<mkfs_minix>
1282 1363
1283Usage: mkfs.minix [B<-c> | B<-l> filename] [B<-nXX>] [B<-iXX>] /dev/name [blocks] 1364mkfs_minix [B<-c> | B<-l> filename] [B<-nXX>] [B<-iXX>] /dev/name [blocks]
1284 1365
1285Make a MINIX filesystem. 1366Make a MINIX filesystem.
1286 1367
1287Options: 1368Options:
1288 1369
1289 -c Check the device for bad blocks 1370 -c Check the device for bad blocks
1290 -n [14|30] Specify the maximum length of filenames 1371 -n [14|30] Specify the maximum length of filenames
1291 -i Specify the number of inodes for the filesystem 1372 -i INODES Specify the number of inodes for the filesystem
1292 -l FILENAME Read the bad blocks list from FILENAME 1373 -l FILENAME Read the bad blocks list from FILENAME
1293 -v Make a Minix version 2 filesystem 1374 -v Make a Minix version 2 filesystem
1294 1375
1295------------------------------- 1376-------------------------------
1296 1377
1297=item mknod 1378=item I<mknod>
1298 1379
1299Usage: mknod [OPTIONS] NAME TYPE MAJOR MINOR 1380mknod [OPTIONS] NAME TYPE MAJOR MINOR
1300 1381
1301Create a special file (block, character, or pipe). 1382Create a special file (block, character, or pipe).
1302 1383
1303Options: 1384Options:
1304 1385
1305 -m create the special file using the specified mode (default a=rw) 1386 -m create the special file using the specified mode (default a=rw)
1306 1387
1307TYPEs include: 1388TYPEs include:
1308 b: Make a block (buffered) device. 1389
1309 c or u: Make a character (un-buffered) device. 1390 b: Make a block (buffered) device.
1310 p: Make a named pipe. MAJOR and MINOR are ignored for named pipes. 1391 c or u: Make a character (un-buffered) device.
1392 p: Make a named pipe. MAJOR and MINOR are ignored for named pipes.
1311 1393
1312Example: 1394Example:
1313 1395
1314 $ mknod /dev/fd0 b 2 0 1396$ mknod /dev/fd0 b 2 0
1315 $ mknod -m 644 /tmp/pipe p 1397$ mknod -m 644 /tmp/pipe p
1398
1316 1399
1317------------------------------- 1400-------------------------------
1318 1401
1319=item mkswap 1402=item I<mkswap>
1320 1403
1321Usage: mkswap [B<-c>] [B<-v0>|B<-v1>] device [block-count] 1404mkswap [B<-c>] [B<-v0>|B<-v1>] device [block-count]
1322 1405
1323Prepare a disk partition to be used as a swap partition. 1406Prepare a disk partition to be used as a swap partition.
1324 1407
1325Options: 1408Options:
1326 1409
1327 -c Check for read-ability. 1410 -c Check for read-ability.
1328 -v0 Make version 0 swap [max 128 Megs]. 1411 -v0 Make version 0 swap [max 128 Megs].
1329 -v1 Make version 1 swap [big!] (default for kernels > 2.1.117). 1412 -v1 Make version 1 swap [big!] (default for kernels >
1330 block-count Number of block to use (default is entire partition). 1413 2.1.117).
1414 block-count Number of block to use (default is entire partition).
1331 1415
1332------------------------------- 1416-------------------------------
1333 1417
1334=item mktemp 1418=item I<mktemp>
1335 1419
1336Usage: mktemp [B<-q>] TEMPLATE 1420mktemp [B<-q>] TEMPLATE
1337 1421
1338Creates a temporary file with its name based on TEMPLATE. 1422Creates a temporary file with its name based on TEMPLATE.
1339TEMPLATE is any name with six `Xs' (i.e. /tmp/temp.XXXXXX). 1423TEMPLATE is any name with six `Xs' (i.e. /tmp/temp.XXXXXX).
1340 1424
1341Example: 1425Example:
1342 1426
1343 $ mktemp /tmp/temp.XXXXXX 1427$ mktemp /tmp/temp.XXXXXX
1344 /tmp/temp.mWiLjM 1428/tmp/temp.mWiLjM
1345 $ ls -la /tmp/temp.mWiLjM 1429$ ls -la /tmp/temp.mWiLjM
1346 -rw------- 1 andersen andersen 0 Apr 25 17:10 /tmp/temp.mWiLjM 1430-rw------- 1 andersen andersen 0 Apr 25 17:10 /tmp/temp.mWiLjM
1431
1347 1432
1348------------------------------- 1433-------------------------------
1349 1434
1350=item more 1435=item I<more>
1351 1436
1352Usage: more [file ...] 1437more [FILE ...]
1353 1438
1354More is a filter for paging through text one screenful at a time. 1439More is a filter for viewing FILE one screenful at a time.
1355 1440
1356Example: 1441Example:
1357 1442
1358 $ dmesg | more 1443$ dmesg | more
1444
1359 1445
1360------------------------------- 1446-------------------------------
1361 1447
1362=item mount 1448=item I<mount>
1449
1450mount [flags] device directory [B<-o> options,more-options]
1363 1451
1364Usage: mount [flags] 1452Mount a filesystem
1365 mount [flags] device directory [B<-o> options,more-options]
1366 1453
1367Flags: 1454Flags:
1368 1455
1369 -a: Mount all file systems in fstab. 1456 -a: Mount all filesystems in fstab.
1370 -o option: One of many filesystem options, listed below. 1457 -f: Fake Add entry to mount table but don't mount it.
1371 -r: Mount the filesystem read-only. 1458 -n: Don't write a mount table entry.
1372 -t fs-type: Specify the filesystem type. 1459 -o option: One of many filesystem options, listed below.
1373 -w: Mount for reading and writing (default). 1460 -r: Mount the filesystem read-only.
1461 -t fs-type: Specify the filesystem type.
1462 -w: Mount for reading and writing (default).
1374 1463
1375Options for use with the "B<-o>" flag: 1464Options for use with the B<-o> flag:
1376 1465
1377 async/sync: Writes are asynchronous / synchronous. 1466 async/sync: Writes are asynchronous / synchronous.
1378 atime/noatime: Enable / disable updates to inode access times. 1467 atime/noatime: Enable / disable updates to inode access times.
1379 dev/nodev: Allow use of special device files / disallow them. 1468 dev/nodev: Allow use of special device files / disallow them.
1380 exec/noexec: Allow use of executable files / disallow them. 1469 exec/noexec: Allow use of executable files / disallow them.
1381 loop: Mounts a file via loop device. 1470 loop: Mounts a file via loop device.
1382 suid/nosuid: Allow set-user-id-root programs / disallow them. 1471 suid/nosuid: Allow set-user-id-root programs / disallow them.
1383 remount: Re-mount a currently-mounted filesystem, changing its flags. 1472 remount: Re-mount a mounted filesystem, changing its flags.
1384 ro/rw: Mount for read-only / read-write. 1473 ro/rw: Mount for read-only / read-write.
1385 There are EVEN MORE flags that are specific to each filesystem. 1474
1386 You'll have to see the written documentation for those. 1475There are EVEN MORE flags that are specific to each filesystem.
1476You'll have to see the written documentation for those.
1387 1477
1388Example: 1478Example:
1389 1479
1390 $ mount 1480$ mount
1391 /dev/hda3 on / type minix (rw) 1481/dev/hda3 on / type minix (rw)
1392 proc on /proc type proc (rw) 1482proc on /proc type proc (rw)
1393 devpts on /dev/pts type devpts (rw) 1483devpts on /dev/pts type devpts (rw)
1394 $ mount /dev/fd0 /mnt -t msdos -o ro 1484$ mount /dev/fd0 /mnt -t msdos -o ro
1395 $ mount /tmp/diskimage /opt -t ext2 -o loop 1485$ mount /tmp/diskimage /opt -t ext2 -o loop
1486
1396 1487
1397------------------------------- 1488-------------------------------
1398 1489
1399=item mt 1490=item I<mt>
1400 1491
1401Usage: mt [B<-f> device] opcode value 1492mt [B<-f> device] opcode value
1402 1493
1403Control magnetic tape drive operation 1494Control magnetic tape drive operation
1404 1495
1405------------------------------- 1496Available Opcodes:
1497
1498bsf bsfm bsr bss datacompression drvbuffer eof eom erase
1499fsf fsfm fsr fss load lock mkpart nop offline ras1 ras2
1500ras3 reset retension rew rewoffline seek setblk setdensity
1501setpart tell unload unlock weof wset
1406 1502
1407=item mv 1503-------------------------------
1408 1504
1409Usage: mv SOURCE DEST 1505=item I<mv>
1410 1506
1411 or: mv SOURCE... DIRECTORY 1507mv SOURCE DEST
1508or: mv SOURCE... DIRECTORY
1412 1509
1413Rename SOURCE to DEST, or move SOURCE(s) to DIRECTORY. 1510Rename SOURCE to DEST, or move SOURCE(s) to DIRECTORY.
1414 1511
1415Example: 1512Example:
1416 1513
1417 $ mv /tmp/foo /bin/bar 1514$ mv /tmp/foo /bin/bar
1515
1418 1516
1419------------------------------- 1517-------------------------------
1420 1518
1421=item nc 1519=item I<nc>
1422 1520
1423Usage: nc [IP] [port] 1521nc [IP] [port]
1424 1522
1425Netcat opens a pipe to IP:port 1523Netcat opens a pipe to IP:port
1426 1524
1427Example: 1525Example:
1428 1526
1429 $ nc foobar.somedomain.com 25 1527$ nc foobar.somedomain.com 25
1430 220 foobar ESMTP Exim 3.12 #1 Sat, 15 Apr 2000 00:03:02 -0600 1528220 foobar ESMTP Exim 3.12 help
1431 help 1529214-Commands supported:
1432 214-Commands supported: 1530214- HELO EHLO MAIL RCPT DATA AUTH
1433 214- HELO EHLO MAIL RCPT DATA AUTH 1531214 NOOP QUIT RSET HELP
1434 214 NOOP QUIT RSET HELP 1532quit
1435 quit 1533221 foobar closing connection
1436 221 foobar closing connection 1534
1437 1535
1438------------------------------- 1536-------------------------------
1439 1537
1440=item nslookup 1538=item I<nslookup>
1441 1539
1442Usage: nslookup [HOST] 1540nslookup [HOST]
1443 1541
1444Queries the nameserver for the IP address of the given HOST 1542Queries the nameserver for the IP address of the given HOST
1445 1543
1446Example: 1544Example:
1447 1545
1448 $ nslookup localhost 1546$ nslookup localhost
1449 Server: default 1547Server: default
1450 Address: default 1548Address: default
1451 1549
1452 Name: debian 1550Name: debian
1453 Address: 127.0.0.1 1551Address: 127.0.0.1
1552
1454 1553
1455------------------------------- 1554-------------------------------
1456 1555
1457=item ping 1556=item I<ping>
1458 1557
1459Usage: ping [OPTION]... host 1558ping [OPTION]... host
1460 1559
1461Send ICMP ECHO_REQUEST packets to network hosts. 1560Send ICMP ECHO_REQUEST packets to network hosts.
1462 1561
1463Options: 1562Options:
1464 1563
1465 -c COUNT Send only COUNT pings. 1564 -c COUNT Send only COUNT pings.
1466 -s SIZE Send SIZE data bytes in packets (default=56). 1565 -s SIZE Send SIZE data bytes in packets (default=56).
1467 -q Quiet mode, only displays output at start 1566 -q Quiet mode, only displays output at start
1468 and when finished. 1567 and when finished.
1568
1469Example: 1569Example:
1470 1570
1471 $ ping localhost 1571$ ping localhost
1472 PING slag (127.0.0.1): 56 data bytes 1572PING slag (127.0.0.1): 56 data bytes
1473 64 bytes from 127.0.0.1: icmp_seq=0 ttl=255 time=20.1 ms 157364 bytes from 127.0.0.1: icmp_seq=0 ttl=255 time=20.1 ms
1474 1574
1475 --- debian ping statistics --- 1575--- debian ping statistics ---
1476 1 packets transmitted, 1 packets received, 0% packet loss 15761 packets transmitted, 1 packets received, 0% packet loss
1477 round-trip min/avg/max = 20.1/20.1/20.1 ms 1577round-trip min/avg/max = 20.1/20.1/20.1 ms
1578
1478 1579
1479------------------------------- 1580-------------------------------
1480 1581
1481=item poweroff 1582=item I<pivot_root>
1482 1583
1483Shuts down the system, and requests that the kernel turn off power upon halting. 1584pivot_root new_root put_old
1585
1586Move the current root file system to put_old and make new_root
1587the new root file system.
1484 1588
1485------------------------------- 1589-------------------------------
1486 1590
1487=item printf 1591=item I<poweroff>
1592
1593poweroff
1594
1595Halt the system and request that the kernel shut off the power.
1596
1597-------------------------------
1488 1598
1489Usage: printf format [argument...] 1599=item I<printf>
1490 1600
1491Formats and prints the given data in a manner similar to the C printf command. 1601printf FORMAT [ARGUMENT...]
1602
1603Formats and prints ARGUMENT(s) according to FORMAT,
1604Where FORMAT controls the output exactly as in C printf.
1492 1605
1493Example: 1606Example:
1494 1607
1495 $ printf "Val=%d\n" 5 1608$ printf Val=%d
1496 Val=5 1609 5
1610Val=5
1611
1497 1612
1498------------------------------- 1613-------------------------------
1499 1614
1500=item ps 1615=item I<ps>
1501 1616
1502Usage: ps 1617ps
1503 1618
1504Report process status 1619Report process status
1505 1620
@@ -1507,7 +1622,7 @@ This version of ps accepts no options.
1507 1622
1508Example: 1623Example:
1509 1624
1510 $ ps 1625$ ps
1511 PID Uid Gid State Command 1626 PID Uid Gid State Command
1512 1 root root S init 1627 1 root root S init
1513 2 root root S [kflushd] 1628 2 root root S [kflushd]
@@ -1519,141 +1634,161 @@ Example:
1519 745 root root S [getty] 1634 745 root root S [getty]
1520 2990 andersen andersen R ps 1635 2990 andersen andersen R ps
1521 1636
1637
1522------------------------------- 1638-------------------------------
1523 1639
1524=item pwd 1640=item I<pwd>
1641
1642pwd
1525 1643
1526Prints the full filename of the current working directory. 1644Print the full filename of the current working directory.
1527 1645
1528Example: 1646Example:
1529 1647
1530 $ pwd 1648$ pwd
1531 /root 1649/root
1650
1532 1651
1533------------------------------- 1652-------------------------------
1534 1653
1535=item rdate 1654=item I<rdate>
1536 1655
1537Usage: rdate [OPTION] HOST 1656rdate [OPTION] HOST
1538 1657
1539Get and possibly set the system date and time from a remote HOST. 1658Get and possibly set the system date and time from a remote HOST.
1540 1659
1541Options: 1660Options:
1542 1661
1543 -s Set the system date and time (default). 1662 -s Set the system date and time (default).
1544 -p Print the date and time. 1663 -p Print the date and time.
1545 1664
1546------------------------------- 1665-------------------------------
1547 1666
1548=item reboot 1667=item I<readlink>
1668
1669readlink
1549 1670
1550Instructs the kernel to reboot the system. 1671Read a symbolic link.
1551 1672
1552------------------------------- 1673-------------------------------
1553 1674
1554=item renice 1675=item I<reboot>
1555 1676
1556Usage: renice priority pid [pid ...] 1677reboot
1678
1679Reboot the system.
1680
1681-------------------------------
1682
1683=item I<renice>
1684
1685renice priority pid [pid ...]
1557 1686
1558Changes priority of running processes. Allowed priorities range 1687Changes priority of running processes. Allowed priorities range
1559from 20 (the process runs only when nothing else is running) to 0 1688from 20 (the process runs only when nothing else is running) to 0
1560(default priority) to -20 (almost nothing else ever gets to run). 1689(default priority) to B<-20> (almost nothing else ever gets to run).
1561 1690
1562------------------------------- 1691-------------------------------
1563 1692
1564=item reset 1693=item I<reset>
1565 1694
1566Usage: reset 1695reset
1567 1696
1568Resets the screen. 1697Resets the screen.
1569 1698
1570------------------------------- 1699-------------------------------
1571 1700
1572=item rm 1701=item I<rm>
1573 1702
1574Usage: rm [OPTION]... FILE... 1703rm [OPTION]... FILE...
1575 1704
1576Remove (unlink) the FILE(s). You may use '--' to 1705Remove (unlink) the FILE(s). You may use '--' to
1577indicate that all following arguments are non-options. 1706indicate that all following arguments are non-options.
1578 1707
1579Options: 1708Options:
1580 1709
1581 -f remove existing destinations, never prompt 1710 -i always prompt before removing each destinations
1582 -r or -R remove the contents of directories recursively 1711 -f remove existing destinations, never prompt
1712 -r or -R remove the contents of directories recursively
1583 1713
1584Example: 1714Example:
1585 1715
1586 $ rm -rf /tmp/foo 1716$ rm -rf /tmp/foo
1717
1587 1718
1588------------------------------- 1719-------------------------------
1589 1720
1590=item rmdir 1721=item I<rmdir>
1591 1722
1592Usage: rmdir [OPTION]... DIRECTORY... 1723rmdir [OPTION]... DIRECTORY...
1593 1724
1594Remove the DIRECTORY(ies), if they are empty. 1725Remove the DIRECTORY(ies), if they are empty.
1595 1726
1596Example: 1727Example:
1597 1728
1598 # rmdir /tmp/foo 1729
1599 1730
1600------------------------------- 1731-------------------------------
1601 1732
1602=item rmmod 1733=item I<rmmod>
1603 1734
1604Usage: rmmod [OPTION]... [MODULE]... 1735rmmod [OPTION]... [MODULE]...
1605 1736
1606Unloads the specified kernel modules from the kernel. 1737Unloads the specified kernel modules from the kernel.
1607 1738
1608Options: 1739Options:
1609 1740
1610 -a Try to remove all unused kernel modules. 1741 -a Try to remove all unused kernel modules.
1611 1742
1612Example: 1743Example:
1613 1744
1614 $ rmmod tulip 1745$ rmmod tulip
1746
1615 1747
1616------------------------------- 1748-------------------------------
1617 1749
1618=item sed 1750=item I<route>
1751
1752route [{add|del|flush}]
1619 1753
1620Usage: sed [B<-n>] B<-e> script [file...] 1754Edit the kernel's routing tables
1621 1755
1622Allowed sed scripts come in the following form: 1756-------------------------------
1757
1758=item I<rpmunpack>
1623 1759
1624 'ADDR [!] COMMAND' 1760rpmunpack < package.rpm | gunzip | cpio B<-idmuv>
1761
1762Extracts an rpm archive.
1625 1763
1626 where address ADDR can be: 1764-------------------------------
1627 NUMBER Match specified line number
1628 $ Match last line
1629 /REGEXP/ Match specified regexp
1630 (! inverts the meaning of the match)
1631 1765
1632 and COMMAND can be: 1766=item I<sed>
1633 s/regexp/replacement/[igp]
1634 which attempt to match regexp against the pattern space
1635 and if successful replaces the matched portion with replacement.
1636 1767
1637 aTEXT 1768sed [B<-Vhnef>] pattern [files...]
1638 which appends TEXT after the pattern space
1639 1769
1640Options: 1770Options:
1641 1771
1642 -e add the script to the commands to be executed 1772 -n suppress automatic printing of pattern space
1643 -n suppress automatic printing of pattern space 1773 -e script add the script to the commands to be executed
1774 -f scriptfile add the contents of script-file to the commands to be executed
1775 -h display this help message
1644 1776
1645This version of sed matches full regular expressions. 1777If no B<-e> or B<-f> is given, the first non-option argument is taken as the
1778sed script to interpret. All remaining arguments are names of input
1779files; if no input files are specified, then the standard input is read.
1646 1780
1647Example: 1781Example:
1648 1782
1649 $ echo "foo" | sed -e 's/f[a-zA-Z]o/bar/g' 1783$ echo foo | sed -e 's/f[a-zA-Z]o/bar/g'
1650 bar 1784bar
1785
1651 1786
1652------------------------------- 1787-------------------------------
1653 1788
1654=item setkeycodes 1789=item I<setkeycodes>
1655 1790
1656Usage: setkeycodes SCANCODE KEYCODE ... 1791setkeycodes SCANCODE KEYCODE ...
1657 1792
1658Set entries into the kernel's scancode-to-keycode map, 1793Set entries into the kernel's scancode-to-keycode map,
1659allowing unusual keyboards to generate usable keycodes. 1794allowing unusual keyboards to generate usable keycodes.
@@ -1663,116 +1798,141 @@ and KEYCODE is given in decimal
1663 1798
1664Example: 1799Example:
1665 1800
1666 # setkeycodes e030 127 1801$ setkeycodes e030 127
1802
1667 1803
1668------------------------------- 1804-------------------------------
1669 1805
1670=item sh 1806=item I<sh>
1671 1807
1672Usage: sh 1808sh [FILE]...
1809or: sh B<-c> command [args]...
1673 1810
1674lash -- the BusyBox LAme SHell (command interpreter) 1811lash: The BusyBox LAme SHell (command interpreter)
1675 1812
1676This command does not yet have proper documentation. 1813This command does not yet have proper documentation.
1677 1814
1678Use lash just as you would use any other shell. It properly handles pipes, 1815Use lash just as you would use any other shell. It properly handles pipes,
1679redirects, job control, can be used as the shell for scripts (#!/bin/sh), and 1816redirects, job control, can be used as the shell for scripts, and has a
1680has a sufficient set of builtins to do what is needed. It does not (yet) 1817sufficient set of builtins to do what is needed. It does not (yet) support
1681support Bourne Shell syntax. If you need things like "if-then-else", "while", 1818Bourne Shell syntax. If you need things like if-then-else, while, and such
1682and such, use ash or bash. If you just need a very simple and extremely small 1819use ash or bash. If you just need a very simple and extremely small shell,
1683shell, this will do the job. 1820this will do the job.
1684 1821
1685------------------------------- 1822-------------------------------
1686 1823
1687=item sleep 1824=item I<sleep>
1688 1825
1689Usage: sleep N 1826sleep N
1690 1827
1691Pause for N seconds. 1828Pause for N seconds.
1692 1829
1693Example: 1830Example:
1694 1831
1695 $ sleep 2 1832$ sleep 2
1696 [2 second delay results] 1833[2 second delay results]
1834
1697 1835
1698------------------------------- 1836-------------------------------
1699 1837
1700=item sort 1838=item I<sort>
1701 1839
1702Usage: sort [B<-n>] [B<-r>] [FILE]... 1840sort [B<-n>] [B<-r>] [FILE]...
1703 1841
1704Sorts lines of text in the specified files 1842Sorts lines of text in the specified files
1705 1843
1706Example: 1844Example:
1707 1845
1708 $ echo -e "e\nf\nb\nd\nc\na" | sort 1846$ echo -e e
1709 a 1847f
1710 b 1848b
1711 c 1849d
1712 d 1850c
1713 e 1851a | sort
1714 f 1852a
1853b
1854c
1855d
1856e
1857f
1858
1715 1859
1716------------------------------- 1860-------------------------------
1717 1861
1718=item swapoff 1862=item I<stty>
1863
1864stty [B<-a>|g] [B<-F> device] [SETTING]...
1719 1865
1720Usage: swapoff [OPTION] [device] 1866Without arguments, prints baud rate, line discipline,
1867and deviations from stty sane.
1868
1869Options:
1870
1871 -F device open device instead of stdin
1872 -a print all current settings in human-readable form
1873 -g print in stty-readable form
1874 [SETTING] see documentation
1875
1876-------------------------------
1877
1878=item I<swapoff>
1879
1880swapoff [OPTION] [device]
1721 1881
1722Stop swapping virtual memory pages on the given device. 1882Stop swapping virtual memory pages on the given device.
1723 1883
1724Options: 1884Options:
1725 1885
1726 -a Stop swapping on all swap devices 1886 -a Stop swapping on all swap devices
1727 1887
1728------------------------------- 1888-------------------------------
1729 1889
1730=item swapon 1890=item I<swapon>
1731 1891
1732Usage: swapon [OPTION] [device] 1892swapon [OPTION] [device]
1733 1893
1734Start swapping virtual memory pages on the given device. 1894Start swapping virtual memory pages on the given device.
1735 1895
1736Options: 1896Options:
1737 1897
1738 -a Start swapping on all swap devices 1898 -a Start swapping on all swap devices
1739 1899
1740------------------------------- 1900-------------------------------
1741 1901
1742=item sync 1902=item I<sync>
1743 1903
1744Usage: sync 1904sync
1745 1905
1746Write all buffered filesystem blocks to disk. 1906Write all buffered filesystem blocks to disk.
1747 1907
1748------------------------------- 1908-------------------------------
1749 1909
1750=item syslogd 1910=item I<syslogd>
1751 1911
1752Usage: syslogd [OPTION]... 1912syslogd [OPTION]...
1753 1913
1754Linux system and kernel (provides klogd) logging utility. 1914Linux system and kernel logging utility.
1755Note that this version of syslogd/klogd ignores /etc/syslog.conf. 1915Note that this version of syslogd ignores /etc/syslog.conf.
1756 1916
1757Options: 1917Options:
1758 1918
1759 -m NUM Interval between MARK lines (default=20min, 0=off) 1919 -m NUM Interval between MARK lines (default=20min, 0=off)
1760 -n Run as a foreground process 1920 -n Run as a foreground process
1761 -K Do not start up the klogd process 1921 -O FILE Use an alternate log file (default=/var/log/messages)
1762 -O FILE Use an alternate log file (default=/var/log/messages) 1922 -R HOST[:PORT] Log to IP or hostname on PORT (default PORT=514/UDP)
1763 -R HOST[:PORT] Log remotely to IP or hostname on PORT (default PORT=514/UDP) 1923 -L Log locally and via network logging (default is network only)
1764 -L Log locally as well as network logging (default is network only)
1765 1924
1766Example: 1925Example:
1767 1926
1768 $ syslogd -R masterlog:514 1927$ syslogd -R masterlog:514
1769 $ syslogd -R 192.168.1.1:601 1928$ syslogd -R 192.168.1.1:601
1929
1770 1930
1771------------------------------- 1931-------------------------------
1772 1932
1773=item tail 1933=item I<tail>
1774 1934
1775Usage: tail [OPTION] [FILE]... 1935tail [OPTION]... [FILE]...
1776 1936
1777Print last 10 lines of each FILE to standard output. 1937Print last 10 lines of each FILE to standard output.
1778With more than one FILE, precede each with a header giving the 1938With more than one FILE, precede each with a header giving the
@@ -1780,405 +1940,450 @@ file name. With no FILE, or when FILE is -, read standard input.
1780 1940
1781Options: 1941Options:
1782 1942
1783 -n NUM Print last NUM lines instead of first 10 1943 -c N[kbm] output the last N bytes
1784 -f Output data as the file grows. This version 1944 -n N[kbm] print last N lines instead of last 10
1785 of 'tail -f' supports only one file at a time. 1945 -f output data as the file grows
1946 -q never output headers giving file names
1947 -s SEC wait SEC seconds between reads with -f
1948 -v always output headers giving file names
1949
1950If the first character of N (bytes or lines) is a `+', output begins with
1951the Nth item from the start of each file, otherwise, print the last N items
1952in the file. N bytes may be suffixed by k (x1024), b (x512), or m (1024^2).
1786 1953
1787Example: 1954Example:
1788 1955
1789 $ tail -n 1 /etc/resolv.conf 1956$ tail -n 1 /etc/resolv.conf
1790 nameserver 10.0.0.1 1957nameserver 10.0.0.1
1958
1791 1959
1792------------------------------- 1960-------------------------------
1793 1961
1794=item tar 1962=item I<tar>
1795 1963
1796Usage: tar -[cxtvO] [B<--exclude> File] [B<-f> tarFile] [FILE] ... 1964tar -[cxtvO] [-B<-exclude> File] [B<-X> File][B<-f> tarFile] [FILE(s)] ...
1797 1965
1798Create, extract, or list files from a tar file. Note that 1966Create, extract, or list files from a tar file.
1799this version of tar treats hard links as separate files.
1800 1967
1801Main operation mode: 1968Main operation mode:
1802 1969
1803 c create 1970 c create
1804 x extract 1971 x extract
1805 t list 1972 t list
1806 1973
1807File selection: 1974File selection:
1808 1975
1809 f name of tarfile or "-" for stdin 1976 f name of tarfile or - for stdin
1810 O extract to stdout 1977 O extract to stdout
1811 exclude file to exclude 1978 exclude file to exclude
1979 X file with names to exclude
1812 1980
1813Informative output: 1981Informative output:
1814 1982
1815 v verbosely list files processed 1983 v verbosely list files processed
1816 1984
1817Example: 1985Example:
1818 1986
1819 $ zcat /tmp/tarball.tar.gz | tar -xf - 1987$ zcat /tmp/tarball.tar.gz | tar -xf -
1820 $ tar -cf /tmp/tarball.tar /usr/local 1988$ tar -cf /tmp/tarball.tar /usr/local
1989
1821 1990
1822------------------------------- 1991-------------------------------
1823 1992
1824=item tee 1993=item I<tee>
1825 1994
1826Usage: tee [OPTION]... [FILE]... 1995tee [OPTION]... [FILE]...
1827 1996
1828Copy standard input to each FILE, and also to standard output. 1997Copy standard input to each FILE, and also to standard output.
1829 1998
1830Options: 1999Options:
1831 2000
1832 -a append to the given FILEs, do not overwrite 2001 -a append to the given FILEs, do not overwrite
1833 2002
1834Example: 2003Example:
1835 2004
1836 $ echo "Hello" | tee /tmp/foo 2005$ echo Hello | tee /tmp/foo
1837 $ cat /tmp/foo 2006$ cat /tmp/foo
1838 Hello 2007Hello
2008
1839 2009
1840------------------------------- 2010-------------------------------
1841 2011
1842=item telnet 2012=item I<telnet>
1843 2013
1844Usage: telnet host [port] 2014telnet host [port]
1845 2015
1846Telnet is used to establish interactive communication with another 2016Telnet is used to establish interactive communication with another
1847computer over a network using the TELNET protocol. 2017computer over a network using the TELNET protocol.
1848 2018
1849------------------------------- 2019-------------------------------
1850 2020
1851=item test, [ 2021=item I<test>
1852 2022
1853Usage: test EXPRESSION 2023test EXPRESSION
1854or [ EXPRESSION ] 2024 or [ EXPRESSION ]
1855 2025
1856Checks file types and compares values returning an exit 2026Checks file types and compares values returning an exit
1857code determined by the value of EXPRESSION. 2027code determined by the value of EXPRESSION.
1858 2028
1859Example: 2029Example:
1860 2030
1861 $ test 1 -eq 2 2031$ test 1 -eq 2
1862 $ echo $? 2032$ echo $?
1863 1 20331
1864 $ test 1 -eq 1 2034$ test 1 -eq 1
1865 $ echo $? 2035$ echo $?
1866 0 20360
1867 $ [ -d /etc ] 2037$ [ -d /etc ]
1868 $ echo $? 2038$ echo $?
1869 0 20390
1870 $ [ -d /junk ] 2040$ [ -d /junk ]
1871 $ echo $? 2041$ echo $?
1872 1 20421
2043
2044
2045-------------------------------
2046
2047=item I<tftp>
2048
2049tftp command SOURCE DEST
2050
2051Transfers a file from/to a tftp server using octet mode.
2052
2053Commands:
2054
2055 get Get file from server SOURCE and store to local DEST.
2056 put Put local file SOURCE to server DEST.
2057
2058When nameing a server, use the syntax server:file.
1873 2059
1874------------------------------- 2060-------------------------------
1875 2061
1876=item touch 2062=item I<touch>
2063
2064touch [B<-c>] file [file ...]
1877 2065
1878Usage: touch [B<-c>] file [file ...] 2066Update the last-modified date on the given file[s].
2067
2068Options:
1879 2069
1880Update the last-modified date on (or create) the selected file[s]. 2070 -c Do not create any files
1881 2071
1882Example: 2072Example:
1883 2073
1884 $ ls -l /tmp/foo 2074$ ls -l /tmp/foo
1885 /bin/ls: /tmp/foo: No such file or directory 2075/bin/ls: /tmp/foo: No such file or directory
1886 $ touch /tmp/foo 2076$ touch /tmp/foo
1887 $ ls -l /tmp/foo 2077$ ls -l /tmp/foo
1888 -rw-rw-r-- 1 andersen andersen 0 Apr 15 01:11 /tmp/foo 2078-rw-rw-r-- 1 andersen andersen 0 Apr 15 01:11 /tmp/foo
2079
1889 2080
1890------------------------------- 2081-------------------------------
1891 2082
1892=item tr 2083=item I<tr>
1893 2084
1894Usage: tr [-cds] STRING1 [STRING2] 2085tr [B<-cds>] STRING1 [STRING2]
1895 2086
1896Translate, squeeze, and/or delete characters from 2087Translate, squeeze, and/or delete characters from
1897standard input, writing to standard output. 2088standard input, writing to standard output.
1898 2089
1899Options: 2090Options:
1900 2091
1901 -c take complement of STRING1 2092 -c take complement of STRING1
1902 -d delete input characters coded STRING1 2093 -d delete input characters coded STRING1
1903 -s squeeze multiple output characters of STRING2 into one character 2094 -s squeeze multiple output characters of STRING2 into one character
1904 2095
1905Example: 2096Example:
1906 2097
1907 $ echo "gdkkn vnqkc" | tr [a-y] [b-z] 2098$ echo gdkkn vnqkc | tr [a-y] [b-z]
1908 hello world 2099hello world
2100
1909 2101
1910------------------------------- 2102-------------------------------
1911 2103
1912=item true 2104=item I<true>
1913 2105
1914Returns an exit code of TRUE (0) 2106true
2107
2108Return an exit code of TRUE (0).
1915 2109
1916Example: 2110Example:
1917 2111
1918 $ true 2112$ true
1919 $ echo $? 2113$ echo $?
1920 0 21140
2115
1921 2116
1922------------------------------- 2117-------------------------------
1923 2118
1924=item tty 2119=item I<tty>
1925 2120
1926Usage: tty 2121tty
1927 2122
1928Print the file name of the terminal connected to standard input. 2123Print the file name of the terminal connected to standard input.
1929 2124
1930Options: 2125Options:
1931 2126
1932 -s print nothing, only return an exit status 2127 -s print nothing, only return an exit status
1933 2128
1934Example: 2129Example:
1935 2130
1936 $ tty 2131$ tty
1937 /dev/tty2 2132/dev/tty2
2133
1938 2134
1939------------------------------- 2135-------------------------------
1940 2136
1941=item umount 2137=item I<umount>
2138
2139umount [flags] filesystem|directory
1942 2140
1943Usage: umount [flags] filesystem|directory 2141Unmount file systems
1944 2142
1945Flags: 2143Flags:
1946 2144
1947 -a: Unmount all file systems 2145 -a: Unmount all file systems in /etc/mtab
1948 -r: Try to remount devices as read-only if mount is busy 2146 -n: Don't erase /etc/mtab entries
1949 -f: Force filesystem umount (i.e. unreachable NFS server) 2147 -r: Try to remount devices as read-only if mount is busy
1950 -l: Do not free loop device (if a loop device has been used) 2148 -f: Force filesystem umount (i.e. unreachable NFS server)
2149 -l: Do not free loop device (if a loop device has been used)
1951 2150
1952Example: 2151Example:
1953 2152
1954 $ umount /dev/hdc1 2153$ umount /dev/hdc1
2154
1955 2155
1956------------------------------- 2156-------------------------------
1957 2157
1958=item uname 2158=item I<uname>
1959 2159
1960Usage: uname [OPTION]... 2160uname [OPTION]...
1961 2161
1962Print certain system information. With no OPTION, same as B<-s>. 2162Print certain system information. With no OPTION, same as B<-s>.
1963 2163
1964Options: 2164Options:
1965 2165
1966 -a print all information 2166 -a print all information
1967 -m the machine (hardware) type 2167 -m the machine (hardware) type
1968 -n print the machine's network node hostname 2168 -n print the machine's network node hostname
1969 -r print the operating system release 2169 -r print the operating system release
1970 -s print the operating system name 2170 -s print the operating system name
1971 -p print the host processor type 2171 -p print the host processor type
1972 -v print the operating system version 2172 -v print the operating system version
1973 2173
1974Example: 2174Example:
1975 2175
1976 $ uname -a 2176$ uname -a
1977 Linux debian 2.2.15pre13 #5 Tue Mar 14 16:03:50 MST 2000 i686 unknown 2177Linux debian 2.2.15pre13
1978 2178
1979------------------------------- 2179-------------------------------
1980 2180
1981=item uniq 2181=item I<uniq>
1982 2182
1983Usage: uniq [OPTION]... [INPUT [OUTPUT]] 2183uniq [OPTION]... [INPUT [OUTPUT]]
1984 2184
1985Discard all but one of successive identical lines from INPUT 2185Discard all but one of successive identical lines from INPUT
1986(or standard input), writing to OUTPUT (or standard output). 2186(or standard input), writing to OUTPUT (or standard output).
1987 2187
1988Options: 2188Options:
1989 2189
1990 -c prefix lines by the number of occurrences 2190 -c prefix lines by the number of occurrences
1991 -d only print duplicate lines 2191 -d only print duplicate lines
1992 -u only print unique lines 2192 -u only print unique lines
1993 2193
1994Example: 2194Example:
1995 2195
1996 $ echo -e "a\na\nb\nc\nc\na" | sort | uniq 2196$ echo -e a
1997 a 2197a
1998 b 2198b
1999 c 2199c
2000 2200c
2001------------------------------- 2201a | sort | uniq
2002 2202a
2003=item unix2dos 2203b
2004 2204c
2005Usage: unix2dos < unixfile > dosfile
2006 2205
2007Converts a text file from unix format to dos format.
2008 2206
2009------------------------------- 2207-------------------------------
2010 2208
2011=item unrpm 2209=item I<unix2dos>
2012 2210
2013Usage: unrpm < package.rpm | gzip B<-d> | cpio -idmuv 2211unix2dos [option] [file]
2014 2212
2015Extracts an rpm archive. 2213See 'dos2unix -B<-help>' for help!
2016 2214
2017------------------------------- 2215-------------------------------
2018 2216
2019=item update 2217=item I<update>
2020 2218
2021Usage: update [options] 2219update [options]
2022 2220
2023Periodically flushes filesystem buffers. 2221Periodically flushes filesystem buffers.
2024 2222
2025Options: 2223Options:
2026 2224
2027 -S force use of sync(2) instead of flushing 2225 -S force use of sync(2) instead of flushing
2028 -s SECS call sync this often (default 30) 2226 -s SECS call sync this often (default 30)
2029 -f SECS flush some buffers this often (default 5) 2227 -f SECS flush some buffers this often (default 5)
2030 2228
2031------------------------------- 2229-------------------------------
2032 2230
2033=item uptime 2231=item I<uptime>
2034 2232
2035Usage: uptime 2233uptime
2036 2234
2037Tells how long the system has been running since boot. 2235Display the time since the last boot.
2038 2236
2039Example: 2237Example:
2040 2238
2041 $ uptime 2239$ uptime
2042 1:55pm up 2:30, load average: 0.09, 0.04, 0.00 2240 1:55pm up 2:30, load average: 0.09, 0.04, 0.00
2241
2043 2242
2044------------------------------- 2243-------------------------------
2045 2244
2046=item usleep 2245=item I<usleep>
2047 2246
2048Usage: usleep N 2247usleep N
2049 2248
2050Pauses for N microseconds. 2249Pause for N microseconds.
2051 2250
2052Example: 2251Example:
2053 2252
2054 $ usleep 1000000 2253$ usleep 1000000
2055 [pauses for 1 second] 2254[pauses for 1 second]
2255
2056 2256
2057------------------------------- 2257-------------------------------
2058 2258
2059=item uuencode 2259=item I<uudecode>
2060 2260
2061Usage: uuencode [OPTION] [INFILE] REMOTEFILE 2261uudecode [FILE]...
2062 2262
2063Uuencode a file. 2263Uudecode a file that is uuencoded.
2064 2264
2065Options: 2265Options:
2066 2266
2067 -m use base64 encoding as of RFC1521 2267 -o FILE direct output to FILE$ uudecode -o busybox busybox.uu
2068 2268$ ls B<-l> busybox
2069Example: 2269B<-rwxr>-xr-x 1 ams ams 245264 Jun 7 21:35 busybox
2070 2270
2071 $ uuencode busybox busybox
2072 begin 755 busybox
2073 M?T5,1@$!`0````````````(``P`!````L+@$"#0```!0N@,``````#0`(``&
2074 .....
2075 $ uudecode busybox busybox > busybox.uu
2076 $
2077 2271
2078------------------------------- 2272-------------------------------
2079 2273
2080=item uudecode 2274=item I<uuencode>
2081 2275
2082Usage: uudecode [OPTION] [FILE] 2276uuencode [OPTION] [INFILE] REMOTEFILE
2083 2277
2084Uudecode a uuencoded file 2278Uuencode a file.
2085 2279
2086Options: 2280Options:
2087 2281
2088 -o FILE direct output to FILE 2282 -m use base64 encoding as of RFC1521
2089 2283
2090Example: 2284Example:
2091 2285
2092 $ uudecode -o busybox busybox.uu 2286$ uuencode busybox busybox
2093 $ ls -l busybox 2287begin 755 busybox
2094 -rwxr-xr-x 1 ams ams 245264 Jun 7 21:35 busybox 2288M?T5,1@$!`0````````````(``P`!````L+@$.....
2289$ uudecode busybox busybox > busybox.uu
2290$
2291
2095 2292
2096------------------------------- 2293-------------------------------
2097 2294
2098=item watchdog 2295=item I<watchdog>
2099 2296
2100Usage: watchdog device 2297watchdog DEV
2101 2298
2102Periodically writes to watchdog device B<device>. 2299Periodically write to watchdog device DEV
2103 2300
2104------------------------------- 2301-------------------------------
2105 2302
2106=item wc 2303=item I<wc>
2107 2304
2108Usage: wc [OPTION]... [FILE]... 2305wc [OPTION]... [FILE]...
2109 2306
2110Print line, word, and byte counts for each FILE, and a total line if 2307Print line, word, and byte counts for each FILE, and a total line if
2111more than one FILE is specified. With no FILE, read standard input. 2308more than one FILE is specified. With no FILE, read standard input.
2112 2309
2113Options: 2310Options:
2114 2311
2115 -c print the byte counts 2312 -c print the byte counts
2116 -l print the newline counts 2313 -l print the newline counts
2117 -L print the length of the longest line 2314 -L print the length of the longest line
2118 -w print the word counts 2315 -w print the word counts
2119 2316
2120Example: 2317Example:
2121 2318
2122 $ wc /etc/passwd 2319$ wc /etc/passwd
2123 31 46 1365 /etc/passwd 2320 31 46 1365 /etc/passwd
2321
2124 2322
2125------------------------------- 2323-------------------------------
2126 2324
2127=item which 2325=item I<wget>
2128 2326
2129Usage: which [COMMAND ...] 2327wget [B<-c>] [B<-O> file] url
2130 2328
2131Locates a COMMAND. 2329wget retrieves files via HTTP
2132 2330
2133Example: 2331Options:
2134 2332
2135 $ which login 2333 -c continue retrieval of aborted transfers
2136 /bin/login 2334 -O save to filename ('-' for stdout)
2137 2335
2138------------------------------- 2336-------------------------------
2139 2337
2140=item whoami 2338=item I<which>
2141 2339
2142Usage: whoami 2340which [COMMAND ...]
2143 2341
2144Prints the user name associated with the current effective user id. 2342Locates a COMMAND.
2145 2343
2146Example: 2344Example:
2147 2345
2148 $ whoami 2346$ which login
2149 andersen 2347/bin/login
2348
2150 2349
2151------------------------------- 2350-------------------------------
2152 2351
2153=item xargs 2352=item I<whoami>
2154 2353
2155Usage: xargs [OPTIONS] [COMMAND] [ARGS...] 2354whoami
2156 2355
2157Executes COMMAND on every item given by standard input. 2356Prints the user name associated with the current effective user id.
2158 2357
2159Options: 2358-------------------------------
2359
2360=item I<xargs>
2361
2362xargs [COMMAND] [ARGS...]
2363
2364Executes COMMAND on every item given by standard input.
2160 2365
2161 -t Print the command just before it is run
2162
2163Example: 2366Example:
2164 2367
2165 $ ls | xargs gzip 2368$ ls | xargs gzip
2166 $ find . -name '*.c' -print | xargs rm 2369$ find . -name '*.c' -print | xargs rm
2370
2167 2371
2168------------------------------- 2372-------------------------------
2169 2373
2170=item yes 2374=item I<yes>
2171 2375
2172Usage: yes [OPTION]... [STRING]... 2376yes [OPTION]... [STRING]...
2173 2377
2174Repeatedly outputs a line with all specified STRING(s), or `y'. 2378Repeatedly outputs a line with all specified STRING(s), or `y'.
2175 2379
2176------------------------------- 2380-------------------------------
2177 2381
2178=item zcat 2382=item I<zcat>
2383
2384zcat FILE
2179 2385
2180This is essentially an alias for invoking "gunzip B<-c>", where 2386Uncompress to stdout.
2181it decompresses the file in question and send the output to stdout.
2182 2387
2183------------------------------- 2388-------------------------------
2184 2389
@@ -2330,4 +2535,4 @@ Enrique Zanardi <ezanardi@ull.es>
2330 2535
2331=cut 2536=cut
2332 2537
2333# $Id: busybox.pod,v 1.89 2001/01/25 23:40:32 andersen Exp $ 2538# $Id: busybox.pod,v 1.90 2001/03/15 18:14:25 andersen Exp $
diff --git a/fbset.c b/fbset.c
index 80711ec9f..41c7f9796 100644
--- a/fbset.c
+++ b/fbset.c
@@ -42,7 +42,6 @@ static const int OPT_INFO = (1 << 1);
42static const int OPT_READMODE = (1 << 2); 42static const int OPT_READMODE = (1 << 2);
43 43
44enum { 44enum {
45 CMD_HELP = 0,
46 CMD_FB = 1, 45 CMD_FB = 1,
47 CMD_DB = 2, 46 CMD_DB = 2,
48 CMD_GEOMETRY = 3, 47 CMD_GEOMETRY = 3,
@@ -138,7 +137,6 @@ static struct cmdoptions_t {
138 unsigned char code; 137 unsigned char code;
139} g_cmdoptions[] = { 138} g_cmdoptions[] = {
140 { 139 {
141 "-h", 0, CMD_HELP}, {
142 "-fb", 1, CMD_FB}, { 140 "-fb", 1, CMD_FB}, {
143 "-db", 1, CMD_DB}, { 141 "-db", 1, CMD_DB}, {
144 "-a", 0, CMD_ALL}, { 142 "-a", 0, CMD_ALL}, {
@@ -150,10 +148,8 @@ static struct cmdoptions_t {
150 "-vsync", 1, CMD_VSYNC}, { 148 "-vsync", 1, CMD_VSYNC}, {
151 "-laced", 1, CMD_LACED}, { 149 "-laced", 1, CMD_LACED}, {
152 "-double", 1, CMD_DOUBLE}, { 150 "-double", 1, CMD_DOUBLE}, {
153 "-help", 0, CMD_HELP}, {
154 "-n", 0, CMD_CHANGE}, { 151 "-n", 0, CMD_CHANGE}, {
155#ifdef BB_FEATURE_FBSET_FANCY 152#ifdef BB_FEATURE_FBSET_FANCY
156 "-help", 0, CMD_HELP}, {
157 "-all", 0, CMD_ALL}, { 153 "-all", 0, CMD_ALL}, {
158 "-xres", 1, CMD_XRES}, { 154 "-xres", 1, CMD_XRES}, {
159 "-yres", 1, CMD_YRES}, { 155 "-yres", 1, CMD_YRES}, {
@@ -356,8 +352,6 @@ extern int fbset_main(int argc, char **argv)
356 if (argc - 1 < g_cmdoptions[i].param_count) 352 if (argc - 1 < g_cmdoptions[i].param_count)
357 show_usage(); 353 show_usage();
358 switch (g_cmdoptions[i].code) { 354 switch (g_cmdoptions[i].code) {
359 case CMD_HELP:
360 show_usage();
361 case CMD_FB: 355 case CMD_FB:
362 fbdev = argv[1]; 356 fbdev = argv[1];
363 break; 357 break;
diff --git a/include/applets.h b/include/applets.h
index f85f45720..c8005f830 100644
--- a/include/applets.h
+++ b/include/applets.h
@@ -135,7 +135,7 @@
135 APPLET(false, false_main, _BB_DIR_BIN) 135 APPLET(false, false_main, _BB_DIR_BIN)
136#endif 136#endif
137#ifdef BB_FBSET 137#ifdef BB_FBSET
138 APPLET_NOUSAGE("fbset", fbset_main, _BB_DIR_USR_SBIN) 138 APPLET(fbset, fbset_main, _BB_DIR_USR_SBIN)
139#endif 139#endif
140#ifdef BB_FDFLUSH 140#ifdef BB_FDFLUSH
141 APPLET(fdflush, fdflush_main, _BB_DIR_BIN) 141 APPLET(fdflush, fdflush_main, _BB_DIR_BIN)
diff --git a/include/usage.h b/include/usage.h
index b60f1f911..3d4752cd2 100644
--- a/include/usage.h
+++ b/include/usage.h
@@ -15,11 +15,21 @@
15#define basename_full_usage \ 15#define basename_full_usage \
16 "Strips directory path and suffixes from FILE.\n" \ 16 "Strips directory path and suffixes from FILE.\n" \
17 "If specified, also removes any trailing SUFFIX." 17 "If specified, also removes any trailing SUFFIX."
18#define basename_example_usage \
19 "$ basename /usr/local/bin/foo\n" \
20 "foo\n" \
21 "$ basename /usr/local/bin/\n" \
22 "bin\n" \
23 "$ basename /foo/bar.txt .txt\n" \
24 "bar"
18 25
19#define cat_trivial_usage \ 26#define cat_trivial_usage \
20 "[FILE]..." 27 "[FILE]..."
21#define cat_full_usage \ 28#define cat_full_usage \
22 "Concatenates FILE(s) and prints them to stdout." 29 "Concatenates FILE(s) and prints them to stdout."
30#define cat_example_usage \
31 "$ cat /proc/uptime\n" \
32 "110716.72 17.67"
23 33
24#define chgrp_trivial_usage \ 34#define chgrp_trivial_usage \
25 "[OPTION]... GROUP FILE..." 35 "[OPTION]... GROUP FILE..."
@@ -27,6 +37,12 @@
27 "Change the group membership of each FILE to GROUP.\n" \ 37 "Change the group membership of each FILE to GROUP.\n" \
28 "\nOptions:\n" \ 38 "\nOptions:\n" \
29 "\t-R\tChanges files and directories recursively." 39 "\t-R\tChanges files and directories recursively."
40#define chgrp_example_usage \
41 "$ ls -l /tmp/foo\n" \
42 "-r--r--r-- 1 andersen andersen 0 Apr 12 18:25 /tmp/foo\n" \
43 "$ chgrp root /tmp/foo\n" \
44 "$ ls -l /tmp/foo\n" \
45 "-r--r--r-- 1 andersen root 0 Apr 12 18:25 /tmp/foo\n"
30 46
31#define chmod_trivial_usage \ 47#define chmod_trivial_usage \
32 "[-R] MODE[,MODE]... FILE..." 48 "[-R] MODE[,MODE]... FILE..."
@@ -35,6 +51,15 @@
35 "symbols +-= and one or more of the letters rwxst.\n\n" \ 51 "symbols +-= and one or more of the letters rwxst.\n\n" \
36 "Options:\n" \ 52 "Options:\n" \
37 "\t-R\tChanges files and directories recursively." 53 "\t-R\tChanges files and directories recursively."
54#define chmod_example_usage \
55 "$ ls -l /tmp/foo\n" \
56 "-rw-rw-r-- 1 root root 0 Apr 12 18:25 /tmp/foo\n" \
57 "$ chmod u+x /tmp/foo\n" \
58 "$ ls -l /tmp/foo\n" \
59 "-rwxrw-r-- 1 root root 0 Apr 12 18:25 /tmp/foo*\n" \
60 "$ chmod 444 /tmp/foo\n" \
61 "$ ls -l /tmp/foo\n" \
62 "-r--r--r-- 1 root root 0 Apr 12 18:25 /tmp/foo\n"
38 63
39#define chown_trivial_usage \ 64#define chown_trivial_usage \
40 "[OPTION]... OWNER[<.|:>[GROUP] FILE..." 65 "[OPTION]... OWNER[<.|:>[GROUP] FILE..."
@@ -42,11 +67,27 @@
42 "Change the owner and/or group of each FILE to OWNER and/or GROUP.\n" \ 67 "Change the owner and/or group of each FILE to OWNER and/or GROUP.\n" \
43 "\nOptions:\n" \ 68 "\nOptions:\n" \
44 "\t-R\tChanges files and directories recursively." 69 "\t-R\tChanges files and directories recursively."
70#define chown_example_usage \
71 "$ ls -l /tmp/foo\n" \
72 "-r--r--r-- 1 andersen andersen 0 Apr 12 18:25 /tmp/foo\n" \
73 "$ chown root /tmp/foo\n" \
74 "$ ls -l /tmp/foo\n" \
75 "-r--r--r-- 1 root andersen 0 Apr 12 18:25 /tmp/foo\n" \
76 "$ chown root.root /tmp/foo\n" \
77 "ls -l /tmp/foo\n" \
78 "-r--r--r-- 1 root root 0 Apr 12 18:25 /tmp/foo\n"
45 79
46#define chroot_trivial_usage \ 80#define chroot_trivial_usage \
47 "NEWROOT [COMMAND...]" 81 "NEWROOT [COMMAND...]"
48#define chroot_full_usage \ 82#define chroot_full_usage \
49 "Run COMMAND with root directory set to NEWROOT." 83 "Run COMMAND with root directory set to NEWROOT."
84#define chroot_example_usage \
85 "$ ls -l /bin/ls\n" \
86 "lrwxrwxrwx 1 root root 12 Apr 13 00:46 /bin/ls -> /BusyBox\n" \
87 "$ mount /dev/hdc1 /mnt -t minix\n" \
88 "$ chroot /mnt\n" \
89 "$ ls -l /bin/ls\n" \
90 "-rwxr-xr-x 1 root root 40816 Feb 5 07:45 /bin/ls*\n"
50 91
51#define chvt_trivial_usage \ 92#define chvt_trivial_usage \
52 "N" 93 "N"
@@ -85,6 +126,11 @@
85 "\t-s\t\tOutput only the lines containing delimiter\n" \ 126 "\t-s\t\tOutput only the lines containing delimiter\n" \
86 "\t-f N\t\tPrint only these fields\n" \ 127 "\t-f N\t\tPrint only these fields\n" \
87 "\t-n\t\tIgnored" 128 "\t-n\t\tIgnored"
129#define cut_example_usage \
130 "$ echo "Hello world" | cut -f 1 -d ' '\n" \
131 "Hello\n" \
132 "$ echo "Hello world" | cut -f 2 -d ' '\n" \
133 "world\n"
88 134
89#define date_trivial_usage \ 135#define date_trivial_usage \
90 "[OPTION]... [+FORMAT]" 136 "[OPTION]... [+FORMAT]"
@@ -95,6 +141,9 @@
95 "\t-d STRING\tdisplay time described by STRING, not `now'\n" \ 141 "\t-d STRING\tdisplay time described by STRING, not `now'\n" \
96 "\t-s\t\tSets time described by STRING\n" \ 142 "\t-s\t\tSets time described by STRING\n" \
97 "\t-u\t\tPrints or sets Coordinated Universal Time" 143 "\t-u\t\tPrints or sets Coordinated Universal Time"
144#define date_example_usage \
145 "$ date\n" \
146 "Wed Apr 12 18:52:41 MDT 2000\n"
98 147
99#define dc_trivial_usage \ 148#define dc_trivial_usage \
100 "expression ..." 149 "expression ..."
@@ -102,6 +151,17 @@
102 "This is a Tiny RPN calculator that understands the\n" \ 151 "This is a Tiny RPN calculator that understands the\n" \
103 "following operations: +, -, /, *, and, or, not, eor.\n" \ 152 "following operations: +, -, /, *, and, or, not, eor.\n" \
104 "i.e. 'dc 2 2 add' -> 4, and 'dc 8 8 \\* 2 2 + /' -> 16" 153 "i.e. 'dc 2 2 add' -> 4, and 'dc 8 8 \\* 2 2 + /' -> 16"
154#define dc_example_usage \
155 "$ dc 2 2 +\n" \
156 "4\n" \
157 "$ dc 8 8 \* 2 2 + /\n" \
158 "16\n" \
159 "$ dc 0 1 and\n" \
160 "0\n" \
161 "$ dc 0 1 or\n" \
162 "1\n" \
163 "$ echo 72 9 div 8 mul | dc\n" \
164 "64\n"
105 165
106#define dd_trivial_usage \ 166#define dd_trivial_usage \
107 "[if=FILE] [of=FILE] [bs=N] [count=N] [skip=N]\n" \ 167 "[if=FILE] [of=FILE] [bs=N] [count=N] [skip=N]\n" \
@@ -119,6 +179,10 @@
119 "\n" \ 179 "\n" \
120 "Numbers may be suffixed by c (x1), w (x2), b (x512), kD (x1000), k (x1024),\n" \ 180 "Numbers may be suffixed by c (x1), w (x2), b (x512), kD (x1000), k (x1024),\n" \
121 "MD (x1000000), M (x1048576), GD (x1000000000) or G (x1073741824)." 181 "MD (x1000000), M (x1048576), GD (x1000000000) or G (x1073741824)."
182#define dd_example_usage \
183 "$ dd if=/dev/zero of=/dev/ram1 bs=1M count=4\n" \
184 "4+0 records in\n" \
185 "4+0 records out\n"
122 186
123#define deallocvt_trivial_usage \ 187#define deallocvt_trivial_usage \
124 "N" 188 "N"
@@ -143,11 +207,24 @@
143 "\t-m\tprint sizes in megabytes\n" \ 207 "\t-m\tprint sizes in megabytes\n" \
144 "\t-k\tprint sizes in kilobytes(default)") USAGE_NOT_HUMAN_READABLE( \ 208 "\t-k\tprint sizes in kilobytes(default)") USAGE_NOT_HUMAN_READABLE( \
145 "\n\t-k\tprint sizes in kilobytes(compatability)") 209 "\n\t-k\tprint sizes in kilobytes(compatability)")
210#define df_example_usage \
211 "$ df\n" \
212 "Filesystem 1k-blocks Used Available Use% Mounted on\n" \
213 "/dev/sda3 8690864 8553540 137324 98% /\n" \
214 "/dev/sda1 64216 36364 27852 57% /boot\n" \
215 "$ df /dev/sda3\n" \
216 "Filesystem 1k-blocks Used Available Use% Mounted on\n" \
217 "/dev/sda3 8690864 8553540 137324 98% /\n"
146 218
147#define dirname_trivial_usage \ 219#define dirname_trivial_usage \
148 "[FILENAME ...]" 220 "[FILENAME ...]"
149#define dirname_full_usage \ 221#define dirname_full_usage \
150 "Strips non-directory suffix from FILENAME" 222 "Strips non-directory suffix from FILENAME"
223#define dirname_example_usage \
224 "$ dirname /tmp/foo\n" \
225 "/tmp\n" \
226 "$ dirname /tmp/foo/\n" \
227 "/tmp\n"
151 228
152#define dmesg_trivial_usage \ 229#define dmesg_trivial_usage \
153 "[-c] [-n LEVEL] [-s SIZE]" 230 "[-c] [-n LEVEL] [-s SIZE]"
@@ -184,6 +261,8 @@
184 "\t-e\tExtract control files to directory\n" \ 261 "\t-e\tExtract control files to directory\n" \
185 "\t-x\tExctract packages filesystem tree to directory\n" \ 262 "\t-x\tExctract packages filesystem tree to directory\n" \
186 "\t-X\tVerbose extract" 263 "\t-X\tVerbose extract"
264#define dpkg_deb_example_usage \
265 "$ dpkg-deb -X ./busybox_0.48-1_i386.deb /tmp\n"
187 266
188#define du_trivial_usage \ 267#define du_trivial_usage \
189 "[-ls" USAGE_HUMAN_READABLE("hm") USAGE_NOT_HUMAN_READABLE("") "k] [FILE]..." 268 "[-ls" USAGE_HUMAN_READABLE("hm") USAGE_NOT_HUMAN_READABLE("") "k] [FILE]..."
@@ -198,17 +277,40 @@
198 "\t-m\tprint sizes in megabytes\n" \ 277 "\t-m\tprint sizes in megabytes\n" \
199 "\t-k\tprint sizes in kilobytes(default)") USAGE_NOT_HUMAN_READABLE( \ 278 "\t-k\tprint sizes in kilobytes(default)") USAGE_NOT_HUMAN_READABLE( \
200 "\n\t-k\tprint sizes in kilobytes(compatability)") 279 "\n\t-k\tprint sizes in kilobytes(compatability)")
280#define du_example_usage \
281 "$ du\n" \
282 "16 ./CVS\n" \
283 "12 ./kernel-patches/CVS\n" \
284 "80 ./kernel-patches\n" \
285 "12 ./tests/CVS\n" \
286 "36 ./tests\n" \
287 "12 ./scripts/CVS\n" \
288 "16 ./scripts\n" \
289 "12 ./docs/CVS\n" \
290 "104 ./docs\n" \
291 "2417 .\n"
201 292
202#define dumpkmap_trivial_usage \ 293#define dumpkmap_trivial_usage \
203 "> keymap" 294 "> keymap"
204#define dumpkmap_full_usage \ 295#define dumpkmap_full_usage \
205 "Prints out a binary keyboard translation table to standard output." 296 "Prints out a binary keyboard translation table to standard output."
297#define dumpkmap_example_usage \
298 "$ dumpkmap > keymap\n"
206 299
207#define dutmp_trivial_usage \ 300#define dutmp_trivial_usage \
208 "[FILE]" 301 "[FILE]"
209#define dutmp_full_usage \ 302#define dutmp_full_usage \
210 "Dump utmp file format (pipe delimited) from FILE\n" \ 303 "Dump utmp file format (pipe delimited) from FILE\n" \
211 "or stdin to stdout. (i.e. 'dutmp /var/run/utmp')" 304 "or stdin to stdout. (i.e. 'dutmp /var/run/utmp')"
305#define dutmp_example_usage \
306 "$ dutmp /var/run/utmp\n" \
307 "8|7||si|||0|0|0|955637625|760097|0\n" \
308 "2|0|~|~~|reboot||0|0|0|955637625|782235|0\n" \
309 "1|20020|~|~~|runlevel||0|0|0|955637625|800089|0\n" \
310 "8|125||l4|||0|0|0|955637629|998367|0\n" \
311 "6|245|tty1|1|LOGIN||0|0|0|955637630|998974|0\n" \
312 "6|246|tty2|2|LOGIN||0|0|0|955637630|999498|0\n" \
313 "7|336|pts/0|vt00andersen|andersen|:0.0|0|0|0|955637763|0|0\n"
212 314
213#define echo_trivial_usage \ 315#define echo_trivial_usage \
214 "[-neE] [ARG ...]" 316 "[-neE] [ARG ...]"
@@ -218,6 +320,15 @@
218 "\t-n\tsuppress trailing newline\n" \ 320 "\t-n\tsuppress trailing newline\n" \
219 "\t-e\tinterpret backslash-escaped characters (i.e. \\t=tab etc)\n" \ 321 "\t-e\tinterpret backslash-escaped characters (i.e. \\t=tab etc)\n" \
220 "\t-E\tdisable interpretation of backslash-escaped characters" 322 "\t-E\tdisable interpretation of backslash-escaped characters"
323#define echo_example_usage \
324 "$ echo "Erik is cool"\n" \
325 "Erik is cool\n" \
326 "$ echo -e "Erik\nis\ncool"\n" \
327 "Erik\n" \
328 "is\n" \
329 "cool\n" \
330 "$ echo "Erik\nis\ncool"\n" \
331 "Erik\nis\ncool\n"
221 332
222#define expr_trivial_usage \ 333#define expr_trivial_usage \
223 "EXPRESSION" 334 "EXPRESSION"
@@ -257,6 +368,24 @@
257 "" 368 ""
258#define false_full_usage \ 369#define false_full_usage \
259 "Return an exit code of FALSE (1)." 370 "Return an exit code of FALSE (1)."
371#define false_example_usage \
372 "$ false\n" \
373 "$ echo $?\n" \
374 "1\n"
375
376#define fbset_trivial_usage \
377 "[options] [mode]"
378#define fbset_full_usage \
379 "Show and modify frame buffer settings"
380#define fbset_example_usage \
381 "$ fbset\n" \
382 "mode "1024x768-76"\n" \
383 "\t# D: 78.653 MHz, H: 59.949 kHz, V: 75.694 Hz\n" \
384 "\tgeometry 1024 768 1024 768 16\n" \
385 "\ttimings 12714 128 32 16 4 128 4\n" \
386 "\taccel false\n" \
387 "\trgba 5/11,6/5,5/0,0/0\n" \
388 "endmode\n"
260 389
261#define fdflush_trivial_usage \ 390#define fdflush_trivial_usage \
262 "DEVICE" 391 "DEVICE"
@@ -293,16 +422,27 @@
293 "\n\t-perm PERMS\tPermissions match any of (+NNN); all of (-NNN);\n\t\t\tor exactly (NNN)" \ 422 "\n\t-perm PERMS\tPermissions match any of (+NNN); all of (-NNN);\n\t\t\tor exactly (NNN)" \
294) USAGE_FIND_MTIME( \ 423) USAGE_FIND_MTIME( \
295 "\n\t-mtime TIME\tModified time is greater than (+N); less than (-N);\n\t\t\tor exactly (N) days") 424 "\n\t-mtime TIME\tModified time is greater than (+N); less than (-N);\n\t\t\tor exactly (N) days")
425#define find_example_usage \
426 "$ find / -name /etc/passwd\n" \
427 "/etc/passwd\n"
296 428
297#define free_trivial_usage \ 429#define free_trivial_usage \
298 "" 430 ""
299#define free_full_usage \ 431#define free_full_usage \
300 "Displays the amount of free and used system memory" 432 "Displays the amount of free and used system memory"
433#define free_example_usage \
434 "$ free\n" \
435 " total used free shared buffers\n" \
436 " Mem: 257628 248724 8904 59644 93124\n" \
437 " Swap: 128516 8404 120112\n" \
438 "Total: 386144 257128 129016\n" \
301 439
302#define freeramdisk_trivial_usage \ 440#define freeramdisk_trivial_usage \
303 "DEVICE" 441 "DEVICE"
304#define freeramdisk_full_usage \ 442#define freeramdisk_full_usage \
305 "Frees all memory used by the specified ramdisk." 443 "Frees all memory used by the specified ramdisk."
444#define freeramdisk_example_usage \
445 "$ freeramdisk /dev/ram2\n"
306 446
307#define fsck_minix_trivial_usage \ 447#define fsck_minix_trivial_usage \
308 "[-larvsmf] /dev/name" 448 "[-larvsmf] /dev/name"
@@ -330,6 +470,26 @@
330 "\t-s, --shell=shell Set shell quoting conventions\n" \ 470 "\t-s, --shell=shell Set shell quoting conventions\n" \
331 "\t-T, --test Test for getopt(1) version\n" \ 471 "\t-T, --test Test for getopt(1) version\n" \
332 "\t-u, --unqote Do not quote the output" 472 "\t-u, --unqote Do not quote the output"
473#define getopt_example_usage \
474 "$ cat getopt.test\n" \
475 "#!/bin/sh\n" \
476 "GETOPT=`getopt -o ab:c:: --long a-long,b-long:,c-long:: \\\n" \
477 " -n 'example.busybox' -- "$@"`\n" \
478 "if [ $? != 0 ] ; then exit 1 ; fi\n" \
479 "eval set -- "$GETOPT"\n" \
480 "while true ; do\n" \
481 " case $1 in\n" \
482 " -a|--a-long) echo \"Option a\" ; shift ;;\n" \
483 " -b|--b-long) echo \"Option b, argument \`$2'\" ; shift 2 ;;\n" \
484 " -c|--c-long)\n" \
485 " case "$2" in\n" \
486 " \"\") echo \"Option c, no argument\"; shift 2 ;;\n" \
487 " *) echo \"Option c, argument \`$2'\" ; shift 2 ;;\n" \
488 " esac ;;\n" \
489 " --) shift ; break ;;\n" \
490 " *) echo \"Internal error!\" ; exit 1 ;;\n" \
491 " esac\n" \
492 "done\n"
333 493
334#define grep_trivial_usage \ 494#define grep_trivial_usage \
335 "[-ihHnqvs] pattern [files...]" 495 "[-ihHnqvs] pattern [files...]"
@@ -343,9 +503,11 @@
343 "\t-q\tbe quiet. Returns 0 if result was found, 1 otherwise\n" \ 503 "\t-q\tbe quiet. Returns 0 if result was found, 1 otherwise\n" \
344 "\t-v\tselect non-matching lines\n" \ 504 "\t-v\tselect non-matching lines\n" \
345 "\t-s\tsuppress file open/read error messages" 505 "\t-s\tsuppress file open/read error messages"
346 506#define grep_example_usage \
347#define egrep_trivial_usage grep_trivial_usage 507 "$ grep root /etc/passwd\n" \
348#define egrep_full_usage grep_full_usage 508 "root:x:0:0:root:/root:/bin/bash\n" \
509 "$ grep ^[rR]oo. /etc/passwd\n" \
510 "root:x:0:0:root:/root:/bin/bash\n"
349 511
350#define gunzip_trivial_usage \ 512#define gunzip_trivial_usage \
351 "[OPTION]... FILE" 513 "[OPTION]... FILE"
@@ -354,6 +516,12 @@
354 "Options:\n" \ 516 "Options:\n" \
355 "\t-c\tWrite output to standard output\n" \ 517 "\t-c\tWrite output to standard output\n" \
356 "\t-t\tTest compressed file integrity" 518 "\t-t\tTest compressed file integrity"
519#define gunzip_example_usage \
520 "$ ls -la /tmp/BusyBox*\n" \
521 "-rw-rw-r-- 1 andersen andersen 557009 Apr 11 10:55 /tmp/BusyBox-0.43.tar.gz\n" \
522 "$ gunzip /tmp/BusyBox-0.43.tar.gz\n" \
523 "$ ls -la /tmp/BusyBox*\n" \
524 "-rw-rw-r-- 1 andersen andersen 1761280 Apr 14 17:47 /tmp/BusyBox-0.43.tar\n"
357 525
358#define gzip_trivial_usage \ 526#define gzip_trivial_usage \
359 "[OPTION]... FILE" 527 "[OPTION]... FILE"
@@ -363,6 +531,12 @@
363 "Options:\n" \ 531 "Options:\n" \
364 "\t-c\tWrite output to standard output instead of FILE.gz\n" \ 532 "\t-c\tWrite output to standard output instead of FILE.gz\n" \
365 "\t-d\tdecompress" 533 "\t-d\tdecompress"
534#define gzip_example_usage \
535 "$ ls -la /tmp/BusyBox*\n" \
536 "-rw-rw-r-- 1 andersen andersen 1761280 Apr 14 17:47 /tmp/BusyBox-0.43.tar\n" \
537 "$ gzip /tmp/BusyBox-0.43.tar\n" \
538 "$ ls -la /tmp/BusyBox*\n" \
539 "-rw-rw-r-- 1 andersen andersen 554058 Apr 14 17:49 /tmp/BusyBox-0.43.tar.gz\n"
366 540
367#define halt_trivial_usage \ 541#define halt_trivial_usage \
368 "" 542 ""
@@ -377,6 +551,10 @@
377 "file name. With no FILE, or when FILE is -, read standard input.\n\n" \ 551 "file name. With no FILE, or when FILE is -, read standard input.\n\n" \
378 "Options:\n" \ 552 "Options:\n" \
379 "\t-n NUM\t\tPrint first NUM lines instead of first 10" 553 "\t-n NUM\t\tPrint first NUM lines instead of first 10"
554#define head_example_usage \
555 "$ head -n 2 /etc/passwd\n" \
556 "root:x:0:0:root:/root:/bin/bash\n" \
557 "daemon:x:1:1:daemon:/usr/sbin:/bin/sh\n"
380 558
381#define hostid_trivial_usage \ 559#define hostid_trivial_usage \
382 "" 560 ""
@@ -393,6 +571,9 @@
393 "\t-i\t\tAddresses for the hostname\n" \ 571 "\t-i\t\tAddresses for the hostname\n" \
394 "\t-d\t\tDNS domain name\n" \ 572 "\t-d\t\tDNS domain name\n" \
395 "\t-F, --file FILE\tUse the contents of FILE to specify the hostname" 573 "\t-F, --file FILE\tUse the contents of FILE to specify the hostname"
574#define hostname_example_usage \
575 "$ hostname\n" \
576 "slag \n"
396 577
397#define id_trivial_usage \ 578#define id_trivial_usage \
398 "[OPTIONS]... [USERNAME]" 579 "[OPTIONS]... [USERNAME]"
@@ -403,6 +584,9 @@
403 "\t-u\tprints only the user ID\n" \ 584 "\t-u\tprints only the user ID\n" \
404 "\t-n\tprint a name instead of a number (with for -ug)\n" \ 585 "\t-n\tprint a name instead of a number (with for -ug)\n" \
405 "\t-r\tprints the real user ID instead of the effective ID (with -ug)" 586 "\t-r\tprints the real user ID instead of the effective ID (with -ug)"
587#define id_example_usage \
588 "$ id\n" \
589 "uid=1000(andersen) gid=1000(andersen)\n"
406 590
407#ifdef BB_FEATURE_IFCONFIG_SLIP 591#ifdef BB_FEATURE_IFCONFIG_SLIP
408 #define USAGE_SIOCSKEEPALIVE(a) a 592 #define USAGE_SIOCSKEEPALIVE(a) a
@@ -443,8 +627,116 @@
443#define init_trivial_usage \ 627#define init_trivial_usage \
444 "" 628 ""
445#define init_full_usage \ 629#define init_full_usage \
446 "Init is the parent of all processes.\n\n" \ 630 "Init is the parent of all processes."
447 "This version of init is designed to be run only by the kernel." 631#define init_notes_usage \
632"This version of init is designed to be run only by the kernel.\n" \
633"\n" \
634"BusyBox init doesn't support multiple runlevels. The runlevels field of\n" \
635"the /etc/inittab file is completely ignored by BusyBox init. If you want \n" \
636"runlevels, use sysvinit.\n" \
637"\n" \
638"BusyBox init works just fine without an inittab. If no inittab is found, \n" \
639"it has the following default behavior:\n" \
640"\n" \
641" ::sysinit:/etc/init.d/rcS\n" \
642" ::askfirst:/bin/sh\n" \
643"\n" \
644"if it detects that /dev/console is _not_ a serial console, it will also run:\n" \
645"\n" \
646" tty2::askfirst:/bin/sh\n" \
647"\n" \
648"If you choose to use an /etc/inittab file, the inittab entry format is as follows:\n" \
649"\n" \
650" <id>:<runlevels>:<action>:<process>\n" \
651"\n" \
652" <id>: \n" \
653"\n" \
654" WARNING: This field has a non-traditional meaning for BusyBox init!\n" \
655" The id field is used by BusyBox init to specify the controlling tty for\n" \
656" the specified process to run on. The contents of this field are\n" \
657" appended to "/dev/" and used as-is. There is no need for this field to\n" \
658" be unique, although if it isn't you may have strange results. If this\n" \
659" field is left blank, the controlling tty is set to the console. Also\n" \
660" note that if BusyBox detects that a serial console is in use, then only\n" \
661" entries whose controlling tty is either the serial console or /dev/null\n" \
662" will be run. BusyBox init does nothing with utmp. We don't need no\n" \
663" stinkin' utmp.\n" \
664"\n" \
665" <runlevels>: \n" \
666"\n" \
667" The runlevels field is completely ignored.\n" \
668"\n" \
669" <action>: \n" \
670"\n" \
671" Valid actions include: sysinit, respawn, askfirst, wait, \n" \
672" once, and ctrlaltdel.\n" \
673"\n" \
674" The available actions can be classified into two groups: actions\n" \
675" that are run only once, and actions that are re-run when the specified\n" \
676" process exits.\n" \
677"\n" \
678" Run only-once actions:\n" \
679"\n" \
680" 'sysinit' is the first item run on boot. init waits until all\n" \
681" sysinit actions are completed before continuing. Following the\n" \
682" completion of all sysinit actions, all 'wait' actions are run.\n" \
683" 'wait' actions, like 'sysinit' actions, cause init to wait until\n" \
684" the specified task completes. 'once' actions are asyncronous,\n" \
685" therefore, init does not wait for them to complete. 'ctrlaltdel'\n" \
686" actions are run immediately before init causes the system to reboot\n" \
687" (unmounting filesystems with a 'ctrlaltdel' action is a very good\n" \
688" idea).\n" \
689"\n" \
690" Run repeatedly actions:\n" \
691"\n" \
692" 'respawn' actions are run after the 'once' actions. When a process\n" \
693" started with a 'respawn' action exits, init automatically restarts\n" \
694" it. Unlike sysvinit, BusyBox init does not stop processes from\n" \
695" respawning out of control. The 'askfirst' actions acts just like\n" \
696" respawn, except that before running the specified process it\n" \
697" displays the line "Please press Enter to activate this console."\n" \
698" and then waits for the user to press enter before starting the\n" \
699" specified process. \n" \
700"\n" \
701" Unrecognized actions (like initdefault) will cause init to emit an\n" \
702" error message, and then go along with its business. All actions are\n" \
703" run in the reverse order from how they appear in /etc/inittab.\n" \
704"\n" \
705" <process>: \n" \
706"\n" \
707" Specifies the process to be executed and it's command line.\n" \
708"\n" \
709"Example /etc/inittab file:\n" \
710" # This is run first except when booting in single-user mode.\n" \
711" #\n" \
712" ::sysinit:/etc/init.d/rcS\n" \
713" \n" \
714" # /bin/sh invocations on selected ttys\n" \
715" #\n" \
716" # Start an "askfirst" shell on the console (whatever that may be)\n" \
717" ::askfirst:-/bin/sh\n" \
718" # Start an "askfirst" shell on /dev/tty2-4\n" \
719" tty2::askfirst:-/bin/sh\n" \
720" tty3::askfirst:-/bin/sh\n" \
721" tty4::askfirst:-/bin/sh\n" \
722" \n" \
723" # /sbin/getty invocations for selected ttys\n" \
724" #\n" \
725" tty4::respawn:/sbin/getty 38400 tty5\n" \
726" tty5::respawn:/sbin/getty 38400 tty6\n" \
727" \n" \
728" \n" \
729" # Example of how to put a getty on a serial line (for a terminal)\n" \
730" #\n" \
731" #::respawn:/sbin/getty -L ttyS0 9600 vt100\n" \
732" #::respawn:/sbin/getty -L ttyS1 9600 vt100\n" \
733" #\n" \
734" # Example how to put a getty on a modem line.\n" \
735" #::respawn:/sbin/getty 57600 ttyS2\n" \
736" \n" \
737" # Stuff to do before rebooting\n" \
738" ::ctrlaltdel:/bin/umount -a -r\n" \
739" ::ctrlaltdel:/sbin/swapoff -a\n"
448 740
449#define insmod_trivial_usage \ 741#define insmod_trivial_usage \
450 "[OPTION]... MODULE [symbol=value]..." 742 "[OPTION]... MODULE [symbol=value]..."
@@ -463,6 +755,15 @@
463 "Send a signal (default is SIGTERM) to the specified process(es).\n\n"\ 755 "Send a signal (default is SIGTERM) to the specified process(es).\n\n"\
464 "Options:\n" \ 756 "Options:\n" \
465 "\t-l\tList all signal names and numbers." 757 "\t-l\tList all signal names and numbers."
758#define kill_example_usage \
759 "$ ps | grep apache\n" \
760 "252 root root S [apache]\n" \
761 "263 www-data www-data S [apache]\n" \
762 "264 www-data www-data S [apache]\n" \
763 "265 www-data www-data S [apache]\n" \
764 "266 www-data www-data S [apache]\n" \
765 "267 www-data www-data S [apache]\n" \
766 "$ kill 252\n"
466 767
467#define killall_trivial_usage \ 768#define killall_trivial_usage \
468 "[-signal] process-name [process-name ...]" 769 "[-signal] process-name [process-name ...]"
@@ -470,6 +771,8 @@
470 "Send a signal (default is SIGTERM) to the specified process(es).\n\n"\ 771 "Send a signal (default is SIGTERM) to the specified process(es).\n\n"\
471 "Options:\n" \ 772 "Options:\n" \
472 "\t-l\tList all signal names and numbers." 773 "\t-l\tList all signal names and numbers."
774#define killall_example_usage \
775 "$ killall apache\n"
473 776
474#define klogd_trivial_usage \ 777#define klogd_trivial_usage \
475 "-n" 778 "-n"
@@ -482,6 +785,9 @@
482 "STRING" 785 "STRING"
483#define length_full_usage \ 786#define length_full_usage \
484 "Prints out the length of the specified STRING." 787 "Prints out the length of the specified STRING."
788#define length_example_usage \
789 "$ length "Hello"\n" \
790 "5\n"
485 791
486#define ln_trivial_usage \ 792#define ln_trivial_usage \
487 "[OPTION] TARGET... LINK_NAME|DIRECTORY" 793 "[OPTION] TARGET... LINK_NAME|DIRECTORY"
@@ -492,21 +798,31 @@
492 "\t-s\tmake symbolic links instead of hard links\n" \ 798 "\t-s\tmake symbolic links instead of hard links\n" \
493 "\t-f\tremove existing destination files\n" \ 799 "\t-f\tremove existing destination files\n" \
494 "\t-n\tno dereference symlinks - treat like normal file" 800 "\t-n\tno dereference symlinks - treat like normal file"
801#define ln_example_usage \
802 "$ ln -s BusyBox /tmp/ls\n" \
803 "$ ls -l /tmp/ls\n" \
804 "lrwxrwxrwx 1 root root 7 Apr 12 18:39 ls -> BusyBox*\n"
495 805
496#define loadacm_trivial_usage \ 806#define loadacm_trivial_usage \
497 "< mapfile" 807 "< mapfile"
498#define loadacm_full_usage \ 808#define loadacm_full_usage \
499 "Loads an acm from standard input." 809 "Loads an acm from standard input."
810#define loadacm_example_usage \
811 "$ loadacm < /etc/i18n/acmname\n"
500 812
501#define loadfont_trivial_usage \ 813#define loadfont_trivial_usage \
502 "< font" 814 "< font"
503#define loadfont_full_usage \ 815#define loadfont_full_usage \
504 "Loads a console font from standard input." 816 "Loads a console font from standard input."
817#define loadfont_example_usage \
818 "$ loadfont < /etc/i18n/fontname\n"
505 819
506#define loadkmap_trivial_usage \ 820#define loadkmap_trivial_usage \
507 "< keymap" 821 "< keymap"
508#define loadkmap_full_usage \ 822#define loadkmap_full_usage \
509 "Loads a binary keyboard translation table from standard input." 823 "Loads a binary keyboard translation table from standard input."
824#define loadkmap_example_usage \
825 "$ loadkmap < /etc/i18n/lang-keymap\n"
510 826
511#define logger_trivial_usage \ 827#define logger_trivial_usage \
512 "[OPTION]... [MESSAGE]" 828 "[OPTION]... [MESSAGE]"
@@ -517,11 +833,16 @@
517 "\t-t\tLog using the specified tag (defaults to user name).\n" \ 833 "\t-t\tLog using the specified tag (defaults to user name).\n" \
518 "\t-p\tEnter the message with the specified priority.\n" \ 834 "\t-p\tEnter the message with the specified priority.\n" \
519 "\t\tThis may be numerical or a ``facility.level'' pair." 835 "\t\tThis may be numerical or a ``facility.level'' pair."
836#define logger_example_usage \
837 "$ logger "hello"\n"
520 838
521#define logname_trivial_usage \ 839#define logname_trivial_usage \
522 "" 840 ""
523#define logname_full_usage \ 841#define logname_full_usage \
524 "Print the name of the current user." 842 "Print the name of the current user."
843#define logname_example_usage \
844 "$ logname\n" \
845 "root\n"
525 846
526#define logread_trivial_usage \ 847#define logread_trivial_usage \
527 "" 848 ""
@@ -612,6 +933,11 @@
612 "For example:\n" \ 933 "For example:\n" \
613 "\tmakedevs /dev/ttyS c 4 66 2 63 -> ttyS2-ttyS63\n" \ 934 "\tmakedevs /dev/ttyS c 4 66 2 63 -> ttyS2-ttyS63\n" \
614 "\tmakedevs /dev/hda b 3 0 0 8 s -> hda,hda1-hda8" 935 "\tmakedevs /dev/hda b 3 0 0 8 s -> hda,hda1-hda8"
936#define makedevs_example_usage \
937 "$ makedevs /dev/ttyS c 4 66 2 63\n" \
938 "[creates ttyS2-ttyS63]\n" \
939 "$ makedevs /dev/hda b 3 0 0 8 s\n" \
940 "[creates hda,hda1-hda8]\n"
615 941
616#define md5sum_trivial_usage \ 942#define md5sum_trivial_usage \
617 "[OPTION] [FILE]...\n" \ 943 "[OPTION] [FILE]...\n" \
@@ -627,6 +953,15 @@
627 "\nThe following two options are useful only when verifying checksums:\n" \ 953 "\nThe following two options are useful only when verifying checksums:\n" \
628 "\t-s\tdon't output anything, status code shows success\n" \ 954 "\t-s\tdon't output anything, status code shows success\n" \
629 "\t-w\twarn about improperly formated MD5 checksum lines" 955 "\t-w\twarn about improperly formated MD5 checksum lines"
956#define md5sum_example_usage \
957 "$ md5sum < busybox\n" \
958 "6fd11e98b98a58f64ff3398d7b324003\n" \
959 "$ md5sum busybox\n" \
960 "6fd11e98b98a58f64ff3398d7b324003 busybox\n" \
961 "$ md5sum -c -\n" \
962 "6fd11e98b98a58f64ff3398d7b324003 busybox\n" \
963 "busybox: OK\n" \
964 "^D\n"
630 965
631#define mkdir_trivial_usage \ 966#define mkdir_trivial_usage \
632 "[OPTION] DIRECTORY..." 967 "[OPTION] DIRECTORY..."
@@ -635,6 +970,13 @@
635 "Options:\n" \ 970 "Options:\n" \
636 "\t-m\tset permission mode (as in chmod), not rwxrwxrwx - umask\n" \ 971 "\t-m\tset permission mode (as in chmod), not rwxrwxrwx - umask\n" \
637 "\t-p\tno error if existing, make parent directories as needed" 972 "\t-p\tno error if existing, make parent directories as needed"
973#define mkdir_example_usage \
974 "$ mkdir /tmp/foo\n" \
975 "$ mkdir /tmp/foo\n" \
976 "/tmp/foo: File exists\n" \
977 "$ mkdir /tmp/foo/bar/baz\n" \
978 "/tmp/foo/bar/baz: No such file or directory\n" \
979 "$ mkdir -p /tmp/foo/bar/baz\n"
638 980
639#define mkfifo_trivial_usage \ 981#define mkfifo_trivial_usage \
640 "[OPTIONS] name" 982 "[OPTIONS] name"
@@ -664,6 +1006,9 @@
664 "\tb:\tMake a block (buffered) device.\n" \ 1006 "\tb:\tMake a block (buffered) device.\n" \
665 "\tc or u:\tMake a character (un-buffered) device.\n" \ 1007 "\tc or u:\tMake a character (un-buffered) device.\n" \
666 "\tp:\tMake a named pipe. MAJOR and MINOR are ignored for named pipes." 1008 "\tp:\tMake a named pipe. MAJOR and MINOR are ignored for named pipes."
1009#define mknod_example_usage \
1010 "$ mknod /dev/fd0 b 2 0 \n" \
1011 "$ mknod -m 644 /tmp/pipe p\n"
667 1012
668#define mkswap_trivial_usage \ 1013#define mkswap_trivial_usage \
669 "[-c] [-v0|-v1] device [block-count]" 1014 "[-c] [-v0|-v1] device [block-count]"
@@ -680,11 +1025,18 @@
680#define mktemp_full_usage \ 1025#define mktemp_full_usage \
681 "Creates a temporary file with its name based on TEMPLATE.\n" \ 1026 "Creates a temporary file with its name based on TEMPLATE.\n" \
682 "TEMPLATE is any name with six `Xs' (i.e. /tmp/temp.XXXXXX)." 1027 "TEMPLATE is any name with six `Xs' (i.e. /tmp/temp.XXXXXX)."
1028#define mktemp_example_usage \
1029 "$ mktemp /tmp/temp.XXXXXX\n" \
1030 "/tmp/temp.mWiLjM\n" \
1031 "$ ls -la /tmp/temp.mWiLjM\n" \
1032 "-rw------- 1 andersen andersen 0 Apr 25 17:10 /tmp/temp.mWiLjM\n"
683 1033
684#define more_trivial_usage \ 1034#define more_trivial_usage \
685 "[FILE ...]" 1035 "[FILE ...]"
686#define more_full_usage \ 1036#define more_full_usage \
687 "More is a filter for viewing FILE one screenful at a time." 1037 "More is a filter for viewing FILE one screenful at a time."
1038#define more_example_usage \
1039 "$ dmesg | more\n"
688 1040
689#ifdef BB_FEATURE_MOUNT_LOOP 1041#ifdef BB_FEATURE_MOUNT_LOOP
690 #define USAGE_MOUNT_LOOP(a) a 1042 #define USAGE_MOUNT_LOOP(a) a
@@ -724,6 +1076,13 @@
724 "\tro/rw:\t\tMount for read-only / read-write.\n" \ 1076 "\tro/rw:\t\tMount for read-only / read-write.\n" \
725 "\nThere are EVEN MORE flags that are specific to each filesystem.\n" \ 1077 "\nThere are EVEN MORE flags that are specific to each filesystem.\n" \
726 "You'll have to see the written documentation for those." 1078 "You'll have to see the written documentation for those."
1079#define mount_example_usage \
1080 "$ mount\n" \
1081 "/dev/hda3 on / type minix (rw)\n" \
1082 "proc on /proc type proc (rw)\n" \
1083 "devpts on /dev/pts type devpts (rw)\n" \
1084 "$ mount /dev/fd0 /mnt -t msdos -o ro\n" \
1085 "$ mount /tmp/diskimage /opt -t ext2 -o loop\n"
727 1086
728#define mt_trivial_usage \ 1087#define mt_trivial_usage \
729 "[-f device] opcode value" 1088 "[-f device] opcode value"
@@ -740,16 +1099,34 @@
740 "or: mv SOURCE... DIRECTORY" 1099 "or: mv SOURCE... DIRECTORY"
741#define mv_full_usage \ 1100#define mv_full_usage \
742 "Rename SOURCE to DEST, or move SOURCE(s) to DIRECTORY." 1101 "Rename SOURCE to DEST, or move SOURCE(s) to DIRECTORY."
1102#define mv_example_usage \
1103 "$ mv /tmp/foo /bin/bar\n"
743 1104
744#define nc_trivial_usage \ 1105#define nc_trivial_usage \
745 "[IP] [port]" 1106 "[IP] [port]"
746#define nc_full_usage \ 1107#define nc_full_usage \
747 "Netcat opens a pipe to IP:port" 1108 "Netcat opens a pipe to IP:port"
1109#define nc_example_usage \
1110 "$ nc foobar.somedomain.com 25\n" \
1111 "220 foobar ESMTP Exim 3.12 #1 Sat, 15 Apr 2000 00:03:02 -0600\n" \
1112 "help\n" \
1113 "214-Commands supported:\n" \
1114 "214- HELO EHLO MAIL RCPT DATA AUTH\n" \
1115 "214 NOOP QUIT RSET HELP\n" \
1116 "quit\n" \
1117 "221 foobar closing connection\n"
748 1118
749#define nslookup_trivial_usage \ 1119#define nslookup_trivial_usage \
750 "[HOST]" 1120 "[HOST]"
751#define nslookup_full_usage \ 1121#define nslookup_full_usage \
752 "Queries the nameserver for the IP address of the given HOST" 1122 "Queries the nameserver for the IP address of the given HOST"
1123#define nslookup_example_usage \
1124 "$ nslookup localhost\n" \
1125 "Server: default\n" \
1126 "Address: default\n" \
1127 "\n" \
1128 "Name: debian\n" \
1129 "Address: 127.0.0.1\n"
753 1130
754#ifdef BB_FEATURE_SIMPLE_PING 1131#ifdef BB_FEATURE_SIMPLE_PING
755#define ping_trivial_usage "host" 1132#define ping_trivial_usage "host"
@@ -765,6 +1142,14 @@
765 "\t-q\t\tQuiet mode, only displays output at start\n" \ 1142 "\t-q\t\tQuiet mode, only displays output at start\n" \
766 "\t\t\tand when finished." 1143 "\t\t\tand when finished."
767#endif 1144#endif
1145#define ping_example_usage \
1146 "$ ping localhost\n" \
1147 "PING slag (127.0.0.1): 56 data bytes\n" \
1148 "64 bytes from 127.0.0.1: icmp_seq=0 ttl=255 time=20.1 ms\n" \
1149 "\n" \
1150 "--- debian ping statistics ---\n" \
1151 "1 packets transmitted, 1 packets received, 0% packet loss\n" \
1152 "round-trip min/avg/max = 20.1/20.1/20.1 ms\n"
768 1153
769#define pivot_root_trivial_usage \ 1154#define pivot_root_trivial_usage \
770 "new_root put_old" 1155 "new_root put_old"
@@ -782,17 +1167,35 @@
782#define printf_full_usage \ 1167#define printf_full_usage \
783 "Formats and prints ARGUMENT(s) according to FORMAT,\n" \ 1168 "Formats and prints ARGUMENT(s) according to FORMAT,\n" \
784 "Where FORMAT controls the output exactly as in C printf." 1169 "Where FORMAT controls the output exactly as in C printf."
1170#define printf_example_usage \
1171 "$ printf "Val=%d\n" 5\n" \
1172 "Val=5\n"
785 1173
786#define ps_trivial_usage \ 1174#define ps_trivial_usage \
787 "" 1175 ""
788#define ps_full_usage \ 1176#define ps_full_usage \
789 "Report process status\n" \ 1177 "Report process status\n" \
790 "\nThis version of ps accepts no options." 1178 "\nThis version of ps accepts no options."
1179#define ps_example_usage \
1180 "$ ps\n" \
1181 " PID Uid Gid State Command\n" \
1182 " 1 root root S init\n" \
1183 " 2 root root S [kflushd]\n" \
1184 " 3 root root S [kupdate]\n" \
1185 " 4 root root S [kpiod]\n" \
1186 " 5 root root S [kswapd]\n" \
1187 " 742 andersen andersen S [bash]\n" \
1188 " 743 andersen andersen S -bash\n" \
1189 " 745 root root S [getty]\n" \
1190 " 2990 andersen andersen R ps\n"
791 1191
792#define pwd_trivial_usage \ 1192#define pwd_trivial_usage \
793 "" 1193 ""
794#define pwd_full_usage \ 1194#define pwd_full_usage \
795 "Print the full filename of the current working directory." 1195 "Print the full filename of the current working directory."
1196#define pwd_example_usage \
1197 "$ pwd\n" \
1198 "/root\n"
796 1199
797#define rdate_trivial_usage \ 1200#define rdate_trivial_usage \
798 "[OPTION] HOST" 1201 "[OPTION] HOST"
@@ -838,11 +1241,15 @@
838 USAGE_RM_INTERACTIVE("\t-i\t\talways prompt before removing each destinations\n") \ 1241 USAGE_RM_INTERACTIVE("\t-i\t\talways prompt before removing each destinations\n") \
839 "\t-f\t\tremove existing destinations, never prompt\n" \ 1242 "\t-f\t\tremove existing destinations, never prompt\n" \
840 "\t-r or -R\tremove the contents of directories recursively" 1243 "\t-r or -R\tremove the contents of directories recursively"
1244#define rm_example_usage \
1245 "$ rm -rf /tmp/foo\n"
841 1246
842#define rmdir_trivial_usage \ 1247#define rmdir_trivial_usage \
843 "[OPTION]... DIRECTORY..." 1248 "[OPTION]... DIRECTORY..."
844#define rmdir_full_usage \ 1249#define rmdir_full_usage \
845 "Remove the DIRECTORY(ies), if they are empty." 1250 "Remove the DIRECTORY(ies), if they are empty."
1251#define rmdir_example_usage \
1252 "# rmdir /tmp/foo\n"
846 1253
847#define rmmod_trivial_usage \ 1254#define rmmod_trivial_usage \
848 "[OPTION]... [MODULE]..." 1255 "[OPTION]... [MODULE]..."
@@ -850,6 +1257,8 @@
850 "Unloads the specified kernel modules from the kernel.\n\n" \ 1257 "Unloads the specified kernel modules from the kernel.\n\n" \
851 "Options:\n" \ 1258 "Options:\n" \
852 "\t-a\tTry to remove all unused kernel modules." 1259 "\t-a\tTry to remove all unused kernel modules."
1260#define rmmod_example_usage \
1261 "$ rmmod tulip\n"
853 1262
854#define route_trivial_usage \ 1263#define route_trivial_usage \
855 "[{add|del|flush}]" 1264 "[{add|del|flush}]"
@@ -873,6 +1282,9 @@
873 "If no -e or -f is given, the first non-option argument is taken as the\n" \ 1282 "If no -e or -f is given, the first non-option argument is taken as the\n" \
874 "sed script to interpret. All remaining arguments are names of input\n" \ 1283 "sed script to interpret. All remaining arguments are names of input\n" \
875 "files; if no input files are specified, then the standard input is read." 1284 "files; if no input files are specified, then the standard input is read."
1285#define sed_example_usage \
1286 "$ echo "foo" | sed -e 's/f[a-zA-Z]o/bar/g'\n" \
1287 "bar\n"
876 1288
877#define setkeycodes_trivial_usage \ 1289#define setkeycodes_trivial_usage \
878 "SCANCODE KEYCODE ..." 1290 "SCANCODE KEYCODE ..."
@@ -881,17 +1293,31 @@
881 "allowing unusual keyboards to generate usable keycodes.\n\n" \ 1293 "allowing unusual keyboards to generate usable keycodes.\n\n" \
882 "SCANCODE may be either xx or e0xx (hexadecimal),\n" \ 1294 "SCANCODE may be either xx or e0xx (hexadecimal),\n" \
883 "and KEYCODE is given in decimal" 1295 "and KEYCODE is given in decimal"
1296#define setkeycodes_example_usage \
1297 "$ setkeycodes e030 127\n"
884 1298
885#define sh_trivial_usage \ 1299#define sh_trivial_usage \
886 "[FILE]...\n" \ 1300 "[FILE]...\n" \
887 "or: sh -c command [args]..." 1301 "or: sh -c command [args]..."
888#define sh_full_usage \ 1302#define sh_full_usage \
889 "lash: The BusyBox command interpreter (shell)." 1303 "lash: The BusyBox LAme SHell (command interpreter)"
1304#define sh_notes_usage \
1305"This command does not yet have proper documentation.\n" \
1306"\n" \
1307"Use lash just as you would use any other shell. It properly handles pipes,\n" \
1308"redirects, job control, can be used as the shell for scripts, and has a\n" \
1309"sufficient set of builtins to do what is needed. It does not (yet) support\n" \
1310"Bourne Shell syntax. If you need things like "if-then-else", "while", and such\n" \
1311"use ash or bash. If you just need a very simple and extremely small shell,\n" \
1312"this will do the job."
890 1313
891#define sleep_trivial_usage \ 1314#define sleep_trivial_usage \
892 "N" 1315 "N"
893#define sleep_full_usage \ 1316#define sleep_full_usage \
894 "Pause for N seconds." 1317 "Pause for N seconds."
1318#define sleep_example_usage \
1319 "$ sleep 2\n" \
1320 "[2 second delay results]\n"
895 1321
896 1322
897#ifdef BB_FEATURE_SORT_REVERSE 1323#ifdef BB_FEATURE_SORT_REVERSE
@@ -903,6 +1329,14 @@
903 "[-n]" USAGE_SORT_REVERSE(" [-r]") " [FILE]..." 1329 "[-n]" USAGE_SORT_REVERSE(" [-r]") " [FILE]..."
904#define sort_full_usage \ 1330#define sort_full_usage \
905 "Sorts lines of text in the specified files" 1331 "Sorts lines of text in the specified files"
1332#define sort_example_usage \
1333 "$ echo -e "e\nf\nb\nd\nc\na" | sort\n" \
1334 "a\n" \
1335 "b\n" \
1336 "c\n" \
1337 "d\n" \
1338 "e\n" \
1339 "f\n"
906 1340
907#define stty_trivial_usage \ 1341#define stty_trivial_usage \
908 "[-a|g] [-F device] [SETTING]..." 1342 "[-a|g] [-F device] [SETTING]..."
@@ -952,6 +1386,9 @@
952 USAGE_REMOTE_LOG( \ 1386 USAGE_REMOTE_LOG( \
953 "\n\t-R HOST[:PORT]\tLog to IP or hostname on PORT (default PORT=514/UDP)\n" \ 1387 "\n\t-R HOST[:PORT]\tLog to IP or hostname on PORT (default PORT=514/UDP)\n" \
954 "\t-L\t\tLog locally and via network logging (default is network only)") 1388 "\t-L\t\tLog locally and via network logging (default is network only)")
1389#define syslogd_example_usage \
1390 "$ syslogd -R masterlog:514\n" \
1391 "$ syslogd -R 192.168.1.1:601\n"
955 1392
956 1393
957#ifdef BB_FEATURE_SIMPLE_TAIL 1394#ifdef BB_FEATURE_SIMPLE_TAIL
@@ -969,14 +1406,15 @@
969 USAGE_UNSIMPLE_TAIL("\t-c N[kbm]\toutput the last N bytes\n") \ 1406 USAGE_UNSIMPLE_TAIL("\t-c N[kbm]\toutput the last N bytes\n") \
970 "\t-n N[kbm]\tprint last N lines instead of last 10\n" \ 1407 "\t-n N[kbm]\tprint last N lines instead of last 10\n" \
971 "\t-f\t\toutput data as the file grows" \ 1408 "\t-f\t\toutput data as the file grows" \
972 USAGE_UNSIMPLE_TAIL( \ 1409 USAGE_UNSIMPLE_TAIL( "\n\t-q\t\tnever output headers giving file names\n" \
973 "\n\t-q\t\tnever output headers giving file names\n" \
974 "\t-s SEC\t\twait SEC seconds between reads with -f\n" \ 1410 "\t-s SEC\t\twait SEC seconds between reads with -f\n" \
975 "\t-v\t\talways output headers giving file names\n\n" \ 1411 "\t-v\t\talways output headers giving file names\n\n" \
976 "If the first character of N (bytes or lines) is a `+', output begins with \n" \ 1412 "If the first character of N (bytes or lines) is a '+', output begins with \n" \
977 "the Nth item from the start of each file, otherwise, print the last N items\n" \ 1413 "the Nth item from the start of each file, otherwise, print the last N items\n" \
978 "in the file. N bytes may be suffixed by k (x1024), b (x512), or m (1024^2)." \ 1414 "in the file. N bytes may be suffixed by k (x1024), b (x512), or m (1024^2)." )
979 ) 1415#define tail_example_usage \
1416 "$ tail -n 1 /etc/resolv.conf\n" \
1417 "nameserver 10.0.0.1\n"
980 1418
981#ifdef BB_FEATURE_TAR_CREATE 1419#ifdef BB_FEATURE_TAR_CREATE
982 #define USAGE_TAR_CREATE(a) a 1420 #define USAGE_TAR_CREATE(a) a
@@ -1007,6 +1445,9 @@
1007 ) \ 1445 ) \
1008 "\nInformative output:\n" \ 1446 "\nInformative output:\n" \
1009 "\tv\t\tverbosely list files processed" 1447 "\tv\t\tverbosely list files processed"
1448#define tar_example_usage \
1449 "$ zcat /tmp/tarball.tar.gz | tar -xf -\n" \
1450 "$ tar -cf /tmp/tarball.tar /usr/local\n"
1010 1451
1011#define tee_trivial_usage \ 1452#define tee_trivial_usage \
1012 "[OPTION]... [FILE]..." 1453 "[OPTION]... [FILE]..."
@@ -1014,6 +1455,10 @@
1014 "Copy standard input to each FILE, and also to standard output.\n\n" \ 1455 "Copy standard input to each FILE, and also to standard output.\n\n" \
1015 "Options:\n" \ 1456 "Options:\n" \
1016 "\t-a\tappend to the given FILEs, do not overwrite" 1457 "\t-a\tappend to the given FILEs, do not overwrite"
1458#define tee_example_usage \
1459 "$ echo "Hello" | tee /tmp/foo\n" \
1460 "$ cat /tmp/foo\n" \
1461 "Hello\n"
1017 1462
1018#define telnet_trivial_usage \ 1463#define telnet_trivial_usage \
1019 "host [port]" 1464 "host [port]"
@@ -1026,6 +1471,19 @@
1026#define test_full_usage \ 1471#define test_full_usage \
1027 "Checks file types and compares values returning an exit\n" \ 1472 "Checks file types and compares values returning an exit\n" \
1028 "code determined by the value of EXPRESSION." 1473 "code determined by the value of EXPRESSION."
1474#define test_example_usage \
1475 "$ test 1 -eq 2\n" \
1476 "$ echo $?\n" \
1477 "1\n" \
1478 "$ test 1 -eq 1\n" \
1479 "$ echo $? \n" \
1480 "0\n" \
1481 "$ [ -d /etc ]\n" \
1482 "$ echo $?\n" \
1483 "0\n" \
1484 "$ [ -d /junk ]\n" \
1485 "$ echo $?\n" \
1486 "1\n"
1029 1487
1030#ifdef BB_FEATURE_TFTP_GET 1488#ifdef BB_FEATURE_TFTP_GET
1031 #define USAGE_TFTP_GET(a) a 1489 #define USAGE_TFTP_GET(a) a
@@ -1057,6 +1515,12 @@
1057 "Update the last-modified date on the given file[s].\n\n" \ 1515 "Update the last-modified date on the given file[s].\n\n" \
1058 "Options:\n" \ 1516 "Options:\n" \
1059 "\t-c\tDo not create any files" 1517 "\t-c\tDo not create any files"
1518#define touch_example_usage \
1519 "$ ls -l /tmp/foo\n" \
1520 "/bin/ls: /tmp/foo: No such file or directory\n" \
1521 "$ touch /tmp/foo\n" \
1522 "$ ls -l /tmp/foo\n" \
1523 "-rw-rw-r-- 1 andersen andersen 0 Apr 15 01:11 /tmp/foo\n"
1060 1524
1061#define tr_trivial_usage \ 1525#define tr_trivial_usage \
1062 "[-cds] STRING1 [STRING2]" 1526 "[-cds] STRING1 [STRING2]"
@@ -1067,11 +1531,18 @@
1067 "\t-c\ttake complement of STRING1\n" \ 1531 "\t-c\ttake complement of STRING1\n" \
1068 "\t-d\tdelete input characters coded STRING1\n" \ 1532 "\t-d\tdelete input characters coded STRING1\n" \
1069 "\t-s\tsqueeze multiple output characters of STRING2 into one character" 1533 "\t-s\tsqueeze multiple output characters of STRING2 into one character"
1534#define tr_example_usage \
1535 "$ echo "gdkkn vnqkc" | tr [a-y] [b-z]\n" \
1536 "hello world\n"
1070 1537
1071#define true_trivial_usage \ 1538#define true_trivial_usage \
1072 "" 1539 ""
1073#define true_full_usage \ 1540#define true_full_usage \
1074 "Return an exit code of TRUE (0)." 1541 "Return an exit code of TRUE (0)."
1542#define true_example_usage \
1543 "$ true\n" \
1544 "$ echo $?\n" \
1545 "0\n"
1075 1546
1076#define tty_trivial_usage \ 1547#define tty_trivial_usage \
1077 "" 1548 ""
@@ -1079,6 +1550,9 @@
1079 "Print the file name of the terminal connected to standard input.\n\n"\ 1550 "Print the file name of the terminal connected to standard input.\n\n"\
1080 "Options:\n" \ 1551 "Options:\n" \
1081 "\t-s\tprint nothing, only return an exit status" 1552 "\t-s\tprint nothing, only return an exit status"
1553#define tty_example_usage \
1554 "$ tty\n" \
1555 "/dev/tty2\n"
1082 1556
1083#ifdef BB_FEATURE_MOUNT_FORCE 1557#ifdef BB_FEATURE_MOUNT_FORCE
1084 #define USAGE_MOUNT_FORCE(a) a 1558 #define USAGE_MOUNT_FORCE(a) a
@@ -1094,6 +1568,8 @@
1094 "\n\t-r:\tTry to remount devices as read-only if mount is busy" \ 1568 "\n\t-r:\tTry to remount devices as read-only if mount is busy" \
1095 USAGE_MOUNT_FORCE("\n\t-f:\tForce filesystem umount (i.e. unreachable NFS server)") \ 1569 USAGE_MOUNT_FORCE("\n\t-f:\tForce filesystem umount (i.e. unreachable NFS server)") \
1096 USAGE_MOUNT_LOOP("\n\t-l:\tDo not free loop device (if a loop device has been used)") 1570 USAGE_MOUNT_LOOP("\n\t-l:\tDo not free loop device (if a loop device has been used)")
1571#define umount_example_usage \
1572 "$ umount /dev/hdc1 \n"
1097 1573
1098#define uname_trivial_usage \ 1574#define uname_trivial_usage \
1099 "[OPTION]..." 1575 "[OPTION]..."
@@ -1107,6 +1583,9 @@
1107 "\t-s\tprint the operating system name\n" \ 1583 "\t-s\tprint the operating system name\n" \
1108 "\t-p\tprint the host processor type\n" \ 1584 "\t-p\tprint the host processor type\n" \
1109 "\t-v\tprint the operating system version" 1585 "\t-v\tprint the operating system version"
1586#define uname_example_usage \
1587 "$ uname -a\n" \
1588 "Linux debian 2.2.15pre13 #5 Tue Mar 14 16:03:50 MST 2000 i686 unknown\n"
1110 1589
1111#define uniq_trivial_usage \ 1590#define uniq_trivial_usage \
1112 "[OPTION]... [INPUT [OUTPUT]]" 1591 "[OPTION]... [INPUT [OUTPUT]]"
@@ -1117,6 +1596,11 @@
1117 "\t-c\tprefix lines by the number of occurrences\n" \ 1596 "\t-c\tprefix lines by the number of occurrences\n" \
1118 "\t-d\tonly print duplicate lines\n" \ 1597 "\t-d\tonly print duplicate lines\n" \
1119 "\t-u\tonly print unique lines" 1598 "\t-u\tonly print unique lines"
1599#define uniq_example_usage \
1600 "$ echo -e "a\na\nb\nc\nc\na" | sort | uniq\n" \
1601 "a\n" \
1602 "b\n" \
1603 "c\n"
1120 1604
1121#define unix2dos_trivial_usage \ 1605#define unix2dos_trivial_usage \
1122 "[option] [file]" 1606 "[option] [file]"
@@ -1136,11 +1620,17 @@
1136 "" 1620 ""
1137#define uptime_full_usage \ 1621#define uptime_full_usage \
1138 "Display the time since the last boot." 1622 "Display the time since the last boot."
1623#define uptime_example_usage \
1624 "$ uptime\n" \
1625 " 1:55pm up 2:30, load average: 0.09, 0.04, 0.00\n"
1139 1626
1140#define usleep_trivial_usage \ 1627#define usleep_trivial_usage \
1141 "N" 1628 "N"
1142#define usleep_full_usage \ 1629#define usleep_full_usage \
1143 "Pause for N microseconds." 1630 "Pause for N microseconds."
1631#define usleep_example_usage \
1632 "$ usleep 1000000\n" \
1633 "[pauses for 1 second]\n"
1144 1634
1145#define uudecode_trivial_usage \ 1635#define uudecode_trivial_usage \
1146 "[FILE]..." 1636 "[FILE]..."
@@ -1148,6 +1638,10 @@
1148 "Uudecode a file that is uuencoded.\n\n" \ 1638 "Uudecode a file that is uuencoded.\n\n" \
1149 "Options:\n" \ 1639 "Options:\n" \
1150 "\t-o FILE\tdirect output to FILE" \ 1640 "\t-o FILE\tdirect output to FILE" \
1641#define uudecode_example_usage \
1642 "$ uudecode -o busybox busybox.uu\n" \
1643 "$ ls -l busybox\n" \
1644 "-rwxr-xr-x 1 ams ams 245264 Jun 7 21:35 busybox\n"
1151 1645
1152#define uuencode_trivial_usage \ 1646#define uuencode_trivial_usage \
1153 "[OPTION] [INFILE] REMOTEFILE" 1647 "[OPTION] [INFILE] REMOTEFILE"
@@ -1155,6 +1649,12 @@
1155 "Uuencode a file.\n\n" \ 1649 "Uuencode a file.\n\n" \
1156 "Options:\n" \ 1650 "Options:\n" \
1157 "\t-m\tuse base64 encoding as of RFC1521" 1651 "\t-m\tuse base64 encoding as of RFC1521"
1652#define uuencode_example_usage \
1653 "$ uuencode busybox busybox\n" \
1654 "begin 755 busybox\n" \
1655 "<encoded file snipped>\n" \
1656 "$ uudecode busybox busybox > busybox.uu\n" \
1657 "$\n"
1158 1658
1159#define watchdog_trivial_usage \ 1659#define watchdog_trivial_usage \
1160 "DEV" 1660 "DEV"
@@ -1171,6 +1671,9 @@
1171 "\t-l\tprint the newline counts\n" \ 1671 "\t-l\tprint the newline counts\n" \
1172 "\t-L\tprint the length of the longest line\n" \ 1672 "\t-L\tprint the length of the longest line\n" \
1173 "\t-w\tprint the word counts" 1673 "\t-w\tprint the word counts"
1674#define wc_example_usage \
1675 "$ wc /etc/passwd\n" \
1676 " 31 46 1365 /etc/passwd\n"
1174 1677
1175#define wget_trivial_usage \ 1678#define wget_trivial_usage \
1176 "[-c] [-O file] url" 1679 "[-c] [-O file] url"
@@ -1184,6 +1687,9 @@
1184 "[COMMAND ...]" 1687 "[COMMAND ...]"
1185#define which_full_usage \ 1688#define which_full_usage \
1186 "Locates a COMMAND." 1689 "Locates a COMMAND."
1690#define which_example_usage \
1691 "$ which login\n" \
1692 "/bin/login\n"
1187 1693
1188#define whoami_trivial_usage \ 1694#define whoami_trivial_usage \
1189 "" 1695 ""
@@ -1194,11 +1700,14 @@
1194 "[COMMAND] [ARGS...]" 1700 "[COMMAND] [ARGS...]"
1195#define xargs_full_usage \ 1701#define xargs_full_usage \
1196 "Executes COMMAND on every item given by standard input." 1702 "Executes COMMAND on every item given by standard input."
1703#define xargs_example_usage \
1704 "$ ls | xargs gzip\n" \
1705 "$ find . -name '*.c' -print | xargs rm\n"
1197 1706
1198#define yes_trivial_usage \ 1707#define yes_trivial_usage \
1199 "[OPTION]... [STRING]..." 1708 "[OPTION]... [STRING]..."
1200#define yes_full_usage \ 1709#define yes_full_usage \
1201 "Repeatedly outputs a line with all specified STRING(s), or `y'." 1710 "Repeatedly outputs a line with all specified STRING(s), or 'y'."
1202 1711
1203#define zcat_trivial_usage \ 1712#define zcat_trivial_usage \
1204 "FILE" 1713 "FILE"
diff --git a/usage.h b/usage.h
index b60f1f911..3d4752cd2 100644
--- a/usage.h
+++ b/usage.h
@@ -15,11 +15,21 @@
15#define basename_full_usage \ 15#define basename_full_usage \
16 "Strips directory path and suffixes from FILE.\n" \ 16 "Strips directory path and suffixes from FILE.\n" \
17 "If specified, also removes any trailing SUFFIX." 17 "If specified, also removes any trailing SUFFIX."
18#define basename_example_usage \
19 "$ basename /usr/local/bin/foo\n" \
20 "foo\n" \
21 "$ basename /usr/local/bin/\n" \
22 "bin\n" \
23 "$ basename /foo/bar.txt .txt\n" \
24 "bar"
18 25
19#define cat_trivial_usage \ 26#define cat_trivial_usage \
20 "[FILE]..." 27 "[FILE]..."
21#define cat_full_usage \ 28#define cat_full_usage \
22 "Concatenates FILE(s) and prints them to stdout." 29 "Concatenates FILE(s) and prints them to stdout."
30#define cat_example_usage \
31 "$ cat /proc/uptime\n" \
32 "110716.72 17.67"
23 33
24#define chgrp_trivial_usage \ 34#define chgrp_trivial_usage \
25 "[OPTION]... GROUP FILE..." 35 "[OPTION]... GROUP FILE..."
@@ -27,6 +37,12 @@
27 "Change the group membership of each FILE to GROUP.\n" \ 37 "Change the group membership of each FILE to GROUP.\n" \
28 "\nOptions:\n" \ 38 "\nOptions:\n" \
29 "\t-R\tChanges files and directories recursively." 39 "\t-R\tChanges files and directories recursively."
40#define chgrp_example_usage \
41 "$ ls -l /tmp/foo\n" \
42 "-r--r--r-- 1 andersen andersen 0 Apr 12 18:25 /tmp/foo\n" \
43 "$ chgrp root /tmp/foo\n" \
44 "$ ls -l /tmp/foo\n" \
45 "-r--r--r-- 1 andersen root 0 Apr 12 18:25 /tmp/foo\n"
30 46
31#define chmod_trivial_usage \ 47#define chmod_trivial_usage \
32 "[-R] MODE[,MODE]... FILE..." 48 "[-R] MODE[,MODE]... FILE..."
@@ -35,6 +51,15 @@
35 "symbols +-= and one or more of the letters rwxst.\n\n" \ 51 "symbols +-= and one or more of the letters rwxst.\n\n" \
36 "Options:\n" \ 52 "Options:\n" \
37 "\t-R\tChanges files and directories recursively." 53 "\t-R\tChanges files and directories recursively."
54#define chmod_example_usage \
55 "$ ls -l /tmp/foo\n" \
56 "-rw-rw-r-- 1 root root 0 Apr 12 18:25 /tmp/foo\n" \
57 "$ chmod u+x /tmp/foo\n" \
58 "$ ls -l /tmp/foo\n" \
59 "-rwxrw-r-- 1 root root 0 Apr 12 18:25 /tmp/foo*\n" \
60 "$ chmod 444 /tmp/foo\n" \
61 "$ ls -l /tmp/foo\n" \
62 "-r--r--r-- 1 root root 0 Apr 12 18:25 /tmp/foo\n"
38 63
39#define chown_trivial_usage \ 64#define chown_trivial_usage \
40 "[OPTION]... OWNER[<.|:>[GROUP] FILE..." 65 "[OPTION]... OWNER[<.|:>[GROUP] FILE..."
@@ -42,11 +67,27 @@
42 "Change the owner and/or group of each FILE to OWNER and/or GROUP.\n" \ 67 "Change the owner and/or group of each FILE to OWNER and/or GROUP.\n" \
43 "\nOptions:\n" \ 68 "\nOptions:\n" \
44 "\t-R\tChanges files and directories recursively." 69 "\t-R\tChanges files and directories recursively."
70#define chown_example_usage \
71 "$ ls -l /tmp/foo\n" \
72 "-r--r--r-- 1 andersen andersen 0 Apr 12 18:25 /tmp/foo\n" \
73 "$ chown root /tmp/foo\n" \
74 "$ ls -l /tmp/foo\n" \
75 "-r--r--r-- 1 root andersen 0 Apr 12 18:25 /tmp/foo\n" \
76 "$ chown root.root /tmp/foo\n" \
77 "ls -l /tmp/foo\n" \
78 "-r--r--r-- 1 root root 0 Apr 12 18:25 /tmp/foo\n"
45 79
46#define chroot_trivial_usage \ 80#define chroot_trivial_usage \
47 "NEWROOT [COMMAND...]" 81 "NEWROOT [COMMAND...]"
48#define chroot_full_usage \ 82#define chroot_full_usage \
49 "Run COMMAND with root directory set to NEWROOT." 83 "Run COMMAND with root directory set to NEWROOT."
84#define chroot_example_usage \
85 "$ ls -l /bin/ls\n" \
86 "lrwxrwxrwx 1 root root 12 Apr 13 00:46 /bin/ls -> /BusyBox\n" \
87 "$ mount /dev/hdc1 /mnt -t minix\n" \
88 "$ chroot /mnt\n" \
89 "$ ls -l /bin/ls\n" \
90 "-rwxr-xr-x 1 root root 40816 Feb 5 07:45 /bin/ls*\n"
50 91
51#define chvt_trivial_usage \ 92#define chvt_trivial_usage \
52 "N" 93 "N"
@@ -85,6 +126,11 @@
85 "\t-s\t\tOutput only the lines containing delimiter\n" \ 126 "\t-s\t\tOutput only the lines containing delimiter\n" \
86 "\t-f N\t\tPrint only these fields\n" \ 127 "\t-f N\t\tPrint only these fields\n" \
87 "\t-n\t\tIgnored" 128 "\t-n\t\tIgnored"
129#define cut_example_usage \
130 "$ echo "Hello world" | cut -f 1 -d ' '\n" \
131 "Hello\n" \
132 "$ echo "Hello world" | cut -f 2 -d ' '\n" \
133 "world\n"
88 134
89#define date_trivial_usage \ 135#define date_trivial_usage \
90 "[OPTION]... [+FORMAT]" 136 "[OPTION]... [+FORMAT]"
@@ -95,6 +141,9 @@
95 "\t-d STRING\tdisplay time described by STRING, not `now'\n" \ 141 "\t-d STRING\tdisplay time described by STRING, not `now'\n" \
96 "\t-s\t\tSets time described by STRING\n" \ 142 "\t-s\t\tSets time described by STRING\n" \
97 "\t-u\t\tPrints or sets Coordinated Universal Time" 143 "\t-u\t\tPrints or sets Coordinated Universal Time"
144#define date_example_usage \
145 "$ date\n" \
146 "Wed Apr 12 18:52:41 MDT 2000\n"
98 147
99#define dc_trivial_usage \ 148#define dc_trivial_usage \
100 "expression ..." 149 "expression ..."
@@ -102,6 +151,17 @@
102 "This is a Tiny RPN calculator that understands the\n" \ 151 "This is a Tiny RPN calculator that understands the\n" \
103 "following operations: +, -, /, *, and, or, not, eor.\n" \ 152 "following operations: +, -, /, *, and, or, not, eor.\n" \
104 "i.e. 'dc 2 2 add' -> 4, and 'dc 8 8 \\* 2 2 + /' -> 16" 153 "i.e. 'dc 2 2 add' -> 4, and 'dc 8 8 \\* 2 2 + /' -> 16"
154#define dc_example_usage \
155 "$ dc 2 2 +\n" \
156 "4\n" \
157 "$ dc 8 8 \* 2 2 + /\n" \
158 "16\n" \
159 "$ dc 0 1 and\n" \
160 "0\n" \
161 "$ dc 0 1 or\n" \
162 "1\n" \
163 "$ echo 72 9 div 8 mul | dc\n" \
164 "64\n"
105 165
106#define dd_trivial_usage \ 166#define dd_trivial_usage \
107 "[if=FILE] [of=FILE] [bs=N] [count=N] [skip=N]\n" \ 167 "[if=FILE] [of=FILE] [bs=N] [count=N] [skip=N]\n" \
@@ -119,6 +179,10 @@
119 "\n" \ 179 "\n" \
120 "Numbers may be suffixed by c (x1), w (x2), b (x512), kD (x1000), k (x1024),\n" \ 180 "Numbers may be suffixed by c (x1), w (x2), b (x512), kD (x1000), k (x1024),\n" \
121 "MD (x1000000), M (x1048576), GD (x1000000000) or G (x1073741824)." 181 "MD (x1000000), M (x1048576), GD (x1000000000) or G (x1073741824)."
182#define dd_example_usage \
183 "$ dd if=/dev/zero of=/dev/ram1 bs=1M count=4\n" \
184 "4+0 records in\n" \
185 "4+0 records out\n"
122 186
123#define deallocvt_trivial_usage \ 187#define deallocvt_trivial_usage \
124 "N" 188 "N"
@@ -143,11 +207,24 @@
143 "\t-m\tprint sizes in megabytes\n" \ 207 "\t-m\tprint sizes in megabytes\n" \
144 "\t-k\tprint sizes in kilobytes(default)") USAGE_NOT_HUMAN_READABLE( \ 208 "\t-k\tprint sizes in kilobytes(default)") USAGE_NOT_HUMAN_READABLE( \
145 "\n\t-k\tprint sizes in kilobytes(compatability)") 209 "\n\t-k\tprint sizes in kilobytes(compatability)")
210#define df_example_usage \
211 "$ df\n" \
212 "Filesystem 1k-blocks Used Available Use% Mounted on\n" \
213 "/dev/sda3 8690864 8553540 137324 98% /\n" \
214 "/dev/sda1 64216 36364 27852 57% /boot\n" \
215 "$ df /dev/sda3\n" \
216 "Filesystem 1k-blocks Used Available Use% Mounted on\n" \
217 "/dev/sda3 8690864 8553540 137324 98% /\n"
146 218
147#define dirname_trivial_usage \ 219#define dirname_trivial_usage \
148 "[FILENAME ...]" 220 "[FILENAME ...]"
149#define dirname_full_usage \ 221#define dirname_full_usage \
150 "Strips non-directory suffix from FILENAME" 222 "Strips non-directory suffix from FILENAME"
223#define dirname_example_usage \
224 "$ dirname /tmp/foo\n" \
225 "/tmp\n" \
226 "$ dirname /tmp/foo/\n" \
227 "/tmp\n"
151 228
152#define dmesg_trivial_usage \ 229#define dmesg_trivial_usage \
153 "[-c] [-n LEVEL] [-s SIZE]" 230 "[-c] [-n LEVEL] [-s SIZE]"
@@ -184,6 +261,8 @@
184 "\t-e\tExtract control files to directory\n" \ 261 "\t-e\tExtract control files to directory\n" \
185 "\t-x\tExctract packages filesystem tree to directory\n" \ 262 "\t-x\tExctract packages filesystem tree to directory\n" \
186 "\t-X\tVerbose extract" 263 "\t-X\tVerbose extract"
264#define dpkg_deb_example_usage \
265 "$ dpkg-deb -X ./busybox_0.48-1_i386.deb /tmp\n"
187 266
188#define du_trivial_usage \ 267#define du_trivial_usage \
189 "[-ls" USAGE_HUMAN_READABLE("hm") USAGE_NOT_HUMAN_READABLE("") "k] [FILE]..." 268 "[-ls" USAGE_HUMAN_READABLE("hm") USAGE_NOT_HUMAN_READABLE("") "k] [FILE]..."
@@ -198,17 +277,40 @@
198 "\t-m\tprint sizes in megabytes\n" \ 277 "\t-m\tprint sizes in megabytes\n" \
199 "\t-k\tprint sizes in kilobytes(default)") USAGE_NOT_HUMAN_READABLE( \ 278 "\t-k\tprint sizes in kilobytes(default)") USAGE_NOT_HUMAN_READABLE( \
200 "\n\t-k\tprint sizes in kilobytes(compatability)") 279 "\n\t-k\tprint sizes in kilobytes(compatability)")
280#define du_example_usage \
281 "$ du\n" \
282 "16 ./CVS\n" \
283 "12 ./kernel-patches/CVS\n" \
284 "80 ./kernel-patches\n" \
285 "12 ./tests/CVS\n" \
286 "36 ./tests\n" \
287 "12 ./scripts/CVS\n" \
288 "16 ./scripts\n" \
289 "12 ./docs/CVS\n" \
290 "104 ./docs\n" \
291 "2417 .\n"
201 292
202#define dumpkmap_trivial_usage \ 293#define dumpkmap_trivial_usage \
203 "> keymap" 294 "> keymap"
204#define dumpkmap_full_usage \ 295#define dumpkmap_full_usage \
205 "Prints out a binary keyboard translation table to standard output." 296 "Prints out a binary keyboard translation table to standard output."
297#define dumpkmap_example_usage \
298 "$ dumpkmap > keymap\n"
206 299
207#define dutmp_trivial_usage \ 300#define dutmp_trivial_usage \
208 "[FILE]" 301 "[FILE]"
209#define dutmp_full_usage \ 302#define dutmp_full_usage \
210 "Dump utmp file format (pipe delimited) from FILE\n" \ 303 "Dump utmp file format (pipe delimited) from FILE\n" \
211 "or stdin to stdout. (i.e. 'dutmp /var/run/utmp')" 304 "or stdin to stdout. (i.e. 'dutmp /var/run/utmp')"
305#define dutmp_example_usage \
306 "$ dutmp /var/run/utmp\n" \
307 "8|7||si|||0|0|0|955637625|760097|0\n" \
308 "2|0|~|~~|reboot||0|0|0|955637625|782235|0\n" \
309 "1|20020|~|~~|runlevel||0|0|0|955637625|800089|0\n" \
310 "8|125||l4|||0|0|0|955637629|998367|0\n" \
311 "6|245|tty1|1|LOGIN||0|0|0|955637630|998974|0\n" \
312 "6|246|tty2|2|LOGIN||0|0|0|955637630|999498|0\n" \
313 "7|336|pts/0|vt00andersen|andersen|:0.0|0|0|0|955637763|0|0\n"
212 314
213#define echo_trivial_usage \ 315#define echo_trivial_usage \
214 "[-neE] [ARG ...]" 316 "[-neE] [ARG ...]"
@@ -218,6 +320,15 @@
218 "\t-n\tsuppress trailing newline\n" \ 320 "\t-n\tsuppress trailing newline\n" \
219 "\t-e\tinterpret backslash-escaped characters (i.e. \\t=tab etc)\n" \ 321 "\t-e\tinterpret backslash-escaped characters (i.e. \\t=tab etc)\n" \
220 "\t-E\tdisable interpretation of backslash-escaped characters" 322 "\t-E\tdisable interpretation of backslash-escaped characters"
323#define echo_example_usage \
324 "$ echo "Erik is cool"\n" \
325 "Erik is cool\n" \
326 "$ echo -e "Erik\nis\ncool"\n" \
327 "Erik\n" \
328 "is\n" \
329 "cool\n" \
330 "$ echo "Erik\nis\ncool"\n" \
331 "Erik\nis\ncool\n"
221 332
222#define expr_trivial_usage \ 333#define expr_trivial_usage \
223 "EXPRESSION" 334 "EXPRESSION"
@@ -257,6 +368,24 @@
257 "" 368 ""
258#define false_full_usage \ 369#define false_full_usage \
259 "Return an exit code of FALSE (1)." 370 "Return an exit code of FALSE (1)."
371#define false_example_usage \
372 "$ false\n" \
373 "$ echo $?\n" \
374 "1\n"
375
376#define fbset_trivial_usage \
377 "[options] [mode]"
378#define fbset_full_usage \
379 "Show and modify frame buffer settings"
380#define fbset_example_usage \
381 "$ fbset\n" \
382 "mode "1024x768-76"\n" \
383 "\t# D: 78.653 MHz, H: 59.949 kHz, V: 75.694 Hz\n" \
384 "\tgeometry 1024 768 1024 768 16\n" \
385 "\ttimings 12714 128 32 16 4 128 4\n" \
386 "\taccel false\n" \
387 "\trgba 5/11,6/5,5/0,0/0\n" \
388 "endmode\n"
260 389
261#define fdflush_trivial_usage \ 390#define fdflush_trivial_usage \
262 "DEVICE" 391 "DEVICE"
@@ -293,16 +422,27 @@
293 "\n\t-perm PERMS\tPermissions match any of (+NNN); all of (-NNN);\n\t\t\tor exactly (NNN)" \ 422 "\n\t-perm PERMS\tPermissions match any of (+NNN); all of (-NNN);\n\t\t\tor exactly (NNN)" \
294) USAGE_FIND_MTIME( \ 423) USAGE_FIND_MTIME( \
295 "\n\t-mtime TIME\tModified time is greater than (+N); less than (-N);\n\t\t\tor exactly (N) days") 424 "\n\t-mtime TIME\tModified time is greater than (+N); less than (-N);\n\t\t\tor exactly (N) days")
425#define find_example_usage \
426 "$ find / -name /etc/passwd\n" \
427 "/etc/passwd\n"
296 428
297#define free_trivial_usage \ 429#define free_trivial_usage \
298 "" 430 ""
299#define free_full_usage \ 431#define free_full_usage \
300 "Displays the amount of free and used system memory" 432 "Displays the amount of free and used system memory"
433#define free_example_usage \
434 "$ free\n" \
435 " total used free shared buffers\n" \
436 " Mem: 257628 248724 8904 59644 93124\n" \
437 " Swap: 128516 8404 120112\n" \
438 "Total: 386144 257128 129016\n" \
301 439
302#define freeramdisk_trivial_usage \ 440#define freeramdisk_trivial_usage \
303 "DEVICE" 441 "DEVICE"
304#define freeramdisk_full_usage \ 442#define freeramdisk_full_usage \
305 "Frees all memory used by the specified ramdisk." 443 "Frees all memory used by the specified ramdisk."
444#define freeramdisk_example_usage \
445 "$ freeramdisk /dev/ram2\n"
306 446
307#define fsck_minix_trivial_usage \ 447#define fsck_minix_trivial_usage \
308 "[-larvsmf] /dev/name" 448 "[-larvsmf] /dev/name"
@@ -330,6 +470,26 @@
330 "\t-s, --shell=shell Set shell quoting conventions\n" \ 470 "\t-s, --shell=shell Set shell quoting conventions\n" \
331 "\t-T, --test Test for getopt(1) version\n" \ 471 "\t-T, --test Test for getopt(1) version\n" \
332 "\t-u, --unqote Do not quote the output" 472 "\t-u, --unqote Do not quote the output"
473#define getopt_example_usage \
474 "$ cat getopt.test\n" \
475 "#!/bin/sh\n" \
476 "GETOPT=`getopt -o ab:c:: --long a-long,b-long:,c-long:: \\\n" \
477 " -n 'example.busybox' -- "$@"`\n" \
478 "if [ $? != 0 ] ; then exit 1 ; fi\n" \
479 "eval set -- "$GETOPT"\n" \
480 "while true ; do\n" \
481 " case $1 in\n" \
482 " -a|--a-long) echo \"Option a\" ; shift ;;\n" \
483 " -b|--b-long) echo \"Option b, argument \`$2'\" ; shift 2 ;;\n" \
484 " -c|--c-long)\n" \
485 " case "$2" in\n" \
486 " \"\") echo \"Option c, no argument\"; shift 2 ;;\n" \
487 " *) echo \"Option c, argument \`$2'\" ; shift 2 ;;\n" \
488 " esac ;;\n" \
489 " --) shift ; break ;;\n" \
490 " *) echo \"Internal error!\" ; exit 1 ;;\n" \
491 " esac\n" \
492 "done\n"
333 493
334#define grep_trivial_usage \ 494#define grep_trivial_usage \
335 "[-ihHnqvs] pattern [files...]" 495 "[-ihHnqvs] pattern [files...]"
@@ -343,9 +503,11 @@
343 "\t-q\tbe quiet. Returns 0 if result was found, 1 otherwise\n" \ 503 "\t-q\tbe quiet. Returns 0 if result was found, 1 otherwise\n" \
344 "\t-v\tselect non-matching lines\n" \ 504 "\t-v\tselect non-matching lines\n" \
345 "\t-s\tsuppress file open/read error messages" 505 "\t-s\tsuppress file open/read error messages"
346 506#define grep_example_usage \
347#define egrep_trivial_usage grep_trivial_usage 507 "$ grep root /etc/passwd\n" \
348#define egrep_full_usage grep_full_usage 508 "root:x:0:0:root:/root:/bin/bash\n" \
509 "$ grep ^[rR]oo. /etc/passwd\n" \
510 "root:x:0:0:root:/root:/bin/bash\n"
349 511
350#define gunzip_trivial_usage \ 512#define gunzip_trivial_usage \
351 "[OPTION]... FILE" 513 "[OPTION]... FILE"
@@ -354,6 +516,12 @@
354 "Options:\n" \ 516 "Options:\n" \
355 "\t-c\tWrite output to standard output\n" \ 517 "\t-c\tWrite output to standard output\n" \
356 "\t-t\tTest compressed file integrity" 518 "\t-t\tTest compressed file integrity"
519#define gunzip_example_usage \
520 "$ ls -la /tmp/BusyBox*\n" \
521 "-rw-rw-r-- 1 andersen andersen 557009 Apr 11 10:55 /tmp/BusyBox-0.43.tar.gz\n" \
522 "$ gunzip /tmp/BusyBox-0.43.tar.gz\n" \
523 "$ ls -la /tmp/BusyBox*\n" \
524 "-rw-rw-r-- 1 andersen andersen 1761280 Apr 14 17:47 /tmp/BusyBox-0.43.tar\n"
357 525
358#define gzip_trivial_usage \ 526#define gzip_trivial_usage \
359 "[OPTION]... FILE" 527 "[OPTION]... FILE"
@@ -363,6 +531,12 @@
363 "Options:\n" \ 531 "Options:\n" \
364 "\t-c\tWrite output to standard output instead of FILE.gz\n" \ 532 "\t-c\tWrite output to standard output instead of FILE.gz\n" \
365 "\t-d\tdecompress" 533 "\t-d\tdecompress"
534#define gzip_example_usage \
535 "$ ls -la /tmp/BusyBox*\n" \
536 "-rw-rw-r-- 1 andersen andersen 1761280 Apr 14 17:47 /tmp/BusyBox-0.43.tar\n" \
537 "$ gzip /tmp/BusyBox-0.43.tar\n" \
538 "$ ls -la /tmp/BusyBox*\n" \
539 "-rw-rw-r-- 1 andersen andersen 554058 Apr 14 17:49 /tmp/BusyBox-0.43.tar.gz\n"
366 540
367#define halt_trivial_usage \ 541#define halt_trivial_usage \
368 "" 542 ""
@@ -377,6 +551,10 @@
377 "file name. With no FILE, or when FILE is -, read standard input.\n\n" \ 551 "file name. With no FILE, or when FILE is -, read standard input.\n\n" \
378 "Options:\n" \ 552 "Options:\n" \
379 "\t-n NUM\t\tPrint first NUM lines instead of first 10" 553 "\t-n NUM\t\tPrint first NUM lines instead of first 10"
554#define head_example_usage \
555 "$ head -n 2 /etc/passwd\n" \
556 "root:x:0:0:root:/root:/bin/bash\n" \
557 "daemon:x:1:1:daemon:/usr/sbin:/bin/sh\n"
380 558
381#define hostid_trivial_usage \ 559#define hostid_trivial_usage \
382 "" 560 ""
@@ -393,6 +571,9 @@
393 "\t-i\t\tAddresses for the hostname\n" \ 571 "\t-i\t\tAddresses for the hostname\n" \
394 "\t-d\t\tDNS domain name\n" \ 572 "\t-d\t\tDNS domain name\n" \
395 "\t-F, --file FILE\tUse the contents of FILE to specify the hostname" 573 "\t-F, --file FILE\tUse the contents of FILE to specify the hostname"
574#define hostname_example_usage \
575 "$ hostname\n" \
576 "slag \n"
396 577
397#define id_trivial_usage \ 578#define id_trivial_usage \
398 "[OPTIONS]... [USERNAME]" 579 "[OPTIONS]... [USERNAME]"
@@ -403,6 +584,9 @@
403 "\t-u\tprints only the user ID\n" \ 584 "\t-u\tprints only the user ID\n" \
404 "\t-n\tprint a name instead of a number (with for -ug)\n" \ 585 "\t-n\tprint a name instead of a number (with for -ug)\n" \
405 "\t-r\tprints the real user ID instead of the effective ID (with -ug)" 586 "\t-r\tprints the real user ID instead of the effective ID (with -ug)"
587#define id_example_usage \
588 "$ id\n" \
589 "uid=1000(andersen) gid=1000(andersen)\n"
406 590
407#ifdef BB_FEATURE_IFCONFIG_SLIP 591#ifdef BB_FEATURE_IFCONFIG_SLIP
408 #define USAGE_SIOCSKEEPALIVE(a) a 592 #define USAGE_SIOCSKEEPALIVE(a) a
@@ -443,8 +627,116 @@
443#define init_trivial_usage \ 627#define init_trivial_usage \
444 "" 628 ""
445#define init_full_usage \ 629#define init_full_usage \
446 "Init is the parent of all processes.\n\n" \ 630 "Init is the parent of all processes."
447 "This version of init is designed to be run only by the kernel." 631#define init_notes_usage \
632"This version of init is designed to be run only by the kernel.\n" \
633"\n" \
634"BusyBox init doesn't support multiple runlevels. The runlevels field of\n" \
635"the /etc/inittab file is completely ignored by BusyBox init. If you want \n" \
636"runlevels, use sysvinit.\n" \
637"\n" \
638"BusyBox init works just fine without an inittab. If no inittab is found, \n" \
639"it has the following default behavior:\n" \
640"\n" \
641" ::sysinit:/etc/init.d/rcS\n" \
642" ::askfirst:/bin/sh\n" \
643"\n" \
644"if it detects that /dev/console is _not_ a serial console, it will also run:\n" \
645"\n" \
646" tty2::askfirst:/bin/sh\n" \
647"\n" \
648"If you choose to use an /etc/inittab file, the inittab entry format is as follows:\n" \
649"\n" \
650" <id>:<runlevels>:<action>:<process>\n" \
651"\n" \
652" <id>: \n" \
653"\n" \
654" WARNING: This field has a non-traditional meaning for BusyBox init!\n" \
655" The id field is used by BusyBox init to specify the controlling tty for\n" \
656" the specified process to run on. The contents of this field are\n" \
657" appended to "/dev/" and used as-is. There is no need for this field to\n" \
658" be unique, although if it isn't you may have strange results. If this\n" \
659" field is left blank, the controlling tty is set to the console. Also\n" \
660" note that if BusyBox detects that a serial console is in use, then only\n" \
661" entries whose controlling tty is either the serial console or /dev/null\n" \
662" will be run. BusyBox init does nothing with utmp. We don't need no\n" \
663" stinkin' utmp.\n" \
664"\n" \
665" <runlevels>: \n" \
666"\n" \
667" The runlevels field is completely ignored.\n" \
668"\n" \
669" <action>: \n" \
670"\n" \
671" Valid actions include: sysinit, respawn, askfirst, wait, \n" \
672" once, and ctrlaltdel.\n" \
673"\n" \
674" The available actions can be classified into two groups: actions\n" \
675" that are run only once, and actions that are re-run when the specified\n" \
676" process exits.\n" \
677"\n" \
678" Run only-once actions:\n" \
679"\n" \
680" 'sysinit' is the first item run on boot. init waits until all\n" \
681" sysinit actions are completed before continuing. Following the\n" \
682" completion of all sysinit actions, all 'wait' actions are run.\n" \
683" 'wait' actions, like 'sysinit' actions, cause init to wait until\n" \
684" the specified task completes. 'once' actions are asyncronous,\n" \
685" therefore, init does not wait for them to complete. 'ctrlaltdel'\n" \
686" actions are run immediately before init causes the system to reboot\n" \
687" (unmounting filesystems with a 'ctrlaltdel' action is a very good\n" \
688" idea).\n" \
689"\n" \
690" Run repeatedly actions:\n" \
691"\n" \
692" 'respawn' actions are run after the 'once' actions. When a process\n" \
693" started with a 'respawn' action exits, init automatically restarts\n" \
694" it. Unlike sysvinit, BusyBox init does not stop processes from\n" \
695" respawning out of control. The 'askfirst' actions acts just like\n" \
696" respawn, except that before running the specified process it\n" \
697" displays the line "Please press Enter to activate this console."\n" \
698" and then waits for the user to press enter before starting the\n" \
699" specified process. \n" \
700"\n" \
701" Unrecognized actions (like initdefault) will cause init to emit an\n" \
702" error message, and then go along with its business. All actions are\n" \
703" run in the reverse order from how they appear in /etc/inittab.\n" \
704"\n" \
705" <process>: \n" \
706"\n" \
707" Specifies the process to be executed and it's command line.\n" \
708"\n" \
709"Example /etc/inittab file:\n" \
710" # This is run first except when booting in single-user mode.\n" \
711" #\n" \
712" ::sysinit:/etc/init.d/rcS\n" \
713" \n" \
714" # /bin/sh invocations on selected ttys\n" \
715" #\n" \
716" # Start an "askfirst" shell on the console (whatever that may be)\n" \
717" ::askfirst:-/bin/sh\n" \
718" # Start an "askfirst" shell on /dev/tty2-4\n" \
719" tty2::askfirst:-/bin/sh\n" \
720" tty3::askfirst:-/bin/sh\n" \
721" tty4::askfirst:-/bin/sh\n" \
722" \n" \
723" # /sbin/getty invocations for selected ttys\n" \
724" #\n" \
725" tty4::respawn:/sbin/getty 38400 tty5\n" \
726" tty5::respawn:/sbin/getty 38400 tty6\n" \
727" \n" \
728" \n" \
729" # Example of how to put a getty on a serial line (for a terminal)\n" \
730" #\n" \
731" #::respawn:/sbin/getty -L ttyS0 9600 vt100\n" \
732" #::respawn:/sbin/getty -L ttyS1 9600 vt100\n" \
733" #\n" \
734" # Example how to put a getty on a modem line.\n" \
735" #::respawn:/sbin/getty 57600 ttyS2\n" \
736" \n" \
737" # Stuff to do before rebooting\n" \
738" ::ctrlaltdel:/bin/umount -a -r\n" \
739" ::ctrlaltdel:/sbin/swapoff -a\n"
448 740
449#define insmod_trivial_usage \ 741#define insmod_trivial_usage \
450 "[OPTION]... MODULE [symbol=value]..." 742 "[OPTION]... MODULE [symbol=value]..."
@@ -463,6 +755,15 @@
463 "Send a signal (default is SIGTERM) to the specified process(es).\n\n"\ 755 "Send a signal (default is SIGTERM) to the specified process(es).\n\n"\
464 "Options:\n" \ 756 "Options:\n" \
465 "\t-l\tList all signal names and numbers." 757 "\t-l\tList all signal names and numbers."
758#define kill_example_usage \
759 "$ ps | grep apache\n" \
760 "252 root root S [apache]\n" \
761 "263 www-data www-data S [apache]\n" \
762 "264 www-data www-data S [apache]\n" \
763 "265 www-data www-data S [apache]\n" \
764 "266 www-data www-data S [apache]\n" \
765 "267 www-data www-data S [apache]\n" \
766 "$ kill 252\n"
466 767
467#define killall_trivial_usage \ 768#define killall_trivial_usage \
468 "[-signal] process-name [process-name ...]" 769 "[-signal] process-name [process-name ...]"
@@ -470,6 +771,8 @@
470 "Send a signal (default is SIGTERM) to the specified process(es).\n\n"\ 771 "Send a signal (default is SIGTERM) to the specified process(es).\n\n"\
471 "Options:\n" \ 772 "Options:\n" \
472 "\t-l\tList all signal names and numbers." 773 "\t-l\tList all signal names and numbers."
774#define killall_example_usage \
775 "$ killall apache\n"
473 776
474#define klogd_trivial_usage \ 777#define klogd_trivial_usage \
475 "-n" 778 "-n"
@@ -482,6 +785,9 @@
482 "STRING" 785 "STRING"
483#define length_full_usage \ 786#define length_full_usage \
484 "Prints out the length of the specified STRING." 787 "Prints out the length of the specified STRING."
788#define length_example_usage \
789 "$ length "Hello"\n" \
790 "5\n"
485 791
486#define ln_trivial_usage \ 792#define ln_trivial_usage \
487 "[OPTION] TARGET... LINK_NAME|DIRECTORY" 793 "[OPTION] TARGET... LINK_NAME|DIRECTORY"
@@ -492,21 +798,31 @@
492 "\t-s\tmake symbolic links instead of hard links\n" \ 798 "\t-s\tmake symbolic links instead of hard links\n" \
493 "\t-f\tremove existing destination files\n" \ 799 "\t-f\tremove existing destination files\n" \
494 "\t-n\tno dereference symlinks - treat like normal file" 800 "\t-n\tno dereference symlinks - treat like normal file"
801#define ln_example_usage \
802 "$ ln -s BusyBox /tmp/ls\n" \
803 "$ ls -l /tmp/ls\n" \
804 "lrwxrwxrwx 1 root root 7 Apr 12 18:39 ls -> BusyBox*\n"
495 805
496#define loadacm_trivial_usage \ 806#define loadacm_trivial_usage \
497 "< mapfile" 807 "< mapfile"
498#define loadacm_full_usage \ 808#define loadacm_full_usage \
499 "Loads an acm from standard input." 809 "Loads an acm from standard input."
810#define loadacm_example_usage \
811 "$ loadacm < /etc/i18n/acmname\n"
500 812
501#define loadfont_trivial_usage \ 813#define loadfont_trivial_usage \
502 "< font" 814 "< font"
503#define loadfont_full_usage \ 815#define loadfont_full_usage \
504 "Loads a console font from standard input." 816 "Loads a console font from standard input."
817#define loadfont_example_usage \
818 "$ loadfont < /etc/i18n/fontname\n"
505 819
506#define loadkmap_trivial_usage \ 820#define loadkmap_trivial_usage \
507 "< keymap" 821 "< keymap"
508#define loadkmap_full_usage \ 822#define loadkmap_full_usage \
509 "Loads a binary keyboard translation table from standard input." 823 "Loads a binary keyboard translation table from standard input."
824#define loadkmap_example_usage \
825 "$ loadkmap < /etc/i18n/lang-keymap\n"
510 826
511#define logger_trivial_usage \ 827#define logger_trivial_usage \
512 "[OPTION]... [MESSAGE]" 828 "[OPTION]... [MESSAGE]"
@@ -517,11 +833,16 @@
517 "\t-t\tLog using the specified tag (defaults to user name).\n" \ 833 "\t-t\tLog using the specified tag (defaults to user name).\n" \
518 "\t-p\tEnter the message with the specified priority.\n" \ 834 "\t-p\tEnter the message with the specified priority.\n" \
519 "\t\tThis may be numerical or a ``facility.level'' pair." 835 "\t\tThis may be numerical or a ``facility.level'' pair."
836#define logger_example_usage \
837 "$ logger "hello"\n"
520 838
521#define logname_trivial_usage \ 839#define logname_trivial_usage \
522 "" 840 ""
523#define logname_full_usage \ 841#define logname_full_usage \
524 "Print the name of the current user." 842 "Print the name of the current user."
843#define logname_example_usage \
844 "$ logname\n" \
845 "root\n"
525 846
526#define logread_trivial_usage \ 847#define logread_trivial_usage \
527 "" 848 ""
@@ -612,6 +933,11 @@
612 "For example:\n" \ 933 "For example:\n" \
613 "\tmakedevs /dev/ttyS c 4 66 2 63 -> ttyS2-ttyS63\n" \ 934 "\tmakedevs /dev/ttyS c 4 66 2 63 -> ttyS2-ttyS63\n" \
614 "\tmakedevs /dev/hda b 3 0 0 8 s -> hda,hda1-hda8" 935 "\tmakedevs /dev/hda b 3 0 0 8 s -> hda,hda1-hda8"
936#define makedevs_example_usage \
937 "$ makedevs /dev/ttyS c 4 66 2 63\n" \
938 "[creates ttyS2-ttyS63]\n" \
939 "$ makedevs /dev/hda b 3 0 0 8 s\n" \
940 "[creates hda,hda1-hda8]\n"
615 941
616#define md5sum_trivial_usage \ 942#define md5sum_trivial_usage \
617 "[OPTION] [FILE]...\n" \ 943 "[OPTION] [FILE]...\n" \
@@ -627,6 +953,15 @@
627 "\nThe following two options are useful only when verifying checksums:\n" \ 953 "\nThe following two options are useful only when verifying checksums:\n" \
628 "\t-s\tdon't output anything, status code shows success\n" \ 954 "\t-s\tdon't output anything, status code shows success\n" \
629 "\t-w\twarn about improperly formated MD5 checksum lines" 955 "\t-w\twarn about improperly formated MD5 checksum lines"
956#define md5sum_example_usage \
957 "$ md5sum < busybox\n" \
958 "6fd11e98b98a58f64ff3398d7b324003\n" \
959 "$ md5sum busybox\n" \
960 "6fd11e98b98a58f64ff3398d7b324003 busybox\n" \
961 "$ md5sum -c -\n" \
962 "6fd11e98b98a58f64ff3398d7b324003 busybox\n" \
963 "busybox: OK\n" \
964 "^D\n"
630 965
631#define mkdir_trivial_usage \ 966#define mkdir_trivial_usage \
632 "[OPTION] DIRECTORY..." 967 "[OPTION] DIRECTORY..."
@@ -635,6 +970,13 @@
635 "Options:\n" \ 970 "Options:\n" \
636 "\t-m\tset permission mode (as in chmod), not rwxrwxrwx - umask\n" \ 971 "\t-m\tset permission mode (as in chmod), not rwxrwxrwx - umask\n" \
637 "\t-p\tno error if existing, make parent directories as needed" 972 "\t-p\tno error if existing, make parent directories as needed"
973#define mkdir_example_usage \
974 "$ mkdir /tmp/foo\n" \
975 "$ mkdir /tmp/foo\n" \
976 "/tmp/foo: File exists\n" \
977 "$ mkdir /tmp/foo/bar/baz\n" \
978 "/tmp/foo/bar/baz: No such file or directory\n" \
979 "$ mkdir -p /tmp/foo/bar/baz\n"
638 980
639#define mkfifo_trivial_usage \ 981#define mkfifo_trivial_usage \
640 "[OPTIONS] name" 982 "[OPTIONS] name"
@@ -664,6 +1006,9 @@
664 "\tb:\tMake a block (buffered) device.\n" \ 1006 "\tb:\tMake a block (buffered) device.\n" \
665 "\tc or u:\tMake a character (un-buffered) device.\n" \ 1007 "\tc or u:\tMake a character (un-buffered) device.\n" \
666 "\tp:\tMake a named pipe. MAJOR and MINOR are ignored for named pipes." 1008 "\tp:\tMake a named pipe. MAJOR and MINOR are ignored for named pipes."
1009#define mknod_example_usage \
1010 "$ mknod /dev/fd0 b 2 0 \n" \
1011 "$ mknod -m 644 /tmp/pipe p\n"
667 1012
668#define mkswap_trivial_usage \ 1013#define mkswap_trivial_usage \
669 "[-c] [-v0|-v1] device [block-count]" 1014 "[-c] [-v0|-v1] device [block-count]"
@@ -680,11 +1025,18 @@
680#define mktemp_full_usage \ 1025#define mktemp_full_usage \
681 "Creates a temporary file with its name based on TEMPLATE.\n" \ 1026 "Creates a temporary file with its name based on TEMPLATE.\n" \
682 "TEMPLATE is any name with six `Xs' (i.e. /tmp/temp.XXXXXX)." 1027 "TEMPLATE is any name with six `Xs' (i.e. /tmp/temp.XXXXXX)."
1028#define mktemp_example_usage \
1029 "$ mktemp /tmp/temp.XXXXXX\n" \
1030 "/tmp/temp.mWiLjM\n" \
1031 "$ ls -la /tmp/temp.mWiLjM\n" \
1032 "-rw------- 1 andersen andersen 0 Apr 25 17:10 /tmp/temp.mWiLjM\n"
683 1033
684#define more_trivial_usage \ 1034#define more_trivial_usage \
685 "[FILE ...]" 1035 "[FILE ...]"
686#define more_full_usage \ 1036#define more_full_usage \
687 "More is a filter for viewing FILE one screenful at a time." 1037 "More is a filter for viewing FILE one screenful at a time."
1038#define more_example_usage \
1039 "$ dmesg | more\n"
688 1040
689#ifdef BB_FEATURE_MOUNT_LOOP 1041#ifdef BB_FEATURE_MOUNT_LOOP
690 #define USAGE_MOUNT_LOOP(a) a 1042 #define USAGE_MOUNT_LOOP(a) a
@@ -724,6 +1076,13 @@
724 "\tro/rw:\t\tMount for read-only / read-write.\n" \ 1076 "\tro/rw:\t\tMount for read-only / read-write.\n" \
725 "\nThere are EVEN MORE flags that are specific to each filesystem.\n" \ 1077 "\nThere are EVEN MORE flags that are specific to each filesystem.\n" \
726 "You'll have to see the written documentation for those." 1078 "You'll have to see the written documentation for those."
1079#define mount_example_usage \
1080 "$ mount\n" \
1081 "/dev/hda3 on / type minix (rw)\n" \
1082 "proc on /proc type proc (rw)\n" \
1083 "devpts on /dev/pts type devpts (rw)\n" \
1084 "$ mount /dev/fd0 /mnt -t msdos -o ro\n" \
1085 "$ mount /tmp/diskimage /opt -t ext2 -o loop\n"
727 1086
728#define mt_trivial_usage \ 1087#define mt_trivial_usage \
729 "[-f device] opcode value" 1088 "[-f device] opcode value"
@@ -740,16 +1099,34 @@
740 "or: mv SOURCE... DIRECTORY" 1099 "or: mv SOURCE... DIRECTORY"
741#define mv_full_usage \ 1100#define mv_full_usage \
742 "Rename SOURCE to DEST, or move SOURCE(s) to DIRECTORY." 1101 "Rename SOURCE to DEST, or move SOURCE(s) to DIRECTORY."
1102#define mv_example_usage \
1103 "$ mv /tmp/foo /bin/bar\n"
743 1104
744#define nc_trivial_usage \ 1105#define nc_trivial_usage \
745 "[IP] [port]" 1106 "[IP] [port]"
746#define nc_full_usage \ 1107#define nc_full_usage \
747 "Netcat opens a pipe to IP:port" 1108 "Netcat opens a pipe to IP:port"
1109#define nc_example_usage \
1110 "$ nc foobar.somedomain.com 25\n" \
1111 "220 foobar ESMTP Exim 3.12 #1 Sat, 15 Apr 2000 00:03:02 -0600\n" \
1112 "help\n" \
1113 "214-Commands supported:\n" \
1114 "214- HELO EHLO MAIL RCPT DATA AUTH\n" \
1115 "214 NOOP QUIT RSET HELP\n" \
1116 "quit\n" \
1117 "221 foobar closing connection\n"
748 1118
749#define nslookup_trivial_usage \ 1119#define nslookup_trivial_usage \
750 "[HOST]" 1120 "[HOST]"
751#define nslookup_full_usage \ 1121#define nslookup_full_usage \
752 "Queries the nameserver for the IP address of the given HOST" 1122 "Queries the nameserver for the IP address of the given HOST"
1123#define nslookup_example_usage \
1124 "$ nslookup localhost\n" \
1125 "Server: default\n" \
1126 "Address: default\n" \
1127 "\n" \
1128 "Name: debian\n" \
1129 "Address: 127.0.0.1\n"
753 1130
754#ifdef BB_FEATURE_SIMPLE_PING 1131#ifdef BB_FEATURE_SIMPLE_PING
755#define ping_trivial_usage "host" 1132#define ping_trivial_usage "host"
@@ -765,6 +1142,14 @@
765 "\t-q\t\tQuiet mode, only displays output at start\n" \ 1142 "\t-q\t\tQuiet mode, only displays output at start\n" \
766 "\t\t\tand when finished." 1143 "\t\t\tand when finished."
767#endif 1144#endif
1145#define ping_example_usage \
1146 "$ ping localhost\n" \
1147 "PING slag (127.0.0.1): 56 data bytes\n" \
1148 "64 bytes from 127.0.0.1: icmp_seq=0 ttl=255 time=20.1 ms\n" \
1149 "\n" \
1150 "--- debian ping statistics ---\n" \
1151 "1 packets transmitted, 1 packets received, 0% packet loss\n" \
1152 "round-trip min/avg/max = 20.1/20.1/20.1 ms\n"
768 1153
769#define pivot_root_trivial_usage \ 1154#define pivot_root_trivial_usage \
770 "new_root put_old" 1155 "new_root put_old"
@@ -782,17 +1167,35 @@
782#define printf_full_usage \ 1167#define printf_full_usage \
783 "Formats and prints ARGUMENT(s) according to FORMAT,\n" \ 1168 "Formats and prints ARGUMENT(s) according to FORMAT,\n" \
784 "Where FORMAT controls the output exactly as in C printf." 1169 "Where FORMAT controls the output exactly as in C printf."
1170#define printf_example_usage \
1171 "$ printf "Val=%d\n" 5\n" \
1172 "Val=5\n"
785 1173
786#define ps_trivial_usage \ 1174#define ps_trivial_usage \
787 "" 1175 ""
788#define ps_full_usage \ 1176#define ps_full_usage \
789 "Report process status\n" \ 1177 "Report process status\n" \
790 "\nThis version of ps accepts no options." 1178 "\nThis version of ps accepts no options."
1179#define ps_example_usage \
1180 "$ ps\n" \
1181 " PID Uid Gid State Command\n" \
1182 " 1 root root S init\n" \
1183 " 2 root root S [kflushd]\n" \
1184 " 3 root root S [kupdate]\n" \
1185 " 4 root root S [kpiod]\n" \
1186 " 5 root root S [kswapd]\n" \
1187 " 742 andersen andersen S [bash]\n" \
1188 " 743 andersen andersen S -bash\n" \
1189 " 745 root root S [getty]\n" \
1190 " 2990 andersen andersen R ps\n"
791 1191
792#define pwd_trivial_usage \ 1192#define pwd_trivial_usage \
793 "" 1193 ""
794#define pwd_full_usage \ 1194#define pwd_full_usage \
795 "Print the full filename of the current working directory." 1195 "Print the full filename of the current working directory."
1196#define pwd_example_usage \
1197 "$ pwd\n" \
1198 "/root\n"
796 1199
797#define rdate_trivial_usage \ 1200#define rdate_trivial_usage \
798 "[OPTION] HOST" 1201 "[OPTION] HOST"
@@ -838,11 +1241,15 @@
838 USAGE_RM_INTERACTIVE("\t-i\t\talways prompt before removing each destinations\n") \ 1241 USAGE_RM_INTERACTIVE("\t-i\t\talways prompt before removing each destinations\n") \
839 "\t-f\t\tremove existing destinations, never prompt\n" \ 1242 "\t-f\t\tremove existing destinations, never prompt\n" \
840 "\t-r or -R\tremove the contents of directories recursively" 1243 "\t-r or -R\tremove the contents of directories recursively"
1244#define rm_example_usage \
1245 "$ rm -rf /tmp/foo\n"
841 1246
842#define rmdir_trivial_usage \ 1247#define rmdir_trivial_usage \
843 "[OPTION]... DIRECTORY..." 1248 "[OPTION]... DIRECTORY..."
844#define rmdir_full_usage \ 1249#define rmdir_full_usage \
845 "Remove the DIRECTORY(ies), if they are empty." 1250 "Remove the DIRECTORY(ies), if they are empty."
1251#define rmdir_example_usage \
1252 "# rmdir /tmp/foo\n"
846 1253
847#define rmmod_trivial_usage \ 1254#define rmmod_trivial_usage \
848 "[OPTION]... [MODULE]..." 1255 "[OPTION]... [MODULE]..."
@@ -850,6 +1257,8 @@
850 "Unloads the specified kernel modules from the kernel.\n\n" \ 1257 "Unloads the specified kernel modules from the kernel.\n\n" \
851 "Options:\n" \ 1258 "Options:\n" \
852 "\t-a\tTry to remove all unused kernel modules." 1259 "\t-a\tTry to remove all unused kernel modules."
1260#define rmmod_example_usage \
1261 "$ rmmod tulip\n"
853 1262
854#define route_trivial_usage \ 1263#define route_trivial_usage \
855 "[{add|del|flush}]" 1264 "[{add|del|flush}]"
@@ -873,6 +1282,9 @@
873 "If no -e or -f is given, the first non-option argument is taken as the\n" \ 1282 "If no -e or -f is given, the first non-option argument is taken as the\n" \
874 "sed script to interpret. All remaining arguments are names of input\n" \ 1283 "sed script to interpret. All remaining arguments are names of input\n" \
875 "files; if no input files are specified, then the standard input is read." 1284 "files; if no input files are specified, then the standard input is read."
1285#define sed_example_usage \
1286 "$ echo "foo" | sed -e 's/f[a-zA-Z]o/bar/g'\n" \
1287 "bar\n"
876 1288
877#define setkeycodes_trivial_usage \ 1289#define setkeycodes_trivial_usage \
878 "SCANCODE KEYCODE ..." 1290 "SCANCODE KEYCODE ..."
@@ -881,17 +1293,31 @@
881 "allowing unusual keyboards to generate usable keycodes.\n\n" \ 1293 "allowing unusual keyboards to generate usable keycodes.\n\n" \
882 "SCANCODE may be either xx or e0xx (hexadecimal),\n" \ 1294 "SCANCODE may be either xx or e0xx (hexadecimal),\n" \
883 "and KEYCODE is given in decimal" 1295 "and KEYCODE is given in decimal"
1296#define setkeycodes_example_usage \
1297 "$ setkeycodes e030 127\n"
884 1298
885#define sh_trivial_usage \ 1299#define sh_trivial_usage \
886 "[FILE]...\n" \ 1300 "[FILE]...\n" \
887 "or: sh -c command [args]..." 1301 "or: sh -c command [args]..."
888#define sh_full_usage \ 1302#define sh_full_usage \
889 "lash: The BusyBox command interpreter (shell)." 1303 "lash: The BusyBox LAme SHell (command interpreter)"
1304#define sh_notes_usage \
1305"This command does not yet have proper documentation.\n" \
1306"\n" \
1307"Use lash just as you would use any other shell. It properly handles pipes,\n" \
1308"redirects, job control, can be used as the shell for scripts, and has a\n" \
1309"sufficient set of builtins to do what is needed. It does not (yet) support\n" \
1310"Bourne Shell syntax. If you need things like "if-then-else", "while", and such\n" \
1311"use ash or bash. If you just need a very simple and extremely small shell,\n" \
1312"this will do the job."
890 1313
891#define sleep_trivial_usage \ 1314#define sleep_trivial_usage \
892 "N" 1315 "N"
893#define sleep_full_usage \ 1316#define sleep_full_usage \
894 "Pause for N seconds." 1317 "Pause for N seconds."
1318#define sleep_example_usage \
1319 "$ sleep 2\n" \
1320 "[2 second delay results]\n"
895 1321
896 1322
897#ifdef BB_FEATURE_SORT_REVERSE 1323#ifdef BB_FEATURE_SORT_REVERSE
@@ -903,6 +1329,14 @@
903 "[-n]" USAGE_SORT_REVERSE(" [-r]") " [FILE]..." 1329 "[-n]" USAGE_SORT_REVERSE(" [-r]") " [FILE]..."
904#define sort_full_usage \ 1330#define sort_full_usage \
905 "Sorts lines of text in the specified files" 1331 "Sorts lines of text in the specified files"
1332#define sort_example_usage \
1333 "$ echo -e "e\nf\nb\nd\nc\na" | sort\n" \
1334 "a\n" \
1335 "b\n" \
1336 "c\n" \
1337 "d\n" \
1338 "e\n" \
1339 "f\n"
906 1340
907#define stty_trivial_usage \ 1341#define stty_trivial_usage \
908 "[-a|g] [-F device] [SETTING]..." 1342 "[-a|g] [-F device] [SETTING]..."
@@ -952,6 +1386,9 @@
952 USAGE_REMOTE_LOG( \ 1386 USAGE_REMOTE_LOG( \
953 "\n\t-R HOST[:PORT]\tLog to IP or hostname on PORT (default PORT=514/UDP)\n" \ 1387 "\n\t-R HOST[:PORT]\tLog to IP or hostname on PORT (default PORT=514/UDP)\n" \
954 "\t-L\t\tLog locally and via network logging (default is network only)") 1388 "\t-L\t\tLog locally and via network logging (default is network only)")
1389#define syslogd_example_usage \
1390 "$ syslogd -R masterlog:514\n" \
1391 "$ syslogd -R 192.168.1.1:601\n"
955 1392
956 1393
957#ifdef BB_FEATURE_SIMPLE_TAIL 1394#ifdef BB_FEATURE_SIMPLE_TAIL
@@ -969,14 +1406,15 @@
969 USAGE_UNSIMPLE_TAIL("\t-c N[kbm]\toutput the last N bytes\n") \ 1406 USAGE_UNSIMPLE_TAIL("\t-c N[kbm]\toutput the last N bytes\n") \
970 "\t-n N[kbm]\tprint last N lines instead of last 10\n" \ 1407 "\t-n N[kbm]\tprint last N lines instead of last 10\n" \
971 "\t-f\t\toutput data as the file grows" \ 1408 "\t-f\t\toutput data as the file grows" \
972 USAGE_UNSIMPLE_TAIL( \ 1409 USAGE_UNSIMPLE_TAIL( "\n\t-q\t\tnever output headers giving file names\n" \
973 "\n\t-q\t\tnever output headers giving file names\n" \
974 "\t-s SEC\t\twait SEC seconds between reads with -f\n" \ 1410 "\t-s SEC\t\twait SEC seconds between reads with -f\n" \
975 "\t-v\t\talways output headers giving file names\n\n" \ 1411 "\t-v\t\talways output headers giving file names\n\n" \
976 "If the first character of N (bytes or lines) is a `+', output begins with \n" \ 1412 "If the first character of N (bytes or lines) is a '+', output begins with \n" \
977 "the Nth item from the start of each file, otherwise, print the last N items\n" \ 1413 "the Nth item from the start of each file, otherwise, print the last N items\n" \
978 "in the file. N bytes may be suffixed by k (x1024), b (x512), or m (1024^2)." \ 1414 "in the file. N bytes may be suffixed by k (x1024), b (x512), or m (1024^2)." )
979 ) 1415#define tail_example_usage \
1416 "$ tail -n 1 /etc/resolv.conf\n" \
1417 "nameserver 10.0.0.1\n"
980 1418
981#ifdef BB_FEATURE_TAR_CREATE 1419#ifdef BB_FEATURE_TAR_CREATE
982 #define USAGE_TAR_CREATE(a) a 1420 #define USAGE_TAR_CREATE(a) a
@@ -1007,6 +1445,9 @@
1007 ) \ 1445 ) \
1008 "\nInformative output:\n" \ 1446 "\nInformative output:\n" \
1009 "\tv\t\tverbosely list files processed" 1447 "\tv\t\tverbosely list files processed"
1448#define tar_example_usage \
1449 "$ zcat /tmp/tarball.tar.gz | tar -xf -\n" \
1450 "$ tar -cf /tmp/tarball.tar /usr/local\n"
1010 1451
1011#define tee_trivial_usage \ 1452#define tee_trivial_usage \
1012 "[OPTION]... [FILE]..." 1453 "[OPTION]... [FILE]..."
@@ -1014,6 +1455,10 @@
1014 "Copy standard input to each FILE, and also to standard output.\n\n" \ 1455 "Copy standard input to each FILE, and also to standard output.\n\n" \
1015 "Options:\n" \ 1456 "Options:\n" \
1016 "\t-a\tappend to the given FILEs, do not overwrite" 1457 "\t-a\tappend to the given FILEs, do not overwrite"
1458#define tee_example_usage \
1459 "$ echo "Hello" | tee /tmp/foo\n" \
1460 "$ cat /tmp/foo\n" \
1461 "Hello\n"
1017 1462
1018#define telnet_trivial_usage \ 1463#define telnet_trivial_usage \
1019 "host [port]" 1464 "host [port]"
@@ -1026,6 +1471,19 @@
1026#define test_full_usage \ 1471#define test_full_usage \
1027 "Checks file types and compares values returning an exit\n" \ 1472 "Checks file types and compares values returning an exit\n" \
1028 "code determined by the value of EXPRESSION." 1473 "code determined by the value of EXPRESSION."
1474#define test_example_usage \
1475 "$ test 1 -eq 2\n" \
1476 "$ echo $?\n" \
1477 "1\n" \
1478 "$ test 1 -eq 1\n" \
1479 "$ echo $? \n" \
1480 "0\n" \
1481 "$ [ -d /etc ]\n" \
1482 "$ echo $?\n" \
1483 "0\n" \
1484 "$ [ -d /junk ]\n" \
1485 "$ echo $?\n" \
1486 "1\n"
1029 1487
1030#ifdef BB_FEATURE_TFTP_GET 1488#ifdef BB_FEATURE_TFTP_GET
1031 #define USAGE_TFTP_GET(a) a 1489 #define USAGE_TFTP_GET(a) a
@@ -1057,6 +1515,12 @@
1057 "Update the last-modified date on the given file[s].\n\n" \ 1515 "Update the last-modified date on the given file[s].\n\n" \
1058 "Options:\n" \ 1516 "Options:\n" \
1059 "\t-c\tDo not create any files" 1517 "\t-c\tDo not create any files"
1518#define touch_example_usage \
1519 "$ ls -l /tmp/foo\n" \
1520 "/bin/ls: /tmp/foo: No such file or directory\n" \
1521 "$ touch /tmp/foo\n" \
1522 "$ ls -l /tmp/foo\n" \
1523 "-rw-rw-r-- 1 andersen andersen 0 Apr 15 01:11 /tmp/foo\n"
1060 1524
1061#define tr_trivial_usage \ 1525#define tr_trivial_usage \
1062 "[-cds] STRING1 [STRING2]" 1526 "[-cds] STRING1 [STRING2]"
@@ -1067,11 +1531,18 @@
1067 "\t-c\ttake complement of STRING1\n" \ 1531 "\t-c\ttake complement of STRING1\n" \
1068 "\t-d\tdelete input characters coded STRING1\n" \ 1532 "\t-d\tdelete input characters coded STRING1\n" \
1069 "\t-s\tsqueeze multiple output characters of STRING2 into one character" 1533 "\t-s\tsqueeze multiple output characters of STRING2 into one character"
1534#define tr_example_usage \
1535 "$ echo "gdkkn vnqkc" | tr [a-y] [b-z]\n" \
1536 "hello world\n"
1070 1537
1071#define true_trivial_usage \ 1538#define true_trivial_usage \
1072 "" 1539 ""
1073#define true_full_usage \ 1540#define true_full_usage \
1074 "Return an exit code of TRUE (0)." 1541 "Return an exit code of TRUE (0)."
1542#define true_example_usage \
1543 "$ true\n" \
1544 "$ echo $?\n" \
1545 "0\n"
1075 1546
1076#define tty_trivial_usage \ 1547#define tty_trivial_usage \
1077 "" 1548 ""
@@ -1079,6 +1550,9 @@
1079 "Print the file name of the terminal connected to standard input.\n\n"\ 1550 "Print the file name of the terminal connected to standard input.\n\n"\
1080 "Options:\n" \ 1551 "Options:\n" \
1081 "\t-s\tprint nothing, only return an exit status" 1552 "\t-s\tprint nothing, only return an exit status"
1553#define tty_example_usage \
1554 "$ tty\n" \
1555 "/dev/tty2\n"
1082 1556
1083#ifdef BB_FEATURE_MOUNT_FORCE 1557#ifdef BB_FEATURE_MOUNT_FORCE
1084 #define USAGE_MOUNT_FORCE(a) a 1558 #define USAGE_MOUNT_FORCE(a) a
@@ -1094,6 +1568,8 @@
1094 "\n\t-r:\tTry to remount devices as read-only if mount is busy" \ 1568 "\n\t-r:\tTry to remount devices as read-only if mount is busy" \
1095 USAGE_MOUNT_FORCE("\n\t-f:\tForce filesystem umount (i.e. unreachable NFS server)") \ 1569 USAGE_MOUNT_FORCE("\n\t-f:\tForce filesystem umount (i.e. unreachable NFS server)") \
1096 USAGE_MOUNT_LOOP("\n\t-l:\tDo not free loop device (if a loop device has been used)") 1570 USAGE_MOUNT_LOOP("\n\t-l:\tDo not free loop device (if a loop device has been used)")
1571#define umount_example_usage \
1572 "$ umount /dev/hdc1 \n"
1097 1573
1098#define uname_trivial_usage \ 1574#define uname_trivial_usage \
1099 "[OPTION]..." 1575 "[OPTION]..."
@@ -1107,6 +1583,9 @@
1107 "\t-s\tprint the operating system name\n" \ 1583 "\t-s\tprint the operating system name\n" \
1108 "\t-p\tprint the host processor type\n" \ 1584 "\t-p\tprint the host processor type\n" \
1109 "\t-v\tprint the operating system version" 1585 "\t-v\tprint the operating system version"
1586#define uname_example_usage \
1587 "$ uname -a\n" \
1588 "Linux debian 2.2.15pre13 #5 Tue Mar 14 16:03:50 MST 2000 i686 unknown\n"
1110 1589
1111#define uniq_trivial_usage \ 1590#define uniq_trivial_usage \
1112 "[OPTION]... [INPUT [OUTPUT]]" 1591 "[OPTION]... [INPUT [OUTPUT]]"
@@ -1117,6 +1596,11 @@
1117 "\t-c\tprefix lines by the number of occurrences\n" \ 1596 "\t-c\tprefix lines by the number of occurrences\n" \
1118 "\t-d\tonly print duplicate lines\n" \ 1597 "\t-d\tonly print duplicate lines\n" \
1119 "\t-u\tonly print unique lines" 1598 "\t-u\tonly print unique lines"
1599#define uniq_example_usage \
1600 "$ echo -e "a\na\nb\nc\nc\na" | sort | uniq\n" \
1601 "a\n" \
1602 "b\n" \
1603 "c\n"
1120 1604
1121#define unix2dos_trivial_usage \ 1605#define unix2dos_trivial_usage \
1122 "[option] [file]" 1606 "[option] [file]"
@@ -1136,11 +1620,17 @@
1136 "" 1620 ""
1137#define uptime_full_usage \ 1621#define uptime_full_usage \
1138 "Display the time since the last boot." 1622 "Display the time since the last boot."
1623#define uptime_example_usage \
1624 "$ uptime\n" \
1625 " 1:55pm up 2:30, load average: 0.09, 0.04, 0.00\n"
1139 1626
1140#define usleep_trivial_usage \ 1627#define usleep_trivial_usage \
1141 "N" 1628 "N"
1142#define usleep_full_usage \ 1629#define usleep_full_usage \
1143 "Pause for N microseconds." 1630 "Pause for N microseconds."
1631#define usleep_example_usage \
1632 "$ usleep 1000000\n" \
1633 "[pauses for 1 second]\n"
1144 1634
1145#define uudecode_trivial_usage \ 1635#define uudecode_trivial_usage \
1146 "[FILE]..." 1636 "[FILE]..."
@@ -1148,6 +1638,10 @@
1148 "Uudecode a file that is uuencoded.\n\n" \ 1638 "Uudecode a file that is uuencoded.\n\n" \
1149 "Options:\n" \ 1639 "Options:\n" \
1150 "\t-o FILE\tdirect output to FILE" \ 1640 "\t-o FILE\tdirect output to FILE" \
1641#define uudecode_example_usage \
1642 "$ uudecode -o busybox busybox.uu\n" \
1643 "$ ls -l busybox\n" \
1644 "-rwxr-xr-x 1 ams ams 245264 Jun 7 21:35 busybox\n"
1151 1645
1152#define uuencode_trivial_usage \ 1646#define uuencode_trivial_usage \
1153 "[OPTION] [INFILE] REMOTEFILE" 1647 "[OPTION] [INFILE] REMOTEFILE"
@@ -1155,6 +1649,12 @@
1155 "Uuencode a file.\n\n" \ 1649 "Uuencode a file.\n\n" \
1156 "Options:\n" \ 1650 "Options:\n" \
1157 "\t-m\tuse base64 encoding as of RFC1521" 1651 "\t-m\tuse base64 encoding as of RFC1521"
1652#define uuencode_example_usage \
1653 "$ uuencode busybox busybox\n" \
1654 "begin 755 busybox\n" \
1655 "<encoded file snipped>\n" \
1656 "$ uudecode busybox busybox > busybox.uu\n" \
1657 "$\n"
1158 1658
1159#define watchdog_trivial_usage \ 1659#define watchdog_trivial_usage \
1160 "DEV" 1660 "DEV"
@@ -1171,6 +1671,9 @@
1171 "\t-l\tprint the newline counts\n" \ 1671 "\t-l\tprint the newline counts\n" \
1172 "\t-L\tprint the length of the longest line\n" \ 1672 "\t-L\tprint the length of the longest line\n" \
1173 "\t-w\tprint the word counts" 1673 "\t-w\tprint the word counts"
1674#define wc_example_usage \
1675 "$ wc /etc/passwd\n" \
1676 " 31 46 1365 /etc/passwd\n"
1174 1677
1175#define wget_trivial_usage \ 1678#define wget_trivial_usage \
1176 "[-c] [-O file] url" 1679 "[-c] [-O file] url"
@@ -1184,6 +1687,9 @@
1184 "[COMMAND ...]" 1687 "[COMMAND ...]"
1185#define which_full_usage \ 1688#define which_full_usage \
1186 "Locates a COMMAND." 1689 "Locates a COMMAND."
1690#define which_example_usage \
1691 "$ which login\n" \
1692 "/bin/login\n"
1187 1693
1188#define whoami_trivial_usage \ 1694#define whoami_trivial_usage \
1189 "" 1695 ""
@@ -1194,11 +1700,14 @@
1194 "[COMMAND] [ARGS...]" 1700 "[COMMAND] [ARGS...]"
1195#define xargs_full_usage \ 1701#define xargs_full_usage \
1196 "Executes COMMAND on every item given by standard input." 1702 "Executes COMMAND on every item given by standard input."
1703#define xargs_example_usage \
1704 "$ ls | xargs gzip\n" \
1705 "$ find . -name '*.c' -print | xargs rm\n"
1197 1706
1198#define yes_trivial_usage \ 1707#define yes_trivial_usage \
1199 "[OPTION]... [STRING]..." 1708 "[OPTION]... [STRING]..."
1200#define yes_full_usage \ 1709#define yes_full_usage \
1201 "Repeatedly outputs a line with all specified STRING(s), or `y'." 1710 "Repeatedly outputs a line with all specified STRING(s), or 'y'."
1202 1711
1203#define zcat_trivial_usage \ 1712#define zcat_trivial_usage \
1204 "FILE" 1713 "FILE"
diff --git a/util-linux/fbset.c b/util-linux/fbset.c
index 80711ec9f..41c7f9796 100644
--- a/util-linux/fbset.c
+++ b/util-linux/fbset.c
@@ -42,7 +42,6 @@ static const int OPT_INFO = (1 << 1);
42static const int OPT_READMODE = (1 << 2); 42static const int OPT_READMODE = (1 << 2);
43 43
44enum { 44enum {
45 CMD_HELP = 0,
46 CMD_FB = 1, 45 CMD_FB = 1,
47 CMD_DB = 2, 46 CMD_DB = 2,
48 CMD_GEOMETRY = 3, 47 CMD_GEOMETRY = 3,
@@ -138,7 +137,6 @@ static struct cmdoptions_t {
138 unsigned char code; 137 unsigned char code;
139} g_cmdoptions[] = { 138} g_cmdoptions[] = {
140 { 139 {
141 "-h", 0, CMD_HELP}, {
142 "-fb", 1, CMD_FB}, { 140 "-fb", 1, CMD_FB}, {
143 "-db", 1, CMD_DB}, { 141 "-db", 1, CMD_DB}, {
144 "-a", 0, CMD_ALL}, { 142 "-a", 0, CMD_ALL}, {
@@ -150,10 +148,8 @@ static struct cmdoptions_t {
150 "-vsync", 1, CMD_VSYNC}, { 148 "-vsync", 1, CMD_VSYNC}, {
151 "-laced", 1, CMD_LACED}, { 149 "-laced", 1, CMD_LACED}, {
152 "-double", 1, CMD_DOUBLE}, { 150 "-double", 1, CMD_DOUBLE}, {
153 "-help", 0, CMD_HELP}, {
154 "-n", 0, CMD_CHANGE}, { 151 "-n", 0, CMD_CHANGE}, {
155#ifdef BB_FEATURE_FBSET_FANCY 152#ifdef BB_FEATURE_FBSET_FANCY
156 "-help", 0, CMD_HELP}, {
157 "-all", 0, CMD_ALL}, { 153 "-all", 0, CMD_ALL}, {
158 "-xres", 1, CMD_XRES}, { 154 "-xres", 1, CMD_XRES}, {
159 "-yres", 1, CMD_YRES}, { 155 "-yres", 1, CMD_YRES}, {
@@ -356,8 +352,6 @@ extern int fbset_main(int argc, char **argv)
356 if (argc - 1 < g_cmdoptions[i].param_count) 352 if (argc - 1 < g_cmdoptions[i].param_count)
357 show_usage(); 353 show_usage();
358 switch (g_cmdoptions[i].code) { 354 switch (g_cmdoptions[i].code) {
359 case CMD_HELP:
360 show_usage();
361 case CMD_FB: 355 case CMD_FB:
362 fbdev = argv[1]; 356 fbdev = argv[1];
363 break; 357 break;