├── examples ├── busybox │ ├── assets │ │ └── css │ │ │ └── busybox.css │ ├── busybox1.png │ ├── dashing.json │ └── BusyBox.html ├── dockerfile │ └── dashing.json └── README.md ├── .gitignore ├── go.mod ├── Makefile ├── LICENSE.txt ├── go.sum ├── README.md └── dashing.go /examples/busybox/assets/css/busybox.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /examples/busybox/busybox1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/technosophos/dashing/HEAD/examples/busybox/busybox1.png -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | _vendor/ 2 | busybox/busybox.docset 3 | dockerfile/dockerfile.docset 4 | foo.docset/ 5 | dashing 6 | busybox.docset/ 7 | vendor/ 8 | -------------------------------------------------------------------------------- /go.mod: -------------------------------------------------------------------------------- 1 | module github.com/technosophos/dashing 2 | 3 | go 1.13 4 | 5 | require ( 6 | github.com/andybalholm/cascadia v1.1.1-0.20191115165331-903109d295d5 7 | github.com/mattn/go-sqlite3 v2.0.1+incompatible 8 | github.com/urfave/cli/v2 v2.0.0 9 | golang.org/x/net v0.0.0-20191207000613-e7e4b65ae663 10 | ) 11 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | VERSION ?= $(shell git describe --tags) 2 | 3 | build: 4 | go build -o dashing -ldflags "-X main.version=${VERSION}" dashing.go 5 | 6 | install: build 7 | install -d ${DESTDIR}/usr/local/bin/ 8 | install -m 755 ./dashing ${DESTDIR}/usr/local/bin/dashing 9 | 10 | test: 11 | go test ./... 12 | 13 | clean: 14 | rm -f ./dashing 15 | rm -f ./dashing.test 16 | 17 | .PHONY: build test install clean 18 | -------------------------------------------------------------------------------- /examples/dockerfile/dashing.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Dockerfile", 3 | "package": "dockerfile", 4 | "index": "index.html", 5 | "selectors": { 6 | "#dockerfile-reference": "File", 7 | "article>h2": "Instruction" 8 | }, 9 | "ignore": [ 10 | "Usage", "Format", "Environment replacement", "Dockerfile examples", "Dockerfile reference" 11 | ], 12 | "icon32x32": "", 13 | "allowJS": false 14 | } 15 | -------------------------------------------------------------------------------- /examples/busybox/dashing.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "BusyBox", 3 | "package":"busybox", 4 | "index":"BusyBox.html", 5 | "icon32x32":"busybox1.png", 6 | "externalURL":"https://busybox.net/downloads/", 7 | "selectors": { 8 | "dt a": "Command", 9 | "title": { 10 | "type":"Package", 11 | "regexp": " - The Swiss Army Knife of Embedded Linux", 12 | "replacement": "" 13 | } 14 | }, 15 | "ignore": [ 16 | "ABOUT" 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | Dashing 2 | Copyright (C) 2015, Matt Butcher 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in 12 | all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /examples/README.md: -------------------------------------------------------------------------------- 1 | # Examples 2 | 3 | You can start with these simple examples and go from there. 4 | 5 | ## BusyBox 6 | 7 | BusyBox is an embedded linux tool that provides many frequently used 8 | shell commands. 9 | 10 | This example is fairly complete, including an icon. 11 | 12 | ``` 13 | $ cd busybox 14 | $ wget http://www.busybox.net/downloads/BusyBox.html 15 | $ dashing build 16 | ``` 17 | 18 | ## Dockerfile 19 | 20 | This example builds documentation for Docker Dockerfiles. The CSS 21 | selectors are just slightly more complicated, but nothing to cause 22 | heartburn. 23 | 24 | This example illustrates the usage of `ignore` fields. 25 | 26 | ``` 27 | $ cd dockderfile 28 | $ wget https://docs.docker.com/engine/reference/builder/ 29 | $ dashing build 30 | ``` 31 | 32 | ## Kubernetes kubectl 33 | 34 | This example shows you had to fetch a remote set of documents and then 35 | build locally with dashing. 36 | 37 | If you don't have it already, you will need `wget`: 38 | 39 | ``` 40 | $ brew install wget 41 | ``` 42 | 43 | Now we can fetch the documentation: 44 | 45 | ``` 46 | $ wget -k -r -p -np http://kubernetes.io/v1.0/docs/user-guide/kubectl/kubectl.html 47 | ``` 48 | 49 | This will leave you with a directory called `kubernetes.io` that 50 | contains all of the Kubectl documentation, along with relevant JS, CSS, 51 | and images. 52 | 53 | 54 | -------------------------------------------------------------------------------- /go.sum: -------------------------------------------------------------------------------- 1 | github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= 2 | github.com/andybalholm/cascadia v1.1.1-0.20191115165331-903109d295d5 h1:lm0H7kPz04JjPtTb+35IO5GrQvadC9nTL5zdvnK49mQ= 3 | github.com/andybalholm/cascadia v1.1.1-0.20191115165331-903109d295d5/go.mod h1:YCyR8vOZT9aZ1CHEd8ap0gMVm2aFgxBp0T0eFw1RUQY= 4 | github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d h1:U+s90UTSYgptZMwQh2aRr3LuazLJIa+Pg3Kc1ylSYVY= 5 | github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= 6 | github.com/mattn/go-sqlite3 v2.0.1+incompatible h1:xQ15muvnzGBHpIpdrNi1DA5x0+TcBZzsIDwmw9uTHzw= 7 | github.com/mattn/go-sqlite3 v2.0.1+incompatible/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= 8 | github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= 9 | github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= 10 | github.com/russross/blackfriday/v2 v2.0.1 h1:lPqVAte+HuHNfhJ/0LC98ESWRz8afy9tM/0RK8m9o+Q= 11 | github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= 12 | github.com/shurcooL/sanitized_anchor_name v1.0.0 h1:PdmoCO6wvbs+7yrJyMORt4/BmY5IYyJwS/kOiWx8mHo= 13 | github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= 14 | github.com/urfave/cli/v2 v2.0.0 h1:+HU9SCbu8GnEUFtIBfuUNXN39ofWViIEJIp6SURMpCg= 15 | github.com/urfave/cli/v2 v2.0.0/go.mod h1:SE9GqnLQmjVa0iPEY0f1w3ygNIYcIJ0OKPMoW2caLfQ= 16 | golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= 17 | golang.org/x/net v0.0.0-20180218175443-cbe0f9307d01/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= 18 | golang.org/x/net v0.0.0-20191207000613-e7e4b65ae663 h1:Dd5RoEW+yQi+9DMybroBctIdyiwuNT7sJFMC27/6KxI= 19 | golang.org/x/net v0.0.0-20191207000613-e7e4b65ae663/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= 20 | golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= 21 | golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= 22 | gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= 23 | gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= 24 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Dashing: Generate Dash documentation from HTML 2 | [![Stability: Maintenance](https://masterminds.github.io/stability/maintenance.svg)](https://masterminds.github.io/stability/maintenance.html) 3 | 4 | 5 | Dashing is a general purpose tool for starting with some HTML 6 | documentation and generating Dash documentation. 7 | 8 | Dashing uses CSS3 selectors to tag an HTML document for import into 9 | Dash. It generates a complete docset for you. 10 | 11 | This supports the following Dash features: 12 | 13 | - Index pages 14 | - Custom icon 15 | - Table of Contents auto-generation 16 | 17 | See: 18 | https://kapeli.com/docsets 19 | 20 | ## INSTALL 21 | 22 | There are several ways to install this program. 23 | 24 | For most people, the easiest way is through [Homebrew:](https://brew.sh/) 25 | 26 | ``` 27 | brew install dashing 28 | ``` 29 | 30 | Or [MacPorts:](https://www.macports.org/) 31 | 32 | ``` 33 | sudo port install dashing 34 | ``` 35 | 36 | Prebuilt OSX 64-bit binaries are also available here: 37 | https://github.com/technosophos/dashing/releases 38 | 39 | If you have Go 1.4 or later installed, simply run: 40 | 41 | ``` 42 | go get -u github.com/technosophos/dashing 43 | ``` 44 | 45 | Dashing will now be located at `$GOPATH/bin/dashing`. 46 | 47 | A prebuilt binary is also available as a GitHub release. 48 | 49 | ## USAGE 50 | 51 | To get started, `cd` to the directory that you want to generate 52 | documentation inside. 53 | 54 | ``` 55 | $ cd mydocs 56 | $ dashing create 57 | # Now you can edit dashing.json. See below. 58 | $ dashing build mydocs 59 | ``` 60 | 61 | You will now have a directory called `mydocs.docset` that contains all 62 | the documentation you need for Dash. 63 | 64 | For more, run `dashing help`. 65 | 66 | ## dashing.json Format 67 | 68 | The basic Dashing format looks like this: 69 | 70 | ```json 71 | { 72 | "name": "Dashing", 73 | "package": "dashing", 74 | "index":"index.html", 75 | "icon32x32": "icon.png", 76 | "externalURL": "https://github.com/technosophos/dashing", 77 | "selectors": { 78 | "dt a": "Command", 79 | "title": "Package" 80 | }, 81 | "ignore": [ 82 | "ABOUT" 83 | ] 84 | } 85 | ``` 86 | 87 | - name: Human-oriented name of the package 88 | - package: Computer-oriented name of the package (one word recommended) 89 | - index: Default index file in the existing docs 90 | - icon32x32: a 32x32 pixel PNG icon 91 | - externalURL: the base URL of the docs 92 | - selectors: a map of selectors. There is a simple format and 93 | a more advanced format (see below for details). 94 | - ignore: a list of matches to be ignored (see below) 95 | 96 | Dashing uses CSS 3 selectors to map patterns in a document to Dash 97 | sections. You tell Dashing which patterns in HTML map to which Dash data 98 | type. The list of Dash data types can be found here: https://kapeli.com/docsets#supportedentrytypes. 99 | 100 | ```json 101 | { 102 | "selectors": { 103 | "h1 a": "Package", 104 | "h2.classdef a": "Class", 105 | } 106 | } 107 | ``` 108 | 109 | The above will look for `h1 a` combinations, and treat those as package 110 | definitions, and `h2 class="classdef" a` combinations and treat those as 111 | Class definitions. 112 | 113 | ## Ignoring Sections You Don't Care About 114 | 115 | On occasion, you'll have to manually ignore some matched text bits. To 116 | do that, you can use the `ignores` directive in the JSON file: 117 | 118 | 119 | ```json 120 | { 121 | "selectors": { 122 | "h1 a": "Package", 123 | "h2.classdef a": "Class", 124 | }, 125 | "ignore": ["DESCRIPTION", "MORE"] 126 | } 127 | ``` 128 | 129 | The above will ignore anything whose text matches the exact text "DESCRIPTION" 130 | or "MORE", even if the selectors match. 131 | 132 | ## Other Mappers/Filters on Selectors 133 | 134 | Instead of using a simple mapping of selector to type, you have the 135 | option to map/filter the selected results. 136 | 137 | The format for this extended type of `selectors` looks like this: 138 | 139 | ```json 140 | { 141 | "name": "BusyBox", 142 | "package":"busybox", 143 | "index":"BusyBox.html", 144 | "icon32x32":"busybox1.png", 145 | "selectors": { 146 | "dt a": "Command", 147 | "title": { 148 | "type":"Package", 149 | "regexp": " - The Swiss Army Knife of Embedded Linux", 150 | "replacement": "", 151 | "matchpath": "doc/.*\\.html" 152 | } 153 | }, 154 | "ignore": [ 155 | "ABOUT" 156 | ] 157 | } 158 | ``` 159 | 160 | The format of the selector value is: 161 | 162 | ```json 163 | "css selector": { 164 | "requiretext": "require that the text matches a regexp. If not, this node is not considered as selected", 165 | "type": "Dash data type", 166 | "attr": "Use the value of the specified attribute instead of html node text as the basis for transformation", 167 | "regexp": "PCRE regular expression (no need to enclose in //)", 168 | "replacement": "Replacement text for each match of 'regexp'", 169 | "matchpath": "Only files matching this regular expression will be parsed. Will match all files if not set." 170 | } 171 | ``` 172 | 173 | And you can have multiple transformations specified for the same css selector: 174 | 175 | ```json 176 | "css selector": [ 177 | { 178 | "requiretext": "...", 179 | "type": "..." 180 | }, 181 | { 182 | "requiretext": "...", 183 | "type": "..." 184 | } 185 | ] 186 | ``` 187 | 188 | The above allows you to fine tweak nodes selected via css selectors using 189 | their text contents. 190 | 191 | Full documentation on the regular expression format can be found here: 192 | http://golang.org/pkg/regexp/syntax/ 193 | 194 | Documentation on the format for `replacement` can be found here: 195 | http://golang.org/pkg/regexp/#Regexp.ReplaceAllString 196 | -------------------------------------------------------------------------------- /dashing.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "bytes" 5 | "database/sql" 6 | "encoding/json" 7 | "fmt" 8 | "io" 9 | "io/ioutil" 10 | "net/url" 11 | "os" 12 | "path/filepath" 13 | "reflect" 14 | "regexp" 15 | "strings" 16 | "text/template" 17 | 18 | css "github.com/andybalholm/cascadia" 19 | "github.com/urfave/cli/v2" 20 | "golang.org/x/net/html" 21 | "golang.org/x/net/html/atom" 22 | 23 | _ "github.com/mattn/go-sqlite3" 24 | ) 25 | 26 | const plist = ` 27 | 28 | 29 | 30 | CFBundleIdentifier 31 | {{.Name}} 32 | CFBundleName 33 | {{.FancyName}} 34 | DocSetPlatformFamily 35 | {{.Name}} 36 | isDashDocset 37 | 38 | DashDocSetFamily 39 | dashtoc 40 | dashIndexFilePath 41 | {{.Index}} 42 | isJavaScriptEnabled<{{.AllowJS}}/>{{if .ExternalURL}} 43 | DashDocSetFallbackURL 44 | {{.ExternalURL}}{{end}} 45 | 46 | 47 | ` 48 | 49 | // Automatically replaced by linker. 50 | var version = "dev" 51 | 52 | type Dashing struct { 53 | // The human-oriented name of the package. 54 | Name string `json:"name"` 55 | // Computer-readable name. Recommendation is to use one word. 56 | Package string `json:"package"` 57 | // The location of the index.html file. 58 | Index string `json:"index"` 59 | // Selectors to match. 60 | Selectors map[string]interface{} `json:"selectors"` 61 | // Final form of the Selectors field. 62 | selectors map[string][]*Transform `json:"-"` 63 | // Entries that should be ignored. 64 | Ignore []string `json:"ignore"` 65 | // A 32x32 pixel PNG image. 66 | Icon32x32 string `json:"icon32x32"` 67 | AllowJS bool `json:"allowJS"` 68 | // External URL for "Open Online Page" 69 | ExternalURL string `json: "externalURL"` 70 | } 71 | 72 | // Transform is a description of what should be done with a selector. 73 | // When the Selectors map is unmarshaled, the values are turned into 74 | // Transform structs. 75 | type Transform struct { 76 | Type string 77 | Attribute string // Use the value of this attribute as basis 78 | Regexp *regexp.Regexp // Perform a replace operation on the text 79 | Replacement string 80 | RequireText *regexp.Regexp // Require text matches the given regexp 81 | MatchPath *regexp.Regexp // Skip files that don't match this path 82 | } 83 | 84 | var ignoreHash map[string]bool 85 | 86 | func main() { 87 | app := cli.NewApp() 88 | app.Name = "dashing" 89 | app.Usage = "Generate Dash documentation from HTML files" 90 | app.Version = version 91 | 92 | app.Commands = commands() 93 | 94 | app.Run(os.Args) 95 | } 96 | 97 | func commands() []*cli.Command { 98 | return []*cli.Command{ 99 | { 100 | Name: "build", 101 | Usage: "build a doc set", 102 | Action: build, 103 | Flags: []cli.Flag{ 104 | &cli.StringFlag{ 105 | Name: "source, s", 106 | Usage: "The path to the HTML files this will ingest. (Default: ./ )", 107 | }, 108 | &cli.StringFlag{ 109 | Name: "config, f", 110 | Usage: "The path to the JSON configuration file.", 111 | }, 112 | }, 113 | }, 114 | { 115 | Name: "update", 116 | Usage: "update a doc set", 117 | Action: update, 118 | Flags: []cli.Flag{ 119 | &cli.StringFlag{ 120 | Name: "source, s", 121 | Usage: "The path to the HTML files this will ingest. (Default: ./ )", 122 | }, 123 | &cli.StringFlag{ 124 | Name: "config, f", 125 | Usage: "The path to the JSON configuration file.", 126 | }, 127 | }, 128 | }, 129 | { 130 | Name: "init", 131 | Aliases: []string{"create"}, 132 | Usage: "create a new template for building documentation", 133 | Action: create, 134 | Flags: []cli.Flag{ 135 | &cli.StringFlag{ 136 | Name: "config, f", 137 | Usage: "The path to the JSON configuration file.", 138 | }, 139 | }, 140 | }, 141 | { 142 | Name: "version", 143 | Usage: "Print version and exit.", 144 | Action: func(c *cli.Context) error { 145 | fmt.Println(version) 146 | return nil 147 | }, 148 | Flags: []cli.Flag{ 149 | &cli.StringFlag{ 150 | Name: "config, f", 151 | Usage: "The path to the JSON configuration file.", 152 | }, 153 | }, 154 | }, 155 | } 156 | } 157 | 158 | func create(c *cli.Context) error { 159 | f := c.String("config") 160 | if len(f) == 0 { 161 | f = "dashing.json" 162 | } 163 | conf := Dashing{ 164 | Name: "Dashing", 165 | Package: "dashing", 166 | Index: "index.html", 167 | Selectors: map[string]interface{}{ 168 | "title": "Package", 169 | "dt a": "Command", 170 | }, 171 | Ignore: []string{"ABOUT"}, 172 | } 173 | j, err := json.MarshalIndent(conf, "", " ") 174 | if err != nil { 175 | panic("The programmer did something dumb.") 176 | } 177 | err = ioutil.WriteFile(f, j, 0755) 178 | if err != nil { 179 | fmt.Errorf("Could not initialize JSON file: %s", err) 180 | os.Exit(1) 181 | } 182 | fmt.Printf("You may now edit %s\n", f) 183 | return nil 184 | } 185 | 186 | func build(c *cli.Context) error { 187 | var dashing Dashing 188 | 189 | source_depth := 0 190 | source := c.String("source") 191 | if len(source) == 0 { 192 | source = "." 193 | } else { 194 | source_depth = len(strings.Split(source, "/")) 195 | } 196 | 197 | cf := strings.TrimSpace(c.String("config")) 198 | if len(cf) == 0 { 199 | cf = "./dashing.json" 200 | } 201 | 202 | conf, err := ioutil.ReadFile(cf) 203 | if err != nil { 204 | fmt.Printf("Failed to open configuration file '%s': %s (Run `dashing init`?)\n", cf, err) 205 | os.Exit(1) 206 | } 207 | 208 | if err := json.Unmarshal(conf, &dashing); err != nil { 209 | fmt.Printf("Failed to parse JSON: %s", err) 210 | os.Exit(1) 211 | } 212 | if err := decodeSelectField(&dashing); err != nil { 213 | fmt.Printf("Could not understand selector value: %s\n", err) 214 | os.Exit(2) 215 | } 216 | 217 | name := dashing.Package 218 | 219 | fmt.Printf("Building %s from files in '%s'.\n", name, source) 220 | 221 | os.MkdirAll(name+".docset/Contents/Resources/Documents/", 0755) 222 | 223 | setIgnore(dashing.Ignore) 224 | addPlist(name, &dashing) 225 | if len(dashing.Icon32x32) > 0 { 226 | addIcon(dashing.Icon32x32, name+".docset/icon.png") 227 | } 228 | db, err := initDB(name, true) 229 | if err != nil { 230 | fmt.Printf("Failed to create database: %s\n", err) 231 | return nil 232 | } 233 | defer db.Close() 234 | texasRanger(source, source_depth, name, dashing, db) 235 | return nil 236 | } 237 | 238 | func update(c *cli.Context) error { 239 | var dashing Dashing 240 | 241 | source_depth := 0 242 | source := c.String("source") 243 | if len(source) == 0 { 244 | source = "." 245 | } else { 246 | source_depth = len(strings.Split(source, "/")) 247 | } 248 | 249 | cf := strings.TrimSpace(c.String("config")) 250 | if len(cf) == 0 { 251 | cf = "./dashing.json" 252 | } 253 | 254 | conf, err := ioutil.ReadFile(cf) 255 | if err != nil { 256 | fmt.Printf("Failed to open configuration file '%s': %s (Run `dashing init`?)\n", cf, err) 257 | os.Exit(1) 258 | } 259 | 260 | if err := json.Unmarshal(conf, &dashing); err != nil { 261 | fmt.Printf("Failed to parse JSON: %s", err) 262 | os.Exit(1) 263 | } 264 | if err := decodeSelectField(&dashing); err != nil { 265 | fmt.Printf("Could not understand selector value: %s\n", err) 266 | os.Exit(2) 267 | } 268 | 269 | name := dashing.Package 270 | 271 | fmt.Printf("Building %s from files in '%s'.\n", name, source) 272 | 273 | os.MkdirAll(name+".docset/Contents/Resources/Documents/", 0755) 274 | 275 | setIgnore(dashing.Ignore) 276 | addPlist(name, &dashing) 277 | if len(dashing.Icon32x32) > 0 { 278 | addIcon(dashing.Icon32x32, name+".docset/icon.png") 279 | } 280 | db, err := initDB(name, false) 281 | if err != nil { 282 | fmt.Printf("Failed to create database: %s\n", err) 283 | return nil 284 | } 285 | defer db.Close() 286 | texasRanger(source, source_depth, name, dashing, db) 287 | return nil 288 | } 289 | 290 | func decodeSingleTransform(val map[string]interface{}) (*Transform, error) { 291 | var ttype, trep, attr string 292 | var creg, cmatchpath, requireText *regexp.Regexp 293 | var err error 294 | 295 | if r, ok := val["attr"]; ok { 296 | attr = r.(string) 297 | } 298 | 299 | if r, ok := val["type"]; ok { 300 | ttype = r.(string) 301 | } 302 | if r, ok := val["regexp"]; ok { 303 | creg, err = regexp.Compile(r.(string)) 304 | if err != nil { 305 | return nil, fmt.Errorf("failed to compile regexp '%s': %s", r.(string), err) 306 | } 307 | } 308 | if r, ok := val["replacement"]; ok { 309 | trep = r.(string) 310 | } 311 | if r, ok := val["requiretext"]; ok { 312 | requireText, err = regexp.Compile(r.(string)) 313 | if err != nil { 314 | return nil, fmt.Errorf("failed to compile regexp '%s': %s", r.(string), err) 315 | } 316 | } 317 | if r, ok := val["matchpath"]; ok { 318 | cmatchpath, err = regexp.Compile(r.(string)) 319 | if err != nil { 320 | return nil, fmt.Errorf("failed to compile regexp '%s': %s", r.(string), err) 321 | } 322 | } 323 | return &Transform{ 324 | Type: ttype, 325 | Attribute: attr, 326 | Regexp: creg, 327 | Replacement: trep, 328 | RequireText: requireText, 329 | MatchPath: cmatchpath, 330 | }, nil 331 | } 332 | 333 | func decodeSelectField(d *Dashing) error { 334 | d.selectors = make(map[string][]*Transform, len(d.Selectors)) 335 | for sel, val := range d.Selectors { 336 | var trans *Transform 337 | var err error 338 | rv := reflect.Indirect(reflect.ValueOf(val)) 339 | if rv.Kind() == reflect.String { 340 | trans = &Transform{ 341 | Type: val.(string), 342 | } 343 | d.selectors[sel] = append(d.selectors[sel], trans) 344 | } else if rv.Kind() == reflect.Map { 345 | val := val.(map[string]interface{}) 346 | if trans, err = decodeSingleTransform(val); err != nil { 347 | return err 348 | } 349 | d.selectors[sel] = append(d.selectors[sel], trans) 350 | } else if rv.Kind() == reflect.Slice { 351 | for i := 0; i < rv.Len(); i++ { 352 | element := rv.Index(i).Interface().(map[string]interface{}) 353 | if trans, err = decodeSingleTransform(element); err != nil { 354 | return err 355 | } 356 | d.selectors[sel] = append(d.selectors[sel], trans) 357 | } 358 | } else { 359 | return fmt.Errorf("Expected string or map. Kind is %s.", rv.Kind().String()) 360 | } 361 | } 362 | return nil 363 | } 364 | 365 | func setIgnore(i []string) { 366 | ignoreHash = make(map[string]bool, len(i)) 367 | for _, item := range i { 368 | ignoreHash[item] = true 369 | } 370 | } 371 | 372 | func addPlist(name string, config *Dashing) { 373 | var file bytes.Buffer 374 | t := template.Must(template.New("plist").Parse(plist)) 375 | 376 | fancyName := config.Name 377 | if len(fancyName) == 0 { 378 | fancyName = strings.ToTitle(name) 379 | } 380 | 381 | aj := "false" 382 | if config.AllowJS { 383 | aj = "true" 384 | } 385 | 386 | tvars := map[string]string{ 387 | "Name": name, 388 | "FancyName": fancyName, 389 | "Index": config.Index, 390 | "AllowJS": aj, 391 | "ExternalURL": config.ExternalURL, 392 | } 393 | 394 | err := t.Execute(&file, tvars) 395 | if err != nil { 396 | fmt.Printf("Failed: %s\n", err) 397 | return 398 | } 399 | ioutil.WriteFile(name+".docset/Contents/Info.plist", file.Bytes(), 0755) 400 | } 401 | 402 | func initDB(name string, fresh bool) (*sql.DB, error) { 403 | dbname := name + ".docset/Contents/Resources/docSet.dsidx" 404 | 405 | if fresh { 406 | os.Remove(dbname) 407 | } 408 | 409 | db, err := sql.Open("sqlite3", dbname) 410 | if err != nil { 411 | return db, err 412 | } 413 | 414 | if fresh { 415 | if _, err := db.Exec(`CREATE TABLE searchIndex(id INTEGER PRIMARY KEY, name TEXT, type TEXT, path TEXT)`); err != nil { 416 | return db, err 417 | } 418 | if _, err := db.Exec(`CREATE UNIQUE INDEX anchor ON searchIndex (name, type, path)`); err != nil { 419 | return db, err 420 | } 421 | } 422 | 423 | return db, nil 424 | } 425 | 426 | // texasRanger is... wait for it... a WALKER! 427 | func texasRanger(base string, base_depth int, name string, dashing Dashing, db *sql.DB) error { 428 | filepath.Walk(base, func(path string, info os.FileInfo, err error) error { 429 | fmt.Printf("Reading %s\n", path) 430 | if strings.HasPrefix(path, name+".docset") { 431 | fmt.Printf("Ignoring directory %s\n", path) 432 | return filepath.SkipDir 433 | } 434 | if info.IsDir() || ignore(path) { 435 | return nil 436 | } 437 | dest := name + ".docset/Contents/Resources/Documents" 438 | if htmlish(path) { 439 | fmt.Printf("%s looks like HTML\n", path) 440 | //if err := copyFile(path, name+".docset/Contents/Resources/Documents"); err != nil { 441 | //fmt.Printf("Failed to copy file %s: %s\n", path, err) 442 | //return err 443 | //} 444 | found, err := parseHTML(path, base_depth, dest, dashing) 445 | if err != nil { 446 | fmt.Printf("Error parsing %s: %s\n", path, err) 447 | return nil 448 | } 449 | for _, ref := range found { 450 | fmt.Printf("Match: '%s' is type %s at %s\n", ref.name, ref.etype, ref.href) 451 | db.Exec(`INSERT OR IGNORE INTO searchIndex(name, type, path) VALUES (?,?,?)`, ref.name, ref.etype, ref.href) 452 | } 453 | } else { 454 | // Or we just copy the file. 455 | err := copyFile(path, filepath.Join(dest, path)) 456 | if err != nil { 457 | fmt.Printf("Skipping file %s. Error: %s\n", path, err) 458 | } 459 | return err 460 | } 461 | return nil 462 | }) 463 | return nil 464 | } 465 | 466 | // ignore returns true if a file should be ignored by dashing. 467 | func ignore(src string) bool { 468 | 469 | // Skip our own config file. 470 | if filepath.Base(src) == "dashing.json" { 471 | return true 472 | } 473 | 474 | // Skip VCS dirs. 475 | parts := strings.Split(src, "/") 476 | for _, p := range parts { 477 | switch p { 478 | case ".git", ".svn": 479 | return true 480 | } 481 | } 482 | return false 483 | } 484 | 485 | func encodeHTMLentities(orig string) string { 486 | escaped := new(bytes.Buffer) 487 | for _, c := range orig { 488 | if point_to_entity[c] == "" { 489 | escaped.WriteRune(c) 490 | } else { 491 | escaped.WriteString(point_to_entity[c]) 492 | } 493 | } 494 | 495 | return escaped.String() 496 | } 497 | 498 | func writeHTML(orig, dest string, root *html.Node) error { 499 | dir := filepath.Dir(orig) 500 | base := filepath.Base(orig) 501 | os.MkdirAll(filepath.Join(dest, dir), 0755) 502 | out, err := os.Create(filepath.Join(dest, dir, base)) 503 | if err != nil { 504 | return err 505 | } 506 | defer out.Close() 507 | 508 | content_bytes := new(bytes.Buffer) 509 | html.Render(content_bytes, root) 510 | content := encodeHTMLentities(content_bytes.String()) 511 | 512 | _, err = out.WriteString(content) 513 | return err 514 | } 515 | 516 | func htmlish(filename string) bool { 517 | e := strings.ToLower(filepath.Ext(filename)) 518 | switch e { 519 | case ".html", ".htm", ".xhtml", ".html5": 520 | return true 521 | } 522 | return false 523 | } 524 | 525 | type reference struct { 526 | name, etype, href string 527 | } 528 | 529 | func parseHTML(path string, source_depth int, dest string, dashing Dashing) ([]*reference, error) { 530 | refs := []*reference{} 531 | 532 | r, err := os.Open(path) 533 | if err != nil { 534 | return refs, err 535 | } 536 | defer r.Close() 537 | top, err := html.Parse(r) 538 | 539 | root := css.MustCompile("*[href],*[src]") 540 | roots := root.MatchAll(top) 541 | for _, node := range roots { 542 | for i, attribute := range node.Attr { 543 | if "href" == attribute.Key || "src" == attribute.Key { 544 | if strings.HasPrefix(attribute.Val, "/") { 545 | // parts of the path - the file name - the source depth 546 | path_depth := len(strings.Split(attribute.Val[1:], "/")) - 1 - source_depth 547 | relative := "" 548 | if path_depth > 0 { 549 | strings.Repeat("../", path_depth) 550 | } 551 | node.Attr[i].Val = relative + attribute.Val[1:] 552 | } 553 | break 554 | } 555 | } 556 | } 557 | 558 | for pattern, sels := range dashing.selectors { 559 | for _, sel := range sels { 560 | // Skip this selector if file path doesn't match 561 | if sel.MatchPath != nil && !sel.MatchPath.MatchString(path) { 562 | continue 563 | } 564 | 565 | m := css.MustCompile(pattern) 566 | found := m.MatchAll(top) 567 | for _, n := range found { 568 | textString := text(n) 569 | if sel.RequireText != nil && !sel.RequireText.MatchString(textString) { 570 | fmt.Printf("Skipping entry for '%s' (Text not matching given regexp '%v')\n", textString, sel.RequireText) 571 | continue 572 | } 573 | var name string 574 | if len(sel.Attribute) != 0 { 575 | name = attr(n, sel.Attribute) 576 | } else { 577 | name = textString 578 | } 579 | 580 | // Skip things explicitly ignored. 581 | if ignored(name) { 582 | fmt.Printf("Skipping entry for %s (Ignored by dashing JSON)\n", name) 583 | continue 584 | } 585 | 586 | // If we have a regexp, run it. 587 | if sel.Regexp != nil { 588 | name = sel.Regexp.ReplaceAllString(name, sel.Replacement) 589 | } 590 | 591 | // References we want to track. 592 | refs = append(refs, &reference{name, sel.Type, path + "#" + anchor(n)}) 593 | // We need to modify the DOM with a special link to support TOC. 594 | n.Parent.InsertBefore(newA(name, sel.Type), n) 595 | } 596 | } 597 | } 598 | return refs, writeHTML(path, dest, top) 599 | } 600 | 601 | func ignored(n string) bool { 602 | _, ok := ignoreHash[n] 603 | return ok 604 | } 605 | 606 | func text(node *html.Node) string { 607 | var b bytes.Buffer 608 | for c := node.FirstChild; c != nil; c = c.NextSibling { 609 | if c.Type == html.TextNode { 610 | b.WriteString(c.Data) 611 | } else if c.Type == html.ElementNode { 612 | b.WriteString(text(c)) 613 | } 614 | } 615 | return strings.TrimSpace(b.String()) 616 | } 617 | 618 | func attr(node *html.Node, key string) string { 619 | for _, a := range node.Attr { 620 | if a.Key == key { 621 | return a.Val 622 | } 623 | } 624 | return "" 625 | } 626 | 627 | // tcounter is used to generate automatic anchors. 628 | // NOTE: NOT THREADSAFE. If we switch to goroutines, swith to atom int. 629 | var tcounter int 630 | 631 | func anchor(node *html.Node) string { 632 | if node.Type == html.ElementNode && node.Data == "a" { 633 | for _, a := range node.Attr { 634 | if a.Key == "name" { 635 | return a.Val 636 | } 637 | } 638 | } 639 | tname := fmt.Sprintf("autolink-%d", tcounter) 640 | link := autolink(tname) 641 | node.Parent.InsertBefore(link, node) 642 | tcounter++ 643 | return tname 644 | } 645 | 646 | //autolink creates an A tag for when one is not present in original docs. 647 | func autolink(target string) *html.Node { 648 | return &html.Node{ 649 | Type: html.ElementNode, 650 | DataAtom: atom.A, 651 | Data: atom.A.String(), 652 | Attr: []html.Attribute{ 653 | html.Attribute{Key: "class", Val: "dashingAutolink"}, 654 | html.Attribute{Key: "name", Val: target}, 655 | }, 656 | } 657 | } 658 | 659 | // newA creates a TOC anchor. 660 | func newA(name, etype string) *html.Node { 661 | name = strings.Replace(url.QueryEscape(name), "+", "%20", -1) 662 | 663 | target := fmt.Sprintf("//apple_ref/cpp/%s/%s", etype, name) 664 | return &html.Node{ 665 | Type: html.ElementNode, 666 | DataAtom: atom.A, 667 | Data: atom.A.String(), 668 | Attr: []html.Attribute{ 669 | html.Attribute{Key: "class", Val: "dashAnchor"}, 670 | html.Attribute{Key: "name", Val: target}, 671 | }, 672 | } 673 | } 674 | 675 | // addIcon adds an icon to the docset. 676 | func addIcon(src, dest string) error { 677 | return copyFile(src, dest) 678 | } 679 | 680 | // copyFile copies a source file to a new destination. 681 | func copyFile(src, dest string) error { 682 | if err := os.MkdirAll(filepath.Dir(dest), 0755); err != nil { 683 | return err 684 | } 685 | 686 | in, err := os.Open(src) 687 | if err != nil { 688 | return err 689 | } 690 | defer in.Close() 691 | out, err := os.Create(dest) 692 | if err != nil { 693 | return err 694 | } 695 | defer out.Close() 696 | 697 | _, err = io.Copy(out, in) 698 | return err 699 | } 700 | 701 | var point_to_entity = map[rune]string{ 702 | 8704: "∀", 703 | 8194: " ", 704 | 8195: " ", 705 | 8709: "∅", 706 | 8711: "∇", 707 | 8712: "∈", 708 | 8201: " ", 709 | 8715: "∋", 710 | 8204: "‌", 711 | 8205: "‍", 712 | 8206: "‎", 713 | 8719: "∏", 714 | 8721: "∑", 715 | 8722: "−", 716 | 8211: "–", 717 | 8212: "—", 718 | 8727: "∗", 719 | 8216: "‘", 720 | 8217: "’", 721 | 8730: "√", 722 | 175: "¯", 723 | 8220: "“", 724 | 8221: "”", 725 | 8222: "„", 726 | 8224: "†", 727 | 8225: "‡", 728 | 8226: "•", 729 | 8230: "…", 730 | 8743: "∧", 731 | 8744: "∨", 732 | 8745: "∩", 733 | 8746: "∪", 734 | 8747: "∫", 735 | 8240: "‰", 736 | 8242: "′", 737 | 8243: "″", 738 | 8756: "∴", 739 | 8713: "∉", 740 | 8249: "‹", 741 | 8250: "›", 742 | 8764: "∼", 743 | // 62: ">", // this is already encoded for us 744 | 8629: "↵", 745 | 9824: "♠", 746 | 8260: "⁄", 747 | 8773: "≅", 748 | 8776: "≈", 749 | 8207: "‏", 750 | 9829: "♥", 751 | 8800: "≠", 752 | 8801: "≡", 753 | 9827: "♣", 754 | 8804: "≤", 755 | 8805: "≥", 756 | 9830: "♦", 757 | // 38: "&", // this is already encoded for us 758 | 8834: "⊂", 759 | 8835: "⊃", 760 | 8836: "⊄", 761 | 8838: "⊆", 762 | 8839: "⊇", 763 | 8853: "⊕", 764 | 8855: "⊗", 765 | 8734: "∞", 766 | 8218: "‚", 767 | 8901: "⋅", 768 | 160: " ", 769 | 161: "¡", 770 | 162: "¢", 771 | 163: "£", 772 | 164: "¤", 773 | 8869: "⊥", 774 | 166: "¦", 775 | 167: "§", 776 | 168: "¨", 777 | 169: "©", 778 | 170: "ª", 779 | 171: "«", 780 | 8364: "€", 781 | 173: "­", 782 | 174: "®", 783 | 8733: "∝", 784 | 176: "°", 785 | 177: "±", 786 | 178: "²", 787 | 179: "³", 788 | 180: "´", 789 | 181: "µ", 790 | 182: "¶", 791 | 183: "·", 792 | 184: "¸", 793 | 185: "¹", 794 | 186: "º", 795 | 187: "»", 796 | 188: "¼", 797 | 189: "½", 798 | 190: "¾", 799 | 191: "¿", 800 | 192: "À", 801 | 193: "Á", 802 | 194: "Â", 803 | 195: "Ã", 804 | 196: "Ä", 805 | 197: "Å", 806 | 198: "Æ", 807 | 199: "Ç", 808 | 200: "È", 809 | 201: "É", 810 | 202: "Ê", 811 | 203: "Ë", 812 | 204: "Ì", 813 | // 34: """, // this is already encoded 814 | 206: "Î", 815 | 207: "Ï", 816 | 208: "Ð", 817 | 209: "Ñ", 818 | 210: "Ò", 819 | 211: "Ó", 820 | 212: "Ô", 821 | 213: "Õ", 822 | 214: "Ö", 823 | 215: "×", 824 | 216: "Ø", 825 | 217: "Ù", 826 | 218: "Ú", 827 | 219: "Û", 828 | 220: "Ü", 829 | 221: "Ý", 830 | 222: "Þ", 831 | 223: "ß", 832 | 224: "à", 833 | 225: "á", 834 | 226: "â", 835 | 227: "ã", 836 | 228: "ä", 837 | 229: "å", 838 | 230: "æ", 839 | 231: "ç", 840 | 232: "è", 841 | 205: "Í", 842 | 234: "ê", 843 | 235: "ë", 844 | 236: "ì", 845 | 8658: "⇒", 846 | 238: "î", 847 | 239: "ï", 848 | 240: "ð", 849 | 241: "ñ", 850 | 242: "ò", 851 | 243: "ó", 852 | 244: "ô", 853 | 245: "õ", 854 | 246: "ö", 855 | 247: "÷", 856 | 248: "ø", 857 | 249: "ù", 858 | 250: "ú", 859 | 251: "û", 860 | 252: "ü", 861 | 253: "ý", 862 | 254: "þ", 863 | 255: "ÿ", 864 | 172: "¬", 865 | 8968: "⌈", 866 | 8969: "⌉", 867 | 8970: "⌊", 868 | 8971: "⌋", 869 | 8465: "ℑ", 870 | 8472: "℘", 871 | 8476: "ℜ", 872 | 8482: "™", 873 | 732: "˜", 874 | 9002: "⟩", 875 | 8736: "∠", 876 | 402: "ƒ", 877 | 8706: "∂", 878 | 8501: "ℵ", 879 | 710: "ˆ", 880 | 338: "Œ", 881 | 339: "œ", 882 | 352: "Š", 883 | 353: "š", 884 | 8593: "↑", 885 | // 60: "<", // this is already encoded for us 886 | 8594: "→", 887 | 8707: "∃", 888 | 8595: "↓", 889 | 8254: "‾", 890 | 233: "é", 891 | 376: "Ÿ", 892 | 916: "Δ", 893 | 237: "í", 894 | 8592: "←", 895 | 913: "Α", 896 | 914: "Β", 897 | 915: "Γ", 898 | 8596: "↔", 899 | 917: "Ε", 900 | 918: "Ζ", 901 | 919: "Η", 902 | 920: "Θ", 903 | 921: "Ι", 904 | 922: "Κ", 905 | 923: "Λ", 906 | 924: "Μ", 907 | 925: "Ν", 908 | 926: "Ξ", 909 | 927: "Ο", 910 | 928: "Π", 911 | 929: "Ρ", 912 | 931: "Σ", 913 | 932: "Τ", 914 | 933: "Υ", 915 | 934: "Φ", 916 | 935: "Χ", 917 | 936: "Ψ", 918 | 937: "Ω", 919 | 945: "α", 920 | 946: "β", 921 | 947: "γ", 922 | 948: "δ", 923 | 949: "ε", 924 | 950: "ζ", 925 | 951: "η", 926 | 952: "θ", 927 | 953: "ι", 928 | 954: "κ", 929 | 955: "λ", 930 | 956: "μ", 931 | 957: "ν", 932 | 958: "ξ", 933 | 959: "ο", 934 | 960: "π", 935 | 961: "ρ", 936 | 962: "ς", 937 | 963: "σ", 938 | 964: "τ", 939 | 965: "υ", 940 | 966: "φ", 941 | 967: "χ", 942 | 968: "ψ", 943 | 969: "ω", 944 | 9674: "◊", 945 | 8656: "⇐", 946 | 977: "ϑ", 947 | 978: "ϒ", 948 | 8659: "⇓", 949 | 8660: "⇔", 950 | 982: "ϖ", 951 | 165: "¥", 952 | 8657: "⇑", 953 | 9001: "⟨", 954 | } 955 | -------------------------------------------------------------------------------- /examples/busybox/BusyBox.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | BusyBox - The Swiss Army Knife of Embedded Linux 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 |

