3aecf3cffe8bdefd812f4e9f0e3d7afe4f628ac2
[oweals/busybox.git] / docs / busybox.pod
1 # pod2man --center=Lineo --release="version 0.43" busybox.pod > busybox.1
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 COMMANDS
36
37 Currently defined functions include:
38
39 basename, cat, chmod, chown, chgrp, chroot, clear, chvt, cp, mv, date,
40 dd, df, dirname, dmesg, du, dutmp, echo, fbset, fdflush, find, free,
41 freeramdisk, deallocvt, fsck.minix, mkfs.minix, grep, gunzip, gzip,
42 halt, head, hostid, hostname, init, kill, killall, length, ln, loadacm,
43 loadfont, loadkmap, ls, lsmod, makedevs, math, mkdir, mkfifo, mknod,
44 mkswap, mnc, more, mount, mt, nslookup, poweroff, ping, printf, ps,
45 pwd, reboot, rm, rmdir, rmmod, sed, sh, fdisk, sfdisk, sleep, sort,
46 sync, syslogd, logger, logname, swapon, swapoff, tail, tar, [, test,
47 tee, touch, tr, true, false, tty, umount, uname, uptime, uniq, update,
48 usleep, wc, whoami, yes, zcat
49
50 =head1 OPTIONS
51
52 Common Options: 
53
54 Most BusyBox commands support the B<--help> option to provide a
55 terse runtime description of their behavior. 
56
57 =over 4
58
59 =item basename
60
61 Usage: basename [file ...]
62
63 Strips directory and suffix from filenames. 
64
65 Example: 
66
67         $ basename /usr/local/bin/foo
68         foo
69         $ basename /usr/local/bin/
70         bin
71
72 =item cat
73
74 Usage: cat [file ...]
75
76 Concatenates files and prints them to the standard output.
77
78 Example:
79
80         $ cat /proc/uptime
81         110716.72 17.67
82
83 =item chmod
84
85 Usage: chmod [B<-R>] MODE[,MODE]... FILE...
86
87 Changes file access permissions for the specified file(s) or directory(s).
88 Each MODE is defined by combining the letters for WHO has access to the file,
89 an OPERATOR for selecting how the permissions should be changed, and a
90 PERISSION for the file(s) or directory(s).
91
92 WHO may be chosen from:
93
94         u       the User who owns the file
95         g       users in the file's Group
96         o       Other users not in the file's group
97         a       All users
98
99 OPERATOR may be chosen from:
100
101         +       add a permission
102         -       remove a permission
103         =       assign a permission
104  
105 PERMISSION may be chosen from:
106
107         r       Read    
108         w       Write
109         x       eXecute (or access for directories)
110         s       Set user (or group) ID bit
111         t       sTickey bit (for directories prevents removing files by non-owners)
112
113 Alternately, permissions may be set numerically where the first three
114 numbers are calculated by adding the octal values:
115         
116         4       Read
117         2       Write
118         1       eXecute
119
120 An optional fourth digit may also be used to specify
121     
122         4       Set user ID
123         2       Set group ID
124         1       sTickey bit
125
126 Options:
127
128  -R     change files and directories recursively.
129  
130 Example:
131
132         $ ls -l /tmp/foo
133         -rw-rw-r--    1 root     root            0 Apr 12 18:25 /tmp/foo
134         $ chmod u+x /tmp/foo
135         $ ls -l /tmp/foo
136         -rwxrw-r--    1 root     root            0 Apr 12 18:25 /tmp/foo*
137         $ chmod 444 /tmp/foo
138         $ ls -l /tmp/foo
139         -r--r--r--    1 root     root            0 Apr 12 18:25 /tmp/foo
140
141 =item chown
142
143 Usage: chown [OPTION]...  OWNER[.[GROUP] FILE...
144
145 Changes the owner and/or group of each FILE to OWNER and/or GROUP.
146  
147 Options:
148
149  -R     change files and directories recursively
150
151 Example:
152
153         $ ls -l /tmp/foo
154         -r--r--r--    1 andersen andersen        0 Apr 12 18:25 /tmp/foo
155         $ chown root /tmp/foo
156         $ ls -l /tmp/foo
157         -r--r--r--    1 root     andersen        0 Apr 12 18:25 /tmp/foo
158         $ chown root.root /tmp/foo
159         ls -l /tmp/foo
160         -r--r--r--    1 root     root            0 Apr 12 18:25 /tmp/foo
161
162 =item chgrp
163
164 Usage: chgrp [OPTION]... GROUP FILE...
165
166 Change the group membership of each FILE to GROUP.
167  
168 Options:
169
170  -R     change files and directories recursively
171  
172 Example:
173
174         $ ls -l /tmp/foo
175         -r--r--r--    1 andersen andersen        0 Apr 12 18:25 /tmp/foo
176         $ chgrp root /tmp/foo
177         $ ls -l /tmp/foo
178         -r--r--r--    1 andersen root            0 Apr 12 18:25 /tmp/foo
179
180 =item chroot
181
182 Usage: chroot NEWROOT [COMMAND...]
183
184 Run COMMAND with root directory set to NEWROOT.
185  
186 Exmaple:
187
188         $ ls -l /bin/ls
189         lrwxrwxrwx    1 root     root          12 Apr 13 00:46 /bin/ls -> /bin/busybox
190         $ mount /dev/hdc1 /mnt -t minix
191         $ chroot /mnt
192         $ ls -l /bin/ls
193         -rwxr-xr-x    1 root     root        40816 Feb  5 07:45 /bin/ls*
194
195 =item clear
196
197 Clears the screen.
198
199 =item chvt
200
201 Usage: chvt N
202
203 Change foreground virtual terminal to /dev/ttyN
204  
205
206 =item cp
207
208 Usage: cp [OPTION]... SOURCE DEST
209
210    or: cp [OPTION]... SOURCE... DIRECTORY
211
212 Copy SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY.
213
214         -a      same as -dpR
215         -d      preserve links
216         -p      preserve file attributes if possable
217         -R      copy directories recursively
218
219 =item date
220
221 Usage: date [OPTION]... [+FORMAT]
222
223   or:  date [OPTION] [MMDDhhmm[[CC]YY][.ss]]
224
225 Display the current time in the given FORMAT, or set the system date.
226
227 Options:
228
229         -R              output RFC-822 compliant date string
230         -s              set time described by STRING
231         -u              print or set Coordinated Universal Time
232
233 Example:
234
235         $ date
236         Wed Apr 12 18:52:41 MDT 2000
237
238 =item dd
239
240 Usage: dd [if=name] [of=name] [bs=n] [count=n] [skip=n] [seek=n]
241
242 Copy a file, converting and formatting according to options
243
244         if=FILE read from FILE instead of stdin
245         of=FILE write to FILE instead of stdout
246         bs=n    read and write n bytes at a time
247         count=n copy only n input blocks
248         skip=n  skip n input blocks
249         seek=n  skip n output blocks
250
251 Numbers may be suffixed by w (x2), k (x1024), b (x512), or M (x1024^2)
252  
253
254 Example:
255
256         $ dd if=/dev/zero of=/dev/ram1 bs=1M count=4
257         4+0 records in
258         4+0 records out
259
260 =item df
261
262 Usage: df [filesystem ...]
263
264 Prints the filesystem space used and space available.
265
266 Exmaple:
267
268         $ df
269         Filesystem           1k-blocks      Used Available Use% Mounted on
270         /dev/sda3              8690864   8553540    137324  98% /
271         /dev/sda1                64216     36364     27852  57% /boot
272         $ df /dev/sda3
273         Filesystem           1k-blocks      Used Available Use% Mounted on
274         /dev/sda3              8690864   8553540    137324  98% /
275
276 =item dmesg
277
278 Usage: dmesg [B<-c>] [B<-n> level] [B<-s> bufsize]
279  
280 Print or controls the kernel ring buffer.
281
282 =item du
283
284 Usage: du [OPTION]... [FILE]...
285
286 Summarize disk space used for each FILE and/or directory.
287 Disk space is printed in units of 1k (i.e. 1024 bytes).
288
289 Options:
290
291         -l      count sizes many times if hard linked
292         -s      display only a total for each argument
293
294 Example:
295
296         $ ./busybox du
297         16      ./CVS
298         12      ./kernel-patches/CVS
299         80      ./kernel-patches
300         12      ./tests/CVS
301         36      ./tests
302         12      ./scripts/CVS
303         16      ./scripts
304         12      ./docs/CVS
305         104     ./docs
306         2417    .
307          
308
309 =item fbset
310
311 Usage: fbset [options] [mode]
312
313 Show and modify frame buffer device settings
314
315 Options:
316
317  -h
318  -fb
319  -db
320  -a
321  -i
322  -g
323  -t
324  -accel
325  -hsync
326  -vsync
327  -laced
328  -double
329
330
331 =item find
332
333 Usage: find [PATH...] [EXPRESSION]
334
335 Search for files in a directory hierarchy.  The default PATH is
336 the current directory; default EXPRESSION is '-print'
337
338
339 EXPRESSION may consist of:
340         -follow
341                 Dereference symbolic links.
342         -name PATTERN
343                 File name (with leading directories removed) matches PATTERN.
344         -print
345                 print the full file name followed by a newline to stdout.
346
347 Example:
348
349         $ find / -name /etc/passwd
350         /etc/passwd
351
352 =item free
353
354 Usage: free
355
356 Displays the amount of free and used memory in the system.
357
358 Example:
359
360         $ free
361                       total         used         free       shared      buffers
362           Mem:       257628       248724         8904        59644        93124
363          Swap:       128516         8404       120112
364         Total:       386144       257128       129016
365
366
367 =item deallocvt
368
369 Usage: deallocvt N
370
371 Deallocates unused virtual terminal /dev/ttyN
372  
373
374 =item fsck.minix
375
376 Usage: fsck.minix [B<-larvsmf>] /dev/name
377
378 Performs a consistency check for MINIX filesystems.
379
380 OPTIONS:
381
382         -l      Lists all filenames
383         -r      Perform interactive repairs
384         -a      Perform automatic repairs
385         -v      verbose
386         -s      Outputs super-block information
387         -m      Activates MINIX-like "mode not cleared" warnings
388         -f      Force file system check.
389  
390
391 =item mkfs.minix
392
393 Usage: mkfs.minix [B<-c> | B<-l> filename] [B<-nXX>] [B<-iXX>] /dev/name [blocks]
394
395 Make a MINIX filesystem.
396
397 OPTIONS:
398
399         -c              Check the device for bad blocks
400         -n [14|30]      Specify the maximum length of filenames
401         -i              Specify the number of inodes for the filesystem
402         -l FILENAME     Read the bad blocks list from FILENAME
403         -v              Make a Minix version 2 filesystem
404  
405
406 =item grep
407
408 Usage: grep [OPTIONS]... PATTERN [FILE]...
409
410 Search for PATTERN in each FILE or standard input.
411
412 OPTIONS:
413
414         -h      suppress the prefixing filename on output
415         -i      ignore case distinctions
416         -n      print line number with output lines
417         -q      be quiet. Returns 0 if result was found, 1 otherwise
418
419 This version of grep matches full regular expresions.
420
421
422 Example:
423
424         $ grep root /etc/passwd
425         root:x:0:0:root:/root:/bin/bash
426         $ grep ^[rR]oo. /etc/passwd
427         root:x:0:0:root:/root:/bin/bash
428
429 =item head
430
431 Usage: head [OPTION] [FILE]...
432
433 Print first 10 lines of each FILE to standard output.
434 With more than one FILE, precede each with a header giving the
435 file name. With no FILE, or when FILE is -, read standard input.
436
437 Options:
438
439         -n NUM          Print first NUM lines instead of first 10
440
441 Example:
442
443         $ head -n 2 /etc/passwd
444         root:x:0:0:root:/root:/bin/bash
445         daemon:x:1:1:daemon:/usr/sbin:/bin/sh
446
447 =item hostname
448
449 Usage: hostname [OPTION] {hostname | B<-F> file}
450
451 Get or set the hostname or DNS domain name. If a hostname is given
452 (or a file with the B<-F> parameter), the host name will be set.
453
454 Options:
455
456         -s              Short
457         -i              Addresses for the hostname
458         -d              DNS domain name
459         -F FILE         Use the contents of FILE to specify the hostname
460
461 Example:
462
463         $ hostname
464         slag 
465
466 =item kill
467
468 Usage: kill [B<-signal>] process-id [process-id ...]
469
470 Send a signal (default is SIGTERM) to the specified process(es).
471
472 Options:
473
474         -l      List all signal names and numbers.
475
476 Example:
477
478         $ ps | grep apache
479         252 root     root     S [apache]
480         263 www-data www-data S [apache]
481         264 www-data www-data S [apache]
482         265 www-data www-data S [apache]
483         266 www-data www-data S [apache]
484         267 www-data www-data S [apache]
485         $ kill 252
486
487 =item ln
488
489 Usage: ln [OPTION] TARGET... LINK_NAME|DIRECTORY
490 Create a link named LINK_NAME or DIRECTORY to the specified TARGET
491  
492 Options:
493
494  -s     make symbolic links instead of hard links
495  -f     remove existing destination files
496  
497
498 =item ls
499
500 Usage: ls [B<-1acdelnpuxACF>] [filenames...]
501  
502
503 =item lsmod
504
505
506
507 =item mkdir
508
509 Usage: Usage: mkdir [OPTION] DIRECTORY...
510 Create the DIRECTORY(ies), if they do not already exist
511  
512 Options:
513
514  -m     set permission mode (as in chmod), not rwxrwxrwx - umask
515  -p     no error if existing, make parent directories as needed
516  
517
518 =item mknod
519
520 Usage: mknod NAME TYPE MAJOR MINOR
521 Make block or character special files.
522
523 TYPEs include:
524
525  b:     Make a block (buffered) device.
526  c or u:        Make a character (un-buffered) device.
527  p:     Make a named pipe. Major and minor are ignored for named pipes.
528  
529
530 =item mkswap
531
532 Usage: mkswap [B<-c>] [-v0|-v1] device [block-count]
533 Prepare a disk partition to be used as a swap partition.
534  
535 Options:
536
537  -c             Check for read-ability.
538  -v0            Make version 0 swap [max 128 Megs].
539  -v1            Make version 1 swap [big!] (default for kernels > 2.1.117).
540  block-count    Number of block to use (default is entire partition).
541  
542
543 =item more
544
545 Usage: more [file ...]
546  
547
548 =item mount
549
550 Usage:  mount [flags]
551
552 mount [flags] device directory [B<-o> options,more-options]
553
554  Flags:
555  -a:    Mount all file systems in fstab.
556  -o option:     One of many filesystem options, listed below.
557  -r:    Mount the filesystem read-only.
558  -t filesystem-type:    Specify the filesystem type.
559  -w:    Mount for reading and writing (default).
560  Options for use with the "-o" flag:
561  async / sync:  Writes are asynchronous / synchronous.
562  dev / nodev:   Allow use of special device files / disallow them.
563  exec / noexec: Allow use of executable files / disallow them.
564  loop: Mounts a file via loop device.
565  suid / nosuid: Allow set-user-id-root programs / disallow them.
566  remount: Re-mount a currently-mounted filesystem, changing its flags.
567  ro / rw: Mount for read-only / read-write.
568
569 There are EVEN MORE flags that are specific to each filesystem.
570 You'll have to see the written documentation for those.
571  
572
573 =item mv
574
575 Usage: mv SOURCE DEST
576
577 or: mv SOURCE... DIRECTORY
578
579 Rename SOURCE to DEST, or move SOURCE(s) to DIRECTORY.
580  
581
582 =item ping
583
584
585
586 =item poweroff
587
588
589
590 =item ps
591
592 Usage: ps
593
594 Report process status.
595 This version of ps accepts no options.
596  
597
598 =item pwd
599
600
601
602 =item reboot
603
604
605
606 =item rm
607
608 Usage: rm [OPTION]... FILE...
609 Remove (unlink) the FILE(s).
610  
611 Options:
612
613  -f             remove existing destinations, never prompt
614  -r or -R       remove the contents of directories recursively
615  
616
617 =item rmdir
618
619 Usage: rmdir [OPTION]... DIRECTORY...
620 Remove the DIRECTORY(ies), if they are empty.
621  
622
623 =item sed
624
625 Usage: sed [B<-n>] B<-e> script [file...]
626 Allowed sed scripts come in the following form:
627
628  'ADDR [!] COMMAND'
629   where address ADDR can be:
630  NUMBER    Match specified line number
631  $         Match last line
632  /REGEXP/  Match specified regexp
633  (! inverts the meaning of the match)
634   and COMMAND can be:
635  s/regexp/replacement/[igp]
636  which attempt to match regexp against the pattern space
637  and if successful replaces the matched portion with replacement.
638   aTEXT
639  which appends TEXT after the pattern space
640
641 Options:
642
643  -e     add the script to the commands to be executed
644  -n     suppress automatic printing of pattern space
645
646 This version of sed matches full regular expresions.
647  
648
649 =item sleep
650
651 Usage: sleep N
652
653 Pause for N seconds.
654  
655
656 =item sort
657
658 Usage: Usage: sort [OPTION]... [FILE]...
659   
660
661 =item sync
662
663 Usage: sync
664
665 Write all buffered filesystem blocks to disk.
666  
667
668 =item syslogd
669
670 Usage: syslogd [OPTION]...
671
672 Linux system and kernel (provides klogd) logging utility.
673 Note that this version of syslogd/klogd ignores /etc/syslog.conf.
674  
675 Options:
676
677  -m     Change the mark timestamp interval. default=20min. 0=off
678  -n     Do not fork into the background (for when run by init)
679  -K     Do not start up the klogd process (by default syslogd spawns klogd).
680  -O     Specify an alternate log file.  default=/var/log/messages
681  
682
683 =item swapon
684
685 Usage: swapon device
686
687 Start swapping virtual memory pages on the given device.
688  
689
690 =item swapoff
691
692 Usage: swapoff device
693
694 Stop swapping virtual memory pages on the given device.
695  
696
697 =item tail
698
699 Usage: tail [OPTION]... [FILE]...
700
701 Print last 10 lines of each FILE to standard output.
702 With more than one FILE, precede each with a header giving the file name.
703 With no FILE, or when FILE is -, read standard input.
704
705  -c=N[kbm]       output the last N bytes
706  -f              output appended data as the file grows
707  -n=N            output the last N lines, instead of last 10
708  -q              never output headers giving file names
709  -v              always output headers giving file names
710  --help          display this help and exit
711
712 If the first character of N (bytes or lines) is a `+', output begins with 
713 the Nth item from the start of each file, otherwise, print the last N items
714 in the file.  N bytes may be suffixed by k (x1024), b (x512), or m (1024^2).
715   
716
717 =item tar
718
719
720
721 =item tee
722
723 Usage: tee [OPTION]... [FILE]...
724 Copy standard input to each FILE, and also to standard output.
725  
726 Options:
727
728  -a     append to the given FILEs, do not overwrite
729  
730
731 =item touch
732
733 Usage: touch [B<-c>] file [file ...]
734  Update the last-modified date on the given file[s].
735  
736
737 =item true
738
739
740
741 =item false
742
743
744
745 =item uname
746
747 Usage: uname [OPTION]...
748
749 Print certain system information.  With no OPTION, same as B<-s>.
750  
751 Options:
752
753  -a     print all information
754  -m     the machine (hardware) type
755  -n     print the machine's network node hostname
756  -r     print the operating system release
757  -s     print the operating system name
758  -p     print the host processor type
759  -v     print the operating system version
760  
761
762 =item umount
763
764 Usage: Usage: umount [flags] filesystem|directory
765
766 Flags:
767
768  -a:    Unmount all file systems
769  
770
771 =item uniq
772
773 Usage: Usage: uniq [OPTION]... [INPUT [OUTPUT]]
774
775 Discard all but one of successive identical lines from INPUT (or
776 standard input), writing to OUTPUT (or standard output).
777
778  -h     display this help and exit
779
780 A field is a run of whitespace, then non-whitespace characters.
781 Fields are skipped before chars.
782  
783
784 =item zcat
785
786 Usage: gunzip [OPTION]... FILE
787
788 Uncompress FILE (or standard input if FILE is '-').
789  
790 Options:
791
792  -c     Write output to standard output
793  -t     Test compressed file integrity
794  
795
796 =item gunzip
797
798 Usage: gunzip [OPTION]... FILE
799
800 Uncompress FILE (or standard input if FILE is '-').
801  
802 Options:
803
804  -c     Write output to standard output
805  -t     Test compressed file integrity
806  
807
808 =item gzip
809
810 Usage: gzip [OPTION]... FILE
811
812 Compress FILE with maximum compression.
813 When FILE is -, reads standard input.  Implies B<-c>.
814  
815 Options:
816
817  -c     Write output to standard output instead of FILE.gz
818  
819
820
821 =back
822
823 =head1 SEE ALSO
824
825 textutils(1), shellutils(1), etc...
826
827 =head1 MAINTAINER
828
829 Erik Andersen <erik@lineo.com>
830
831 =head1 AUTHORS
832
833 The following people have contributed code to BusyBox whether
834 they know it or not.
835
836 Erik Andersen <erik@lineo.com>
837
838 =for html <br>
839
840 John Beppu <beppu@lineo.com>
841
842 =for html <br>
843
844 Brian Candler <B.Candler@pobox.com>
845
846 =for html <br>
847
848 Randolph Chung <tausq@debian.org>
849
850 =for html <br>
851
852 Dave Cinege <dcinege@psychosis.com>     
853
854 =for html <br>
855
856 Bruce Perens <bruce@perens.com>
857
858 =for html <br>
859
860 Linus Torvalds <torvalds@transmeta.com>
861
862 =for html <br>
863
864 Charles P. Wright <cpwright@villagenet.com>
865
866 =for html <br>
867
868 Enrique Zanardi <ezanardi@ull.es>
869
870 =for html <br>
871
872 =cut
873