summaryrefslogtreecommitdiff
path: root/docs/busybox.pod
blob: 655e07bcadd210f43a2cbb4c1c286dbed470e257 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
=head1 NAME

busybox - I am BusyBox of Borg.  Unix will be assimilated.

=head1 SYNOPSIS

 busybox <function> [arguments...]  # or

 <function> [arguments...]	    # if symlinked

=head1 DESCRIPTION

BusyBox is a multi-call binary that combines many common Unix utilities into a
single executable.  Most people will create a link to busybox for each function
they wish to use, and BusyBox will act like whatever it was invoked as.  For
example,

	ln -s ./busybox ls
	./ls

will cause BusyBox to behave as 'ls' (if the 'ls' command has been compiled
into busybox).  You can also invoke BusyBox by providing it the command to run
on the command line.  For example,

	./busybox ls

will also cause BusyBox to behave as 'ls'. 

BusyBox has been written with size-optimization in mind.  It is very easy to
include or exclude the commands (or features) you want installed.  BusyBox
tries to make itself useful to small systems with limited resources.

=head1 COMMANDS

Currently defined functions include:

	basename, cat, chmod, chown, chgrp, chroot, clear, chvt, cp, mv, date,
	dd, df, dirname, dmesg, du, dutmp, echo, fbset, fdflush, find, free,
	freeramdisk, deallocvt, fsck.minix, mkfs.minix, grep, gunzip, gzip,
	halt, head, hostid, hostname, init, kill, killall, length, ln, loadacm,
	loadfont, loadkmap, ls, lsmod, makedevs, math, mkdir, mkfifo, mknod,
	mkswap, mnc, more, mount, mt, nslookup, poweroff, ping, printf, ps,
	pwd, reboot, rm, rmdir, rmmod, sed, sh, fdisk, sfdisk, sleep, sort,
	sync, syslogd, logger, logname, swapon, swapoff, tail, tar, [, test,
	tee, touch, tr, true, false, tty, umount, uname, uptime, uniq, update,
	usleep, wc, whoami, yes, zcat

=head1 OPTIONS

Common Options: 

	Most BusyBox commands support the "--help" option to provide a
	terse runtime description of their behavior. 

=over 4

=item basename

Usage: basename [file ...]

Strips directory and suffix from filenames. 

Example: 

	$ basename /usr/local/bin/foo
	foo
	$ basename /usr/local/bin/
	bin

=item cat

Usage: cat [file ...]

Concatenates files and prints them to the standard output.

Example:

	$ cat /proc/uptime
	110716.72 17.67

=item chmod

Usage: chmod [-R] MODE[,MODE]... FILE...

Changes file access permissions for the specified file(s) or directory(s).
Each MODE is defined by combining the letters for WHO has access to the file,
an OPERATOR for selecting how the permissions should be changed, and a
PERISSION for the file(s) or directory(s).

WHO may be chosen from:

	u	the User who owns the file
	g	users in the file's Group
	o	Other users not in the file's group
	a	All users

OPERATOR may be chosen from:

	+	add a permission
	-	remove a permission
	=	assign a permission
 
PERMISSION may be chosen from:

	r	Read	
	w	Write
	x	eXecute (or access for directories)
	s	Set user (or group) ID bit
	t	sTickey bit (for directories prevents removing files by non-owners)

Alternately, permissions may be set numerically where the first three
numbers are calculated by adding the octal values:
	
	4	Read
	2	Write
	1	eXecute

An optional fourth digit may also be used to specify
    
	4	Set user ID
	2	Set group ID
	1	sTickey bit

Options:

 -R	change files and directories recursively.
 
Example:

	$ ls -l /tmp/foo
	-rw-rw-r--    1 root     root            0 Apr 12 18:25 /tmp/foo
	$ chmod u+x /tmp/foo
	$ ls -l /tmp/foo
	-rwxrw-r--    1 root     root            0 Apr 12 18:25 /tmp/foo*
	$ chmod 444 /tmp/foo
	$ ls -l /tmp/foo
	-r--r--r--    1 root     root            0 Apr 12 18:25 /tmp/foo

=item chown

Usage: chown [OPTION]...  OWNER[.[GROUP] FILE...

Changes the owner and/or group of each FILE to OWNER and/or GROUP.
 
Options:

 -R	change files and directories recursively

Example:

	$ ls -l /tmp/foo
	-r--r--r--    1 andersen andersen        0 Apr 12 18:25 /tmp/foo
	$ chown root /tmp/foo
	$ ls -l /tmp/foo
	-r--r--r--    1 root     andersen        0 Apr 12 18:25 /tmp/foo
	$ chown root.root /tmp/foo
	ls -l /tmp/foo
	-r--r--r--    1 root     root            0 Apr 12 18:25 /tmp/foo

=item chgrp

Usage: chgrp [OPTION]... GROUP FILE...

Change the group membership of each FILE to GROUP.
 
Options:

 -R	change files and directories recursively
 
Example:

	$ ls -l /tmp/foo
	-r--r--r--    1 andersen andersen        0 Apr 12 18:25 /tmp/foo
	$ chgrp root /tmp/foo
	$ ls -l /tmp/foo
	-r--r--r--    1 andersen root            0 Apr 12 18:25 /tmp/foo

=item chroot

Usage: chroot NEWROOT [COMMAND...]

Run COMMAND with root directory set to NEWROOT.
 
Exmaple:

	$ ls -l /bin/ls
	lrwxrwxrwx    1 root     root          12 Apr 13 00:46 /bin/ls -> /bin/busybox
	$ mount /dev/hdc1 /mnt -t minix
	$ chroot /mnt
	$ ls -l /bin/ls
	-rwxr-xr-x    1 root     root        40816 Feb  5 07:45 /bin/ls*

=item clear

Clears the screen.

=item chvt

Usage: chvt N

Change foreground virtual terminal to /dev/ttyN
 

=item cp

Usage: cp [OPTION]... SOURCE DEST

   or: cp [OPTION]... SOURCE... DIRECTORY

Copy SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY.

        -a      same as -dpR
        -d      preserve links
        -p      preserve file attributes if possable
        -R      copy directories recursively

=item date

Usage: date [OPTION]... [+FORMAT]

  or:  date [OPTION] [MMDDhhmm[[CC]YY][.ss]]

Display the current time in the given FORMAT, or set the system date.

Options:
        -R              output RFC-822 compliant date string
        -s              set time described by STRING
        -u              print or set Coordinated Universal Time

Example:
	
	$ date
	Wed Apr 12 18:52:41 MDT 2000

=item dd

Usage: dd [if=name] [of=name] [bs=n] [count=n] [skip=n] [seek=n]

Copy a file, converting and formatting according to options

        if=FILE read from FILE instead of stdin
        of=FILE write to FILE instead of stdout
        bs=n    read and write n bytes at a time
        count=n copy only n input blocks
        skip=n  skip n input blocks
        seek=n  skip n output blocks

Numbers may be suffixed by w (x2), k (x1024), b (x512), or M (x1024^2)
 

Example:

	$ dd if=/dev/zero of=/dev/ram1 bs=1M count=4
	4+0 records in
	4+0 records out

=item df

Usage: df [filesystem ...]

Prints the filesystem space used and space available.

Exmaple:

	$ df
	Filesystem           1k-blocks      Used Available Use% Mounted on
	/dev/sda3              8690864   8553540    137324  98% /
	/dev/sda1                64216     36364     27852  57% /boot
	$ df /dev/sda3
	Filesystem           1k-blocks      Used Available Use% Mounted on
	/dev/sda3              8690864   8553540    137324  98% /

=item dmesg

Usage: dmesg [-c] [-n level] [-s bufsize]
 
Print or controls the kernel ring buffer.

=item du

Usage: du [OPTION]... [FILE]...

Summarize disk space used for each FILE and/or directory.
Disk space is printed in units of 1k (i.e. 1024 bytes).

Options:
        -l      count sizes many times if hard linked
        -s      display only a total for each argument

Example:

	$ ./busybox du
	16      ./CVS
	12      ./kernel-patches/CVS
	80      ./kernel-patches
	12      ./tests/CVS
	36      ./tests
	12      ./scripts/CVS
	16      ./scripts
	12      ./docs/CVS
	104     ./docs
	2417    .
	 

=item fbset

Usage: fbset [options] [mode]

Show and modify frame buffer device settings

Options:

 -h
 -fb
 -db
 -a
 -i
 -g
 -t
 -accel
 -hsync
 -vsync
 -laced
 -double


=item find

Usage: find [PATH...] [EXPRESSION]

Search for files in a directory hierarchy.  The default PATH is
the current directory; default EXPRESSION is '-print'


EXPRESSION may consist of:
        -follow
                Dereference symbolic links.
        -name PATTERN
                File name (with leading directories removed) matches PATTERN.
        -print
                print the full file name followed by a newline to stdout.

Example:

	$ find / -name /etc/passwd
	/etc/passwd

=item free

Usage: free

Displays the amount of free and used memory in the system.

Example:

	$ free
		      total         used         free       shared      buffers
	  Mem:       257628       248724         8904        59644        93124
	 Swap:       128516         8404       120112
	Total:       386144       257128       129016


=item deallocvt

Usage: deallocvt N

Deallocates unused virtual terminal /dev/ttyN
 

=item fsck.minix

Usage: fsck.minix [-larvsmf] /dev/name

Performs a consistency check for MINIX filesystems.

OPTIONS:
        -l      Lists all filenames
        -r      Perform interactive repairs
        -a      Perform automatic repairs
        -v      verbose
        -s      Outputs super-block information
        -m      Activates MINIX-like "mode not cleared" warnings
        -f      Force file system check.
 

=item mkfs.minix

Usage: mkfs.minix [-c | -l filename] [-nXX] [-iXX] /dev/name [blocks]

Make a MINIX filesystem.

OPTIONS:
        -c              Check the device for bad blocks
        -n [14|30]      Specify the maximum length of filenames
        -i              Specify the number of inodes for the filesystem
        -l FILENAME     Read the bad blocks list from FILENAME
        -v              Make a Minix version 2 filesystem
 

=item grep

Usage: grep [OPTIONS]... PATTERN [FILE]...

Search for PATTERN in each FILE or standard input.

OPTIONS:
        -h      suppress the prefixing filename on output
        -i      ignore case distinctions
        -n      print line number with output lines
        -q      be quiet. Returns 0 if result was found, 1 otherwise

This version of grep matches full regular expresions.


Example:

	$ grep root /etc/passwd
	root:x:0:0:root:/root:/bin/bash
	$ grep ^[rR]oo. /etc/passwd
	root:x:0:0:root:/root:/bin/bash

=item head

Usage: head [OPTION] [FILE]...

Print first 10 lines of each FILE to standard output.
With more than one FILE, precede each with a header giving the
file name. With no FILE, or when FILE is -, read standard input.

Options:
        -n NUM          Print first NUM lines instead of first 10

Example:

	$ head -n 2 /etc/passwd
	root:x:0:0:root:/root:/bin/bash
	daemon:x:1:1:daemon:/usr/sbin:/bin/sh

=item hostname

Usage: hostname [OPTION] {hostname | -F file}

Get or set the hostname or DNS domain name. If a hostname is given
(or a file with the -F parameter), the host name will be set.

Options:
        -s              Short
        -i              Addresses for the hostname
        -d              DNS domain name
        -F FILE         Use the contents of FILE to specify the hostname

Example:

	$ hostname
	slag 

=item kill

Usage: kill [-signal] process-id [process-id ...]

Send a signal (default is SIGTERM) to the specified process(es).

Options:
        -l      List all signal names and numbers.

Example:

	$ ps | grep apache
	252 root     root     S [apache]
	263 www-data www-data S [apache]
	264 www-data www-data S [apache]
	265 www-data www-data S [apache]
	266 www-data www-data S [apache]
	267 www-data www-data S [apache]
	$ kill 252

=item ln

Usage: ln [OPTION] TARGET... LINK_NAME|DIRECTORY
Create a link named LINK_NAME or DIRECTORY to the specified TARGET
 
Options:

 -s	make symbolic links instead of hard links
 -f	remove existing destination files
 

=item ls

Usage: ls [-1acdelnpuxACF] [filenames...]
 

=item lsmod



=item mkdir

Usage: Usage: mkdir [OPTION] DIRECTORY...
Create the DIRECTORY(ies), if they do not already exist
 
Options:

 -m	set permission mode (as in chmod), not rwxrwxrwx - umask
 -p	no error if existing, make parent directories as needed
 

=item mknod

Usage: mknod NAME TYPE MAJOR MINOR
Make block or character special files.

TYPEs include:

 b:	Make a block (buffered) device.
 c or u:	Make a character (un-buffered) device.
 p:	Make a named pipe. Major and minor are ignored for named pipes.
 

=item mkswap

Usage: mkswap [-c] [-v0|-v1] device [block-count]
Prepare a disk partition to be used as a swap partition.
 
Options:

 -c		Check for read-ability.
 -v0		Make version 0 swap [max 128 Megs].
 -v1		Make version 1 swap [big!] (default for kernels > 2.1.117).
 block-count	Number of block to use (default is entire partition).
 

=item more

Usage: more [file ...]
 

=item mount

Usage: 	mount [flags]

mount [flags] device directory [-o options,more-options]

 Flags:
 -a:	Mount all file systems in fstab.
 -o option:	One of many filesystem options, listed below.
 -r:	Mount the filesystem read-only.
 -t filesystem-type:	Specify the filesystem type.
 -w:	Mount for reading and writing (default).
 Options for use with the "-o" flag:
 async / sync:	Writes are asynchronous / synchronous.
 dev / nodev:	Allow use of special device files / disallow them.
 exec / noexec:	Allow use of executable files / disallow them.
 loop: Mounts a file via loop device.
 suid / nosuid:	Allow set-user-id-root programs / disallow them.
 remount: Re-mount a currently-mounted filesystem, changing its flags.
 ro / rw: Mount for read-only / read-write.

There are EVEN MORE flags that are specific to each filesystem.
You'll have to see the written documentation for those.
 

=item mv

Usage: mv SOURCE DEST

or: mv SOURCE... DIRECTORY

Rename SOURCE to DEST, or move SOURCE(s) to DIRECTORY.
 

=item ping



=item poweroff



=item ps

Usage: ps

Report process status.
This version of ps accepts no options.
 

=item pwd



=item reboot



=item rm

Usage: rm [OPTION]... FILE...
Remove (unlink) the FILE(s).
 
Options:

 -f		remove existing destinations, never prompt
 -r or -R	remove the contents of directories recursively
 

=item rmdir

Usage: rmdir [OPTION]... DIRECTORY...
Remove the DIRECTORY(ies), if they are empty.
 

=item sed

Usage: sed [-n] -e script [file...]
Allowed sed scripts come in the following form:

 'ADDR [!] COMMAND'
  where address ADDR can be:
 NUMBER    Match specified line number
 $         Match last line
 /REGEXP/  Match specified regexp
 (! inverts the meaning of the match)
  and COMMAND can be:
 s/regexp/replacement/[igp]
 which attempt to match regexp against the pattern space
 and if successful replaces the matched portion with replacement.
  aTEXT
 which appends TEXT after the pattern space

Options:

-e	add the script to the commands to be executed
-n	suppress automatic printing of pattern space

This version of sed matches full regular expresions.
 

=item sleep

Usage: sleep N

Pause for N seconds.
 

=item sort

Usage: Usage: sort [OPTION]... [FILE]...
  

=item sync

Usage: sync

Write all buffered filesystem blocks to disk.
 

=item syslogd

Usage: syslogd [OPTION]...

Linux system and kernel (provides klogd) logging utility.
Note that this version of syslogd/klogd ignores /etc/syslog.conf.
 
Options:

 -m	Change the mark timestamp interval. default=20min. 0=off
 -n	Do not fork into the background (for when run by init)
 -K	Do not start up the klogd process (by default syslogd spawns klogd).
 -O	Specify an alternate log file.  default=/var/log/messages
 

=item swapon

Usage: swapon device

Start swapping virtual memory pages on the given device.
 

=item swapoff

Usage: swapoff device

Stop swapping virtual memory pages on the given device.
 

=item tail

Usage: tail [OPTION]... [FILE]...

Print last 10 lines of each FILE to standard output.
With more than one FILE, precede each with a header giving the file name.
With no FILE, or when FILE is -, read standard input.

 -c=N[kbm]       output the last N bytes
 -f              output appended data as the file grows
 -n=N            output the last N lines, instead of last 10
 -q              never output headers giving file names
 -v              always output headers giving file names
 --help          display this help and exit

If the first character of N (bytes or lines) is a `+', output begins with 
the Nth item from the start of each file, otherwise, print the last N items
in the file.  N bytes may be suffixed by k (x1024), b (x512), or m (1024^2).
  

=item tar



=item tee

Usage: tee [OPTION]... [FILE]...
Copy standard input to each FILE, and also to standard output.
 
Options:

 -a	append to the given FILEs, do not overwrite
 

=item touch

Usage: touch [-c] file [file ...]
 Update the last-modified date on the given file[s].
 

=item true



=item false



=item uname

Usage: uname [OPTION]...
 Print certain system information.  With no OPTION, same as -s.
 
Options:

 -a	print all information
 -m	the machine (hardware) type
 -n	print the machine's network node hostname
 -r	print the operating system release
 -s	print the operating system name
 -p	print the host processor type
 -v	print the operating system version
 

=item umount

Usage: Usage: umount [flags] filesystem|directory
 Flags:
 -a:	Unmount all file systems
 

=item uniq

Usage: Usage: uniq [OPTION]... [INPUT [OUTPUT]]

Discard all but one of successive identical lines from INPUT (or
standard input), writing to OUTPUT (or standard output).

 -h	display this help and exit

A field is a run of whitespace, then non-whitespace characters.
Fields are skipped before chars.
 

=item zcat

Usage: gunzip [OPTION]... FILE

Uncompress FILE (or standard input if FILE is '-').
 
Options:

 -c	Write output to standard output
 -t	Test compressed file integrity
 

=item gunzip

Usage: gunzip [OPTION]... FILE

Uncompress FILE (or standard input if FILE is '-').
 
Options:

 -c	Write output to standard output
 -t	Test compressed file integrity
 

=item gzip

Usage: gzip [OPTION]... FILE

Compress FILE with maximum compression.
When FILE is -, reads standard input.  Implies -c.
 
Options:

 -c	Write output to standard output instead of FILE.gz
 


=back

=head1 SEE ALSO

textutils(1), shellutils(1), etc...

=head1 MAINTAINER

Erik Andersen <erik@lineo.com>

=head1 AUTHORS

The following people have contributed code to BusyBox whether
they know it or not.

Erik Andersen <erik@lineo.com>

=for html <br>

John Beppu <beppu@lineo.com>

=for html <br>

Brian Candler <B.Candler@pobox.com>

=for html <br>

Randolph Chung <tausq@debian.org>

=for html <br>

Dave Cinege <dcinege@psychosis.com>	

=for html <br>

Bruce Perens <bruce@perens.com>

=for html <br>

Linus Torvalds <torvalds@transmeta.com>

=for html <br>

Charles P. Wright <cpwright@villagenet.com>

=for html <br>

Enrique Zanardi <ezanardi@ull.es>

=for html <br>

=cut