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