Minor doc change
[oweals/busybox.git] / docs / busybox.pod
1 # vi: set sw=4 ts=4:
2
3 =head1 NAME
4
5 busybox - I am BusyBox of Borg.  Unix will be assimilated.
6
7 =head1 SYNOPSIS
8
9  busybox <function> [arguments...]  # or
10
11  <function> [arguments...]          # if symlinked
12
13 =head1 DESCRIPTION
14
15 BusyBox is a multi-call binary that combines many common Unix utilities into a
16 single executable.  Most people will create a link to busybox for each function
17 they wish to use, and BusyBox will act like whatever it was invoked as.  For
18 example,
19
20         ln -s ./busybox ls
21         ./ls
22
23 will cause BusyBox to behave as 'ls' (if the 'ls' command has been compiled
24 into busybox).  You can also invoke BusyBox by providing it the command to run
25 on the command line.  For example,
26
27         ./busybox ls
28
29 will also cause BusyBox to behave as 'ls'. 
30
31 BusyBox has been written with size-optimization in mind.  It is very easy to
32 include or exclude the commands (or features) you want installed.  BusyBox
33 tries to make itself useful to small systems with limited resources.
34
35 =head1 COMMON OPTIONS
36
37 Most BusyBox commands support the B<--help> option to provide a
38 terse runtime description of their behavior. 
39
40 =head1 COMMANDS
41
42 Currently defined functions include:
43
44 basename, cat, chgrp, chmod, chown, chroot, clear, chvt, cp, date, dd, df,
45 dirname, dmesg, du, dutmp, echo, false, fbset, fdflush, find, free,
46 freeramdisk, deallocvt, fsck.minix, grep, gunzip, gzip, halt, head, hostid,
47 hostname, init, kill, killall, length, ln, loadacm, loadfont, loadkmap, logger,
48 logname, ls, lsmod, makedevs, math, mkdir, mkfifo, mkfs.minix, mknod, mkswap,
49 mnc, more, mount, mt, mv, nslookup, ping, poweroff, printf, ps, pwd, reboot,
50 rm, rmdir, rmmod, sed, sh, sfdisk, sleep, sort, sync, syslogd, swapon, swapoff,
51 tail, tar, test, tee, touch, tr, true, tty, umount, uname, uniq, update,
52 uptime, usleep, wc, whoami, yes, zcat, [
53
54 =over 4
55
56 =item basename
57
58 Usage: basename [file ...]
59
60 Strips directory and suffix from filenames. 
61
62 Example: 
63
64         $ basename /usr/local/bin/foo
65         foo
66         $ basename /usr/local/bin/
67         bin
68
69 -------------------------------
70
71 =item cat  
72
73 Usage: cat [file ...]
74
75 Concatenates files and prints them to the standard output.
76
77 Example:
78
79         $ cat /proc/uptime
80         110716.72 17.67
81
82 -------------------------------
83
84 =item chgrp
85
86 Usage: chgrp [OPTION]... GROUP FILE...
87
88 Change the group membership of each FILE to GROUP.
89
90 Options:
91
92         -R      change files and directories recursively
93
94 Example:
95
96         $ ls -l /tmp/foo
97         -r--r--r--    1 andersen andersen        0 Apr 12 18:25 /tmp/foo
98         $ chgrp root /tmp/foo
99         $ ls -l /tmp/foo
100         -r--r--r--    1 andersen root            0 Apr 12 18:25 /tmp/foo
101
102 -------------------------------
103
104 =item chmod
105
106 Usage: chmod [B<-R>] MODE[,MODE]... FILE...
107
108 Changes file access permissions for the specified file(s) or directory(s).
109 Each MODE is defined by combining the letters for WHO has access to the file,
110 an OPERATOR for selecting how the permissions should be changed, and a
111 PERISSION for the file(s) or directory(s).
112
113 WHO may be chosen from:
114
115         u       the User who owns the file
116         g       users in the file's Group
117         o       Other users not in the file's group
118         a       All users
119
120 OPERATOR may be chosen from:
121
122         +       add a permission
123         -       remove a permission
124         =       assign a permission
125  
126 PERMISSION may be chosen from:
127
128         r       Read    
129         w       Write
130         x       eXecute (or access for directories)
131         s       Set user (or group) ID bit
132         t       sTickey bit (for directories prevents removing files by non-owners)
133
134 Alternately, permissions may be set numerically where the first three
135 numbers are calculated by adding the octal values:
136
137         4       Read
138         2       Write
139         1       eXecute
140
141 An optional fourth digit may also be used to specify
142
143         4       Set user ID
144         2       Set group ID
145         1       sTickey bit
146
147 Options:
148
149         -R      change files and directories recursively.
150  
151 Example:
152
153         $ ls -l /tmp/foo
154         -rw-rw-r--    1 root     root            0 Apr 12 18:25 /tmp/foo
155         $ chmod u+x /tmp/foo
156         $ ls -l /tmp/foo
157         -rwxrw-r--    1 root     root            0 Apr 12 18:25 /tmp/foo*
158         $ chmod 444 /tmp/foo
159         $ ls -l /tmp/foo
160         -r--r--r--    1 root     root            0 Apr 12 18:25 /tmp/foo
161
162 -------------------------------
163
164 =item chown
165
166 Usage: chown [OPTION]...  OWNER[.[GROUP] FILE...
167
168 Changes the owner and/or group of each FILE to OWNER and/or GROUP.
169
170 Options:
171
172         -R      change files and directories recursively
173
174 Example:
175
176         $ ls -l /tmp/foo
177         -r--r--r--    1 andersen andersen        0 Apr 12 18:25 /tmp/foo
178         $ chown root /tmp/foo
179         $ ls -l /tmp/foo
180         -r--r--r--    1 root     andersen        0 Apr 12 18:25 /tmp/foo
181         $ chown root.root /tmp/foo
182         ls -l /tmp/foo
183         -r--r--r--    1 root     root            0 Apr 12 18:25 /tmp/foo
184
185 -------------------------------
186
187 =item chroot
188
189 Usage: chroot NEWROOT [COMMAND...]
190
191 Run COMMAND with root directory set to NEWROOT.
192  
193 Example:
194
195         $ ls -l /bin/ls
196         lrwxrwxrwx    1 root     root          12 Apr 13 00:46 /bin/ls -> /busybox
197         $ mount /dev/hdc1 /mnt -t minix
198         $ chroot /mnt
199         $ ls -l /bin/ls
200         -rwxr-xr-x    1 root     root        40816 Feb  5 07:45 /bin/ls*
201
202 -------------------------------
203
204 =item clear
205
206 Clears the screen.
207
208 -------------------------------
209
210 =item chvt
211
212 Usage: chvt N
213
214 Change foreground virtual terminal to /dev/ttyN
215
216 -------------------------------
217
218 =item cp
219
220 Usage: cp [OPTION]... SOURCE DEST
221
222    or: cp [OPTION]... SOURCE... DIRECTORY
223
224 Copy SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY.
225
226         -a      same as -dpR
227         -d      preserve links
228         -p      preserve file attributes if possable
229         -R      copy directories recursively
230
231 -------------------------------
232
233 =item date
234
235 Usage: date [OPTION]... [+FORMAT]
236
237   or:  date [OPTION] [MMDDhhmm[[CC]YY][.ss]]
238
239 Display the current time in the given FORMAT, or set the system date.
240
241 Options:
242
243         -R              output RFC-822 compliant date string
244         -s              set time described by STRING
245         -u              print or set Coordinated Universal Time
246
247 Example:
248
249         $ date
250         Wed Apr 12 18:52:41 MDT 2000
251
252 -------------------------------
253
254 =item dd
255
256 Usage: dd [if=name] [of=name] [bs=n] [count=n] [skip=n] [seek=n]
257
258 Copy a file, converting and formatting according to options
259
260         if=FILE read from FILE instead of stdin
261         of=FILE write to FILE instead of stdout
262         bs=n    read and write n bytes at a time
263         count=n copy only n input blocks
264         skip=n  skip n input blocks
265         seek=n  skip n output blocks
266
267 Numbers may be suffixed by w (x2), k (x1024), b (x512), or M (x1024^2)
268  
269 Example:
270
271         $ dd if=/dev/zero of=/dev/ram1 bs=1M count=4
272         4+0 records in
273         4+0 records out
274
275 -------------------------------
276
277 =item df
278
279 Usage: df [filesystem ...]
280
281 Prints the filesystem space used and space available.
282
283 Example:
284
285         $ df
286         Filesystem           1k-blocks      Used Available Use% Mounted on
287         /dev/sda3              8690864   8553540    137324  98% /
288         /dev/sda1                64216     36364     27852  57% /boot
289         $ df /dev/sda3
290         Filesystem           1k-blocks      Used Available Use% Mounted on
291         /dev/sda3              8690864   8553540    137324  98% /
292
293 -------------------------------
294
295 =item dirname
296
297 Usage: dirname NAME
298
299 Strip non-directory suffix from file name
300
301 Example:
302
303         $ dirname /tmp/foo
304         /tmp
305         $ dirname /tmp/foo/
306         /tmp
307
308 -------------------------------
309
310 =item dmesg
311
312 Usage: dmesg [B<-c>] [B<-n> level] [B<-s> bufsize]
313  
314 Print or controls the kernel ring buffer.
315
316 -------------------------------
317
318 =item du
319
320 Usage: du [OPTION]... [FILE]...
321
322 Summarize disk space used for each FILE and/or directory.
323 Disk space is printed in units of 1k (i.e. 1024 bytes).
324
325 Options:
326
327         -l      count sizes many times if hard linked
328         -s      display only a total for each argument
329
330 Example:
331
332         $ ./busybox du
333         16      ./CVS
334         12      ./kernel-patches/CVS
335         80      ./kernel-patches
336         12      ./tests/CVS
337         36      ./tests
338         12      ./scripts/CVS
339         16      ./scripts
340         12      ./docs/CVS
341         104     ./docs
342         2417    .
343          
344 -------------------------------
345
346 =item dutmp
347
348 Usage: dutmp [FILE]
349
350 Dump utmp file format (pipe delimited) from FILE
351 or stdin to stdout.
352
353 Example:
354
355         $ dutmp /var/run/utmp
356         8|7||si|||0|0|0|955637625|760097|0
357         2|0|~|~~|reboot||0|0|0|955637625|782235|0
358         1|20020|~|~~|runlevel||0|0|0|955637625|800089|0
359         8|125||l4|||0|0|0|955637629|998367|0
360         6|245|tty1|1|LOGIN||0|0|0|955637630|998974|0
361         6|246|tty2|2|LOGIN||0|0|0|955637630|999498|0
362         7|336|pts/0|vt00andersen|andersen|:0.0|0|0|0|955637763|0|0
363          
364 -------------------------------
365
366 =item echo
367
368 Usage: echo [-neE] [ARG ...]
369
370 Prints the specified ARGs to stdout
371
372 Options:
373
374         -n      suppress trailing newline
375         -e      interpret backslash-escaped characters (i.e. \t=tab etc)
376         -E      disable interpretation of backslash-escaped characters
377
378 Example:
379
380         $ echo "Erik is cool"
381         Erik is cool
382         $  echo -e "Erik\nis\ncool"
383         Erik
384         is
385         cool
386         $ echo "Erik\nis\ncool"
387         Erik\nis\ncool
388          
389 -------------------------------
390
391 =item false
392
393 Returns an exit code of FALSE (1)
394
395 Example:
396
397         $ false
398         $ echo $?
399         1
400
401 -------------------------------
402
403 =item fbset
404
405 Usage: fbset [options] [mode]
406
407 Show and modify frame buffer device settings
408
409 Options:
410
411         -h
412         -fb
413         -db
414         -a
415         -i
416         -g
417         -t
418         -accel
419         -hsync
420         -vsync
421         -laced
422         -double
423
424 Example:
425
426         $ fbset
427         mode "1024x768-76"
428                         # D: 78.653 MHz, H: 59.949 kHz, V: 75.694 Hz
429                         geometry 1024 768 1024 768 16
430                         timings 12714 128 32 16 4 128 4
431                         accel false
432                         rgba 5/11,6/5,5/0,0/0
433         endmode
434
435 -------------------------------
436
437 =item fdflush
438
439 Usage: fdflush device
440
441 Force floppy disk drive to detect disk change
442
443 -------------------------------
444
445 =item find
446
447 Usage: find [PATH...] [EXPRESSION]
448
449 Search for files in a directory hierarchy.  The default PATH is
450 the current directory; default EXPRESSION is '-print'
451
452
453 EXPRESSION may consist of:
454
455         -follow                 Dereference symbolic links.
456         -name PATTERN   File name (leading directories removed) matches PATTERN.
457         -print                  print the full file name followed by a newline to stdout.
458
459 Example:
460
461         $ find / -name /etc/passwd
462         /etc/passwd
463
464 -------------------------------
465
466 =item free
467
468 Usage: free
469
470 Displays the amount of free and used memory in the system.
471
472 Example:
473
474         $ free
475                                   total         used         free       shared      buffers
476           Mem:       257628       248724         8904        59644        93124
477          Swap:       128516         8404       120112
478         Total:       386144       257128       129016
479
480 -------------------------------
481
482 =item freeramdisk
483
484 Usage: freeramdisk DEVICE
485
486 Free all memory used by the specified ramdisk.
487
488 Example:
489
490         $ freeramdisk /dev/ram2
491
492 -------------------------------
493
494 =item deallocvt
495
496 Usage: deallocvt N
497
498 Deallocates unused virtual terminal /dev/ttyN
499
500 -------------------------------
501
502 =item fsck.minix
503
504 Usage: fsck.minix [B<-larvsmf>] /dev/name
505
506 Performs a consistency check for MINIX filesystems.
507
508 OPTIONS:
509
510         -l      Lists all filenames
511         -r      Perform interactive repairs
512         -a      Perform automatic repairs
513         -v      verbose
514         -s      Outputs super-block information
515         -m      Activates MINIX-like "mode not cleared" warnings
516         -f      Force file system check.
517
518 -------------------------------
519
520 =item grep
521
522 Usage: grep [OPTIONS]... PATTERN [FILE]...
523
524 Search for PATTERN in each FILE or standard input.
525
526 OPTIONS:
527
528         -h      suppress the prefixing filename on output
529         -i      ignore case distinctions
530         -n      print line number with output lines
531         -q      be quiet. Returns 0 if result was found, 1 otherwise
532
533 This version of grep matches full regular expresions.
534
535 Example:
536
537         $ grep root /etc/passwd
538         root:x:0:0:root:/root:/bin/bash
539         $ grep ^[rR]oo. /etc/passwd
540         root:x:0:0:root:/root:/bin/bash
541
542 -------------------------------
543
544 =item gunzip
545
546 Usage: gunzip [OPTION]... FILE
547
548 Uncompress FILE (or standard input if FILE is '-').
549
550 Options:
551
552         -c      Write output to standard output
553         -t      Test compressed file integrity
554
555 Example:
556
557         $ ls -la /tmp/busybox*
558         -rw-rw-r--    1 andersen andersen   557009 Apr 11 10:55 /tmp/busybox-0.43.tar.gz
559         $ gunzip /tmp/busybox-0.43.tar.gz
560         $ ls -la /tmp/busybox*
561         -rw-rw-r--    1 andersen andersen  1761280 Apr 14 17:47 /tmp/busybox-0.43.tar
562
563 -------------------------------
564
565 =item gzip
566
567 Usage: gzip [OPTION]... FILE
568
569 Compress FILE with maximum compression.
570 When FILE is '-', reads standard input.  Implies B<-c>.
571
572 Options:
573
574         -c      Write output to standard output instead of FILE.gz
575
576 Example:
577
578         $ ls -la /tmp/busybox*
579         -rw-rw-r--    1 andersen andersen  1761280 Apr 14 17:47 /tmp/busybox-0.43.tar
580         $ gzip /tmp/busybox-0.43.tar
581         $ ls -la /tmp/busybox*
582         -rw-rw-r--    1 andersen andersen   554058 Apr 14 17:49 /tmp/busybox-0.43.tar.gz
583
584
585 -------------------------------
586
587 =item halt
588
589 Usage: halt
590
591 This comand halts the system.
592
593 -------------------------------
594
595 =item head
596
597 Usage: head [OPTION] [FILE]...
598
599 Print first 10 lines of each FILE to standard output.
600 With more than one FILE, precede each with a header giving the
601 file name. With no FILE, or when FILE is -, read standard input.
602
603 Options:
604
605         -n NUM          Print first NUM lines instead of first 10
606
607 Example:
608
609         $ head -n 2 /etc/passwd
610         root:x:0:0:root:/root:/bin/bash
611         daemon:x:1:1:daemon:/usr/sbin:/bin/sh
612
613 -------------------------------
614
615 =item hostid
616
617 Usage: hostid
618
619 Prints out a unique  32-bit  identifier  for  the  current
620 machine.   The  32-bit identifier is intended to be unique
621 among all UNIX systems in existence. 
622
623 -------------------------------
624
625 =item hostname
626
627 Usage: hostname [OPTION] {hostname | B<-F> file}
628
629 Get or set the hostname or DNS domain name. If a hostname is given
630 (or a file with the B<-F> parameter), the host name will be set.
631
632 Options:
633
634         -s              Short
635         -i              Addresses for the hostname
636         -d              DNS domain name
637         -F FILE         Use the contents of FILE to specify the hostname
638
639 Example:
640
641         $ hostname
642         slag 
643
644 -------------------------------
645
646 =item init
647
648 Usage: init
649
650 Init is the parent of all processes.
651
652 This version of init is designed to be run only by the kernel.
653
654 BusyBox init doesn't support multiple runlevels.  The runlevels field of
655 the /etc/inittab file is completely ignored by BusyBox init. If you want 
656 runlevels, use sysvinit.
657
658 BusyBox init works just fine without an inittab.  If no inittab is found, 
659 it has the following default behavior:
660
661         ::sysinit:/etc/init.d/rcS
662         ::askfirst:/bin/sh
663
664 if it detects that /dev/console is _not_ a serial console, it will also run:
665
666         tty2::askfirst:/bin/sh
667
668 If you choose to use an /etc/inittab file, the inittab entry format is as follows:
669
670         <id>:<runlevels>:<action>:<process>
671
672         <id>: 
673
674                 WARNING: This field has a non-traditional meaning for BusyBox init!
675                 The id field is used by BusyBox init to specify the controlling tty for
676                 the specified process to run on.  The contents of this field are
677                 appended to "/dev/" and used as-is.  There is no need for this field to
678                 be unique, although if it isn't you may have strange results.  If this
679                 field is left blank, it is completely ignored.  Also note that if
680                 BusyBox detects that a serial console is in use, then all entries
681                 containing non-empty id fields will _not_ be run.  BusyBox init does
682                 nothing with utmp.  We don't need no stinkin' utmp.
683
684         <runlevels>: 
685
686                 The runlevels field is completely ignored.
687
688         <action>: 
689
690                 Valid actions include: sysinit, respawn, askfirst, wait, 
691                 once, and ctrlaltdel.
692
693                 askfirst acts just like respawn, but before running the specified
694                 process it displays the line "Please press Enter to activate this
695                 console." and then waits for the user to press enter before starting
696                 the specified process.
697
698                 Unrecognised actions (like initdefault) will cause init to emit
699                 an error message, and then go along with its business.
700
701         <process>: 
702
703                 Specifies the process to be executed and it's command line.
704
705
706 Example /etc/inittab file:
707
708         # This is run first except when booting in single-user mode.
709         #
710         ::sysinit:/etc/init.d/rcS
711
712         # /bin/sh invocations on selected ttys
713         #
714         # Start an "askfirst" shell on the console (whatever that may be)
715         ::askfirst:/bin/sh
716         # Start an "askfirst" shell on /dev/tty2
717         tty2::askfirst:/bin/sh
718
719         # /sbin/getty invocations for selected ttys
720         #
721         tty4::respawn:/sbin/getty 38400 tty4
722         tty5::respawn:/sbin/getty 38400 tty5
723
724
725         # Example of how to put a getty on a serial line (for a terminal)
726         #
727         #ttyS0::respawn:/sbin/getty -L ttyS0 9600 vt100
728         #ttyS1::respawn:/sbin/getty -L ttyS1 9600 vt100
729         #
730         # Example how to put a getty on a modem line.
731         #ttyS2::respawn:/sbin/getty -x0 -s 57600 ttyS2
732
733         # Stuff to do before rebooting
734         ::ctrlaltdel:/bin/umount -a -r > /dev/null 2>&1
735         ::ctrlaltdel:/sbin/swapoff -a > /dev/null 2>&1
736
737 -------------------------------
738
739 =item kill
740
741 Usage: kill [B<-signal>] process-id [process-id ...]
742
743 Send a signal (default is SIGTERM) to the specified process(es).
744
745 Options:
746
747         -l      List all signal names and numbers.
748
749 Example:
750
751         $ ps | grep apache
752         252 root     root     S [apache]
753         263 www-data www-data S [apache]
754         264 www-data www-data S [apache]
755         265 www-data www-data S [apache]
756         266 www-data www-data S [apache]
757         267 www-data www-data S [apache]
758         $ kill 252
759
760 -------------------------------
761
762 =item killall
763
764 Usage: killall [B<-signal>] process-name [process-name ...]
765
766 Send a signal (default is SIGTERM) to the specified process(es).
767
768 Options:
769
770         -l      List all signal names and numbers.
771
772 Example:
773
774         $ killall apache
775
776 -------------------------------
777
778 =item length
779
780 Usage: length string
781
782 Prints out the length of the specified string.
783
784 Example:
785         $ length "Hello"
786         5
787
788 -------------------------------
789
790 =item ln
791
792 Usage: ln [OPTION] TARGET... LINK_NAME|DIRECTORY
793 Create a link named LINK_NAME or DIRECTORY to the specified TARGET
794  
795 Options:
796
797         -s      make symbolic links instead of hard links
798         -f      remove existing destination files
799  
800 Example:
801
802     $ ln -s busybox /tmp/ls
803     [andersen@debian busybox]$ ls -l /tmp/ls
804     lrwxrwxrwx    1 root     root            7 Apr 12 18:39 ls -> busybox*
805
806 -------------------------------
807
808 =item loadacm
809
810 Usage: loadacm
811
812 Loads an acm from standard input.
813
814 Example:
815
816         $ loadacm < /etc/i18n/acmname
817
818 -------------------------------
819
820 =item loadfont
821
822 Usage: loadfont
823
824 Loads a console font from standard input.
825
826 Example:
827
828         $ loadfont < /etc/i18n/fontname
829
830 -------------------------------
831
832 =item loadkmap
833
834 Usage: loadkmap
835
836 Loads a binary keyboard translation table from standard input.
837
838 Example:
839
840         $ loadkmap < /etc/i18n/lang-keymap
841
842 -------------------------------
843
844 =item logger
845
846 Usage: logger [OPTION]... [MESSAGE]
847
848 Write MESSAGE to the system log.  If MESSAGE is '-', log stdin.
849
850 Options:
851
852         -s      Log to stderr as well as the system log.
853         -t      Log using the specified tag (defaults to user name).
854         -p      Enter the message with the specified priority.
855                 This may be numerical or a ``facility.level'' pair.
856
857 Example:
858
859                 $ logger "hello"
860
861 -------------------------------
862
863 =item logname
864
865 Usage: logname
866
867 Print the name of the current user.
868
869 Example:
870
871         $ logname
872         root
873
874 -------------------------------
875
876 =item ls
877
878 Usage: ls [B<-1acdelnpuxACF>] [filenames...]
879
880 Options:
881
882         -a      do not hide entries starting with .
883         -c      with  -l:  show ctime (the time of last
884                 modification of file status information)
885         -d      list directory entries instead of contents
886         -e      list both full date and full time
887         -l      use a long listing format
888         -n      list numeric UIDs and GIDs instead of names
889         -p      append indicator (one of /=@|) to entries
890         -u      with -l: show access time (the time of last
891                 access of the file)
892         -x      list entries by lines instead of by columns
893         -A      do not list implied . and ..
894         -C      list entries by columns
895         -F      append indicator (one of */=@|) to entries
896
897 -------------------------------
898
899 =item lsmod
900
901 Usage: lsmod
902
903 Shows a list of all currently loaded kernel modules.
904
905 -------------------------------
906
907 =item makedevs
908
909 Usage: makedevs NAME TYPE MAJOR MINOR FIRST LAST [s]
910
911 Creates a range of block or character special files
912
913 TYPEs include:
914
915         b:      Make a block (buffered) device.
916         c or u: Make a character (un-buffered) device.
917         p:      Make a named pipe. MAJOR and MINOR are ignored for named pipes.
918
919 FIRST specifies the number appended to NAME to create the first device.
920 LAST specifies the number of the last item that should be created.
921 If 's' is the last argument, the base device is created as well.
922
923 Example:
924
925         $ makedevs /dev/ttyS c 4 66 2 63
926         [creates ttyS2-ttyS63]
927         $ makedevs /dev/hda b 3 0 0 8 s
928         [creates hda,hda1-hda8]
929
930 -------------------------------
931
932 =item math
933
934 Usage: math expression ...
935
936 This is a Tiny RPN calculator that understands the
937 following operations: +, -, /, *, and, or, not, eor.
938
939 Example:
940
941         $ math 2 2 add
942         4
943         $ math 8 8 \* 2 2 + /
944         16
945         $ math 0 1 and
946         0
947         $ math 0 1 or
948         1
949
950 -------------------------------
951
952 =item mkdir
953
954 Usage: mkdir [OPTION] DIRECTORY...
955
956 Create the DIRECTORY(ies), if they do not already exist
957
958 Options:
959
960         -m      set permission mode (as in chmod), not rwxrwxrwx - umask
961         -p      no error if dir exists, make parent directories as needed
962
963 Example:
964
965         $ mkdir /tmp/foo
966         $ mkdir /tmp/foo
967         /tmp/foo: File exists
968         $ mkdir /tmp/foo/bar/baz
969         /tmp/foo/bar/baz: No such file or directory
970         $ mkdir -p /tmp/foo/bar/baz
971
972 -------------------------------
973
974 =item mkfifo
975
976 Usage: mkfifo [OPTIONS] name
977
978 Creates a named pipe (identical to 'mknod name p')
979
980 Options:
981
982         -m      create the pipe using the specified mode (default a=rw)
983
984 -------------------------------
985
986 =item mkfs.minix
987
988 Usage: mkfs.minix [B<-c> | B<-l> filename] [B<-nXX>] [B<-iXX>] /dev/name [blocks]
989
990 Make a MINIX filesystem.
991
992 OPTIONS:
993
994         -c              Check the device for bad blocks
995         -n [14|30]      Specify the maximum length of filenames
996         -i              Specify the number of inodes for the filesystem
997         -l FILENAME     Read the bad blocks list from FILENAME
998         -v              Make a Minix version 2 filesystem
999
1000 -------------------------------
1001
1002 =item mknod
1003
1004 Usage: mknod [OPTIONS] NAME TYPE MAJOR MINOR
1005
1006 Create a special file (block, character, or pipe).
1007
1008 Options:
1009
1010         -m      create the special file using the specified mode (default a=rw)
1011
1012 TYPEs include:
1013         b:      Make a block (buffered) device.
1014         c or u: Make a character (un-buffered) device.
1015         p:      Make a named pipe. MAJOR and MINOR are ignored for named pipes.
1016
1017 Example:
1018
1019         $ mknod /dev/fd0 b 2 0 
1020         $ mknod -m 644 /tmp/pipe p
1021
1022 -------------------------------
1023
1024 =item mkswap
1025
1026 Usage: mkswap [B<-c>] [B<-v0>|B<-v1>] device [block-count]
1027
1028 Prepare a disk partition to be used as a swap partition.
1029
1030 Options:
1031
1032         -c              Check for read-ability.
1033         -v0             Make version 0 swap [max 128 Megs].
1034         -v1             Make version 1 swap [big!] (default for kernels > 2.1.117).
1035         block-count     Number of block to use (default is entire partition).
1036
1037 -------------------------------
1038
1039 =item mnc
1040
1041 Usage: mnc [IP] [port]
1042
1043 mini-netcat opens a pipe to IP:port
1044
1045 Example:
1046
1047         $ mnc foobar.somedomain.com 25
1048         220 foobar ESMTP Exim 3.12 #1 Sat, 15 Apr 2000 00:03:02 -0600
1049         help
1050         214-Commands supported:
1051         214-    HELO EHLO MAIL RCPT DATA AUTH
1052         214     NOOP QUIT RSET HELP
1053         quit
1054         221 foobar closing connection
1055  
1056 -------------------------------
1057
1058 =item more
1059
1060 Usage: more [file ...]
1061
1062 More is a filter for paging through text one screenful at a time.
1063
1064 Example:
1065
1066         $ dmesg | more
1067
1068 -------------------------------
1069
1070 =item mount
1071
1072 Usage:  mount [flags]
1073         mount [flags] device directory [B<-o> options,more-options]
1074
1075 Flags:
1076
1077         -a:     Mount all file systems in fstab.
1078         -o option:      One of many filesystem options, listed below.
1079         -r:     Mount the filesystem read-only.
1080         -t filesystem-type:     Specify the filesystem type.
1081         -w:     Mount for reading and writing (default).
1082
1083 Options for use with the "B<-o>" flag:
1084
1085         async / sync:   Writes are asynchronous / synchronous.
1086         dev / nodev:    Allow use of special device files / disallow them.
1087         exec / noexec:  Allow use of executable files / disallow them.
1088         loop: Mounts a file via loop device.
1089         suid / nosuid:  Allow set-user-id-root programs / disallow them.
1090         remount: Re-mount a currently-mounted filesystem, changing its flags.
1091         ro / rw: Mount for read-only / read-write.
1092         There are EVEN MORE flags that are specific to each filesystem.
1093         You'll have to see the written documentation for those.
1094
1095 Example:
1096
1097         $ mount
1098         /dev/hda3 on / type minix (rw)
1099         proc on /proc type proc (rw)
1100         devpts on /dev/pts type devpts (rw)
1101         $ mount /dev/fd0 /mnt -t msdos -o ro
1102         $ mount /tmp/diskimage /opt -t ext2 -o loop
1103
1104 -------------------------------
1105
1106 =item mt
1107
1108 Usage: mt [B<-f> device] opcode value
1109
1110 Control magnetic tape drive operation
1111
1112 -------------------------------
1113
1114 =item mv
1115
1116 Usage: mv SOURCE DEST
1117
1118    or: mv SOURCE... DIRECTORY
1119
1120 Rename SOURCE to DEST, or move SOURCE(s) to DIRECTORY.
1121
1122 Example:
1123
1124         $ mv /tmp/foo /bin/bar
1125
1126 -------------------------------
1127
1128 =item nslookup
1129
1130 Usage: nslookup [HOST]
1131
1132 Queries the nameserver for the IP address of the given HOST
1133
1134 Example:
1135
1136         $ nslookup localhost
1137         Server:     default
1138         Address:    default
1139
1140         Name:       debian
1141         Address:    127.0.0.1
1142
1143 -------------------------------
1144
1145 =item ping
1146
1147 Usage: ping [OPTION]... host
1148
1149 Send ICMP ECHO_REQUEST packets to network hosts.
1150
1151 Options:
1152
1153         -c COUNT        Send only COUNT pings.
1154         -q              Quiet mode, only displays output at start
1155                         and when finished.
1156 Example:
1157
1158         $ ping localhost
1159         PING slag (127.0.0.1): 56 data bytes
1160         64 bytes from 127.0.0.1: icmp_seq=0 ttl=255 time=20.1 ms
1161
1162         --- debian ping statistics ---
1163         1 packets transmitted, 1 packets received, 0% packet loss
1164         round-trip min/avg/max = 20.1/20.1/20.1 ms
1165
1166 -------------------------------
1167
1168 =item poweroff
1169
1170 Shuts down the system, and requests that the kernel turn off power upon halting.
1171
1172 -------------------------------
1173
1174 =item printf
1175
1176 Usage: printf format [argument...]
1177
1178 Formats and prints the given data in a manner similar to the C printf command.
1179
1180 Example:
1181
1182         $ printf "Val=%d\n" 5
1183         Val=5
1184
1185 -------------------------------
1186
1187 =item ps
1188
1189 Usage: ps
1190
1191 Report process status
1192
1193 This version of ps accepts no options.
1194
1195 Example:
1196
1197         $ ps
1198   PID  Uid      Gid State Command
1199     1 root     root     S init
1200     2 root     root     S [kflushd]
1201     3 root     root     S [kupdate]
1202     4 root     root     S [kpiod]
1203     5 root     root     S [kswapd]
1204   742 andersen andersen S [bash]
1205   743 andersen andersen S -bash
1206   745 root     root     S [getty]
1207  2990 andersen andersen R ps
1208
1209 -------------------------------
1210
1211 =item pwd
1212
1213 Prints the full filename of the current working directory.
1214
1215 Example:
1216
1217         $ pwd
1218         /root
1219
1220 -------------------------------
1221
1222 =item reboot
1223
1224 Instructs the kernel to reboot the system.
1225
1226 -------------------------------
1227
1228 =item rm
1229
1230 Usage: rm [OPTION]... FILE...
1231
1232 Remove (unlink) the FILE(s).
1233
1234 Options:
1235
1236         -f              remove existing destinations, never prompt
1237         -r or -R        remove the contents of directories recursively
1238
1239 Example:
1240
1241         $ rm -rf /tmp/foo
1242
1243 -------------------------------
1244
1245 =item rmdir
1246
1247 Usage: rmdir [OPTION]... DIRECTORY...
1248
1249 Remove the DIRECTORY(ies), if they are empty.
1250
1251 Example:
1252
1253         # rmdir /tmp/foo
1254
1255 -------------------------------
1256
1257 =item rmmod
1258
1259 Usage: rmmod [OPTION]... [MODULE]...
1260
1261 Unloads the specified kernel modules from the kernel.
1262
1263 Options:
1264
1265         -a      Try to remove all unused kernel modules.
1266
1267 Example:
1268
1269         $ rmmod tulip
1270
1271 -------------------------------
1272
1273 =item sed
1274
1275 Usage: sed [B<-n>] B<-e> script [file...]
1276
1277 Allowed sed scripts come in the following form:
1278
1279         'ADDR [!] COMMAND'
1280
1281         where address ADDR can be:
1282           NUMBER    Match specified line number
1283           $         Match last line
1284           /REGEXP/  Match specified regexp
1285           (! inverts the meaning of the match)
1286
1287         and COMMAND can be:
1288           s/regexp/replacement/[igp]
1289                  which attempt to match regexp against the pattern space
1290                  and if successful replaces the matched portion with replacement.
1291
1292           aTEXT
1293                  which appends TEXT after the pattern space
1294
1295 Options:
1296
1297         -e      add the script to the commands to be executed
1298         -n      suppress automatic printing of pattern space
1299
1300 This version of sed matches full regular expresions.
1301
1302 Example:
1303
1304         $ echo "foo" | sed -e 's/f[a-zA-Z]o/bar/g'
1305         bar
1306
1307 -------------------------------
1308
1309 =item sh
1310
1311 Usage: sh
1312
1313 lash -- the BusyBox LAme SHell (command interpreter)
1314
1315 This command does not yet have proper documentation.  
1316
1317 Use lash just as you would use any other shell.  It properly handles pipes,
1318 redirects, job control, can be used as the shell for scripts (#!/bin/sh), and
1319 has a sufficient set of builtins to do what is needed.  It does not (yet)
1320 support Bourne Shell syntax.  If you need things like "if-then-else", "while",
1321 and such, use ash or bash.  If you just need a very simple and extremely small
1322 shell, this will do the job.
1323
1324 -------------------------------
1325
1326 =item sfdisk
1327
1328 Usage: sfdisk [options] device ...
1329
1330 device: something like /dev/hda or /dev/sda
1331
1332 useful options:
1333
1334     -s [or --show-size]: list size of a partition
1335     -c [or --id]:        print or change partition Id
1336     -l [or --list]:      list partitions of each device
1337     -d [or --dump]:      idem, but in a format suitable for later input
1338     -i [or --increment]: number cylinders etc. from 1 instead of from 0
1339     -uS, -uB, -uC, -uM:  accept/report in units of sectors/blocks/cylinders/MB
1340     -T [or --list-types]:list the known partition types
1341     -D [or --DOS]:       for DOS-compatibility: waste a little space
1342     -R [or --re-read]:   make kernel reread partition table
1343     -N# :                change only the partition with number #
1344     -n :                 do not actually write to disk
1345     -O file :            save the sectors that will be overwritten to file
1346     -I file :            restore these sectors again
1347     -v [or --version]:   print version
1348     -? [or --help]:      print this message
1349
1350 dangerous options:
1351
1352     -g [or --show-geometry]: print the kernel's idea of the geometry
1353     -x [or --show-extended]: also list extended partitions on output
1354
1355                              or expect descriptors for them on input
1356     -L  [or --Linux]:      do not complain about things irrelevant for Linux
1357     -q  [or --quiet]:      suppress warning messages
1358     You can override the detected geometry using:
1359     -C# [or --cylinders #]:set the number of cylinders to use
1360     -H# [or --heads #]:    set the number of heads to use
1361     -S# [or --sectors #]:  set the number of sectors to use
1362
1363 You can disable all consistency checking with:
1364
1365     -f  [or --force]:      do what I say, even if it is stupid
1366
1367 -------------------------------
1368
1369 =item sleep
1370
1371 Usage: sleep N
1372
1373 Pause for N seconds.
1374
1375 Example:
1376
1377         $ sleep 2
1378         [2 second delay results]
1379
1380 -------------------------------
1381
1382 =item sort
1383
1384 Usage: sort [B<-n>] [B<-r>] [FILE]...
1385
1386 Sorts lines of text in the specified files
1387
1388 Example:
1389
1390         $ echo -e "e\nf\nb\nd\nc\na" | sort
1391         a
1392         b
1393         c
1394         d
1395         e
1396         f
1397
1398 -------------------------------
1399
1400 =item sync
1401
1402 Usage: sync
1403
1404 Write all buffered filesystem blocks to disk.
1405
1406 -------------------------------
1407
1408 =item syslogd
1409
1410 Usage: syslogd [OPTION]...
1411
1412 Linux system and kernel (provides klogd) logging utility.
1413 Note that this version of syslogd/klogd ignores /etc/syslog.conf.
1414
1415 Options:
1416
1417         -m      Change the mark timestamp interval. default=20min. 0=off
1418         -n      Do not fork into the background (for when run by init)
1419         -K      Do not start up the klogd process (by default syslogd spawns klogd).
1420         -O      Specify an alternate log file.  default=/var/log/messages
1421
1422 -------------------------------
1423
1424 =item swapon
1425
1426 Usage: swapon [OPTION] [device]
1427
1428 Start swapping virtual memory pages on the given device.
1429
1430 Options:
1431
1432         -a      Start swapping on all swap devices
1433
1434 -------------------------------
1435
1436 =item swapoff
1437
1438 Usage: swapoff [OPTION] [device]
1439
1440 Stop swapping virtual memory pages on the given device.
1441
1442 Options:
1443
1444         -a      Stop swapping on all swap devices
1445
1446 -------------------------------
1447
1448 =item tail
1449
1450 Usage: tail [OPTION] [FILE]...
1451
1452 Print last 10 lines of each FILE to standard output.
1453 With more than one FILE, precede each with a header giving the
1454 file name. With no FILE, or when FILE is -, read standard input.
1455
1456 Options:
1457
1458         -n NUM          Print last NUM lines instead of first 10
1459         -f              Output data as the file grows.  This version
1460                         of 'tail -f' supports only one file at a time.
1461
1462 Example:
1463
1464         $ tail -n 1 /etc/resolv.conf
1465         nameserver 10.0.0.1
1466
1467 -------------------------------
1468
1469 =item tar
1470
1471 Usage: tar -[cxtvO] [B<--exclude> File] [B<-f> tarFile] [FILE] ...
1472
1473 Create, extract, or list files from a tar file.  Note that
1474 this version of tar treats hard links as separate files.
1475
1476 Main operation mode:
1477
1478         c               create
1479         x               extract
1480         t               list
1481
1482 File selection:
1483
1484         f               name of tarfile or "-" for stdin
1485         O               extract to stdout
1486         --exclude       file to exclude
1487
1488 Informative output:
1489
1490         v               verbosely list files processed
1491
1492 Example:
1493
1494         $ zcat /tmp/tarball.tar.gz | tar -xf -
1495         $ tar -cf /tmp/tarball.tar /usr/local
1496
1497 -------------------------------
1498
1499 =item test, [
1500
1501 Usage: test EXPRESSION
1502 or   [ EXPRESSION ]
1503
1504 Checks file types and compares values returning an exit
1505 code determined by the value of EXPRESSION.
1506
1507 Example:
1508
1509         $ test 1 -eq 2
1510         $ echo $?
1511         1
1512         $ test 1 -eq 1
1513         $ echo $?
1514         0
1515         $ [ -d /etc ]
1516         $ echo $?
1517         0
1518         $ [ -d /junk ]
1519         $ echo $?
1520         1
1521
1522 -------------------------------
1523
1524 =item tee
1525
1526 Usage: tee [OPTION]... [FILE]...
1527
1528 Copy standard input to each FILE, and also to standard output.
1529
1530 Options:
1531
1532         -a      append to the given FILEs, do not overwrite
1533
1534 Example:
1535
1536         $ echo "Hello" | tee /tmp/foo
1537         $ cat /tmp/foo
1538         Hello
1539
1540 -------------------------------
1541
1542 =item touch
1543
1544 Usage: touch [B<-c>] file [file ...]
1545
1546 Update the last-modified date on (or create) the selected file[s].
1547
1548 Example:
1549
1550         $ ls -l /tmp/foo
1551         /bin/ls: /tmp/foo: No such file or directory
1552         $ touch /tmp/foo
1553         $ ls -l /tmp/foo
1554         -rw-rw-r--    1 andersen andersen        0 Apr 15 01:11 /tmp/foo
1555
1556 -------------------------------
1557
1558 =item tr
1559
1560 Usage:  tr [B<-cdsu>] string1 [string2]
1561
1562 Translate, squeeze, and/or delete characters from standard
1563 input, writing to standard output.
1564
1565 Example:
1566
1567         $ echo "gdkkn vnqkc" | tr [a-y] [b-z]
1568         hello world
1569
1570 -------------------------------
1571
1572 =item true
1573
1574 Returns an exit code of TRUE (0)
1575
1576 Example:
1577
1578         $ true
1579         $ echo $?
1580         0
1581
1582 -------------------------------
1583
1584 =item tty
1585
1586 Usage: tty
1587
1588 Print the file name of the terminal connected to standard input.
1589
1590 Options:
1591
1592         -s      print nothing, only return an exit status
1593
1594 Example:
1595
1596         $ tty
1597         /dev/tty2
1598
1599 -------------------------------
1600
1601 =item umount
1602
1603 Usage: umount [flags] filesystem|directory
1604
1605 Flags:
1606
1607         -a:     Unmount all file systems
1608         -r:     Try to remount devices as read-only if mount is busy
1609         -f:     Do not free loop device (if a loop device has been used)
1610
1611 Example:
1612
1613         $ umount /dev/hdc1 
1614
1615 -------------------------------
1616
1617 =item uname
1618
1619 Usage: uname [OPTION]...
1620
1621 Print certain system information.  With no OPTION, same as B<-s>.
1622
1623 Options:
1624
1625         -a      print all information
1626         -m      the machine (hardware) type
1627         -n      print the machine's network node hostname
1628         -r      print the operating system release
1629         -s      print the operating system name
1630         -p      print the host processor type
1631         -v      print the operating system version
1632
1633 Example:
1634
1635         $ uname -a
1636         Linux debian 2.2.15pre13 #5 Tue Mar 14 16:03:50 MST 2000 i686 unknown
1637
1638 -------------------------------
1639
1640 =item uniq
1641
1642 Usage: uniq [OPTION]... [INPUT [OUTPUT]]
1643
1644 Discard all but one of successive identical lines from INPUT
1645 (or standard input), writing to OUTPUT (or standard output).
1646
1647 Example:
1648
1649         $ echo -e "a\na\nb\nc\nc\na" | sort | uniq
1650         a
1651         b
1652         c
1653
1654 -------------------------------
1655
1656 =item update
1657
1658 Usage: update [options]
1659
1660 Periodically flushes filesystem buffers.
1661
1662 Options:
1663
1664         -S      force use of sync(2) instead of flushing
1665         -s SECS call sync this often (default 30)
1666         -f SECS flush some buffers this often (default 5)
1667
1668 -------------------------------
1669
1670 =item uptime
1671
1672 Usage: uptime
1673
1674 Tells how long the system has been running since boot.
1675
1676 Example:
1677
1678         $ uptime
1679           1:55pm  up  2:30, load average: 0.09, 0.04, 0.00
1680
1681 -------------------------------
1682
1683 =item usleep
1684
1685 Usage: usleep N
1686
1687 Pauses for N microseconds.
1688
1689 Example:
1690
1691         $ usleep 1000000
1692         [pauses for 1 second]
1693
1694 -------------------------------
1695
1696 =item wc
1697
1698 Usage: wc [OPTION]... [FILE]...
1699
1700 Print line, word, and byte counts for each FILE, and a total line if
1701 more than one FILE is specified.  With no FILE, read standard input.
1702
1703 Options:
1704
1705         -c      print the byte counts
1706         -l      print the newline counts
1707         -L      print the length of the longest line
1708         -w      print the word counts
1709
1710 Example:
1711
1712         $ wc /etc/passwd
1713              31      46    1365 /etc/passwd
1714
1715 -------------------------------
1716
1717 =item whoami
1718
1719 Usage: whoami
1720
1721 Prints the user name associated with the current effective user id.
1722
1723 Example:
1724
1725         $ whoami
1726         andersen
1727
1728 -------------------------------
1729
1730 =item yes
1731
1732 Usage: yes [OPTION]... [STRING]...
1733
1734 Repeatedly outputs a line with all specified STRING(s), or `y'.
1735
1736 -------------------------------
1737
1738 =item zcat
1739
1740 This is essentially an alias for invoking "gunzip B<-c>", where 
1741 it decompresses the file inquestion and send the output to stdout. 
1742
1743 -------------------------------
1744
1745 =back
1746
1747 =head1 SEE ALSO
1748
1749 textutils(1), shellutils(1), etc...
1750
1751 =head1 MAINTAINER
1752
1753 Erik Andersen <erik@lineo.com>
1754
1755 =head1 AUTHORS
1756
1757 The following people have contributed code to BusyBox whether
1758 they know it or not.
1759
1760 Erik Andersen <erik@lineo.com>
1761
1762 =for html <br>
1763
1764 John Beppu <beppu@lineo.com>
1765
1766 =for html <br>
1767
1768 Brian Candler <B.Candler@pobox.com>
1769
1770 =for html <br>
1771
1772 Randolph Chung <tausq@debian.org>
1773
1774 =for html <br>
1775
1776 Dave Cinege <dcinege@psychosis.com>     
1777
1778 =for html <br>
1779
1780 Karl M. Hegbloom <karlheg@debian.org>
1781
1782 =for html <br>
1783
1784 John Lombardo <john@deltanet.com>       
1785
1786 =for html <br>
1787
1788 Bruce Perens <bruce@perens.com>
1789
1790 =for html <br>
1791
1792 Linus Torvalds <torvalds@transmeta.com>
1793
1794 =for html <br>
1795
1796 Charles P. Wright <cpwright@villagenet.com>
1797
1798 =for html <br>
1799
1800 Enrique Zanardi <ezanardi@ull.es>
1801
1802 =for html <br>
1803
1804 =cut
1805
1806 # $Id: busybox.pod,v 1.18 2000/04/19 05:12:02 erik Exp $