16 | 33 | 34 | 35 |
36 | 37 | 38 |

39 |

40 |

NAME

41 |

BusyBox - The Swiss Army Knife of Embedded Linux

42 |

43 |

44 |
45 |

SYNTAX

46 |
  47 |  busybox <applet> [arguments...]  # or
48 |
  49 |  <applet> [arguments...]          # if symlinked
50 |

51 |

52 |
53 |

DESCRIPTION

54 |

BusyBox combines tiny versions of many common UNIX utilities into a single 55 | small executable. It provides minimalist replacements for most of the utilities 56 | you usually find in GNU coreutils, util-linux, etc. The utilities in BusyBox 57 | generally have fewer options than their full-featured GNU cousins; however, the 58 | options that are included provide the expected functionality and behave very 59 | much like their GNU counterparts.

60 |

BusyBox has been written with size-optimization and limited resources in mind. 61 | It is also extremely modular so you can easily include or exclude commands (or 62 | features) at compile time. This makes it easy to customize your embedded 63 | systems. To create a working system, just add /dev, /etc, and a Linux kernel. 64 | BusyBox provides a fairly complete POSIX environment for any small or embedded 65 | system.

66 |

BusyBox is extremely configurable. This allows you to include only the 67 | components you need, thereby reducing binary size. Run 'make config' or 'make 68 | menuconfig' to select the functionality that you wish to enable. Then run 69 | 'make' to compile BusyBox using your configuration.

70 |

After the compile has finished, you should use 'make install' to install 71 | BusyBox. This will install the 'bin/busybox' binary, in the target directory 72 | specified by CONFIG_PREFIX. CONFIG_PREFIX can be set when configuring BusyBox, 73 | or you can specify an alternative location at install time (i.e., with a 74 | command line like 'make CONFIG_PREFIX=/tmp/foo install'). If you enabled 75 | any applet installation scheme (either as symlinks or hardlinks), these will 76 | also be installed in the location pointed to by CONFIG_PREFIX.

77 |

78 |

79 |
80 |

USAGE

81 |

BusyBox is a multi-call binary. A multi-call binary is an executable program 82 | that performs the same job as more than one utility program. That means there 83 | is just a single BusyBox binary, but that single binary acts like a large 84 | number of utilities. This allows BusyBox to be smaller since all the built-in 85 | utility programs (we call them applets) can share code for many common 86 | operations.

87 |

You can also invoke BusyBox by issuing a command as an argument on the 88 | command line. For example, entering

89 |
  90 |         /bin/busybox ls
91 |

will also cause BusyBox to behave as 'ls'.

92 |

Of course, adding '/bin/busybox' into every command would be painful. So most 93 | people will invoke BusyBox using links to the BusyBox binary.

94 |

For example, entering

95 |
  96 |         ln -s /bin/busybox ls
  97 |         ./ls
98 |

will cause BusyBox to behave as 'ls' (if the 'ls' command has been compiled 99 | into BusyBox). Generally speaking, you should never need to make all these 100 | links yourself, as the BusyBox build system will do this for you when you run 101 | the 'make install' command.

102 |

If you invoke BusyBox with no arguments, it will provide you with a list of the 103 | applets that have been compiled into your BusyBox binary.

104 |

105 |

106 |
107 |

COMMON OPTIONS

108 |

Most BusyBox applets support the --help argument to provide a terse runtime 109 | description of their behavior. If the CONFIG_FEATURE_VERBOSE_USAGE option has 110 | been enabled, more detailed usage information will also be available.

111 |

112 |

113 |
114 |

COMMANDS

115 |

Currently available applets include:

