⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 busybox.html

📁 手机嵌入式Linux下可用的busybox源码
💻 HTML
📖 第 1 页 / 共 4 页
字号:
<P>Example:</P><PRE>        $ cat getopt.test        #!/bin/sh        GETOPT=`getopt -o ab:c:: --long a-long,b-long:,c-long:: \               -n 'example.busybox' -- &quot;$@&quot;`        if [ $? != 0 ] ; then  exit 1 ; fi        eval set -- &quot;$GETOPT&quot;        while true ; do         case $1 in           -a|--a-long) echo &quot;Option a&quot; ; shift ;;           -b|--b-long) echo &quot;Option b, argument `$2'&quot; ; shift 2 ;;           -c|--c-long)             case &quot;$2&quot; in               &quot;&quot;) echo &quot;Option c, no argument&quot;; shift 2 ;;               *)  echo &quot;Option c, argument `$2'&quot; ; shift 2 ;;             esac ;;           --) shift ; break ;;           *) echo &quot;Internal error!&quot; ; exit 1 ;;         esac        done</PRE><P>-------------------------------</P><P></P><DT><STRONG><A NAME="item_grep"><STRONG>grep</STRONG></A></STRONG><BR><DD>grep [<STRONG>-ihHnqvs</STRONG>] PATTERN [FILEs...]<P>Search for PATTERN in each FILE or standard input.</P><P>Options:</P><PRE>        -H      prefix output lines with filename where match was found        -h      suppress the prefixing filename on output        -i      ignore case distinctions        -l      list names of files that match        -n      print line number with output lines        -q      be quiet. Returns 0 if result was found, 1 otherwise        -v      select non-matching lines        -s      suppress file open/read error messages</PRE><P>Example:</P><PRE>        $ 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</PRE><P>-------------------------------</P><P></P><DT><STRONG><A NAME="item_gunzip"><STRONG>gunzip</STRONG></A></STRONG><BR><DD>gunzip [OPTION]... FILE<P>Uncompress FILE (or standard input if FILE is '-').</P><P>Options:</P><PRE>        -c      Write output to standard output        -t      Test compressed file integrity</PRE><P>Example:</P><PRE>        $ ls -la /tmp/BusyBox*        -rw-rw-r--    1 andersen andersen   557009 Apr 11 10:55 /tmp/BusyBox-0.43.tar.gz        $ gunzip /tmp/BusyBox-0.43.tar.gz        $ ls -la /tmp/BusyBox*        -rw-rw-r--    1 andersen andersen  1761280 Apr 14 17:47 /tmp/BusyBox-0.43.tar</PRE><P>-------------------------------</P><P></P><DT><STRONG><A NAME="item_gzip"><STRONG>gzip</STRONG></A></STRONG><BR><DD>gzip [OPTION]... FILE<P>Compress FILE with maximum compression.When FILE is '-', reads standard input.  Implies <STRONG>-c</STRONG>.</P><P>Options:</P><PRE>        -c      Write output to standard output instead of FILE.gz        -d      decompress</PRE><P>Example:</P><PRE>        $ ls -la /tmp/busybox*        -rw-rw-r--    1 andersen andersen  1761280 Apr 14 17:47 /tmp/busybox.tar        $ gzip /tmp/busybox.tar        $ ls -la /tmp/busybox*        -rw-rw-r--    1 andersen andersen   554058 Apr 14 17:49 /tmp/busybox.tar.gz</PRE><P>-------------------------------</P><P></P><DT><STRONG><A NAME="item_halt"><STRONG>halt</STRONG></A></STRONG><BR><DD>halt<P>Halt the system.</P><P>-------------------------------</P><P></P><DT><STRONG><A NAME="item_head"><STRONG>head</STRONG></A></STRONG><BR><DD>head [OPTION] [FILE]...<P>Print first 10 lines of each FILE to standard output.With more than one FILE, precede each with a header giving thefile name. With no FILE, or when FILE is -, read standard input.</P><P>Options:</P><PRE>        -n NUM          Print first NUM lines instead of first 10</PRE><P>Example:</P><PRE>        $ head -n 2 /etc/passwd        root:x:0:0:root:/root:/bin/bash        daemon:x:1:1:daemon:/usr/sbin:/bin/sh</PRE><P>-------------------------------</P><P></P><DT><STRONG><A NAME="item_hostid"><STRONG>hostid</STRONG></A></STRONG><BR><DD>hostid<P>Print out a unique 32-bit identifier for the machine.</P><P>-------------------------------</P><P></P><DT><STRONG><A NAME="item_hostname"><STRONG>hostname</STRONG></A></STRONG><BR><DD>hostname [OPTION] {hostname | <STRONG>-F</STRONG> FILE}<P>Get or set the hostname or DNS domain name. If a hostname is given(or FILE with the <STRONG>-F</STRONG> parameter), the host name will be set.</P><P>Options:</P><PRE>        -s              Short        -i              Addresses for the hostname        -d              DNS domain name        -F, --file FILE Use the contents of FILE to specify the hostname</PRE><P>Example:</P><PRE>        $ hostname        sage</PRE><P>-------------------------------</P><P></P><DT><STRONG><A NAME="item_id"><STRONG>id</STRONG></A></STRONG><BR><DD>id [OPTIONS]... [USERNAME]<P>Print information for USERNAME or the current user</P><P>Options:</P><PRE>        -g      prints only the group ID        -u      prints only the user ID        -n      print a name instead of a number (with for -ug)        -r      prints the real user ID instead of the effective ID (with -ug)</PRE><P>Example:</P><PRE>        $ id        uid=1000(andersen) gid=1000(andersen)</PRE><P>-------------------------------</P><P></P><DT><STRONG><A NAME="item_ifconfig"><STRONG>ifconfig</STRONG></A></STRONG><BR><DD>ifconfig [<STRONG>-a</STRONG>] &lt;interface&gt; [&lt;address&gt;]<P>configure a network interface</P><P>Options:</P><PRE>        [[-]broadcast [&lt;address&gt;]]  [[-]pointopoint [&lt;address&gt;]]        [netmask &lt;address&gt;]  [dstaddr &lt;address&gt;]        [outfill &lt;NN&gt;] [keepalive &lt;NN&gt;]        [hw ether &lt;address&gt;]  [metric &lt;NN&gt;]  [mtu &lt;NN&gt;]        [[-]trailers]  [[-]arp]  [[-]allmulti]        [multicast]  [[-]promisc]  [txqueuelen &lt;NN&gt;]  [[-]dynamic]        [mem_start &lt;NN&gt;]  [io_addr &lt;NN&gt;]  [irq &lt;NN&gt;]        [up|down] ...</PRE><P>-------------------------------</P><P></P><DT><STRONG><A NAME="item_init"><STRONG>init</STRONG></A></STRONG><BR><DD>init<P>Init is the parent of all processes.</P><P>This version of init is designed to be run only by the kernel.</P><P>BusyBox init doesn't support multiple runlevels.  The runlevels field ofthe /etc/inittab file is completely ignored by BusyBox init. If you want runlevels, use sysvinit.</P><P>BusyBox init works just fine without an inittab.  If no inittab is found, it has the following default behavior:</P><PRE>        ::sysinit:/etc/init.d/rcS        ::askfirst:/bin/sh        ::ctrlaltdel:/sbin/reboot        ::shutdown:/sbin/swapoff -a        ::shutdown:/bin/umount -a -r        ::restart:/sbin/init</PRE><P>if it detects that /dev/console is _not_ a serial console, it will also run:</P><PRE>        tty2::askfirst:/bin/sh        tty3::askfirst:/bin/sh        tty4::askfirst:/bin/sh</PRE><P>If you choose to use an /etc/inittab file, the inittab entry format is as follows:</P><PRE>        &lt;id&gt;:&lt;runlevels&gt;:&lt;action&gt;:&lt;process&gt;</PRE><PRE>        &lt;id&gt;:</PRE><PRE>                WARNING: This field has a non-traditional meaning for BusyBox init!                The id field is used by BusyBox init to specify the controlling tty for                the specified process to run on.  The contents of this field are                appended to &quot;/dev/&quot; and used as-is.  There is no need for this field to                be unique, although if it isn't you may have strange results.  If this                field is left blank, the controlling tty is set to the console.  Also                note that if BusyBox detects that a serial console is in use, then only                entries whose controlling tty is either the serial console or /dev/null                will be run.  BusyBox init does nothing with utmp.  We don't need no                stinkin' utmp.</PRE><PRE>        &lt;runlevels&gt;:</PRE><PRE>                The runlevels field is completely ignored.</PRE><PRE>        &lt;action&gt;:</PRE><PRE>                Valid actions include: sysinit, respawn, askfirst, wait,                 once, restart, ctrlaltdel, and shutdown.</PRE><PRE>                The available actions can be classified into two groups: actions                that are run only once, and actions that are re-run when the specified                process exits.</PRE><PRE>                Run only-once actions:</PRE><PRE>                        'sysinit' is the first item run on boot.  init waits until all                        sysinit actions are completed before continuing.  Following the                        completion of all sysinit actions, all 'wait' actions are run.                        'wait' actions, like  'sysinit' actions, cause init to wait until                        the specified task completes.  'once' actions are asynchronous,                        therefore, init does not wait for them to complete.  'restart' is                        the action taken to restart the init process.  By default this should                        simply run /sbin/init, but can be a script which runs pivot_root or it                        can do all sorts of other interesting things.  The 'ctrlaltdel' init                        actions are run when the system detects that someone on the system                       console has pressed the CTRL-ALT-DEL key combination.  Typically one                       wants to run 'reboot' at this point to cause the system to reboot.                        Finally the 'shutdown' action specifies the actions to taken when                       init is told to reboot.  Unmounting filesystems and disabling swap                       is a very good here</PRE><PRE>                Run repeatedly actions:</PRE><PRE>                        'respawn' actions are run after the 'once' actions.  When a process                        started with a 'respawn' action exits, init automatically restarts                        it.  Unlike sysvinit, BusyBox init does not stop processes from                        respawning out of control.  The 'askfirst' actions acts just like                        respawn, except that before running the specified process it                        displays the line &quot;Please press Enter to activate this console.&quot;                        and then waits for the user to press enter before starting the                        specified process.</PRE><PRE>                Unrecognized actions (like initdefault) will cause init to emit an                error message, and then go along with its business.  All actions are                run in the order they appear in /etc/inittab.</PRE><PRE>        &lt;process&gt;:</PRE><PRE>                Specifies the process to be executed and it's command line.</PRE><P>Example /etc/inittab file:</P><PRE>        # This is run first except when booting in single-user mode.        #        ::sysinit:/etc/init.d/rcS</PRE><PRE>        # /bin/sh invocations on selected ttys        #        # Start an &quot;askfirst&quot; shell on the console (whatever that may be)        ::askfirst:-/bin/sh        # Start an &quot;askfirst&quot; shell on /dev/tty2-4        tty2::askfirst:-/bin/sh        tty3::askfirst:-/bin/sh        tty4::askfirst:-/bin/sh</PRE><PRE>        # /sbin/getty invocations for selected ttys        #        tty4::respawn:/sbin/getty 38400 tty5        tty5::respawn:/sbin/getty 38400 tty6</PRE><PRE>        # Example of how to put a getty on a serial line (for a terminal)        #        #::respawn:/sbin/getty -L ttyS0 9600 vt100        #::respawn:/sbin/getty -L ttyS1 9600 vt100        #        # Example how to put a getty on a modem line.        #::respawn:/sbin/getty 57600 ttyS2</PRE><PRE>        # Stuff to do when restarting the init process        ::restart:/sbin/init</PRE><PRE>        # Stuff to do before rebooting        ::ctrlaltdel:/sbin/reboot        ::shutdown:/bin/umount -a -r        ::shutdown:/sbin/swapoff -a</PRE><P>-------------------------------</P><P></P><DT><STRONG><A NAME="item_insmod"><STRONG>insmod</STRONG></A></STRONG><BR><DD>insmod [OPTION]... MODULE [symbol=value]...<P>Loads the specified kernel modules into the kernel.</P><P>Options:</P><PRE>        -f      Force module to load into the wrong kernel version.        -k      Make module autoclean-able.        -v      verbose output        -L      Lock to prevent simultaneous loads of a module        -x      do not export externs</PRE><P>-------------------------------</P><P></P><DT><STRONG><A NAME="item_kill"><STRONG>kill</STRONG></A></STRONG><BR><DD>kill [<STRONG>-signal</STRONG>] process-id [process-id ...]<P>Send a signal (default is SIGTERM) to the specified process(es).</P><P>Options:</P><PRE>        -l      List all signal names and numbers.</PRE><P>Example:</P><PRE>        $ 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</PRE><P>-------------------------------</P><P></P><DT><STRONG><A NAME="item_killall"><STRONG>killall</STRONG></A></STRONG><BR><DD>killall [<STRONG>-signal</STRONG>] process-name [process-name ...]<P>Send a signal (default is SIGTERM) to the specified process(es).</P><P>Options:</P><PRE>        -l      List all signal names and numbers.</PRE><P>Example:</P><PRE>        $ killall apache</PRE>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -