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