116 |
 117 |         [, [[, acpid, addgroup, adduser, adjtimex, ar, arp, arping, ash,
 118 |         awk, basename, beep, blkid, brctl, bunzip2, bzcat, bzip2, cal, cat,
 119 |         catv, chat, chattr, chgrp, chmod, chown, chpasswd, chpst, chroot,
 120 |         chrt, chvt, cksum, clear, cmp, comm, cp, cpio, crond, crontab,
 121 |         cryptpw, cut, date, dc, dd, deallocvt, delgroup, deluser, depmod,
 122 |         devmem, df, dhcprelay, diff, dirname, dmesg, dnsd, dnsdomainname,
 123 |         dos2unix, dpkg, du, dumpkmap, dumpleases, echo, ed, egrep, eject,
 124 |         env, envdir, envuidgid, expand, expr, fakeidentd, false, fbset,
 125 |         fbsplash, fdflush, fdformat, fdisk, fgrep, find, findfs, flash_lock,
 126 |         flash_unlock, fold, free, freeramdisk, fsck, fsck.minix, fsync,
 127 |         ftpd, ftpget, ftpput, fuser, getopt, getty, grep, gunzip, gzip, hd,
 128 |         hdparm, head, hexdump, hostid, hostname, httpd, hush, hwclock, id,
 129 |         ifconfig, ifdown, ifenslave, ifplugd, ifup, inetd, init, inotifyd,
 130 |         insmod, install, ionice, ip, ipaddr, ipcalc, ipcrm, ipcs, iplink,
 131 |         iproute, iprule, iptunnel, kbd_mode, kill, killall, killall5, klogd,
 132 |         last, length, less, linux32, linux64, linuxrc, ln, loadfont,
 133 |         loadkmap, logger, login, logname, logread, losetup, lpd, lpq, lpr,
 134 |         ls, lsattr, lsmod, lzmacat, lzop, lzopcat, makemime, man, md5sum,
 135 |         mdev, mesg, microcom, mkdir, mkdosfs, mkfifo, mkfs.minix, mkfs.vfat,
 136 |         mknod, mkpasswd, mkswap, mktemp, modprobe, more, mount, mountpoint,
 137 |         mt, mv, nameif, nc, netstat, nice, nmeter, nohup, nslookup, od,
 138 |         openvt, passwd, patch, pgrep, pidof, ping, ping6, pipe_progress,
 139 |         pivot_root, pkill, popmaildir, printenv, printf, ps, pscan, pwd,
 140 |         raidautorun, rdate, rdev, readlink, readprofile, realpath,
 141 |         reformime, renice, reset, resize, rm, rmdir, rmmod, route, rpm,
 142 |         rpm2cpio, rtcwake, run-parts, runlevel, runsv, runsvdir, rx, script,
 143 |         scriptreplay, sed, sendmail, seq, setarch, setconsole, setfont,
 144 |         setkeycodes, setlogcons, setsid, setuidgid, sh, sha1sum, sha256sum,
 145 |         sha512sum, showkey, slattach, sleep, softlimit, sort, split,
 146 |         start-stop-daemon, stat, strings, stty, su, sulogin, sum, sv,
 147 |         svlogd, swapoff, swapon, switch_root, sync, sysctl, syslogd, tac,
 148 |         tail, tar, taskset, tcpsvd, tee, telnet, telnetd, test, tftp, tftpd,
 149 |         time, timeout, top, touch, tr, traceroute, true, tty, ttysize,
 150 |         udhcpc, udhcpd, udpsvd, umount, uname, uncompress, unexpand, uniq,
 151 |         unix2dos, unlzma, unlzop, unzip, uptime, usleep, uudecode, uuencode,
 152 |         vconfig, vi, vlock, volname, watch, watchdog, wc, wget, which, who,
 153 |         whoami, xargs, yes, zcat, zcip
154 |

155 |

156 |
157 |

COMMAND DESCRIPTIONS

158 |
159 |
acpid
160 | 161 |
162 |

acpid [-d] [-c CONFDIR] [-l LOGFILE] [-e PROC_EVENT_FILE] [EVDEV_EVENT_FILE...]

163 |

Listen to ACPI events and spawn specific helpers on event arrival

164 |

Options:

165 |
 166 |         -d      Do not daemonize and log to stderr
 167 |         -c DIR  Config directory [/etc/acpi]
 168 |         -e FILE /proc event file [/proc/acpi/event]
 169 |         -l FILE Log file [/var/log/acpid]
170 |

Accept and ignore compatibility options -g -m -s -S -v

171 |
172 |
addgroup
173 | 174 |
175 |

addgroup [-g GID] [user_name] group_name

176 |

Add a group or add a user to a group

177 |

Options:

178 |
 179 |         -g GID  Group id
 180 |         -S      Create a system group
181 |
182 |
adduser
183 | 184 |
185 |

adduser [OPTIONS] user_name

186 |

Add a user

187 |

Options:

188 |
 189 |         -h DIR          Home directory
 190 |         -g GECOS        GECOS field
 191 |         -s SHELL        Login shell
 192 |         -G GRP          Add user to existing group
 193 |         -S              Create a system user
 194 |         -D              Do not assign a password
 195 |         -H              Do not create home directory
 196 |         -u UID          User id
197 |
198 |
adjtimex
199 | 200 |
201 |

adjtimex [-q] [-o offset] [-f frequency] [-p timeconstant] [-t tick]

202 |

Read and optionally set system timebase parameters. See adjtimex(2).

203 |

Options:

204 |
 205 |         -q              Quiet
 206 |         -o offset       Time offset, microseconds
 207 |         -f frequency    Frequency adjust, integer kernel units (65536 is 1ppm)
 208 |                         (positive values make clock run faster)
 209 |         -t tick         Microseconds per tick, usually 10000
 210 |         -p timeconstant
211 |
212 |
ar
213 | 214 |
215 |

ar [-o] [-v] [-p] [-t] [-x] ARCHIVE FILES

216 |

Extract or list FILES from an ar archive

217 |

Options:

218 |
 219 |         -o      Preserve original dates
 220 |         -p      Extract to stdout
 221 |         -t      List
 222 |         -x      Extract
 223 |         -v      Verbose
224 |
225 |
arp
226 | 227 |
228 |

arp 229 |
[-vn][-H type] [-i if] -a [hostname] 230 |
[-v] [-i if] -d hostname [pub] 231 |
[-v][-H type] [-i if] -s hostname hw_addr [temp] 232 |
[-v][-H type] [-i if] -s hostname hw_addr [netmask nm] pub 233 |
[-v][-H type] [-i if] -Ds hostname ifa [netmask nm] pub

234 |

Manipulate ARP cache

235 |

Options:

236 |
 237 |         -a              Display (all) hosts
 238 |         -s              Set new ARP entry
 239 |         -d              Delete a specified entry
 240 |         -v              Verbose
 241 |         -n              Don't resolve names
 242 |         -i IF           Network interface
 243 |         -D              Read <hwaddr> from given device
 244 |         -A, -p AF       Protocol family
 245 |         -H HWTYPE       Hardware address type
246 |
247 |
arping
248 | 249 |
250 |

arping [-fqbDUA] [-c count] [-w timeout] [-I dev] [-s sender] target

251 |

Send ARP requests/replies

252 |

Options:

253 |
 254 |         -f              Quit on first ARP reply
 255 |         -q              Quiet
 256 |         -b              Keep broadcasting, don't go unicast
 257 |         -D              Duplicated address detection mode
 258 |         -U              Unsolicited ARP mode, update your neighbors
 259 |         -A              ARP answer mode, update your neighbors
 260 |         -c N            Stop after sending N ARP requests
 261 |         -w timeout      Time to wait for ARP reply, in seconds
 262 |         -I dev          Interface to use (default eth0)
 263 |         -s sender       Sender IP address
 264 |         target          Target IP address
265 |
266 |
awk
267 | 268 |
269 |

awk [OPTIONS] [AWK_PROGRAM] [FILE]...

270 |

Options:

271 |
 272 |         -v VAR=VAL      Set variable
 273 |         -F SEP          Use SEP as field separator
 274 |         -f FILE         Read program from file
275 |
276 |
basename
277 | 278 |
279 |

basename FILE [SUFFIX]

280 |

Strip directory path and .SUFFIX from FILE

281 |
282 |
beep
283 | 284 |
285 |

beep -f freq -l length -d delay -r repetitions -n

286 |

Options:

287 |
 288 |         -f      Frequency in Hz
 289 |         -l      Length in ms
 290 |         -d      Delay in ms
 291 |         -r      Repetitions
 292 |         -n      Start new tone
293 |
294 |
blkid
295 | 296 |
297 |

blkid

298 |

Print UUIDs of all filesystems

299 |
300 |
brctl
301 | 302 |
303 |

brctl COMMAND [BRIDGE [INTERFACE]]

304 |

Manage ethernet bridges

305 |

Commands:

306 |
 307 |         show                    Show a list of bridges
 308 |         addbr BRIDGE            Create BRIDGE
 309 |         delbr BRIDGE            Delete BRIDGE
 310 |         addif BRIDGE IFACE      Add IFACE to BRIDGE
 311 |         delif BRIDGE IFACE      Delete IFACE from BRIDGE
 312 |         setageing BRIDGE TIME           Set ageing time
 313 |         setfd BRIDGE TIME               Set bridge forward delay
 314 |         sethello BRIDGE TIME            Set hello time
 315 |         setmaxage BRIDGE TIME           Set max message age
 316 |         setpathcost BRIDGE COST         Set path cost
 317 |         setportprio BRIDGE PRIO         Set port priority
 318 |         setbridgeprio BRIDGE PRIO       Set bridge priority
 319 |         stp BRIDGE [1|0]                STP on/off
320 |
321 |
bunzip2
322 | 323 |
324 |

bunzip2 [OPTIONS] [FILE]

325 |

Uncompress FILE (or standard input if FILE is '-' or omitted)

326 |

Options:

327 |
 328 |         -c      Write to standard output
 329 |         -f      Force
330 |
331 |
bzcat
332 | 333 |
334 |

bzcat FILE

335 |

Uncompress to stdout

336 |
337 |
bzip2
338 | 339 |
340 |

bzip2 [OPTIONS] [FILE]...

341 |

Compress FILE(s) with bzip2 algorithm. 342 | When FILE is '-' or unspecified, reads standard input. Implies -c.

343 |

Options:

344 |
 345 |         -c      Write to standard output
 346 |         -d      Decompress
 347 |         -f      Force
 348 |         -1..-9  Compression level
349 |
350 |
cal
351 | 352 |
353 |

cal [-jy] [[month] year]

354 |

Display a calendar

355 |

Options:

356 |
 357 |         -j      Use julian dates
 358 |         -y      Display the entire year
359 |
360 |
cat
361 | 362 |
363 |

cat [-u] [FILE]...

364 |

Concatenate FILE(s) and print them to stdout

365 |

Options:

366 |
 367 |         -u      Use unbuffered i/o (ignored)
368 |
369 |
catv
370 | 371 |
372 |

catv [-etv] [FILE]...

373 |

Display nonprinting characters as ^x or M-x

374 |

Options:

375 |
 376 |         -e      End each line with $
 377 |         -t      Show tabs as ^I
 378 |         -v      Don't use ^x or M-x escapes
379 |
380 |
chat
381 | 382 |
383 |

chat EXPECT [SEND [EXPECT [SEND...]]]

384 |

Useful for interacting with a modem connected to stdin/stdout. 385 | A script consists of one or more "expect-send" pairs of strings, 386 | each pair is a pair of arguments. Example: 387 | chat '' ATZ OK ATD123456 CONNECT '' ogin: pppuser word: ppppass '~'

388 |
389 |
chattr
390 | 391 |
392 |

chattr [-R] [-+=AacDdijsStTu] [-v version] files...

393 |

Change file attributes on an ext2 fs

394 |

Modifiers:

395 |
 396 |         -       Remove attributes
 397 |         +       Add attributes
 398 |         =       Set attributes
 399 | Attributes:
400 |
 401 |         A       Don't track atime
 402 |         a       Append mode only
 403 |         c       Enable compress
 404 |         D       Write dir contents synchronously
 405 |         d       Do not backup with dump
 406 |         i       Cannot be modified (immutable)
 407 |         j       Write all data to journal first
 408 |         s       Zero disk storage when deleted
 409 |         S       Write file contents synchronously
 410 |         t       Disable tail-merging of partial blocks with other files
 411 |         u       Allow file to be undeleted
 412 | Options:
413 |
 414 |         -R      Recursively list subdirectories
 415 |         -v      Set the file's version/generation number
416 |
417 |
chgrp
418 | 419 |
420 |

chgrp [-RhLHPcvf]... GROUP FILE...

421 |

Change the group membership of each FILE to GROUP

422 |

Options:

423 |
 424 |         -R      Recurse
 425 |         -h      Affect symlinks instead of symlink targets
 426 |         -L      Traverse all symlinks to directories
 427 |         -H      Traverse symlinks on command line only
 428 |         -P      Do not traverse symlinks (default)
 429 |         -c      List changed files
 430 |         -v      Verbose
 431 |         -f      Hide errors
432 |
433 |
chmod
434 | 435 |
436 |

chmod [-Rcvf] MODE[,MODE]... FILE...

437 |

Each MODE is one or more of the letters ugoa, one of the 438 | symbols +-= and one or more of the letters rwxst

439 |

Options:

440 |
 441 |         -R      Recurse
 442 |         -c      List changed files
 443 |         -v      List all files
 444 |         -f      Hide errors
445 |
446 |
chown
447 | 448 |
449 |

chown [-RhLHPcvf]... OWNER[<.|:>[GROUP]] FILE...

450 |

Change the owner and/or group of each FILE to OWNER and/or GROUP

451 |

Options:

452 |
 453 |         -R      Recurse
 454 |         -h      Affect symlinks instead of symlink targets
 455 |         -L      Traverse all symlinks to directories
 456 |         -H      Traverse symlinks on command line only
 457 |         -P      Do not traverse symlinks (default)
 458 |         -c      List changed files
 459 |         -v      List all files
 460 |         -f      Hide errors
461 |
462 |
chpasswd
463 | 464 |
465 |

chpasswd [--md5|--encrypted]

466 |

Read user:password from stdin and update /etc/passwd

467 |

Options:

468 |
 469 |         -e,--encrypted  Supplied passwords are in encrypted form
 470 |         -m,--md5        Use MD5 encryption instead of DES
471 |
472 |
chpst
473 | 474 |
475 |

chpst [-vP012] [-u USER[:GRP]] [-U USER[:GRP]] [-e DIR] 476 |
[-/ DIR] [-n NICE] [-m BYTES] [-d BYTES] [-o N] 477 |
[-p N] [-f BYTES] [-c BYTES] PROG ARGS

478 |

Change the process state and run PROG

479 |

Options:

480 |
 481 |         -u USER[:GRP]   Set uid and gid
 482 |         -U USER[:GRP]   Set $UID and $GID in environment
 483 |         -e DIR          Set environment variables as specified by files
 484 |                         in DIR: file=1st_line_of_file
 485 |         -/ DIR          Chroot to DIR
 486 |         -n NICE         Add NICE to nice value
 487 |         -m BYTES        Same as -d BYTES -s BYTES -l BYTES
 488 |         -d BYTES        Limit data segment
 489 |         -o N            Limit number of open files per process
 490 |         -p N            Limit number of processes per uid
 491 |         -f BYTES        Limit output file sizes
 492 |         -c BYTES        Limit core file size
 493 |         -v              Verbose
 494 |         -P              Create new process group
 495 |         -0              Close standard input
 496 |         -1              Close standard output
 497 |         -2              Close standard error
498 |
499 |
chroot
500 | 501 |
502 |

chroot NEWROOT [PROG [ARGS]]

503 |

Run PROG with root directory set to NEWROOT

504 |
505 |
chrt
506 | 507 |
508 |

chrt [OPTIONS] [PRIO] [PID | PROG [ARGS]]

509 |

Manipulate real-time attributes of a process

510 |

Options:

511 |
 512 |         -p      Operate on pid
 513 |         -r      Set scheduling policy to SCHED_RR
 514 |         -f      Set scheduling policy to SCHED_FIFO
 515 |         -o      Set scheduling policy to SCHED_OTHER
 516 |         -m      Show min and max priorities
517 |
518 |
chvt
519 | 520 |
521 |

chvt N

522 |

Change the foreground virtual terminal to /dev/ttyN

523 |
524 |
cksum
525 | 526 |
527 |

cksum FILES...

528 |

Calculate the CRC32 checksums of FILES

529 |
530 |
clear
531 | 532 |
533 |

clear

534 |

Clear screen

535 |
536 |
cmp
537 | 538 |
539 |

cmp [-l] [-s] FILE1 [FILE2 [SKIP1 [SKIP2]]]

540 |

Compares FILE1 vs stdin if FILE2 is not specified

541 |

Options:

542 |
 543 |         -l      Write the byte numbers (decimal) and values (octal)
 544 |                 for all differing bytes
 545 |         -s      Quiet
546 |
547 |
comm
548 | 549 |
550 |

comm [-123] FILE1 FILE2

551 |

Compare FILE1 to FILE2, or to stdin if - is specified

552 |

Options:

553 |
 554 |         -1      Suppress lines unique to FILE1
 555 |         -2      Suppress lines unique to FILE2
 556 |         -3      Suppress lines common to both files
557 |
558 |
cp
559 | 560 |
561 |

cp [OPTIONS] SOURCE DEST

562 |

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

563 |

Options:

564 |
 565 |         -a      Same as -dpR
 566 |         -d,-P   Preserve links
 567 |         -H,-L   Dereference all symlinks (default)
 568 |         -p      Preserve file attributes if possible
 569 |         -f      Force overwrite
 570 |         -i      Prompt before overwrite
 571 |         -R,-r   Recurse
 572 |         -l,-s   Create (sym)links
573 |
574 |
cpio
575 | 576 |
577 |

cpio -[tiopdmvu] [-F FILE] [-H newc]

578 |

Extract or list files from a cpio archive, or create a cpio archive 579 | Main operation mode:

580 |
 581 |         -t      List
 582 |         -i      Extract
 583 |         -o      Create
 584 |         -p      Passthrough
 585 | Options:
586 |
 587 |         -d      Make leading directories
 588 |         -m      Preserve mtime
 589 |         -v      Verbose
 590 |         -u      Overwrite
 591 |         -F      Input file
 592 |         -H      Define format
593 |
594 |
crond
595 | 596 |
597 |

crond -fbS -l N -d N -L LOGFILE -c DIR

598 |
 599 |         -f      Foreground
 600 |         -b      Background (default)
 601 |         -S      Log to syslog (default)
 602 |         -l      Set log level. 0 is the most verbose, default 8
 603 |         -d      Set log level, log to stderr
 604 |         -L      Log to file
 605 |         -c      Working dir
606 |
607 |
crontab
608 | 609 |
610 |

crontab [-c DIR] [-u USER] [-ler]|[FILE]

611 |
 612 |         -c      Crontab directory
 613 |         -u      User
 614 |         -l      List crontab
 615 |         -e      Edit crontab
 616 |         -r      Delete crontab
 617 |         FILE    Replace crontab by FILE ('-': stdin)
618 |
619 |
cryptpw
620 | 621 |
622 |

cryptpw [OPTIONS] [PASSWORD] [SALT]

623 |

Crypt the PASSWORD using crypt(3)

624 |

Options:

625 |
 626 |         -P,--password-fd=NUM    Read password from fd NUM
 627 |         -m,--method=TYPE        Encryption method TYPE
 628 |         -S,--salt=SALT
629 |
630 |
cut
631 | 632 |
633 |

cut [OPTIONS] [FILE]...

634 |

Print selected fields from each input FILE to standard output

635 |

Options:

636 |
 637 |         -b LIST Output only bytes from LIST
 638 |         -c LIST Output only characters from LIST
 639 |         -d CHAR Use CHAR instead of tab as the field delimiter
 640 |         -s      Output only the lines containing delimiter
 641 |         -f N    Print only these fields
 642 |         -n      Ignored
643 |
644 |
date
645 | 646 |
647 |

date [OPTIONS] [+FMT] [TIME]

648 |

Display time (using +FMT), or set time

649 |

Options:

650 |
 651 |         [-s] TIME       Set time to TIME
 652 |         -u              Work in UTC (don't convert to local time)
 653 |         -R              Output RFC-822 compliant date string
 654 |         -I[SPEC]        Output ISO-8601 compliant date string
 655 |                         SPEC='date' (default) for date only,
 656 |                         'hours', 'minutes', or 'seconds' for date and
 657 |                         time to the indicated precision
 658 |         -r FILE         Display last modification time of FILE
 659 |         -d TIME         Display TIME, not 'now'
 660 |         -D FMT          Use FMT for -d TIME conversion
661 |

Recognized TIME formats:

662 |
 663 |         hh:mm[:ss]
 664 |         [YYYY.]MM.DD-hh:mm[:ss]
 665 |         YYYY-MM-DD hh:mm[:ss]
 666 |         [[[[[YY]YY]MM]DD]hh]mm[.ss]
667 |
668 |
dc
669 | 670 |
671 |

dc expression...

672 |

Tiny RPN calculator. Operations: 673 | +, add, -, sub, *, mul, /, div, %, mod, **, exp, and, or, not, eor, 674 | p - print top of the stack (without altering the stack), 675 | f - print entire stack, o - pop the value and set output radix 676 | (value must be 10 or 16). 677 | Examples: 'dc 2 2 add' -> 4, 'dc 8 8 * 2 2 + /' -> 16.

678 |
679 |
dd
680 | 681 |
682 |

dd [if=FILE] [of=FILE] [ibs=N] [obs=N] [bs=N] [count=N] [skip=N] 683 |
[seek=N] [conv=notrunc|noerror|sync|fsync]

684 |

Copy a file with converting and formatting

685 |

Options:

686 |
 687 |         if=FILE         Read from FILE instead of stdin
 688 |         of=FILE         Write to FILE instead of stdout
 689 |         bs=N            Read and write N bytes at a time
 690 |         ibs=N           Read N bytes at a time
 691 |         obs=N           Write N bytes at a time
 692 |         count=N         Copy only N input blocks
 693 |         skip=N          Skip N input blocks
 694 |         seek=N          Skip N output blocks
 695 |         conv=notrunc    Don't truncate output file
 696 |         conv=noerror    Continue after read errors
 697 |         conv=sync       Pad blocks with zeros
 698 |         conv=fsync      Physically write data out before finishing
699 |

Numbers may be suffixed by c (x1), w (x2), b (x512), kD (x1000), k (x1024), 700 | MD (x1000000), M (x1048576), GD (x1000000000) or G (x1073741824)

701 |
702 |
deallocvt
703 | 704 |
705 |

deallocvt [N]

706 |

Deallocate unused virtual terminal /dev/ttyN

707 |
708 |
delgroup
709 | 710 |
711 |

delgroup [USER] GROUP

712 |

Delete group GROUP from the system or user USER from group GROUP

713 |
714 |
deluser
715 | 716 |
717 |

deluser USER

718 |

Delete USER from the system

719 |
720 |
devmem
721 | 722 |
723 |

devmem ADDRESS [WIDTH [VALUE]]

724 |

Read/write from physical address

725 |
 726 |         ADDRESS Address to act upon
 727 |         WIDTH   Width (8/16/...)
 728 |         VALUE   Data to be written
729 |
730 |
df
731 | 732 |
733 |

df [-Pkmhai] [-B SIZE] [FILESYSTEM...]

734 |

Print filesystem usage statistics

735 |

Options:

736 |
 737 |         -P      POSIX output format
 738 |         -k      1024-byte blocks (default)
 739 |         -m      1M-byte blocks
 740 |         -h      Human readable (e.g. 1K 243M 2G)
 741 |         -a      Show all filesystems
 742 |         -i      Inodes
 743 |         -B SIZE Blocksize
744 |
745 |
dhcprelay
746 | 747 |
748 |

dhcprelay CLIENT_IFACE[,CLIENT_IFACE2...] SERVER_IFACE [SERVER_IP]

749 |

Relay DHCP requests between clients and server

750 |
751 |
diff
752 | 753 |
754 |

diff [-abdiNqrTstw] [-L LABEL] [-S FILE] [-U LINES] FILE1 FILE2

755 |

Compare files line by line and output the differences between them. 756 | This implementation supports unified diffs only.

757 |

Options:

758 |
 759 |         -a      Treat all files as text
 760 |         -b      Ignore changes in the amount of whitespace
 761 |         -d      Try hard to find a smaller set of changes
 762 |         -i      Ignore case differences
 763 |         -L      Use LABEL instead of the filename in the unified header
 764 |         -N      Treat absent files as empty
 765 |         -q      Output only whether files differ
 766 |         -r      Recursively compare subdirectories
 767 |         -S      Start with FILE when comparing directories
 768 |         -T      Make tabs line up by prefixing a tab when necessary
 769 |         -s      Report when two files are the same
 770 |         -t      Expand tabs to spaces in output
 771 |         -U      Output LINES lines of context
 772 |         -w      Ignore all whitespace
773 |
774 |
dirname
775 | 776 |
777 |

dirname FILENAME

778 |

Strip non-directory suffix from FILENAME

779 |
780 |
dmesg
781 | 782 |
783 |

dmesg [-c] [-n LEVEL] [-s SIZE]

784 |

Print or control the kernel ring buffer

785 |

Options:

786 |
 787 |         -c              Clear ring buffer after printing
 788 |         -n LEVEL        Set console logging level
 789 |         -s SIZE         Buffer size
790 |
791 |
dnsd
792 | 793 |
794 |

dnsd [-c config] [-t seconds] [-p port] [-i iface-ip] [-d]

795 |

Small static DNS server daemon

796 |

Options:

797 |
 798 |         -c      Config filename
 799 |         -t      TTL in seconds
 800 |         -p      Listening port
 801 |         -i      Listening ip (default all)
 802 |         -d      Daemonize
803 |
804 |
dos2unix
805 | 806 |
807 |

dos2unix [OPTION] [FILE]

808 |

Convert FILE in-place from DOS to Unix format. 809 | When no file is given, use stdin/stdout.

810 |

Options:

811 |
 812 |         -u      dos2unix
 813 |         -d      unix2dos
814 |
815 |
dpkg
816 | 817 |
818 |

dpkg [-ilCPru] [-F option] package_name

819 |

Install, remove and manage Debian packages

820 |

Options:

821 |
 822 |         -i              Install the package
 823 |         -l              List of installed packages
 824 |         -C              Configure an unpackaged package
 825 |         -F depends      Ignore dependency problems
 826 |         -P              Purge all files of a package
 827 |         -r              Remove all but the configuration files for a package
 828 |         -u              Unpack a package, but don't configure it
829 |
830 |
du
831 | 832 |
833 |

du [-aHLdclsxhmk] [FILE]...

834 |

Summarize disk space used for each FILE and/or directory. 835 | Disk space is printed in units of 1024 bytes.

836 |

Options:

837 |
 838 |         -a      Show file sizes too
 839 |         -H      Follow symlinks on command line
 840 |         -L      Follow all symlinks
 841 |         -d N    Limit output to directories (and files with -a) of depth < N
 842 |         -c      Show grand total
 843 |         -l      Count sizes many times if hard linked
 844 |         -s      Display only a total for each argument
 845 |         -x      Skip directories on different filesystems
 846 |         -h      Sizes in human readable format (e.g., 1K 243M 2G )
 847 |         -m      Sizes in megabytes
 848 |         -k      Sizes in kilobytes (default)
849 |
850 |
dumpkmap
851 | 852 |
853 |

dumpkmap > keymap

854 |

Print a binary keyboard translation table to standard output

855 |
856 |
dumpleases
857 | 858 |
859 |

dumpleases [-r|-a] [-f LEASEFILE]

860 |

Display DHCP leases granted by udhcpd

861 |

Options:

862 |
 863 |         -f,--file=FILE  Leases file to load
 864 |         -r,--remaining  Interpret lease times as time remaining
 865 |         -a,--absolute   Interpret lease times as expire time
866 |
867 |
echo
868 | 869 |
870 |

echo [-neE] [ARG...]

871 |

Print the specified ARGs to stdout

872 |

Options:

873 |
 874 |         -n      Suppress trailing newline
 875 |         -e      Interpret backslash-escaped characters (i.e., \t=tab)
 876 |         -E      Disable interpretation of backslash-escaped characters
877 |
878 |
ed
879 | 880 |
881 |

ed

882 |
883 |
eject
884 | 885 |
886 |

eject [-t] [-T] [DEVICE]

887 |

Eject specified DEVICE (or default /dev/cdrom)

888 |

Options:

889 |
 890 |         -s      SCSI device
 891 |         -t      Close tray
 892 |         -T      Open/close tray (toggle)
893 |
894 |
env
895 | 896 |
897 |

env [-iu] [-] [name=value]... [PROG [ARGS]]

898 |

Print the current environment or run PROG after setting up 899 | the specified environment

900 |

Options:

901 |
 902 |         -, -i   Start with an empty environment
 903 |         -u      Remove variable from the environment
904 |
905 |
envdir
906 | 907 |
908 |

envdir dir prog args

909 |

Set various environment variables as specified by files 910 | in the directory dir and run PROG

911 |
912 |
envuidgid
913 | 914 |
915 |

envuidgid account prog args

916 |

Set $UID to account's uid and $GID to account's gid and run PROG

917 |
918 |
expand
919 | 920 |
921 |

expand [-i] [-t NUM] [FILE|-]

922 |

Convert tabs to spaces, writing to standard output

923 |

Options:

924 |
 925 |         -i,--initial    Do not convert tabs after non blanks
 926 |         -t,--tabs=N     Tabstops every N chars
927 |
928 |
expr
929 | 930 |
931 |

expr EXPRESSION

932 |

Print the value of EXPRESSION to standard output

933 |

EXPRESSION may be:

934 |
 935 |         ARG1 | ARG2     ARG1 if it is neither null nor 0, otherwise ARG2
 936 |         ARG1 & ARG2     ARG1 if neither argument is null or 0, otherwise 0
 937 |         ARG1 < ARG2     1 if ARG1 is less than ARG2, else 0. Similarly:
 938 |         ARG1 <= ARG2
 939 |         ARG1 = ARG2
 940 |         ARG1 != ARG2
 941 |         ARG1 >= ARG2
 942 |         ARG1 > ARG2
 943 |         ARG1 + ARG2     Sum of ARG1 and ARG2. Similarly:
 944 |         ARG1 - ARG2
 945 |         ARG1 * ARG2
 946 |         ARG1 / ARG2
 947 |         ARG1 % ARG2
 948 |         STRING : REGEXP         Anchored pattern match of REGEXP in STRING
 949 |         match STRING REGEXP     Same as STRING : REGEXP
 950 |         substr STRING POS LENGTH Substring of STRING, POS counted from 1
 951 |         index STRING CHARS      Index in STRING where any CHARS is found, or 0
 952 |         length STRING           Length of STRING
 953 |         quote TOKEN             Interpret TOKEN as a string, even if
 954 |                                 it is a keyword like 'match' or an
 955 |                                 operator like '/'
 956 |         (EXPRESSION)            Value of EXPRESSION
957 |

Beware that many operators need to be escaped or quoted for shells. 958 | Comparisons are arithmetic if both ARGs are numbers, else 959 | lexicographical. Pattern matches return the string matched between 960 | \( and \) or null; if \( and \) are not used, they return the number 961 | of characters matched or 0.

962 |
963 |
fakeidentd
964 | 965 |
966 |

fakeidentd [-fiw] [-b ADDR] [STRING]

967 |

Provide fake ident (auth) service

968 |

Options:

969 |
 970 |         -f      Run in foreground
 971 |         -i      Inetd mode
 972 |         -w      Inetd 'wait' mode
 973 |         -b ADDR Bind to specified address
 974 |         STRING  Ident answer string (default: nobody)
975 |
976 |
false
977 | 978 |
979 |

false

980 |

Return an exit code of FALSE (1)

981 |
982 |
fbset
983 | 984 |
985 |

fbset [OPTIONS] [MODE]

986 |

Show and modify frame buffer settings

987 |
988 |
fbsplash
989 | 990 |
991 |

fbsplash -s IMGFILE [-c] [-d DEV] [-i INIFILE] [-f CMD]

992 |

Options:

993 |
 994 |         -s      Image
 995 |         -c      Hide cursor
 996 |         -d      Framebuffer device (default /dev/fb0)
 997 |         -i      Config file (var=value):
 998 |                         BAR_LEFT,BAR_TOP,BAR_WIDTH,BAR_HEIGHT
 999 |                         BAR_R,BAR_G,BAR_B
1000 |         -f      Control pipe (else exit after drawing image)
1001 |                         commands: 'NN' (% for progress bar) or 'exit'
1002 |
1003 |
fdflush
1004 | 1005 |
1006 |

fdflush DEVICE

1007 |

Force floppy disk drive to detect disk change

1008 |
1009 |
fdformat
1010 | 1011 |
1012 |

fdformat [-n] DEVICE

1013 |

Format floppy disk

1014 |

Options:

1015 |
1016 |         -n      Don't verify after format
1017 |
1018 |
fdisk
1019 | 1020 |
1021 |

fdisk [-ul] [-C CYLINDERS] [-H HEADS] [-S SECTORS] [-b SSZ] DISK

1022 |

Change partition table

1023 |

Options:

1024 |
1025 |         -u              Start and End are in sectors (instead of cylinders)
1026 |         -l              Show partition table for each DISK, then exit
1027 |         -b 2048         (for certain MO disks) use 2048-byte sectors
1028 |         -C CYLINDERS    Set number of cylinders/heads/sectors
1029 |         -H HEADS
1030 |
1031 |         -S SECTORS
1032 |
1033 |
find
1034 | 1035 |
1036 |

find [PATH...] [EXPRESSION]

1037 |

Search for files. The default PATH is the current directory, 1038 | default EXPRESSION is '-print'

1039 |

EXPRESSION may consist of:

1040 |
1041 |         -follow         Dereference symlinks
1042 |         -xdev           Don't descend directories on other filesystems
1043 |         -maxdepth N     Descend at most N levels. -maxdepth 0 applies
1044 |                         tests/actions to command line arguments only
1045 |         -mindepth N     Do not act on first N levels
1046 |         -name PATTERN   File name (w/o directory name) matches PATTERN
1047 |         -iname PATTERN  Case insensitive -name
1048 |         -path PATTERN   Path matches PATTERN
1049 |         -regex PATTERN  Path matches regex PATTERN
1050 |         -type X         File type is X (X is one of: f,d,l,b,c,...)
1051 |         -perm NNN       Permissions match any of (+NNN), all of (-NNN),
1052 |                         or exactly (NNN)
1053 |         -mtime DAYS     Modified time is greater than (+N), less than (-N),
1054 |                         or exactly (N) days
1055 |         -mmin MINS      Modified time is greater than (+N), less than (-N),
1056 |                         or exactly (N) minutes
1057 |         -newer FILE     Modified time is more recent than FILE's
1058 |         -inum N         File has inode number N
1059 |         -user NAME      File is owned by user NAME (numeric user ID allowed)
1060 |         -group NAME     File belongs to group NAME (numeric group ID allowed)
1061 |         -depth          Process directory name after traversing it
1062 |         -size N[bck]    File size is N (c:bytes,k:kbytes,b:512 bytes(def.)).
1063 |                         +/-N: file size is bigger/smaller than N
1064 |         -print          Print (default and assumed)
1065 |         -print0         Delimit output with null characters rather than
1066 |                         newlines
1067 |         -exec CMD ARG ; Run CMD with all instances of {} replaced by the
1068 |                         matching files
1069 |         -prune          Stop traversing current subtree
1070 |         -delete         Delete files, turns on -depth option
1071 |         (EXPR)          Group an expression
1072 |
1073 |
findfs
1074 | 1075 |
1076 |

findfs LABEL=label or UUID=uuid

1077 |

Find a filesystem device based on a label or UUID

1078 |
1079 |
flash_lock
1080 | 1081 |
1082 |

flash_lock MTD_DEVICE OFFSET SECTORS

1083 |

Lock part or all of an MTD device. If SECTORS is -1, then all sectors 1084 | will be locked, regardless of the value of OFFSET

1085 |
1086 |
flash_unlock
1087 | 1088 |
1089 |

flash_unlock MTD_DEVICE

1090 |

Unlock an MTD device

1091 |
1092 |
fold
1093 | 1094 |
1095 |

fold [-bs] [-w WIDTH] [FILE]

1096 |

Wrap input lines in each FILE (standard input by default), writing to 1097 | standard output

1098 |

Options:

1099 |
1100 |         -b      Count bytes rather than columns
1101 |         -s      Break at spaces
1102 |         -w      Use WIDTH columns instead of 80
1103 |
1104 |
free
1105 | 1106 |
1107 |

free

1108 |

Display the amount of free and used system memory

1109 |
1110 |
freeramdisk
1111 | 1112 |
1113 |

freeramdisk DEVICE

1114 |

Free all memory used by the specified ramdisk

1115 |
1116 |
fsck
1117 | 1118 |
1119 |

fsck [-ANPRTV] [-C fd] [-t fstype] [fs-options] [filesys...]

1120 |

Check and repair filesystems

1121 |

Options:

1122 |
1123 |         -A      Walk /etc/fstab and check all filesystems
1124 |         -N      Don't execute, just show what would be done
1125 |         -P      With -A, check filesystems in parallel
1126 |         -R      With -A, skip the root filesystem
1127 |         -T      Don't show title on startup
1128 |         -V      Verbose
1129 |         -C n    Write status information to specified filedescriptor
1130 |         -t type List of filesystem types to check
1131 |
1132 |
fsck.minix
1133 | 1134 |
1135 |

fsck.minix [-larvsmf] /dev/name

1136 |

Check MINIX filesystem

1137 |

Options:

1138 |
1139 |         -l      List all filenames
1140 |         -r      Perform interactive repairs
1141 |         -a      Perform automatic repairs
1142 |         -v      Verbose
1143 |         -s      Output superblock information
1144 |         -m      Show "mode not cleared" warnings
1145 |         -f      Force file system check
1146 |
1147 |
fsync
1148 | 1149 |
1150 |

fsync [OPTIONS] FILE...Write files' buffered blocks to disk

1151 |

Options:

1152 |
1153 |         -d      Avoid syncing metadata
1154 |
1155 |
ftpd
1156 | 1157 |
1158 |

ftpd [-wvS] [-t N] [-T N] [DIR]

1159 |

Anonymous FTP server

1160 |

ftpd should be used as an inetd service. 1161 | ftpd's line for inetd.conf: 1162 | 21 stream tcp nowait root ftpd ftpd /files/to/serve 1163 | It also can be ran from tcpsvd:

1164 |
1165 |         tcpsvd -vE 0.0.0.0 21 ftpd /files/to/serve
1166 |

Options:

1167 |
1168 |         -w      Allow upload
1169 |         -v      Log to stderr
1170 |         -S      Log to syslog
1171 |         -t,-T   Idle and absolute timeouts
1172 |         DIR     Change root to this directory
1173 |
1174 |
ftpget
1175 | 1176 |
1177 |

ftpget [OPTIONS] HOST LOCAL_FILE REMOTE_FILE

1178 |

Retrieve a remote file via FTP

1179 |

Options:

1180 |
1181 |         -c,--continue   Continue previous transfer
1182 |         -v,--verbose    Verbose
1183 |         -u,--username   Username
1184 |         -p,--password   Password
1185 |         -P,--port       Port number
1186 |
1187 |
ftpput
1188 | 1189 |
1190 |

ftpput [OPTIONS] HOST REMOTE_FILE LOCAL_FILE

1191 |

Store a local file on a remote machine via FTP

1192 |

Options:

1193 |
1194 |         -v,--verbose    Verbose
1195 |         -u,--username   Username
1196 |         -p,--password   Password
1197 |         -P,--port       Port number
1198 |
1199 |
fuser
1200 | 1201 |
1202 |

fuser [OPTIONS] FILE or PORT/PROTO

1203 |

Find processes which use FILEs or PORTs

1204 |

Options:

1205 |
1206 |         -m      Find processes which use same fs as FILEs
1207 |         -4      Search only IPv4 space
1208 |         -6      Search only IPv6 space
1209 |         -s      Silent: just exit with 0 if any processes are found
1210 |         -k      Kill found processes (otherwise display PIDs)
1211 |         -SIGNAL Signal to send (default: TERM)
1212 |
1213 |
getopt
1214 | 1215 |
1216 |

getopt [OPTIONS]

1217 |

Options:

1218 |
1219 |         -a,--alternative                Allow long options starting with single -
1220 |         -l,--longoptions=longopts       Long options to be recognized
1221 |         -n,--name=progname              The name under which errors are reported
1222 |         -o,--options=optstring          Short options to be recognized
1223 |         -q,--quiet                      Disable error reporting by getopt(3)
1224 |         -Q,--quiet-output               No normal output
1225 |         -s,--shell=shell                Set shell quoting conventions
1226 |         -T,--test                       Test for getopt(1) version
1227 |         -u,--unquoted                   Don't quote the output
1228 |
1229 |
getty
1230 | 1231 |
1232 |

getty [OPTIONS] BAUD_RATE TTY [TERMTYPE]

1233 |

Open a tty, prompt for a login name, then invoke /bin/login

1234 |

Options:

1235 |
1236 |         -h              Enable hardware (RTS/CTS) flow control
1237 |         -i              Do not display /etc/issue before running login
1238 |         -L              Local line, do not do carrier detect
1239 |         -m              Get baud rate from modem's CONNECT status message
1240 |         -w              Wait for a CR or LF before sending /etc/issue
1241 |         -n              Do not prompt the user for a login name
1242 |         -f ISSUE_FILE   Display ISSUE_FILE instead of /etc/issue
1243 |         -l LOGIN        Invoke LOGIN instead of /bin/login
1244 |         -t SEC          Terminate after SEC if no username is read
1245 |         -I INITSTR      Send INITSTR before anything else
1246 |         -H HOST         Log HOST into the utmp file as the hostname
1247 |
1248 |
grep
1249 | 1250 |
1251 |

grep [-HhrilLnqvsoweFEABCz] PATTERN [FILE]...

1252 |

Search for PATTERN in each FILE or standard input

1253 |

Options:

1254 |
1255 |         -H      Prefix output lines with filename where match was found
1256 |         -h      Suppress the prefixing filename on output
1257 |         -r      Recurse
1258 |         -i      Ignore case distinctions
1259 |         -l      List names of files that match
1260 |         -L      List names of files that do not match
1261 |         -n      Print line number with output lines
1262 |         -q      Quiet. Return 0 if PATTERN is found, 1 otherwise
1263 |         -v      Select non-matching lines
1264 |         -s      Suppress file open/read error messages
1265 |         -c      Only print count of matching lines
1266 |         -o      Show only the part of a line that matches PATTERN
1267 |         -m MAX  Match up to MAX times per file
1268 |         -w      Match whole words only
1269 |         -F      PATTERN is a set of newline-separated strings
1270 |         -E      PATTERN is an extended regular expression
1271 |         -e PTRN Pattern to match
1272 |         -f FILE Read pattern from file
1273 |         -A      Print NUM lines of trailing context
1274 |         -B      Print NUM lines of leading context
1275 |         -C      Print NUM lines of output context
1276 |         -z      Input is NUL terminated
1277 |
1278 |
gunzip
1279 | 1280 |
1281 |

gunzip [OPTIONS] [FILE]...

1282 |

Uncompress FILEs (or standard input)

1283 |

Options:

1284 |
1285 |         -c      Write to standard output
1286 |         -f      Force
1287 |         -t      Test file integrity
1288 |
1289 |
gzip
1290 | 1291 |
1292 |

gzip [OPTIONS] [FILE]...

1293 |

Compress FILEs (or standard input)

1294 |

Options:

1295 |
1296 |         -c      Write to standard output
1297 |         -d      Decompress
1298 |         -f      Force
1299 |
1300 |
hd
1301 | 1302 |
1303 |

hd FILE...

1304 |

hd is an alias for hexdump -C

1305 |
1306 |
hdparm
1307 | 1308 |
1309 |

hdparm [OPTIONS] [DEVICE]

1310 |

Options:

1311 |
1312 |         -a      Get/set fs readahead
1313 |         -A      Set drive read-lookahead flag (0/1)
1314 |         -b      Get/set bus state (0 == off, 1 == on, 2 == tristate)
1315 |         -B      Set Advanced Power Management setting (1-255)
1316 |         -c      Get/set IDE 32-bit IO setting
1317 |         -C      Check IDE power mode status
1318 |         -d      Get/set using_dma flag
1319 |         -D      Enable/disable drive defect-mgmt
1320 |         -f      Flush buffer cache for device on exit
1321 |         -g      Display drive geometry
1322 |         -h      Display terse usage information
1323 |         -i      Display drive identification
1324 |         -I      Detailed/current information directly from drive
1325 |         -k      Get/set keep_settings_over_reset flag (0/1)
1326 |         -K      Set drive keep_features_over_reset flag (0/1)
1327 |         -L      Set drive doorlock (0/1) (removable harddisks only)
1328 |         -m      Get/set multiple sector count
1329 |         -n      Get/set ignore-write-errors flag (0/1)
1330 |         -p      Set PIO mode on IDE interface chipset (0,1,2,3,4,...)
1331 |         -P      Set drive prefetch count
1332 |         -Q      Get/set DMA tagged-queuing depth (if supported)
1333 |         -r      Get/set readonly flag (DANGEROUS to set)
1334 |         -R      Register an IDE interface (DANGEROUS)
1335 |         -S      Set standby (spindown) timeout
1336 |         -t      Perform device read timings
1337 |         -T      Perform cache read timings
1338 |         -u      Get/set unmaskirq flag (0/1)
1339 |         -U      Un-register an IDE interface (DANGEROUS)
1340 |         -v      Defaults; same as -mcudkrag for IDE drives
1341 |         -V      Display program version and exit immediately
1342 |         -w      Perform device reset (DANGEROUS)
1343 |         -W      Set drive write-caching flag (0/1) (DANGEROUS)
1344 |         -x      Tristate device for hotswap (0/1) (DANGEROUS)
1345 |         -X      Set IDE xfer mode (DANGEROUS)
1346 |         -y      Put IDE drive in standby mode
1347 |         -Y      Put IDE drive to sleep
1348 |         -Z      Disable Seagate auto-powersaving mode
1349 |         -z      Re-read partition table
1350 |
1351 |
head
1352 | 1353 |
1354 |

head [OPTIONS] [FILE]...

1355 |

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

1358 |

Options:

1359 |
1360 |         -n NUM  Print first NUM lines instead of first 10
1361 |         -c NUM  Output the first NUM bytes
1362 |         -q      Never output headers giving file names
1363 |         -v      Always output headers giving file names
1364 |
1365 |
hexdump
1366 | 1367 |
1368 |

hexdump [-bcCdefnosvxR] FILE...

1369 |

Display file(s) or standard input in a user specified format

1370 |

Options:

1371 |
1372 |         -b              One-byte octal display
1373 |         -c              One-byte character display
1374 |         -C              Canonical hex+ASCII, 16 bytes per line
1375 |         -d              Two-byte decimal display
1376 |         -e FORMAT STRING
1377 |         -f FORMAT FILE
1378 |         -n LENGTH       Interpret only LENGTH bytes of input
1379 |         -o              Two-byte octal display
1380 |         -s OFFSET       Skip OFFSET bytes
1381 |         -v              Display all input data
1382 |         -x              Two-byte hexadecimal display
1383 |         -R              Reverse of 'hexdump -Cv'
1384 |
1385 |
hostid
1386 | 1387 |
1388 |

hostid

1389 |

Print out a unique 32-bit identifier for the machine

1390 |
1391 |
hostname
1392 | 1393 |
1394 |

hostname [OPTIONS] [HOSTNAME | -F FILE]

1395 |

Get or set hostname or DNS domain name

1396 |

Options:

1397 |
1398 |         -s      Short
1399 |         -i      Addresses for the hostname
1400 |         -d      DNS domain name
1401 |         -f      Fully qualified domain name
1402 |         -F FILE Use FILE's content as hostname
1403 |
1404 |
httpd
1405 | 1406 |
1407 |

httpd [-ifv[v]] [-c CONFFILE] [-p [IP:]PORT] [-u USER[:GRP]] [-r REALM] [-h HOME] 1408 | or httpd -d/-e/-m STRING

1409 |

Listen for incoming HTTP requests

1410 |

Options:

1411 |
1412 |         -i              Inetd mode
1413 |         -f              Do not daemonize
1414 |         -v[v]           Verbose
1415 |         -c FILE         Configuration file (default httpd.conf)
1416 |         -p [IP:]PORT    Bind to ip:port (default *:80)
1417 |         -u USER[:GRP]   Set uid/gid after binding to port
1418 |         -r REALM        Authentication Realm for Basic Authentication
1419 |         -h HOME         Home directory (default .)
1420 |         -m STRING       MD5 crypt STRING
1421 |         -e STRING       HTML encode STRING
1422 |         -d STRING       URL decode STRING
1423 |
1424 |
hwclock
1425 | 1426 |
1427 |

hwclock [-r|--show] [-s|--hctosys] [-w|--systohc] [-l|--localtime] [-u|--utc] [-f FILE]

1428 |

Query and set hardware clock (RTC)

1429 |

Options:

1430 |
1431 |         -r      Show hardware clock time
1432 |         -s      Set system time from hardware clock
1433 |         -w      Set hardware clock to system time
1434 |         -u      Hardware clock is in UTC
1435 |         -l      Hardware clock is in local time
1436 |         -f FILE Use specified device (e.g. /dev/rtc2)
1437 |
1438 |
id
1439 | 1440 |
1441 |

id [OPTIONS] [USER]

1442 |

Print information about USER or the current user

1443 |

Options:

1444 |
1445 |         -u      Print user ID
1446 |         -g      Print group ID
1447 |         -G      Print supplementary group IDs
1448 |         -n      Print name instead of a number
1449 |         -r      Print real user ID instead of effective ID
1450 |
1451 |
ifconfig
1452 | 1453 |
1454 |

ifconfig [-a] interface [address]

1455 |

Configure a network interface

1456 |

Options:

1457 |
1458 |         [add ADDRESS[/PREFIXLEN]]
1459 |         [del ADDRESS[/PREFIXLEN]]
1460 |         [[-]broadcast [ADDRESS]] [[-]pointopoint [ADDRESS]]
1461 |         [netmask ADDRESS] [dstaddr ADDRESS]
1462 |         [outfill NN] [keepalive NN]
1463 |         [hw ether|infiniband ADDRESS] [metric NN] [mtu NN]
1464 |         [[-]trailers] [[-]arp] [[-]allmulti]
1465 |         [multicast] [[-]promisc] [txqueuelen NN] [[-]dynamic]
1466 |         [mem_start NN] [io_addr NN] [irq NN]
1467 |         [up|down] ...
1468 |
1469 |
ifdown
1470 | 1471 |
1472 |

ifdown [-ainmvf] ifaces...

1473 |

Options:

1474 |
1475 |         -a      De/configure all interfaces automatically
1476 |         -i FILE Use FILE for interface definitions
1477 |         -n      Print out what would happen, but don't do it
1478 |                 (note: doesn't disable mappings)
1479 |         -m      Don't run any mappings
1480 |         -v      Print out what would happen before doing it
1481 |         -f      Force de/configuration
1482 |
1483 |
ifenslave
1484 | 1485 |
1486 |

ifenslave [-cdf] master-iface <slave-iface...>

1487 |

Configure network interfaces for parallel routing

1488 |

Options:

1489 |
1490 |         -c, --change-active     Change active slave
1491 |         -d, --detach            Remove slave interface from bonding device
1492 |         -f, --force             Force, even if interface is not Ethernet
1493 |
1494 |
ifplugd
1495 | 1496 |
1497 |

ifplugd [OPTIONS]

1498 |

Network interface plug detection daemon

1499 |

Options:

1500 |
1501 |         -n              Do not daemonize
1502 |         -s              Do not log to syslog
1503 |         -i IFACE        Interface
1504 |         -f/-F           Treat link detection error as link down/link up
1505 |                         (otherwise exit on error)
1506 |         -a              Do not up interface automatically
1507 |         -M              Monitor creation/destruction of interface
1508 |                         (otherwise it must exist)
1509 |         -r PROG         Script to run
1510 |         -x ARG          Extra argument for script
1511 |         -I              Don't exit on nonzero exit code from script
1512 |         -p              Don't run script on daemon startup
1513 |         -q              Don't run script on daemon quit
1514 |         -l              Run script on startup even if no cable is detected
1515 |         -t SECS         Poll time in seconds
1516 |         -u SECS         Delay before running script after link up
1517 |         -d SECS         Delay after link down
1518 |         -m MODE         API mode (mii, priv, ethtool, wlan, auto)
1519 |         -k              Kill running daemon
1520 |
1521 |
ifup
1522 | 1523 |
1524 |

ifup [-ainmvf] ifaces...

1525 |

Options:

1526 |
1527 |         -a      De/configure all interfaces automatically
1528 |         -i FILE Use FILE for interface definitions
1529 |         -n      Print out what would happen, but don't do it
1530 |                 (note: doesn't disable mappings)
1531 |         -m      Don't run any mappings
1532 |         -v      Print out what would happen before doing it
1533 |         -f      Force de/configuration
1534 |
1535 |
inetd
1536 | 1537 |
1538 |

inetd [-fe] [-q N] [-R N] [CONFFILE]

1539 |

Listen for network connections and launch programs

1540 |

Options:

1541 |
1542 |         -f      Run in foreground
1543 |         -e      Log to stderr
1544 |         -q N    Socket listen queue (default: 128)
1545 |         -R N    Pause services after N connects/min
1546 |                 (default: 0 - disabled)
1547 |
1548 |
init
1549 | 1550 |
1551 |

init

1552 |

Init is the parent of all processes

1553 |
1554 |
inotifyd
1555 | 1556 |
1557 |

inotifyd PROG FILE1[:MASK] ...

1558 |

Run PROG on filesystem changes. 1559 | When a filesystem event matching MASK occurs on FILEn, 1560 | PROG <actual_event(s)> <FILEn> [<subfile_name>] is run. 1561 | Events:

1562 |
1563 |         a       File is accessed
1564 |         c       File is modified
1565 |         e       Metadata changed
1566 |         w       Writable file is closed
1567 |         0       Unwritable file is closed
1568 |         r       File is opened
1569 |         D       File is deleted
1570 |         M       File is moved
1571 |         u       Backing fs is unmounted
1572 |         o       Event queue overflowed
1573 |         x       File can't be watched anymore
1574 | If watching a directory:
1575 |
1576 |         m       Subfile is moved into dir
1577 |         y       Subfile is moved out of dir
1578 |         n       Subfile is created
1579 |         d       Subfile is deleted
1580 |

inotifyd waits for PROG to exit. 1581 | When x event happens for all FILEs, inotifyd exits

1582 |
1583 |
insmod
1584 | 1585 |
1586 |

insmod [OPTIONS] MODULE [symbol=value]...

1587 |

Load the specified kernel modules into the kernel

1588 |

Options:

1589 |
1590 |         -f      Force module to load into the wrong kernel version
1591 |         -k      Make module autoclean-able
1592 |         -v      Verbose
1593 |         -q      Quiet
1594 |         -L      Lock to prevent simultaneous loads of a module
1595 |         -m      Output load map to stdout
1596 |         -o NAME Set internal module name to NAME
1597 |         -x      Do not export externs
1598 |
1599 |
install
1600 | 1601 |
1602 |

install [-cdDsp] [-o USER] [-g GRP] [-m MODE] [source] dest|directory

1603 |

Copy files and set attributes

1604 |

Options:

1605 |
1606 |         -c      Just copy (default)
1607 |         -d      Create directories
1608 |         -D      Create leading target directories
1609 |         -s      Strip symbol table
1610 |         -p      Preserve date
1611 |         -o USER Set ownership
1612 |         -g GRP  Set group ownership
1613 |         -m MODE Set permissions
1614 |
1615 |
ionice
1616 | 1617 |
1618 |

ionice [-c 1-3] [-n 0-7] [-p PID] [PROG]

1619 |

Change I/O scheduling class and priority

1620 |

Options:

1621 |
1622 |         -c      Class. 1:realtime 2:best-effort 3:idle
1623 |         -n      Priority
1624 |
1625 |
ip
1626 | 1627 |
1628 |

ip [OPTIONS] {address | route | link | tunnel | rule} {COMMAND}

1629 |

ip [OPTIONS] OBJECT {COMMAND} 1630 | where OBJECT := {address | route | link | tunnel | rule} 1631 | OPTIONS := { -f[amily] { inet | inet6 | link } | -o[neline] }

1632 |
1633 |
ipaddr
1634 | 1635 |
1636 |

ipaddr { {add|del} IFADDR dev STRING | {show|flush} 1637 |
[dev STRING] [to PREFIX] }

1638 |

ipaddr {add|delete} IFADDR dev STRING 1639 | ipaddr {show|flush} [dev STRING] [scope SCOPE-ID] 1640 | [to PREFIX] [label PATTERN] 1641 | IFADDR := PREFIX | ADDR peer PREFIX 1642 | [broadcast ADDR] [anycast ADDR] 1643 | [label STRING] [scope SCOPE-ID] 1644 | SCOPE-ID := [host | link | global | NUMBER]

1645 |
1646 |
ipcalc
1647 | 1648 |
1649 |

ipcalc [OPTIONS] ADDRESS[[/]NETMASK] [NETMASK]

1650 |

Calculate IP network settings from a IP address

1651 |

Options:

1652 |
1653 |         -b,--broadcast  Display calculated broadcast address
1654 |         -n,--network    Display calculated network address
1655 |         -m,--netmask    Display default netmask for IP
1656 |         -p,--prefix     Display the prefix for IP/NETMASK
1657 |         -h,--hostname   Display first resolved host name
1658 |         -s,--silent     Don't ever display error messages
1659 |
1660 |
ipcrm
1661 | 1662 |
1663 |

ipcrm [-MQS key] [-mqs id]

1664 |

Upper-case options MQS remove an object by shmkey value. 1665 | Lower-case options remove an object by shmid value.

1666 |

Options:

1667 |
1668 |         -mM     Remove memory segment after last detach
1669 |         -qQ     Remove message queue
1670 |         -sS     Remove semaphore
1671 |
1672 |
ipcs
1673 | 1674 |
1675 |

ipcs [[-smq] -i shmid] | [[-asmq] [-tcplu]]

1676 |
1677 |         -i      Show specific resource
1678 | Resource specification:
1679 |
1680 |         -m      Shared memory segments
1681 |         -q      Message queues
1682 |         -s      Semaphore arrays
1683 |         -a      All (default)
1684 | Output format:
1685 |
1686 |         -t      Time
1687 |         -c      Creator
1688 |         -p      Pid
1689 |         -l      Limits
1690 |         -u      Summary
1691 |
1692 |
iplink
1693 | 1694 |
1695 |

iplink { set DEVICE { up | down | arp { on | off } | show [DEVICE] }

1696 |

iplink set DEVICE { up | down | arp | multicast { on | off } | 1697 | dynamic { on | off } | 1698 | mtu MTU } 1699 | iplink show [DEVICE]

1700 |
1701 |
iproute
1702 | 1703 |
1704 |

iproute { list | flush | { add | del | change | append | 1705 |
replace | monitor } ROUTE }

1706 |

iproute { list | flush } SELECTOR 1707 | iproute get ADDRESS [from ADDRESS iif STRING] 1708 | [oif STRING] [tos TOS] 1709 | iproute { add | del | change | append | replace | monitor } ROUTE 1710 | SELECTOR := [root PREFIX] [match PREFIX] [proto RTPROTO] 1711 | ROUTE := [TYPE] PREFIX [tos TOS] [proto RTPROTO] 1712 | [metric METRIC]

1713 |
1714 |
iprule
1715 | 1716 |
1717 |

iprule {[list | add | del] RULE}

1718 |

iprule [list | add | del] SELECTOR ACTION 1719 |
SELECTOR := [from PREFIX] [to PREFIX] [tos TOS] [fwmark FWMARK] 1720 |
[dev STRING] [pref NUMBER] 1721 |
ACTION := [table TABLE_ID] [nat ADDRESS] 1722 |
[prohibit | reject | unreachable] 1723 |
[realms [SRCREALM/]DSTREALM] 1724 |
TABLE_ID := [local | main | default | NUMBER]

1725 |
1726 |
iptunnel
1727 | 1728 |
1729 |

iptunnel { add | change | del | show } [NAME] 1730 |
[mode { ipip | gre | sit }] 1731 |
[remote ADDR] [local ADDR] [ttl TTL]

1732 |

iptunnel { add | change | del | show } [NAME] 1733 |
[mode { ipip | gre | sit }] [remote ADDR] [local ADDR] 1734 |
[[i|o]seq] [[i|o]key KEY] [[i|o]csum] 1735 |
[ttl TTL] [tos TOS] [[no]pmtudisc] [dev PHYS_DEV]

1736 |
1737 |
kbd_mode
1738 | 1739 |
1740 |

kbd_mode [-a|k|s|u] [-C TTY]

1741 |

Report or set the keyboard mode

1742 |

Options:

1743 |
1744 |         -a      Default (ASCII)
1745 |         -k      Medium-raw (keyboard)
1746 |         -s      Raw (scancode)
1747 |         -u      Unicode (utf-8)
1748 |         -C TTY  Affect TTY instead of /dev/tty
1749 |
1750 |
kill
1751 | 1752 |
1753 |

kill [-l] [-SIG] PID...

1754 |

Send a signal (default: TERM) to given PIDs

1755 |

Options:

1756 |
1757 |         -l      List all signal names and numbers
1758 |
1759 |
killall
1760 | 1761 |
1762 |

killall [-l] [-q] [-SIG] process-name...

1763 |

Send a signal (default: TERM) to given processes

1764 |

Options:

1765 |
1766 |         -l      List all signal names and numbers
1767 |         -q      Do not complain if no processes were killed
1768 |
1769 |
killall5
1770 | 1771 |
1772 |

killall5 [-l] [-SIG] [-o PID]...

1773 |

Send a signal (default: TERM) to all processes outside current session

1774 |

Options:

1775 |
1776 |         -l      List all signal names and numbers
1777 |         -o PID  Do not signal this PID
1778 |
1779 |
klogd
1780 | 1781 |
1782 |

klogd [-c N] [-n]

1783 |

Kernel logger

1784 |

Options:

1785 |
1786 |         -c N    Only messages with level < N are printed to console
1787 |         -n      Run in foreground
1788 |
1789 |
last
1790 | 1791 |
1792 |

last [-HW] [-f file]

1793 |

Show listing of the last users that logged into the system

1794 |

Options:

1795 |
1796 |         -W      Display with no host column truncation
1797 |         -f file Read from file instead of /var/log/wtmp
1798 |
1799 |
length
1800 | 1801 |
1802 |

length STRING

1803 |

Print STRING's length

1804 |
1805 |
less
1806 | 1807 |
1808 |

less [-EMNmh~I?] [FILE]...

1809 |

View a file or list of files. The position within files can be 1810 | changed, and files can be manipulated in various ways.

1811 |

Options:

1812 |
1813 |         -E      Quit once the end of a file is reached
1814 |         -M,-m   Display status line with line numbers
1815 |                 and percentage through the file
1816 |         -N      Prefix line number to each line
1817 |         -I      Ignore case in all searches
1818 |         -~      Suppress ~s displayed past the end of the file
1819 |
1820 |
ln
1821 | 1822 |
1823 |

ln [OPTIONS] TARGET... LINK|DIRECTORY

1824 |

Create a link LINK or DIRECTORY/TARGET to the specified TARGET(s)

1825 |

Options:

1826 |
1827 |         -s      Make symlinks instead of hardlinks
1828 |         -f      Remove existing destination files
1829 |         -n      Don't dereference symlinks - treat like normal file
1830 |         -b      Make a backup of the target (if exists) before link operation
1831 |         -S suf  Use suffix instead of ~ when making backup files
1832 |
1833 |
loadfont
1834 | 1835 |
1836 |

loadfont < font

1837 |

Load a console font from standard input

1838 |
1839 |
loadkmap
1840 | 1841 |
1842 |

loadkmap < keymap

1843 |

Load a binary keyboard translation table from standard input

1844 |
1845 |
logger
1846 | 1847 |
1848 |

logger [OPTIONS] [MESSAGE]

1849 |

Write MESSAGE to the system log. If MESSAGE is omitted, log stdin.

1850 |

Options:

1851 |
1852 |         -s      Log to stderr as well as the system log
1853 |         -t TAG  Log using the specified tag (defaults to user name)
1854 |         -p PRIO Priority (numeric or facility.level pair)
1855 |
1856 |
login
1857 | 1858 |
1859 |

login [-p] [-h HOST] [[-f] USER]

1860 |

Begin a new session on the system

1861 |

Options:

1862 |
1863 |         -f      Do not authenticate (user already authenticated)
1864 |         -h      Name of the remote host
1865 |         -p      Preserve environment
1866 |
1867 |
logname
1868 | 1869 |
1870 |

logname

1871 |

Print the name of the current user

1872 |
1873 |
logread
1874 | 1875 |
1876 |

logread [OPTIONS]

1877 |

Show messages in syslogd's circular buffer

1878 |

Options:

1879 |
1880 |         -f      Output data as log grows
1881 |
1882 |
losetup
1883 | 1884 |
1885 |

losetup [-o OFS] LOOPDEV FILE - associate loop devices 1886 |
losetup -d LOOPDEV - disassociate 1887 |
losetup [-f] - show

1888 |

Options:

1889 |
1890 |         -o OFS  Start OFS bytes into FILE
1891 |         -f      Show first free loop device
1892 |
1893 |
lpd
1894 | 1895 |
1896 |

lpd SPOOLDIR [HELPER [ARGS]]

1897 |

SPOOLDIR must contain (symlinks to) device nodes or directories 1898 | with names matching print queue names. In the first case, jobs are 1899 | sent directly to the device. Otherwise each job is stored in queue 1900 | directory and HELPER program is called. Name of file to print 1901 | is passed in $DATAFILE variable. 1902 | Example:

1903 |
1904 |         tcpsvd -E 0 515 softlimit -m 999999 lpd /var/spool ./print
1905 |
1906 |
lpq
1907 | 1908 |
1909 |

lpq [-P queue[@host[:port]]] [-U USERNAME] [-d JOBID...] [-fs]

1910 |

Options:

1911 |
1912 |         -P      lp service to connect to (else uses $PRINTER)
1913 |         -d      Delete jobs
1914 |         -f      Force any waiting job to be printed
1915 |         -s      Short display
1916 |
1917 |
lpr
1918 | 1919 |
1920 |

lpr -P queue[@host[:port]] -U USERNAME -J TITLE -Vmh [FILE]...

1921 |

Options:

1922 |
1923 |         -P      lp service to connect to (else uses $PRINTER)
1924 |         -m      Send mail on completion
1925 |         -h      Print banner page too
1926 |         -V      Verbose
1927 |
1928 |
ls
1929 | 1930 |
1931 |

ls [-1AacCdeFilnpLRrSsTtuvwxXhk] [FILE]...

1932 |

List directory contents

1933 |

Options:

1934 |
1935 |         -1      List in a single column
1936 |         -A      Don't list . and ..
1937 |         -a      Don't hide entries starting with .
1938 |         -C      List by columns
1939 |         -c      With -l: sort by ctime
1940 |         --color[={always,never,auto}]   Control coloring
1941 |         -d      List directory entries instead of contents
1942 |         -e      List full date and time
1943 |         -F      Append indicator (one of */=@|) to entries
1944 |         -i      List inode numbers
1945 |         -l      Long listing format
1946 |         -n      List numeric UIDs and GIDs instead of names
1947 |         -p      Append indicator (one of /=@|) to entries
1948 |         -L      List entries pointed to by symlinks
1949 |         -R      List subdirectories recursively
1950 |         -r      Sort in reverse order
1951 |         -S      Sort by file size
1952 |         -s      List the size of each file, in blocks
1953 |         -T NUM  Assume tabstop every NUM columns
1954 |         -t      With -l: sort by modification time
1955 |         -u      With -l: sort by access time
1956 |         -v      Sort by version
1957 |         -w NUM  Assume the terminal is NUM columns wide
1958 |         -x      List by lines
1959 |         -X      Sort by extension
1960 |         -h      List sizes in human readable format (1K 243M 2G)
1961 |
1962 |
lsattr
1963 | 1964 |
1965 |

lsattr [-Radlv] [FILE]...

1966 |

List file attributes on an ext2 fs

1967 |

Options:

1968 |
1969 |         -R      Recursively list subdirectories
1970 |         -a      Do not hide entries starting with .
1971 |         -d      List directory entries instead of contents
1972 |         -l      List long flag names
1973 |         -v      List the file's version/generation number
1974 |
1975 |
lsmod
1976 | 1977 |
1978 |

lsmod

1979 |

List the currently loaded kernel modules

1980 |
1981 |
lzmacat
1982 | 1983 |
1984 |

lzmacat FILE

1985 |

Uncompress to stdout

1986 |
1987 |
lzop
1988 | 1989 |
1990 |

lzop [-cfvd123456789CF] [FILE]...

1991 |
1992 |         -c      Write to standard output
1993 |         -f      Force
1994 |         -v      Verbose
1995 |         -d      Decompress
1996 |         -F      Don't store or verify checksum
1997 |         -C      Also write checksum of compressed block
1998 |         -1..9   Compression level
1999 |
2000 |
lzopcat
2001 | 2002 |
2003 |

lzopcat [-vCF] [FILE]...

2004 |
2005 |         -v      Verbose
2006 |         -F      Don't store or verify checksum
2007 |
2008 |
makemime
2009 | 2010 |
2011 |

makemime [OPTIONS] [FILE]...

2012 |

Create multipart MIME-encoded message from FILEs

2013 |

Options:

2014 |
2015 |         -o FILE Output. Default: stdout
2016 |         -a HDR  Add header. Examples:
2017 |                 "From: user@host.org", "Date: `date -R`"
2018 |         -c CT   Content type. Default: text/plain
2019 |         -C CS   Charset. Default: us-ascii
2020 |

Other options are silently ignored

2021 |
2022 |
man
2023 | 2024 |
2025 |

man [OPTIONS] [MANPAGE]...

2026 |

Format and display manual page

2027 |

Options:

2028 |
2029 |         -a      Display all pages
2030 |         -w      Show page locations
2031 |
2032 |
md5sum
2033 | 2034 |
2035 |

md5sum [OPTIONS] [FILE]... 2036 | or: md5sum [OPTIONS] -c [FILE]

2037 |

Print or check MD5 checksums

2038 |

Options:

2039 |
2040 |         -c      Check sums against given list
2041 |         -s      Don't output anything, status code shows success
2042 |         -w      Warn about improperly formatted checksum lines
2043 |
2044 |
mdev
2045 | 2046 |
2047 |

mdev [-s]

2048 |
2049 |         -s      Scan /sys and populate /dev during system boot
2050 |

It can be run by kernel as a hotplug helper. To activate it: 2051 | echo /bin/mdev >/proc/sys/kernel/hotplug 2052 | It uses /etc/mdev.conf with lines 2053 | [-]DEVNAME UID:GID PERM [>|=PATH] [@|$|*PROG]

2054 |
2055 |
mesg
2056 | 2057 |
2058 |

mesg [y|n]

2059 |

Control write access to your terminal 2060 |
yAllow write access to your terminal 2061 |
nDisallow write access to your terminal

2062 |
2063 |
microcom
2064 | 2065 |
2066 |

microcom [-d DELAY] [-t TIMEOUT] [-s SPEED] [-X] TTY

2067 |

Copy bytes for stdin to TTY and from TTY to stdout

2068 |

Options:

2069 |
2070 |         -d      Wait up to DELAY ms for TTY output before sending every
2071 |                 next byte to it
2072 |         -t      Exit if both stdin and TTY are silent for TIMEOUT ms
2073 |         -s      Set serial line to SPEED
2074 |         -X      Disable special meaning of NUL and Ctrl-X from stdin
2075 |
2076 |
mkdir
2077 | 2078 |
2079 |

mkdir [OPTIONS] DIRECTORY...

2080 |

Create DIRECTORY

2081 |

Options:

2082 |
2083 |         -m      Mode
2084 |         -p      No error if exists; make parent directories as needed
2085 |
2086 |
mkdosfs
2087 | 2088 |
2089 |

mkdosfs [-v] [-n LABEL] FILE_OR_DEVICE [SIZE_IN_KB]

2090 |

Make a FAT32 filesystem

2091 |

Options:

2092 |
2093 |         -v      Verbose
2094 |         -n LBL  Volume label
2095 |
2096 |
mkfifo
2097 | 2098 |
2099 |

mkfifo [OPTIONS] name

2100 |

Create named pipe (identical to 'mknod name p')

2101 |

Options:

2102 |
2103 |         -m MODE Mode (default a=rw)
2104 |
2105 |
mkfs.minix
2106 | 2107 |
2108 |

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

2109 |

Make a MINIX filesystem

2110 |

Options:

2111 |
2112 |         -c              Check device for bad blocks
2113 |         -n [14|30]      Maximum length of filenames
2114 |         -i INODES       Number of inodes for the filesystem
2115 |         -l FILENAME     Read bad blocks list from FILENAME
2116 |         -v              Make version 2 filesystem
2117 |
2118 |
mkfs.vfat
2119 | 2120 |
2121 |

mkfs.vfat [-v] [-n LABEL] FILE_OR_DEVICE [SIZE_IN_KB]

2122 |

Make a FAT32 filesystem

2123 |

Options:

2124 |
2125 |         -v      Verbose
2126 |         -n LBL  Volume label
2127 |
2128 |
mknod
2129 | 2130 |
2131 |

mknod [OPTIONS] NAME TYPE MAJOR MINOR

2132 |

Create a special file (block, character, or pipe)

2133 |

Options:

2134 |
2135 |         -m      Create the special file using the specified mode (default a=rw)
2136 | TYPEs include:
2137 |
2138 |         b:      Make a block device
2139 |         c or u: Make a character device
2140 |         p:      Make a named pipe (MAJOR and MINOR are ignored)
2141 |
2142 |
mkpasswd
2143 | 2144 |
2145 |

mkpasswd [OPTIONS] [PASSWORD] [SALT]

2146 |

Crypt the PASSWORD using crypt(3)

2147 |

Options:

2148 |
2149 |         -P,--password-fd=NUM    Read password from fd NUM
2150 |         -m,--method=TYPE        Encryption method TYPE
2151 |         -S,--salt=SALT
2152 |
2153 |
mkswap
2154 | 2155 |
2156 |

mkswap DEVICE

2157 |

Prepare block device to be used as swap partition

2158 |
2159 |
mktemp
2160 | 2161 |
2162 |

mktemp [-dt] [-p DIR] [TEMPLATE]

2163 |

Create a temporary file with name based on TEMPLATE and print its name. 2164 | TEMPLATE must end with XXXXXX (e.g. [/dir/]nameXXXXXX).

2165 |

Options:

2166 |
2167 |         -d      Make a directory instead of a file
2168 |         -t      Generate a path rooted in temporary directory
2169 |         -p DIR  Use DIR as a temporary directory (implies -t)
2170 |

For -t or -p, directory is chosen as follows: 2171 | $TMPDIR if set, else -p DIR, else /tmp

2172 |
2173 |
modprobe
2174 | 2175 |
2176 |

modprobe [-knqrsvb] MODULE [symbol=value...]

2177 |

Options:

2178 |
2179 |         -k      Make module autoclean-able
2180 |         -n      Dry run
2181 |         -q      Quiet
2182 |         -r      Remove module (stacks) or do autoclean
2183 |         -s      Report via syslog instead of stderr
2184 |         -v      Verbose
2185 |         -b      Apply blacklist to module names too
2186 |
2187 |
more
2188 | 2189 |
2190 |

more [FILE]...

2191 |

View FILE or standard input one screenful at a time

2192 |
2193 |
mount
2194 | 2195 |
2196 |

mount [flags] DEVICE NODE [-o OPT,OPT]

2197 |

Mount a filesystem. Filesystem autodetection requires /proc.

2198 |

Options:

2199 |
2200 |         -a              Mount all filesystems in fstab
2201 |         -f              Dry run
2202 |         -i              Don't run mount helper
2203 |         -r              Read-only mount
2204 |         -w              Read-write mount (default)
2205 |         -t FSTYPE       Filesystem type
2206 |         -O OPT          Mount only filesystems with option OPT (-a only)
2207 | -o OPT:
2208 |         loop            Ignored (loop devices are autodetected)
2209 |         [a]sync         Writes are [a]synchronous
2210 |         [no]atime       Disable/enable updates to inode access times
2211 |         [no]diratime    Disable/enable atime updates to directories
2212 |         [no]relatime    Disable/enable atime updates relative to modification time
2213 |         [no]dev         (Dis)allow use of special device files
2214 |         [no]exec        (Dis)allow use of executable files
2215 |         [no]suid        (Dis)allow set-user-id-root programs
2216 |         [r]shared       Convert [recursively] to a shared subtree
2217 |         [r]slave        Convert [recursively] to a slave subtree
2218 |         [r]private      Convert [recursively] to a private subtree
2219 |         [un]bindable    Make mount point [un]able to be bind mounted
2220 |         bind            Bind a directory to an additional location
2221 |         move            Relocate an existing mount point
2222 |         remount         Remount a mounted filesystem, changing its flags
2223 |         ro/rw           Read-only/read-write mount
2224 |

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

2226 |
2227 |
mountpoint
2228 | 2229 |
2230 |

mountpoint [-q] <[-dn] DIR | -x DEVICE>

2231 |

Check if the directory is a mountpoint

2232 |

Options:

2233 |
2234 |         -q      Quiet
2235 |         -d      Print major/minor device number of the filesystem
2236 |         -n      Print device name of the filesystem
2237 |         -x      Print major/minor device number of the blockdevice
2238 |
2239 |
mt
2240 | 2241 |
2242 |

mt [-f device] opcode value

2243 |

Control magnetic tape drive operation

2244 |

Available Opcodes:

2245 |

bsf bsfm bsr bss datacompression drvbuffer eof eom erase 2246 | fsf fsfm fsr fss load lock mkpart nop offline ras1 ras2 2247 | ras3 reset retension rewind rewoffline seek setblk setdensity 2248 | setpart tell unload unlock weof wset

2249 |
2250 |
mv
2251 | 2252 |
2253 |

mv [OPTIONS] SOURCE DEST 2254 | or: mv [OPTIONS] SOURCE... DIRECTORY

2255 |

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

2256 |

Options:

2257 |
2258 |         -f      Don't prompt before overwriting
2259 |         -i      Interactive, prompt before overwrite
2260 |
2261 |
nameif
2262 | 2263 |
2264 |

nameif [-s] [-c FILE] [{IFNAME MACADDR}]

2265 |

Rename network interface while it in the down state

2266 |

Options:

2267 |
2268 |         -c FILE         Use configuration file (default: /etc/mactab)
2269 |         -s              Use syslog (LOCAL0 facility)
2270 |         IFNAME MACADDR  new_interface_name interface_mac_address
2271 |
2272 |
nc
2273 | 2274 |
2275 |

nc [OPTIONS] HOST PORT - connect 2276 | nc [OPTIONS] -l -p PORT [HOST] [PORT] - listen

2277 |

Options:

2278 |
2279 |         -e PROG         Run PROG after connect (must be last)
2280 |         -l              Listen mode, for inbound connects
2281 |         -n              Don't do DNS resolution
2282 |         -s ADDR         Local address
2283 |         -p PORT         Local port
2284 |         -u              UDP mode
2285 |         -v              Verbose
2286 |         -w SEC          Timeout for connects and final net reads
2287 |         -i SEC          Delay interval for lines sent
2288 |         -o FILE         Hex dump traffic
2289 |         -z              Zero-I/O mode (scanning)
2290 |
2291 |
netstat
2292 | 2293 |
2294 |

netstat [-laentuwxrWp]

2295 |

Display networking information

2296 |

Options:

2297 |
2298 |         -l      Display listening server sockets
2299 |         -a      Display all sockets (default: connected)
2300 |         -e      Display other/more information
2301 |         -n      Don't resolve names
2302 |         -t      Tcp sockets
2303 |         -u      Udp sockets
2304 |         -w      Raw sockets
2305 |         -x      Unix sockets
2306 |         -r      Display routing table
2307 |         -W      Display with no column truncation
2308 |         -p      Display PID/Program name for sockets
2309 |
2310 |
nice
2311 | 2312 |
2313 |

nice [-n ADJUST] [PROG [ARGS]]

2314 |

Run PROG with modified scheduling priority

2315 |

Options:

2316 |
2317 |         -n ADJUST       Adjust priority by ADJUST
2318 |
2319 |
nmeter
2320 | 2321 |
2322 |

nmeter format_string

2323 |

Monitor system in real time

2324 |

Format specifiers:

2325 |
2326 |  %Nc or %[cN]   Monitor CPU. N - bar size, default 10
2327 |                 (displays: S:system U:user N:niced D:iowait I:irq i:softirq)
2328 |  %[niface]      Monitor network interface 'iface'
2329 |  %m             Monitor allocated memory
2330 |  %[mf]          Monitor free memory
2331 |  %[mt]          Monitor total memory
2332 |  %s             Monitor allocated swap
2333 |  %f             Monitor number of used file descriptors
2334 |  %Ni            Monitor total/specific IRQ rate
2335 |  %x             Monitor context switch rate
2336 |  %p             Monitor forks
2337 |  %[pn]          Monitor # of processes
2338 |  %b             Monitor block io
2339 |  %Nt            Show time (with N decimal points)
2340 |  %Nd            Milliseconds between updates (default:1000)
2341 |  %r             Print <cr> instead of <lf> at EOL
2342 |
2343 |
nohup
2344 | 2345 |
2346 |

nohup PROG [ARGS]

2347 |

Run PROG immune to hangups, with output to a non-tty

2348 |
2349 |
nslookup
2350 | 2351 |
2352 |

nslookup [HOST] [SERVER]

2353 |

Query the nameserver for the IP address of the given HOST 2354 | optionally using a specified DNS server

2355 |
2356 |
od
2357 | 2358 |
2359 |

od [-aBbcDdeFfHhIiLlOovXx] [-t TYPE] [FILE]

2360 |

Write an unambiguous representation, octal bytes by default, of FILE 2361 | to standard output. With no FILE or when FILE is -, read standard input.

2362 |
2363 |
openvt
2364 | 2365 |
2366 |

openvt [-c N] [-sw] [PROG [ARGS]]

2367 |

Start PROG on a new virtual terminal

2368 |

Options:

2369 |
2370 |         -c N    Use specified VT
2371 |         -s      Switch to the VT
2372 |         -w      Wait for PROG to exit
2373 |
2374 |
passwd
2375 | 2376 |
2377 |

passwd [OPTIONS] [USER]

2378 |

Change USER's password. If no USER is specified, 2379 | changes the password for the current user.

2380 |

Options:

2381 |
2382 |         -a      Algorithm to use for password (choices: des, md5)
2383 |         -d      Delete password for the account
2384 |         -l      Lock (disable) account
2385 |         -u      Unlock (re-enable) account
2386 |
2387 |
patch
2388 | 2389 |
2390 |

patch [-p NUM] [-i DIFF] [-R] [-N]

2391 |
2392 |         -p NUM  Strip NUM leading components from file names
2393 |         -i DIFF Read DIFF instead of stdin
2394 |         -R      Reverse patch
2395 |         -N      Ignore already applied patches
2396 |
2397 |
pgrep
2398 | 2399 |
2400 |

pgrep [-flnovx] [-s SID|-P PPID|PATTERN]

2401 |

Display process(es) selected by regex PATTERN

2402 |

Options:

2403 |
2404 |         -l      Show command name too
2405 |         -f      Match against entire command line
2406 |         -n      Show the newest process only
2407 |         -o      Show the oldest process only
2408 |         -v      Negate the match
2409 |         -x      Match whole name (not substring)
2410 |         -s      Match session ID (0 for current)
2411 |         -P      Match parent process ID
2412 |
2413 |
pidof
2414 | 2415 |
2416 |

pidof [OPTIONS] [NAME...]

2417 |

List PIDs of all processes with names that match NAMEs

2418 |

Options:

2419 |
2420 |         -s      Show only one PID
2421 |         -o PID  Omit given pid
2422 |                 Use %PPID to omit pid of pidof's parent
2423 |
2424 |
ping
2425 | 2426 |
2427 |

ping [OPTIONS] HOST

2428 |

Send ICMP ECHO_REQUEST packets to network hosts

2429 |

Options:

2430 |
2431 |         -4, -6          Force IPv4 or IPv6 hostname resolution
2432 |         -c CNT          Send only CNT pings
2433 |         -s SIZE         Send SIZE data bytes in packets (default:56)
2434 |         -I IFACE/IP     Use interface or IP address as source
2435 |         -W SEC          Seconds to wait for the first response (default:10)
2436 |                         (after all -c CNT packets are sent)
2437 |         -w SEC          Seconds until ping exits (default:infinite)
2438 |                         (can exit earlier with -c CNT)
2439 |         -q              Quiet, only displays output at start
2440 |                         and when finished
2441 |
2442 |
ping6
2443 | 2444 |
2445 |

ping6 [OPTIONS] HOST

2446 |

Send ICMP ECHO_REQUEST packets to network hosts

2447 |

Options:

2448 |
2449 |         -c CNT          Send only CNT pings
2450 |         -s SIZE         Send SIZE data bytes in packets (default:56)
2451 |         -I IFACE/IP     Use interface or IP address as source
2452 |         -q              Quiet, only displays output at start
2453 |                         and when finished
2454 |
2455 |
pivot_root
2456 | 2457 |
2458 |

pivot_root NEW_ROOT PUT_OLD

2459 |

Move the current root file system to PUT_OLD and make NEW_ROOT 2460 | the new root file system

2461 |
2462 |
pkill
2463 | 2464 |
2465 |

pkill [-l|-SIGNAL] [-fnovx] [-s SID|-P PPID|PATTERN]

2466 |

Send a signal to process(es) selected by regex PATTERN

2467 |

Options:

2468 |
2469 |         -l      List all signals
2470 |         -f      Match against entire command line
2471 |         -n      Signal the newest process only
2472 |         -o      Signal the oldest process only
2473 |         -v      Negate the match
2474 |         -x      Match whole name (not substring)
2475 |         -s      Match session ID (0 for current)
2476 |         -P      Match parent process ID
2477 |
2478 |
popmaildir
2479 | 2480 |
2481 |

popmaildir [OPTIONS] Maildir [connection-helper ...]

2482 |

Fetch content of remote mailbox to local maildir

2483 |

Options:

2484 |
2485 |         -b              Binary mode. Ignored
2486 |         -d              Debug. Ignored
2487 |         -m              Show used memory. Ignored
2488 |         -V              Show version. Ignored
2489 |         -c              Use tcpclient. Ignored
2490 |         -a              Use APOP protocol. Implied. If server supports APOP -> use it
2491 |         -s              Skip authorization
2492 |         -T              Get messages with TOP instead with RETR
2493 |         -k              Keep retrieved messages on the server
2494 |         -t timeout      Network timeout
2495 |         -F "program arg1 arg2 ..."      Filter by program. May be multiple
2496 |         -M "program arg1 arg2 ..."      Deliver by program
2497 |         -R size         Remove old messages on the server >= size (in bytes). Ignored
2498 |         -Z N1-N2        Remove messages from N1 to N2 (dangerous). Ignored
2499 |         -L size         Do not retrieve new messages >= size (in bytes). Ignored
2500 |         -H lines        Type specified number of lines of a message. Ignored
2501 |
2502 |
printenv
2503 | 2504 |
2505 |

printenv [VARIABLE...]

2506 |

Print all or part of environment. 2507 | If no environment VARIABLE specified, print them all.

2508 |
2509 |
printf
2510 | 2511 |
2512 |

printf FORMAT [ARGUMENT...]

2513 |

Format and print ARGUMENT(s) according to FORMAT, 2514 | where FORMAT controls the output exactly as in C printf

2515 |
2516 |
ps
2517 | 2518 |
2519 |

ps

2520 |

Report process status

2521 |

Options:

2522 |
2523 |         -o col1,col2=header     Select columns for display
2524 |         -T                      Show threads
2525 |
2526 |
pscan
2527 | 2528 |
2529 |

pscan [-cb] [-p MIN_PORT] [-P MAX_PORT] [-t TIMEOUT] [-T MIN_RTT] HOST

2530 |

Scan a host, print all open ports

2531 |

Options:

2532 |
2533 |         -c      Show closed ports too
2534 |         -b      Show blocked ports too
2535 |         -p      Scan from this port (default 1)
2536 |         -P      Scan up to this port (default 1024)
2537 |         -t      Timeout (default 5000 ms)
2538 |         -T      Minimum rtt (default 5 ms, increase for congested hosts)
2539 |
2540 |
pwd
2541 | 2542 |
2543 |

pwd

2544 |

Print the full filename of the current working directory

2545 |
2546 |
raidautorun
2547 | 2548 |
2549 |

raidautorun DEVICE

2550 |

Tell the kernel to automatically search and start RAID arrays

2551 |
2552 |
rdate
2553 | 2554 |
2555 |

rdate [-sp] HOST

2556 |

Get and possibly set the system date and time from a remote HOST

2557 |

Options:

2558 |
2559 |         -s      Set the system date and time (default)
2560 |         -p      Print the date and time
2561 |
2562 |
rdev
2563 | 2564 |
2565 |

rdev

2566 |

Print the device node associated with the filesystem mounted at '/'

2567 |
2568 |
readlink
2569 | 2570 |
2571 |

readlink [-fnv] FILE

2572 |

Display the value of a symlink

2573 |

Options:

2574 |
2575 |         -f      Canonicalize by following all symlinks
2576 |         -n      Don't add newline
2577 |         -v      Verbose
2578 |
2579 |
readprofile
2580 | 2581 |
2582 |

readprofile [OPTIONS]

2583 |

Options:

2584 |
2585 |         -m mapfile      (Default: /boot/System.map)
2586 |         -p profile      (Default: /proc/profile)
2587 |         -M mult         Set the profiling multiplier to mult
2588 |         -i              Print only info about the sampling step
2589 |         -v              Verbose
2590 |         -a              Print all symbols, even if count is 0
2591 |         -b              Print individual histogram-bin counts
2592 |         -s              Print individual counters within functions
2593 |         -r              Reset all the counters (root only)
2594 |         -n              Disable byte order auto-detection
2595 |
2596 |
realpath
2597 | 2598 |
2599 |

realpath pathname...

2600 |

Return the absolute pathnames of given argument

2601 |
2602 |
reformime
2603 | 2604 |
2605 |

reformime [OPTIONS] [FILE]...

2606 |

Parse MIME-encoded message

2607 |

Options:

2608 |
2609 |         -x prefix       Extract content of MIME sections to files
2610 |         -X prog [args]  Filter content of MIME sections through prog.
2611 |                         Must be the last option
2612 |

Other options are silently ignored.

2613 |
2614 |
renice
2615 | 2616 |
2617 |

renice {{-n INCREMENT} | PRIORITY} [[-p | -g | -u] ID...]

2618 |

Change priority of running processes

2619 |

Options:

2620 |
2621 |         -n      Adjust current nice value (smaller is faster)
2622 |         -p      Process id(s) (default)
2623 |         -g      Process group id(s)
2624 |         -u      Process user name(s) and/or id(s)
2625 |
2626 |
reset
2627 | 2628 |
2629 |

reset

2630 |

Reset the screen

2631 |
2632 |
resize
2633 | 2634 |
2635 |

resize

2636 |

Resize the screen

2637 |
2638 |
rm
2639 | 2640 |
2641 |

rm [OPTIONS] FILE...

2642 |

Remove (unlink) the FILE(s). Use '--' to 2643 | indicate that all following arguments are non-options.

2644 |

Options:

2645 |
2646 |         -i      Always prompt before removing
2647 |         -f      Never prompt
2648 |         -r,-R   Remove directories recursively
2649 |
2650 |
rmdir
2651 | 2652 |
2653 |

rmdir [OPTIONS] DIRECTORY...

2654 |

Remove the DIRECTORY, if it is empty

2655 |

Options:

2656 |
2657 |         -p|--parents    Include parents
2658 |         --ignore-fail-on-non-empty
2659 |
2660 |
rmmod
2661 | 2662 |
2663 |

rmmod [OPTIONS] [MODULE]...

2664 |

Unload the specified kernel modules from the kernel

2665 |

Options:

2666 |
2667 |         -w      Wait until the module is no longer used
2668 |         -f      Force unloading
2669 |         -a      Remove all unused modules (recursively)
2670 |
2671 |
route
2672 | 2673 |
2674 |

route [{add|del|delete}]

2675 |

Edit kernel routing tables

2676 |

Options:

2677 |
2678 |         -n      Don't resolve names
2679 |         -e      Display other/more information
2680 |         -A inet{6}      Select address family
2681 |
2682 |
rpm
2683 | 2684 |
2685 |

rpm -i -q[ildc]p package.rpm

2686 |

Manipulate RPM packages

2687 |

Options:

2688 |
2689 |         -i      Install package
2690 |         -q      Query package
2691 |         -p      Query uninstalled package
2692 |         -i      Show information
2693 |         -l      List contents
2694 |         -d      List documents
2695 |         -c      List config files
2696 |
2697 |
rpm2cpio
2698 | 2699 |
2700 |

rpm2cpio package.rpm

2701 |

Output a cpio archive of the rpm file

2702 |
2703 |
rtcwake
2704 | 2705 |
2706 |

rtcwake [-a | -l | -u] [-d DEV] [-m MODE] [-s SEC | -t TIME]

2707 |

Enter a system sleep state until specified wakeup time

2708 |
2709 |         -a,--auto       Read clock mode from adjtime
2710 |         -l,--local      Clock is set to local time
2711 |         -u,--utc        Clock is set to UTC time
2712 |         -d,--device=DEV Specify the RTC device
2713 |         -m,--mode=MODE  Set the sleep state (default: standby)
2714 |         -s,--seconds=SEC Set the timeout in SEC seconds from now
2715 |         -t,--time=TIME  Set the timeout to TIME seconds from epoch
2716 |
2717 |
run-parts
2718 | 2719 |
2720 |

run-parts [-t] [-l] [-a ARG] [-u MASK] DIRECTORY

2721 |

Run a bunch of scripts in a directory

2722 |

Options:

2723 |
2724 |         -t      Print what would be run, but don't actually run anything
2725 |         -a ARG  Pass ARG as argument for every program
2726 |         -u MASK Set the umask to MASK before running every program
2727 |         -l      Print names of all matching files even if they are not executable
2728 |
2729 |
runlevel
2730 | 2731 |
2732 |

runlevel [utmp]

2733 |

Find the current and previous system runlevel

2734 |

If no utmp file exists or if no runlevel record can be found, 2735 | print "unknown"

2736 |
2737 |
runsv
2738 | 2739 |
2740 |

runsv dir

2741 |

Start and monitor a service and optionally an appendant log service

2742 |
2743 |
runsvdir
2744 | 2745 |
2746 |

runsvdir [-P] [-s SCRIPT] dir

2747 |

Start a runsv process for each subdirectory. If it exits, restart it.

2748 |
2749 |         -P              Put each runsv in a new session
2750 |         -s SCRIPT       Run SCRIPT <signo> after signal is processed
2751 |
2752 |
rx
2753 | 2754 |
2755 |

rx FILE

2756 |

Receive a file using the xmodem protocol

2757 |
2758 |
script
2759 | 2760 |
2761 |

script [-afqt] [-c PROG] [OUTFILE]

2762 |

Options:

2763 |
2764 |         -a      Append output
2765 |         -c      Run PROG, not shell
2766 |         -f      Flush output after each write
2767 |         -q      Quiet
2768 |         -t      Send timing to stderr
2769 |
2770 |
scriptreplay
2771 | 2772 |
2773 |

scriptreplay timingfile [typescript [divisor]]

2774 |

Play back typescripts, using timing information

2775 |
2776 |
sed
2777 | 2778 |
2779 |

sed [-efinr] SED_CMD [FILE]...

2780 |

Options:

2781 |
2782 |         -e CMD  Add CMD to sed commands to be executed
2783 |         -f FILE Add FILE contents to sed commands to be executed
2784 |         -i      Edit files in-place
2785 |         -n      Suppress automatic printing of pattern space
2786 |         -r      Use extended regex syntax
2787 |

If no -e or -f is given, the first non-option argument is taken as the sed 2788 | command to interpret. All remaining arguments are names of input files; if no 2789 | input files are specified, then the standard input is read. Source files 2790 | will not be modified unless -i option is given.

2791 |
2792 |
sendmail
2793 | 2794 |
2795 |

sendmail [OPTIONS] [RECIPIENT_EMAIL]...

2796 |

Read email from stdin and send it

2797 |

Standard options:

2798 |
2799 |         -t              Read additional recipients from message body
2800 |         -f sender       Sender (required)
2801 |         -o options      Various options. -oi implied, others are ignored
2802 |

Busybox specific options:

2803 |
2804 |         -w seconds      Network timeout
2805 |         -H 'PROG ARGS'  Run connection helper
2806 |                         Examples:
2807 |                         -H 'exec openssl s_client -quiet -tls1 -starttls smtp
2808 |                                 -connect smtp.gmail.com:25' <email.txt
2809 |                                 [4<username_and_passwd.txt | -au<username> -ap<password>]
2810 |                         -H 'exec openssl s_client -quiet -tls1
2811 |                                 -connect smtp.gmail.com:465' <email.txt
2812 |                                 [4<username_and_passwd.txt | -au<username> -ap<password>]
2813 |         -S server[:port] Server
2814 |         -au<username>   Username for AUTH LOGIN
2815 |         -ap<password>   Password for AUTH LOGIN
2816 |         -am<method>     Authentication method. Ignored. LOGIN is implied
2817 |

Other options are silently ignored; -oi -t is implied 2818 | Use makemime applet to create message with attachments

2819 |
2820 |
seq
2821 | 2822 |
2823 |

seq [-w] [-s SEP] [FIRST [INC]] LAST

2824 |

Print numbers from FIRST to LAST, in steps of INC. 2825 | FIRST, INC default to 1

2826 |

Options:

2827 |
2828 |         -w      Pad to last with leading zeros
2829 |         -s SEP  String separator
2830 |
2831 |
setarch
2832 | 2833 |
2834 |

setarch personality program [args...]

2835 |

Personality may be:

2836 |
2837 |         linux32         Set 32bit uname emulation
2838 |         linux64         Set 64bit uname emulation
2839 |
2840 |
setconsole
2841 | 2842 |
2843 |

setconsole [-r|--reset] [DEVICE]

2844 |

Redirect system console output to DEVICE (default: /dev/tty)

2845 |

Options:

2846 |
2847 |         -r      Reset output to /dev/console
2848 |
2849 |
setfont
2850 | 2851 |
2852 |

setfont FONT [-m MAPFILE] [-C TTY]

2853 |

Load a console font

2854 |

Options:

2855 |
2856 |         -m MAPFILE      Load console screen map
2857 |         -C TTY          Affect TTY instead of /dev/tty
2858 |
2859 |
setkeycodes
2860 | 2861 |
2862 |

setkeycodes SCANCODE KEYCODE...

2863 |

Set entries into the kernel's scancode-to-keycode map, 2864 | allowing unusual keyboards to generate usable keycodes.

2865 |

SCANCODE may be either xx or e0xx (hexadecimal), 2866 | and KEYCODE is given in decimal

2867 |
2868 |
setlogcons
2869 | 2870 |
2871 |

setlogcons N

2872 |

Redirect the kernel output to console N (0 for current)

2873 |
2874 |
setsid
2875 | 2876 |
2877 |

setsid PROG [ARG...]

2878 |

Run PROG in a new session. PROG will have no controlling terminal 2879 | and will not be affected by keyboard signals (Ctrl-C etc). 2880 | See setsid(2) for details.

2881 |
2882 |
setuidgid
2883 | 2884 |
2885 |

setuidgid account prog args

2886 |

Set uid and gid to account's uid and gid, removing all supplementary 2887 | groups and run PROG

2888 |
2889 |
sha1sum
2890 | 2891 |
2892 |

sha1sum [OPTIONS] [FILE]... 2893 | or: sha1sum [OPTIONS] -c [FILE]

2894 |

Print or check SHA1 checksums

2895 |

Options:

2896 |
2897 |         -c      Check sums against given list
2898 |         -s      Don't output anything, status code shows success
2899 |         -w      Warn about improperly formatted checksum lines
2900 |
2901 |
sha256sum
2902 | 2903 |
2904 |

sha256sum [OPTIONS] [FILE]... 2905 | or: sha256sum [OPTIONS] -c [FILE]

2906 |

Print or check SHA256 checksums

2907 |

Options:

2908 |
2909 |         -c      Check sums against given list
2910 |         -s      Don't output anything, status code shows success
2911 |         -w      Warn about improperly formatted checksum lines
2912 |
2913 |
sha512sum
2914 | 2915 |
2916 |

sha512sum [OPTIONS] [FILE]... 2917 | or: sha512sum [OPTIONS] -c [FILE]

2918 |

Print or check SHA512 checksums

2919 |

Options:

2920 |
2921 |         -c      Check sums against given list
2922 |         -s      Don't output anything, status code shows success
2923 |         -w      Warn about improperly formatted checksum lines
2924 |
2925 |
showkey
2926 | 2927 |
2928 |

showkey [-a | -k | -s]

2929 |

Show keys pressed

2930 |

Options:

2931 |
2932 |         -a      Display decimal/octal/hex values of the keys
2933 |         -k      Display interpreted keycodes (default)
2934 |         -s      Display raw scan-codes
2935 |
2936 |
slattach
2937 | 2938 |
2939 |

slattach [-cehmLF] [-s SPEED] [-p PROTOCOL] DEVICE

2940 |

Attach network interface(s) to serial line(s)

2941 |

Options:

2942 |
2943 |         -p PROT Set protocol (slip, cslip, slip6, clisp6 or adaptive)
2944 |         -s SPD  Set line speed
2945 |         -e      Exit after initializing device
2946 |         -h      Exit when the carrier is lost
2947 |         -c PROG Run PROG when the line is hung up
2948 |         -m      Do NOT initialize the line in raw 8 bits mode
2949 |         -L      Enable 3-wire operation
2950 |         -F      Disable RTS/CTS flow control
2951 |
2952 |
sleep
2953 | 2954 |
2955 |

sleep [N]...

2956 |

Pause for a time equal to the total of the args given, where each arg can 2957 | have an optional suffix of (s)econds, (m)inutes, (h)ours, or (d)ays

2958 |
2959 |
softlimit
2960 | 2961 |
2962 |

softlimit [-a BYTES] [-m BYTES] [-d BYTES] [-s BYTES] [-l BYTES] 2963 |
[-f BYTES] [-c BYTES] [-r BYTES] [-o N] [-p N] [-t N] 2964 |
PROG ARGS

2965 |

Set soft resource limits, then run PROG

2966 |

Options:

2967 |
2968 |         -a BYTES        Limit total size of all segments
2969 |         -m BYTES        Same as -d BYTES -s BYTES -l BYTES -a BYTES
2970 |         -d BYTES        Limit data segment
2971 |         -s BYTES        Limit stack segment
2972 |         -l BYTES        Limit locked memory size
2973 |         -o N            Limit number of open files per process
2974 |         -p N            Limit number of processes per uid
2975 | Options controlling file sizes:
2976 |
2977 |         -f BYTES        Limit output file sizes
2978 |         -c BYTES        Limit core file size
2979 | Efficiency opts:
2980 |
2981 |         -r BYTES        Limit resident set size
2982 |         -t N            Limit CPU time, process receives
2983 |                         a SIGXCPU after N seconds
2984 |
2985 |
sort
2986 | 2987 |
2988 |

sort [-nrugMcszbdfimSTokt] [-o FILE] [-k start[.offset][opts][,end[.offset][opts]] [-t CHAR] [FILE]...

2989 |

Sort lines of text

2990 |

Options:

2991 |
2992 |         -b      Ignore leading blanks
2993 |         -c      Check whether input is sorted
2994 |         -d      Dictionary order (blank or alphanumeric only)
2995 |         -f      Ignore case
2996 |         -g      General numerical sort
2997 |         -i      Ignore unprintable characters
2998 |         -k      Sort key
2999 |         -M      Sort month
3000 |         -n      Sort numbers
3001 |         -o      Output to file
3002 |         -k      Sort by key
3003 |         -t CHAR Key separator
3004 |         -r      Reverse sort order
3005 |         -s      Stable (don't sort ties alphabetically)
3006 |         -u      Suppress duplicate lines
3007 |         -z      Lines are terminated by NUL, not newline
3008 |         -mST    Ignored for GNU compatibility
3009 |
3010 |
split
3011 | 3012 |
3013 |

split [OPTIONS] [INPUT [PREFIX]]

3014 |

Options:

3015 |
3016 |         -b n[k|m]       Split by bytes
3017 |         -l n            Split by lines
3018 |         -a n            Use n letters as suffix
3019 |
3020 |
start-stop-daemon
3021 | 3022 |
3023 |

start-stop-daemon [OPTIONS] [-S|-K] ... [-- arguments...]

3024 |

Search for matching processes, and then 3025 | -K: stop all matching processes. 3026 | -S: start a process unless a matching process is found.

3027 |

Process matching:

3028 |
3029 |         -u,--user USERNAME|UID  Match only this user's processes
3030 |         -n,--name NAME          Match processes with NAME
3031 |                                 in comm field in /proc/PID/stat
3032 |         -x,--exec EXECUTABLE    Match processes with this command
3033 |                                 in /proc/PID/cmdline
3034 |         -p,--pidfile FILE       Match a process with PID from the file
3035 |         All specified conditions must match
3036 | -S only:
3037 |         -x,--exec EXECUTABLE    Program to run
3038 |         -a,--startas NAME       Zeroth argument
3039 |         -b,--background         Background
3040 |         -N,--nicelevel N        Change nice level
3041 |         -c,--chuid USER[:[GRP]] Change to user/group
3042 |         -m,--make-pidfile       Write PID to the pidfile specified by -p
3043 | -K only:
3044 |         -s,--signal SIG         Signal to send
3045 |         -t,--test               Match only, exit with 0 if a process is found
3046 | Other:
3047 |
3048 |         -o,--oknodo             Exit with status 0 if nothing is done
3049 |         -v,--verbose            Verbose
3050 |         -q,--quiet              Quiet
3051 |
3052 |
stat
3053 | 3054 |
3055 |

stat [OPTIONS] FILE...

3056 |

Display file (default) or filesystem status

3057 |

Options:

3058 |
3059 |         -c fmt  Use the specified format
3060 |         -f      Display filesystem status
3061 |         -L      Dereference links
3062 |         -t      Display info in terse form
3063 |

Valid format sequences for files:

3064 |
3065 |  %a     Access rights in octal
3066 |  %A     Access rights in human readable form
3067 |  %b     Number of blocks allocated (see %B)
3068 |  %B     The size in bytes of each block reported by %b
3069 |  %d     Device number in decimal
3070 |  %D     Device number in hex
3071 |  %f     Raw mode in hex
3072 |  %F     File type
3073 |  %g     Group ID of owner
3074 |  %G     Group name of owner
3075 |  %h     Number of hard links
3076 |  %i     Inode number
3077 |  %n     File name
3078 |  %N     Quoted file name with dereference if symlink
3079 |  %o     I/O block size
3080 |  %s     Total size, in bytes
3081 |  %t     Major device type in hex
3082 |  %T     Minor device type in hex
3083 |  %u     User ID of owner
3084 |  %U     User name of owner
3085 |  %x     Time of last access
3086 |  %X     Time of last access as seconds since Epoch
3087 |  %y     Time of last modification
3088 |  %Y     Time of last modification as seconds since Epoch
3089 |  %z     Time of last change
3090 |  %Z     Time of last change as seconds since Epoch
3091 |

Valid format sequences for file systems:

3092 |
3093 |  %a     Free blocks available to non-superuser
3094 |  %b     Total data blocks in file system
3095 |  %c     Total file nodes in file system
3096 |  %d     Free file nodes in file system
3097 |  %f     Free blocks in file system
3098 |  %i     File System ID in hex
3099 |  %l     Maximum length of filenames
3100 |  %n     File name
3101 |  %s     Block size (for faster transfer)
3102 |  %S     Fundamental block size (for block counts)
3103 |  %t     Type in hex
3104 |  %T     Type in human readable form
3105 |
3106 |
strings
3107 | 3108 |
3109 |

strings [-afo] [-n LEN] [FILE]...

3110 |

Display printable strings in a binary file

3111 |

Options:

3112 |
3113 |         -a      Scan whole file (default)
3114 |         -f      Precede strings with filenames
3115 |         -n LEN  At least LEN characters form a string (default 4)
3116 |         -o      Precede strings with decimal offsets
3117 |
3118 |
stty
3119 | 3120 |
3121 |

stty [-a|g] [-F DEVICE] [SETTING]...

3122 |

Without arguments, prints baud rate, line discipline, 3123 | and deviations from stty sane

3124 |

Options:

3125 |
3126 |         -F DEVICE       Open device instead of stdin
3127 |         -a              Print all current settings in human-readable form
3128 |         -g              Print in stty-readable form
3129 |         [SETTING]       See manpage
3130 |
3131 |
su
3132 | 3133 |
3134 |

su [OPTIONS] [-] [username]

3135 |

Change user id or become root

3136 |

Options:

3137 |
3138 |         -p, -m  Preserve environment
3139 |         -c CMD  Command to pass to 'sh -c'
3140 |         -s SH   Shell to use instead of default shell
3141 |
3142 |
sulogin
3143 | 3144 |
3145 |

sulogin [OPTIONS] [TTY]

3146 |

Single user login

3147 |

Options:

3148 |
3149 |         -t N    Timeout
3150 |
3151 |
sum
3152 | 3153 |
3154 |

sum [-rs] [FILE]...

3155 |

Checksum and count the blocks in a file

3156 |

Options:

3157 |
3158 |         -r      Use BSD sum algorithm (1K blocks)
3159 |         -s      Use System V sum algorithm (512byte blocks)
3160 |
3161 |
sv
3162 | 3163 |
3164 |

sv [-v] [-w sec] command service...

3165 |

Control services monitored by runsv supervisor. 3166 | Commands (only first character is enough):

3167 |

status: query service status 3168 | up: if service isn't running, start it. If service stops, restart it 3169 | once: like 'up', but if service stops, don't restart it 3170 | down: send TERM and CONT signals. If ./run exits, start ./finish 3171 | if it exists. After it stops, do not restart service 3172 | exit: send TERM and CONT signals to service and log service. If they exit, 3173 | runsv exits too 3174 | pause, cont, hup, alarm, interrupt, quit, 1, 2, term, kill: send 3175 | STOP, CONT, HUP, ALRM, INT, QUIT, USR1, USR2, TERM, KILL signal to service

3176 |
3177 |
svlogd
3178 | 3179 |
3180 |

svlogd [-ttv] [-r c] [-R abc] [-l len] [-b buflen] dir...

3181 |

Continuously read log data from standard input, optionally 3182 | filter log messages, and write the data to one or more automatically 3183 | rotated logs

3184 |
3185 |
swapoff
3186 | 3187 |
3188 |

swapoff [-a] [DEVICE]

3189 |

Stop swapping on DEVICE

3190 |

Options:

3191 |
3192 |         -a      Stop swapping on all swap devices
3193 |
3194 |
swapon
3195 | 3196 |
3197 |

swapon [-a] [-p pri] [DEVICE]

3198 |

Start swapping on DEVICE

3199 |

Options:

3200 |
3201 |         -a      Start swapping on all swap devices
3202 |         -p pri  Set swap device priority
3203 |
3204 |
switch_root
3205 | 3206 |
3207 |

switch_root [-c /dev/console] NEW_ROOT NEW_INIT [ARGS]

3208 |

Free initramfs and switch to another root fs:

3209 |

chroot to NEW_ROOT, delete all in /, move NEW_ROOT to /, 3210 | execute NEW_INIT. PID must be 1. NEW_ROOT must be a mountpoint.

3211 |

Options:

3212 |
3213 |         -c DEV  Reopen stdio to DEV after switch
3214 |
3215 |
sync
3216 | 3217 |
3218 |

sync

3219 |

Write all buffered blocks to disk

3220 |
3221 |
sysctl
3222 | 3223 |
3224 |

sysctl [OPTIONS] [VALUE]...

3225 |

Configure kernel parameters at runtime

3226 |

Options:

3227 |
3228 |         -n      Don't print key names
3229 |         -e      Don't warn about unknown keys
3230 |         -w      Change sysctl setting
3231 |         -p FILE Load sysctl settings from FILE (default /etc/sysctl.conf)
3232 |         -a      Display all values
3233 |         -A      Display all values in table form
3234 |
3235 |
syslogd
3236 | 3237 |
3238 |

syslogd [OPTIONS]

3239 |

System logging utility. 3240 | Note that this version of syslogd ignores /etc/syslog.conf.

3241 |

Options:

3242 |
3243 |         -n              Run in foreground
3244 |         -O FILE         Log to given file (default:/var/log/messages)
3245 |         -l n            Set local log level
3246 |         -S              Smaller logging output
3247 |         -s SIZE         Max size (KB) before rotate (default:200KB, 0=off)
3248 |         -b NUM          Number of rotated logs to keep (default:1, max=99, 0=purge)
3249 |         -R HOST[:PORT]  Log to IP or hostname on PORT (default PORT=514/UDP)
3250 |         -L              Log locally and via network (default is network only if -R)
3251 |         -D              Drop duplicates
3252 |         -C[size(KiB)]   Log to shared mem buffer (read it using logread)
3253 |
3254 |
tac
3255 | 3256 |
3257 |

tac [FILE]...

3258 |

Concatenate FILE(s) and print them in reverse

3259 |
3260 |
tail
3261 | 3262 |
3263 |

tail [OPTIONS] [FILE]...

3264 |

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

3267 |

Options:

3268 |
3269 |         -c N[kbm]       Output the last N bytes
3270 |         -n N[kbm]       Print last N lines instead of last 10
3271 |         -f              Output data as the file grows
3272 |         -q              Never output headers giving file names
3273 |         -s SEC          Wait SEC seconds between reads with -f
3274 |         -v              Always output headers giving file names
3275 |

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

3278 |
3279 |
tar
3280 | 3281 |
3282 |

tar -[czjaZxtvO] [-X FILE] [-f TARFILE] [-C DIR] [FILE(s)]...

3283 |

Create, extract, or list files from a tar file

3284 |

Options:

3285 |
3286 |         c       Create
3287 |         x       Extract
3288 |         t       List
3289 | Archive format selection:
3290 |
3291 |         z       Filter the archive through gzip
3292 |         j       Filter the archive through bzip2
3293 |         a       Filter the archive through lzma
3294 |         Z       Filter the archive through compress
3295 | File selection:
3296 |
3297 |         f       Name of TARFILE or "-" for stdin
3298 |         O       Extract to stdout
3299 |         exclude File to exclude
3300 |         X       File with names to exclude
3301 |         C       Change to directory DIR before operation
3302 |         v       Verbose
3303 |
3304 |
taskset
3305 | 3306 |
3307 |

taskset [-p] [MASK] [PID | PROG [ARGS]]

3308 |

Set or get CPU affinity

3309 |

Options:

3310 |
3311 |         -p      Operate on an existing PID
3312 |
3313 |
tcpsvd
3314 | 3315 |
3316 |

tcpsvd [-hEv] [-c N] [-C N[:MSG]] [-b N] [-u USER] [-l NAME] IP PORT PROG

3317 |

Create TCP socket, bind to IP:PORT and listen 3318 | for incoming connection. Run PROG for each connection.

3319 |
3320 |         IP              IP to listen on. '0' = all
3321 |         PORT            Port to listen on
3322 |         PROG [ARGS]     Program to run
3323 |         -l NAME         Local hostname (else looks up local hostname in DNS)
3324 |         -u USER[:GRP]   Change to user/group after bind
3325 |         -c N            Handle up to N connections simultaneously
3326 |         -b N            Allow a backlog of approximately N TCP SYNs
3327 |         -C N[:MSG]      Allow only up to N connections from the same IP
3328 |                         New connections from this IP address are closed
3329 |                         immediately. MSG is written to the peer before close
3330 |         -h              Look up peer's hostname
3331 |         -E              Do not set up environment variables
3332 |         -v              Verbose
3333 |
3334 |
tee
3335 | 3336 |
3337 |

tee [OPTIONS] [FILE]...

3338 |

Copy standard input to each FILE, and also to standard output

3339 |

Options:

3340 |
3341 |         -a      Append to the given FILEs, do not overwrite
3342 |         -i      Ignore interrupt signals (SIGINT)
3343 |
3344 |
telnet
3345 | 3346 |
3347 |

telnet [-a] [-l USER] HOST [PORT]

3348 |

Connect to telnet server

3349 |

Options:

3350 |
3351 |         -a      Automatic login with $USER variable
3352 |         -l USER Automatic login as USER
3353 |
3354 |
telnetd
3355 | 3356 |
3357 |

telnetd [OPTIONS]

3358 |

Handle incoming telnet connections

3359 |

Options:

3360 |
3361 |         -l LOGIN        Exec LOGIN on connect
3362 |         -f ISSUE_FILE   Display ISSUE_FILE instead of /etc/issue
3363 |         -K              Close connection as soon as login exits
3364 |                         (normally wait until all programs close slave pty)
3365 |         -p PORT         Port to listen on
3366 |         -b ADDR[:PORT]  Address to bind to
3367 |         -F              Run in foreground
3368 |         -i              Run as inetd service
3369 |         -w SEC          Run as inetd service in wait mode, linger time SEC
3370 |         -S              Log to syslog (implied by -i or without -F and -w)
3371 |
3372 |
test
3373 | 3374 |
3375 |

test EXPRESSION ]

3376 |

Check file types, compare values etc. Return a 0/1 exit code 3377 | depending on logical value of EXPRESSION

3378 |
3379 |
tftp
3380 | 3381 |
3382 |

tftp [OPTIONS] HOST [PORT]

3383 |

Transfer a file from/to tftp server

3384 |

Options:

3385 |
3386 |         -l FILE Local FILE
3387 |         -r FILE Remote FILE
3388 |         -g      Get file
3389 |         -p      Put file
3390 |         -b SIZE Transfer blocks of SIZE octets
3391 |
3392 |
tftpd
3393 | 3394 |
3395 |

tftpd [-cr] [-u USER] [DIR]

3396 |

Transfer a file on tftp client's request

3397 |

tftpd should be used as an inetd service. 3398 | tftpd's line for inetd.conf: 3399 | 69 dgram udp nowait root tftpd tftpd /files/to/serve 3400 | It also can be ran from udpsvd:

3401 |
3402 |         udpsvd -vE 0.0.0.0 69 tftpd /files/to/serve
3403 |

Options:

3404 |
3405 |         -r      Prohibit upload
3406 |         -c      Allow file creation via upload
3407 |         -u      Access files as USER
3408 |
3409 |
time
3410 | 3411 |
3412 |

time [OPTIONS] PROG [ARGS]

3413 |

Run PROG. When it finishes, its resource usage is displayed.

3414 |

Options:

3415 |
3416 |         -v      Verbose
3417 |
3418 |
timeout
3419 | 3420 |
3421 |

timeout [-t SECS] [-s SIG] PROG [ARGS]

3422 |

Runs PROG. Sends SIG to it if it is not gone in SECS seconds. 3423 | Defaults: SECS: 10, SIG: TERM.

3424 |
3425 |
top
3426 | 3427 |
3428 |

top [-b] [-nCOUNT] [-dSECONDS] [-m]

3429 |

Provide a view of process activity in real time. 3430 | Read the status of all processes from /proc each SECONDS 3431 | and show the status for however many processes will fit on the screen.

3432 |
3433 |
touch
3434 | 3435 |
3436 |

touch [-c] [-d DATE] FILE [FILE]...

3437 |

Update the last-modified date on the given FILE[s]

3438 |

Options:

3439 |
3440 |         -c      Do not create files
3441 |         -d DT   Date/time to use
3442 |
3443 |
tr
3444 | 3445 |
3446 |

tr [-cds] STRING1 [STRING2]

3447 |

Translate, squeeze, and/or delete characters from 3448 | standard input, writing to standard output

3449 |

Options:

3450 |
3451 |         -c      Take complement of STRING1
3452 |         -d      Delete input characters coded STRING1
3453 |         -s      Squeeze multiple output characters of STRING2 into one character
3454 |
3455 |
traceroute
3456 | 3457 |
3458 |

traceroute [-FIldnrv] [-f 1st_ttl] [-m max_ttl] [-p port#] [-q nqueries] 3459 |
[-s src_addr] [-t tos] [-w wait] [-g gateway] [-i iface] 3460 |
[-z pausemsecs] HOST [data size]

3461 |

Trace the route to HOST

3462 |

Options:

3463 |
3464 |         -F      Set the don't fragment bit
3465 |         -I      Use ICMP ECHO instead of UDP datagrams
3466 |         -l      Display the ttl value of the returned packet
3467 |         -d      Set SO_DEBUG options to socket
3468 |         -n      Print hop addresses numerically rather than symbolically
3469 |         -r      Bypass the normal routing tables and send directly to a host
3470 |         -v      Verbose
3471 |         -m max_ttl      Max time-to-live (max number of hops)
3472 |         -p port#        Base UDP port number used in probes
3473 |                         (default 33434)
3474 |         -q nqueries     Number of probes per 'ttl' (default 3)
3475 |         -s src_addr     IP address to use as the source address
3476 |         -t tos          Type-of-service in probe packets (default 0)
3477 |         -w wait         Time in seconds to wait for a response
3478 |                         (default 3 sec)
3479 |         -g              Loose source route gateway (8 max)
3480 |
3481 |
true
3482 | 3483 |
3484 |

true

3485 |

Return an exit code of TRUE (0)

3486 |
3487 |
tty
3488 | 3489 |
3490 |

tty

3491 |

Print file name of standard input's terminal

3492 |

Options:

3493 |
3494 |         -s      Print nothing, only return exit status
3495 |
3496 |
ttysize
3497 | 3498 |
3499 |

ttysize [w] [h]

3500 |

Print dimension(s) of standard input's terminal, on error return 80x25

3501 |
3502 |
udhcpc
3503 | 3504 |
3505 |

udhcpc [-Cfbnqtvo] [-c CID] [-V VCLS] [-H HOSTNAME] [-i INTERFACE] 3506 |
[-p pidfile] [-r IP] [-s script] [-O dhcp-option]...

3507 |
3508 |         -V,--vendorclass=CLASSID        Vendor class identifier
3509 |         -i,--interface=INTERFACE        Interface to use (default eth0)
3510 |         -H,-h,--hostname=HOSTNAME       Client hostname
3511 |         -c,--clientid=CLIENTID  Client identifier
3512 |         -C,--clientid-none      Suppress default client identifier
3513 |         -p,--pidfile=file       Create pidfile
3514 |         -r,--request=IP         IP address to request
3515 |         -s,--script=file        Run file at DHCP events (default /usr/share/udhcpc/default.script)
3516 |         -t,--retries=N          Send up to N request packets
3517 |         -T,--timeout=N          Try to get a lease for N seconds (default 3)
3518 |         -A,--tryagain=N         Wait N seconds (default 20) after failure
3519 |         -O,--request-option=OPT Request DHCP option OPT (cumulative)
3520 |         -o,--no-default-options Do not request any options (unless -O is also given)
3521 |         -f,--foreground Run in foreground
3522 |         -b,--background Background if lease is not immediately obtained
3523 |         -S,--syslog     Log to syslog too
3524 |         -n,--now        Exit with failure if lease is not immediately obtained
3525 |         -q,--quit       Quit after obtaining lease
3526 |         -R,--release    Release IP on quit
3527 |         -a,--arping     Use arping to validate offered address
3528 |
3529 |
udhcpd
3530 | 3531 |
3532 |

udhcpd [-fS] [configfile]

3533 |

DHCP server

3534 |
3535 |         -f      Run in foreground
3536 |         -S      Log to syslog too
3537 |
3538 |
udpsvd
3539 | 3540 |
3541 |

udpsvd [-hEv] [-c N] [-u USER] [-l NAME] IP PORT PROG

3542 |

Create UDP socket, bind to IP:PORT and wait 3543 | for incoming packets. Run PROG for each packet, 3544 | redirecting all further packets with same peer ip:port to it.

3545 |
3546 |         IP              IP to listen on. '0' = all
3547 |         PORT            Port to listen on
3548 |         PROG [ARGS]     Program to run
3549 |         -l NAME         Local hostname (else looks up local hostname in DNS)
3550 |         -u USER[:GRP]   Change to user/group after bind
3551 |         -c N            Handle up to N connections simultaneously
3552 |         -h              Look up peer's hostname
3553 |         -E              Do not set up environment variables
3554 |         -v              Verbose
3555 |
3556 |
umount
3557 | 3558 |
3559 |

umount [flags] FILESYSTEM|DIRECTORY

3560 |

Unmount file systems

3561 |

Options:

3562 |
3563 |         -a      Unmount all file systems
3564 |         -r      Try to remount devices as read-only if mount is busy
3565 |         -l      Lazy umount (detach filesystem)
3566 |         -f      Force umount (i.e., unreachable NFS server)
3567 |         -d      Free loop device if it has been used
3568 |
3569 |
uname
3570 | 3571 |
3572 |

uname [-amnrspv]

3573 |

Print system information

3574 |

Options:

3575 |
3576 |         -a      Print all
3577 |         -m      The machine (hardware) type
3578 |         -n      Hostname
3579 |         -r      OS release
3580 |         -s      OS name (default)
3581 |         -p      Processor type
3582 |         -v      OS version
3583 |
3584 |
uncompress
3585 | 3586 |
3587 |

uncompress [-c] [-f] [name...]

3588 |

Uncompress .Z file[s]

3589 |

Options:

3590 |
3591 |         -c      Extract to stdout
3592 |         -f      Overwrite an existing file
3593 |
3594 |
unexpand
3595 | 3596 |
3597 |

unexpand [-f][-a][-t NUM] [FILE|-]

3598 |

Convert spaces to tabs, writing to standard output

3599 |

Options:

3600 |
3601 |         -a,--all        Convert all blanks
3602 |         -f,--first-only Convert only leading blanks
3603 |         -t,--tabs=N     Tabstops every N chars
3604 |
3605 |
uniq
3606 | 3607 |
3608 |

uniq [-fscduw]... [INPUT [OUTPUT]]

3609 |

Discard duplicate lines

3610 |

Options:

3611 |
3612 |         -c      Prefix lines by the number of occurrences
3613 |         -d      Only print duplicate lines
3614 |         -u      Only print unique lines
3615 |         -f N    Skip first N fields
3616 |         -s N    Skip first N chars (after any skipped fields)
3617 |         -w N    Compare N characters in line
3618 |
3619 |
unix2dos
3620 | 3621 |
3622 |

unix2dos [OPTION] [FILE]

3623 |

Convert FILE in-place from Unix to DOS format. 3624 | When no file is given, use stdin/stdout.

3625 |

Options:

3626 |
3627 |         -u      dos2unix
3628 |         -d      unix2dos
3629 |
3630 |
unlzma
3631 | 3632 |
3633 |

unlzma [OPTIONS] [FILE]

3634 |

Uncompress FILE (or standard input if FILE is '-' or omitted)

3635 |

Options:

3636 |
3637 |         -c      Write to standard output
3638 |         -f      Force
3639 |
3640 |
unlzop
3641 | 3642 |
3643 |

unlzop [-cfvCF] [FILE]...

3644 |
3645 |         -c      Write to standard output
3646 |         -f      Force
3647 |         -v      Verbose
3648 |         -F      Don't store or verify checksum
3649 |
3650 |
unzip
3651 | 3652 |
3653 |

unzip [-opts[modifiers]] file[.zip] [list] [-x xlist] [-d exdir]

3654 |

Extract files from ZIP archives

3655 |

Options:

3656 |
3657 |         -l      List archive contents (with -q for short form)
3658 |         -n      Never overwrite existing files (default)
3659 |         -o      Overwrite files without prompting
3660 |         -p      Send output to stdout
3661 |         -q      Quiet
3662 |         -x      Exclude these files
3663 |         -d      Extract files into this directory
3664 |
3665 |
uptime
3666 | 3667 |
3668 |

uptime

3669 |

Display the time since the last boot

3670 |
3671 |
usleep
3672 | 3673 |
3674 |

usleep N

3675 |

Pause for N microseconds

3676 |
3677 |
uudecode
3678 | 3679 |
3680 |

uudecode [-o outfile] [infile]

3681 |

Uudecode a file 3682 | Finds outfile name in uuencoded source unless -o is given

3683 |
3684 |
uuencode
3685 | 3686 |
3687 |

uuencode [-m] [infile] stored_filename

3688 |

Uuencode a file to stdout

3689 |

Options:

3690 |
3691 |         -m      Use base64 encoding per RFC1521
3692 |
3693 |
vconfig
3694 | 3695 |
3696 |

vconfig COMMAND [OPTIONS]

3697 |

Create and remove virtual ethernet devices

3698 |

Options:

3699 |
3700 |         add             [interface-name] [vlan_id]
3701 |         rem             [vlan-name]
3702 |         set_flag        [interface-name] [flag-num] [0 | 1]
3703 |         set_egress_map  [vlan-name] [skb_priority] [vlan_qos]
3704 |         set_ingress_map [vlan-name] [skb_priority] [vlan_qos]
3705 |         set_name_type   [name-type]
3706 |
3707 |
vi
3708 | 3709 |
3710 |

vi [OPTIONS] [FILE]...

3711 |

Edit FILE

3712 |

Options:

3713 |
3714 |         -c      Initial command to run ($EXINIT also available)
3715 |         -R      Read-only - do not write to the file
3716 |         -H      Short help regarding available features
3717 |
3718 |
vlock
3719 | 3720 |
3721 |

vlock [OPTIONS]

3722 |

Lock a virtual terminal. A password is required to unlock.

3723 |

Options:

3724 |
3725 |         -a      Lock all VTs
3726 |
3727 |
volname
3728 | 3729 |
3730 |

volname [DEVICE]

3731 |

Show CD volume name of the DEVICE (default /dev/cdrom)

3732 |
3733 |
watch
3734 | 3735 |
3736 |

watch [-n seconds] [-t] PROG [ARGS]

3737 |

Run PROG periodically

3738 |

Options:

3739 |
3740 |         -n      Loop period in seconds (default 2)
3741 |         -t      Don't print header
3742 |
3743 |
watchdog
3744 | 3745 |
3746 |

watchdog [-t N[ms]] [-T N[ms]] [-F] DEV

3747 |

Periodically write to watchdog device DEV

3748 |

Options:

3749 |
3750 |         -T N    Reboot after N seconds if not reset (default 60)
3751 |         -t N    Reset every N seconds (default 30)
3752 |         -F      Run in foreground
3753 |

Use 500ms to specify period in milliseconds

3754 |
3755 |
wc
3756 | 3757 |
3758 |

wc [OPTIONS] [FILE]...

3759 |

Print line, word, and byte counts for each FILE, and a total line if 3760 | more than one FILE is specified. With no FILE, read standard input.

3761 |

Options:

3762 |
3763 |         -c      Print the byte counts
3764 |         -l      Print the newline counts
3765 |         -L      Print the length of the longest line
3766 |         -w      Print the word counts
3767 |
3768 |
wget
3769 | 3770 |
3771 |

wget [-c|--continue] [-s|--spider] [-q|--quiet] [-O|--output-document file] 3772 |
[--header 'header: value'] [-Y|--proxy on/off] [-P DIR] 3773 |
[-U|--user-agent agent] url

3774 |

Retrieve files via HTTP or FTP

3775 |

Options:

3776 |
3777 |         -s      Spider mode - only check file existence
3778 |         -c      Continue retrieval of aborted transfer
3779 |         -q      Quiet
3780 |         -P      Set directory prefix to DIR
3781 |         -O      Save to filename ('-' for stdout)
3782 |         -U      Adjust 'User-Agent' field
3783 |         -Y      Use proxy ('on' or 'off')
3784 |
3785 |
which
3786 | 3787 |
3788 |

which [COMMAND]...

3789 |

Locate a COMMAND

3790 |
3791 |
who
3792 | 3793 |
3794 |

who [-a]

3795 |

Show who is logged on

3796 |

Options:

3797 |
3798 |         -a      show all
3799 |
3800 |
whoami
3801 | 3802 |
3803 |

whoami

3804 |

Print the user name associated with the current effective user id

3805 |
3806 |
xargs
3807 | 3808 |
3809 |

xargs [OPTIONS] [PROG [ARGS]]

3810 |

Run PROG on every item given by standard input

3811 |

Options:

3812 |
3813 |         -p      Ask user whether to run each command
3814 |         -r      Do not run command if input is empty
3815 |         -0      Input is separated by NUL characters
3816 |         -t      Print the command on stderr before execution
3817 |         -e[STR] STR stops input processing
3818 |         -n N    Pass no more than N args to PROG
3819 |         -s N    Pass command line of no more than N bytes
3820 |         -x      Exit if size is exceeded
3821 |
3822 |
yes
3823 | 3824 |
3825 |

yes [OPTIONS] [STRING]

3826 |

Repeatedly output a line with STRING, or 'y'

3827 |
3828 |
zcat
3829 | 3830 |
3831 |

zcat FILE

3832 |

Uncompress to stdout

3833 |
3834 |
zcip
3835 | 3836 |
3837 |

zcip [OPTIONS] IFACE SCRIPT

3838 |

Manage a ZeroConf IPv4 link-local address

3839 |

Options:

3840 |
3841 |         -f              Run in foreground
3842 |         -q              Quit after obtaining address
3843 |         -r 169.254.x.x  Request this address first
3844 |         -v              Verbose
3845 |

With no -q, runs continuously monitoring for ARP conflicts, 3846 | exits only on I/O errors (link down etc)

3847 |
3848 |
3849 |

3850 |

3851 |
3852 |

LIBC NSS

3853 |

GNU Libc (glibc) uses the Name Service Switch (NSS) to configure the behavior 3854 | of the C library for the local environment, and to configure how it reads 3855 | system data, such as passwords and group information. This is implemented 3856 | using an /etc/nsswitch.conf configuration file, and using one or more of the 3857 | /lib/libnss_* libraries. BusyBox tries to avoid using any libc calls that make 3858 | use of NSS. Some applets however, such as login and su, will use libc functions 3859 | that require NSS.

3860 |

If you enable CONFIG_USE_BB_PWD_GRP, BusyBox will use internal functions to 3861 | directly access the /etc/passwd, /etc/group, and /etc/shadow files without 3862 | using NSS. This may allow you to run your system without the need for 3863 | installing any of the NSS configuration files and libraries.

3864 |

When used with glibc, the BusyBox 'networking' applets will similarly require 3865 | that you install at least some of the glibc NSS stuff (in particular, 3866 | /etc/nsswitch.conf, /lib/libnss_dns*, /lib/libnss_files*, and /lib/libresolv*).

3867 |

Shameless Plug: As an alternative, one could use a C library such as uClibc. In 3868 | addition to making your system significantly smaller, uClibc does not require the 3869 | use of any NSS support files or libraries.

3870 |

3871 |

3872 |
3873 |

MAINTAINER

3874 |

Denis Vlasenko <vda.linux@googlemail.com>

3875 |

3876 |

3877 |
3878 |

AUTHORS

3879 |

The following people have contributed code to BusyBox whether they know it or 3880 | not. If you have written code included in BusyBox, you should probably be 3881 | listed here so you can obtain your bit of eternal glory. If you should be 3882 | listed here, or the description of what you have done needs more detail, or is 3883 | incorrect, please send in an update.

3884 |

Emanuele Aina <emanuele.aina@tiscali.it> 3885 | run-parts

3886 |

Erik Andersen <andersen@codepoet.org>

3887 |
3888 |     Tons of new stuff, major rewrite of most of the
3889 |     core apps, tons of new apps as noted in header files.
3890 |     Lots of tedious effort writing these boring docs that
3891 |     nobody is going to actually read.
3892 |

Laurence Anderson <l.d.anderson@warwick.ac.uk>

3893 |
3894 |     rpm2cpio, unzip, get_header_cpio, read_gz interface, rpm
3895 |

Jeff Angielski <jeff@theptrgroup.com>

3896 |
3897 |     ftpput, ftpget
3898 |

Edward Betts <edward@debian.org>

3899 |
3900 |     expr, hostid, logname, whoami
3901 |

John Beppu <beppu@codepoet.org>

3902 |
3903 |     du, nslookup, sort
3904 |

Brian Candler <B.Candler@pobox.com>

3905 |
3906 |     tiny-ls(ls)
3907 |

Randolph Chung <tausq@debian.org>

3908 |
3909 |     fbset, ping, hostname
3910 |

Dave Cinege <dcinege@psychosis.com>

3911 |
3912 |     more(v2), makedevs, dutmp, modularization, auto links file,
3913 |     various fixes, Linux Router Project maintenance
3914 |

Jordan Crouse <jordan@cosmicpenguin.net>

3915 |
3916 |     ipcalc
3917 |

Magnus Damm <damm@opensource.se>

3918 |
3919 |     tftp client insmod powerpc support
3920 |

Larry Doolittle <ldoolitt@recycle.lbl.gov>

3921 |
3922 |     pristine source directory compilation, lots of patches and fixes.
3923 |

Glenn Engel <glenne@engel.org>

3924 |
3925 |     httpd
3926 |

Gennady Feldman <gfeldman@gena01.com>

3927 |
3928 |     Sysklogd (single threaded syslogd, IPC Circular buffer support,
3929 |     logread), various fixes.
3930 |

Karl M. Hegbloom <karlheg@debian.org>

3931 |
3932 |     cp_mv.c, the test suite, various fixes to utility.c, &c.
3933 |

Daniel Jacobowitz <dan@debian.org>

3934 |
3935 |     mktemp.c
3936 |

Matt Kraai <kraai@alumni.cmu.edu>

3937 |
3938 |     documentation, bugfixes, test suite
3939 |

Stephan Linz <linz@li-pro.net>

3940 |
3941 |     ipcalc, Red Hat equivalence
3942 |

John Lombardo <john@deltanet.com>

3943 |
3944 |     tr
3945 |

Glenn McGrath <bug1@iinet.net.au>

3946 |
3947 |     Common unarchiving code and unarchiving applets, ifupdown, ftpgetput,
3948 |     nameif, sed, patch, fold, install, uudecode.
3949 |     Various bugfixes, review and apply numerous patches.
3950 |

Manuel Novoa III <mjn3@codepoet.org>

3951 |
3952 |     cat, head, mkfifo, mknod, rmdir, sleep, tee, tty, uniq, usleep, wc, yes,
3953 |     mesg, vconfig, make_directory, parse_mode, dirname, mode_string,
3954 |     get_last_path_component, simplify_path, and a number trivial libbb routines
3955 |
3956 |     also bug fixes, partial rewrites, and size optimizations in
3957 |     ash, basename, cal, cmp, cp, df, du, echo, env, ln, logname, md5sum, mkdir,
3958 |     mv, realpath, rm, sort, tail, touch, uname, watch, arith, human_readable,
3959 |     interface, dutmp, ifconfig, route
3960 |

Vladimir Oleynik <dzo@simtreas.ru>

3961 |
3962 |     cmdedit; xargs(current), httpd(current);
3963 |     ports: ash, crond, fdisk, inetd, stty, traceroute, top;
3964 |     locale, various fixes
3965 |     and irreconcilable critic of everything not perfect.
3966 |

Bruce Perens <bruce@pixar.com>

3967 |
3968 |     Original author of BusyBox in 1995, 1996. Some of his code can
3969 |     still be found hiding here and there...
3970 |

Tim Riker <Tim@Rikers.org>

3971 |
3972 |     bug fixes, member of fan club
3973 |

Kent Robotti <robotti@metconnect.com>

3974 |
3975 |     reset, tons and tons of bug reports and patches.
3976 |

Chip Rosenthal <chip@unicom.com>, <crosenth@covad.com>

3977 |
3978 |     wget - Contributed by permission of Covad Communications
3979 |

Pavel Roskin <proski@gnu.org>

3980 |
3981 |     Lots of bugs fixes and patches.
3982 |

Gyepi Sam <gyepi@praxis-sw.com>

3983 |
3984 |     Remote logging feature for syslogd
3985 |

Linus Torvalds <torvalds@transmeta.com>

3986 |
3987 |     mkswap, fsck.minix, mkfs.minix
3988 |

Mark Whitley <markw@codepoet.org>

3989 |
3990 |     grep, sed, cut, xargs(previous),
3991 |     style-guide, new-applet-HOWTO, bug fixes, etc.
3992 |

Charles P. Wright <cpwright@villagenet.com>

3993 |
3994 |     gzip, mini-netcat(nc)
3995 |

Enrique Zanardi <ezanardi@ull.es>

3996 |
3997 |     tarcat (since removed), loadkmap, various fixes, Debian maintenance
3998 |

Tito Ragusa <farmatito@tiscali.it>

3999 |
4000 |     devfsd and size optimizations in strings, openvt and deallocvt.
4001 | 4002 | 4003 | 4004 | 4005 | --------------------------------------------------------------------------------