Useful Commands
If you're seeing this, JavaScript doesn't appear to be enabled, and some function of this site may not work properly!
Return to the index
Glossary
- Accuracy
-
Mathematically, how "arbitrarily close" a chosen value's
representation is to the "true
[value]" it is to
represent. For example, 3 is a rather inaccurate
representation of the mathematical constant π, while
3.14159 is a slightly more accurate representation
(but no representation of π is perfectly accurate—it is
transcendental). In a computing system, all [integer]s
can represent a subset of the natural numbers with perfect
accuracy, but [floating point] values, while having a
larger range, cannot accurately represent all natural numbers
nor all real values within their range.
- Algorithm
-
The mathematical, conceptual counterpart of a
[program]. Strictly speaking, an algorithm is a Turing
machine that may decide some problem (a decision
problem) or compute some value (for a function
problem), or, equivalently, a "program" for a Universal
Turing machine, which is a fairly robust, general model for our
stored-program computers.
- Array
-
A contiguous, ordered collection of values. It is a
[type] of [variable] that contains the finite
sequences (including empty sequences). In some languages,
arrays have a size which is a property of their type,
and which dictates how large the sequence is; in [C]
and descendants, arrays start at index 0 and contain
elements up to (but not including) their size.
- Background
-
Said of a
[job], indicates that the [process]
is not using the terminal right now. A
[shell] can have any number of background jobs, but
may have at most one [foreground] job at any given
time. If there are no foreground jobs, a [prompt] is
usually displayed instead. See Job
Control.
- Base name
-
The component of a
[path] at the very end, past the
last slash (if there are no slashes, the whole path is the
"base name"). For example, if a path names a [file],
then the base name is, conceptually, the file's "name" inside
whatever [directory] it's in; that is to say, the base
name of /home/username/dir/foo is
simply foo.
- Body
-
Of a
[function], the part of it that actually contains
[statement]s and [declaration]s, which
describe what the function does. All functions have
exactly one body.
- Bootstrapping
-
The process of initially preparing something—for example,
starting up an
[operating system] after turning on a
computer, or using a smaller, simpler [compile]r to
compile a larger one. Often colloquially shortened to
booting.
- Bug
-
In various fields of engineering and science, a discrepancy or
error which causes unintended or undefined behavior—for
example, a program not compiling, or producing wrong results.
(An apocryphal story states that the first "bug" was a moth
caught in the relays of a very old computer in the presence of
Grace Hopper—which indisputably did happen—but the word "bug"
did apparently refer to "erroneous behavior" before this
event.)
- Byte
-
Eight bits, the smallest addressable unit of system memory in
most architectures. Also known as an octet.
- Call
-
Of a
[function], to pass [control flow] into
the [body], and wait until that function
[return]s. If and when it does, the value of the call
(which is an [expression]) is the returned
[value] from the function.
- Character
-
A single symbol, usually one to be displayed on a
[terminal]. Letters, numbers, symbols, etc. are all
characters. In the [C Programming Language] (and C++),
a single character can be encoded in ' (single
quotes). A sequence of multiple characters is a
[string].
- C
-
See
[C Programming Language].
- C++
-
See
[C++ Programming Language].
- Code Reuse
-
The "holy grail" of programming, the art of making
[program]s that are general enough that they can be
used elsewhere without significant changes and without loss of
generality. Striving to find adequate balance of usability,
comprehensability, and code reuse adequately describes most of
the history of software engineering since its inception. It
occurs naturally to programmers who realize thati, e.g., a
[function] of theirs is useful enough to be used in
another program without change. Large efforts are expended to
make libraries of functions with well-defined
semantics so that other programmers may easily use them, and
these libraries are usually invoked with their
[header] files in [C].
- Command
-
An instruction from the
[user] to a [program]
that is understood to do something in particular. Most notably
pronounced in [terminal]-based [shell]s, but
also a feature of other programs, like [editor]s.
- Compile
-
Changing a
[program] from one form to another;
usually, changing a program's [source code] (written
and readable by humans) to the stored form readable and
runnable by the system. A program which compiles is a
compiler, and—yes—most compilers can compile
themselves, sometimes with the help of
[bootstrapping].
- Control Flow
-
In programming, said generically of things which alter the
usual "line-by-line" execution of a program. In
[C]
and its many derivatives, for example, the if and
while statements may cause control flow to move
"around" a statement or statements. A [function]
[call] causes control to temporarily move into the
function's [body] before it [return]s.
- C Programming Language
-
A
[programming language] developed by Kernighan and
Ritchie, popularized as the language of choice for development
in [Unix]. It has stood the test of time for more than
four decades now.
- C++ Programming Language
-
A
[programming language] that succeeded C and adds
somewhat more comprehensive support for "objects"
(object-oriented programming). While fairly popular, it has
only just succeeded the [C Programming Language] in
terms of number of projects using it, and is criticized for
being slightly more bloated that C.
- Declaration
-
In
[C], a source line that informs the compiler of one
or more [variable]s of a certain type, or of a single
[function] and its [signature]. A function
may be declared exactly once with its [body],
but any number of [prototype]s may be used before and
after its declaration. Declarations of [variable]s are
of the form type name,
name2, name3, ...; where each
name becomes a variable of the given
[type].
- Debug
-
To remove the
[bug]s from; correct, fix, make free of
error. In programming, various tools are designed especially
for this task, which are known as debuggers.
- Directive
-
In
[C], a line starting with the pound sign
(#) which is important to the [preprocessor].
- Directory
-
An
[object] that contains other [object]s in
a [filesystem].
- Domain Name
-
A human-readable name that translates to an
[IP address].
Like paths, they consist of components; unlike paths, the
separator is a dot (.). For example,
google.com is a domain name that translates to one of
many different IP addresses.
- Editor
-
A
[program] used to edit [file]s. Most common
editors on [Unix] systems are text editors, which
allow the [user] to type the contents of a file using the
keyboard.
- Execution
-
Said of a
[program] that is running as a
[process]; the term applies generally to its state or
the commands issued to the system by the program. A program
that is executed spawns a process and does some work
for the [user]; a statement that is executed
causes its effect upon the process while it runs.
- Expression
-
In programming, some syntactic element that has a
[value] that is apparent when it is
evaluated. For example, 2 + 4 is a valid
[C] expression, and it evaluates to
6. Similarly, the expression x * 3 + 5
evaluates to 14 when the value of x is
3. In [C], expressions constitute most
arithmetic (+ - * / %), logical (&& ||
!), binary (& | ^ ~), relational (== !=
> < >= <=), and [pointer] (unary
&
*) operations, as well as [function]
[call]s.
- Extension
-
Of
[path]s, the part of the [base name] past
the last dot (.), if any. For example, the extension
of both /home/username/foo.txt and bar.txt is
txt, but /home/username/foo has no extension,
and the extension of bar.txt.bak is bak.
Extensions are rarely important on [Unix] systems;
their relative popularity is mostly due to DOS and Windows.
- File
-
An
[object] that contains some content with a
known size, as stored in a [filesystem].
- Filesystem
-
A data structure, usually backed by some storage (like a hard
disk) which holds
[object]s.
- Floating Point
-
Mathematically, a value in exponential notation. In a computing
system, IEEE standards dictate how an arbitrary pattern of bits
corresponds to an exponential value, but the basic components
are a sign bit (whether the value is positive or
negative), an exponent to which 2 is raised,
and a mantissa that is multiplied with the resulting
power. There are some special encodings for "exotic" values
like ±∞ and "not a number" (for when an expression is invalid
but no error is to be generated; e.g., division by zero,
tan(π/4), etc.). In
[C], these
[type]s can represent a very large range of values—far
larger than any [integer] type—but at the cost of lost
[accuracy].
- Foreground
-
Said of a
[job], indicates that the [process]
is displaying to, and taking input from, the
[terminal] right now. Contrast a [background]
job. If there is no current foreground job, a [prompt]
is usually displayed instead. See Job
Control.
- Function
-
In programming, an executable unit that is
[call]ed
with [parameter]s and that may or may not
[return] a [value]. In some programming
languages (based on the λ-calculus), this is the only
unit of execution, but the [control flow] of
[C] gives a programmer more practical and
comprehensive options. Nonetheless, breaking a program down
into functions based on its critical tasks promotes less
[bug]s, better [debug]ging, easier
[refactor]ing, and more [code reuse].
- Header
-
In
[C], a file containing many [function]
[prototype]s to instruct the [compile]r as to
what [function]s are available from a
[library]. They are typically incorporated with the
#include [preprocessor] [directive].
- Home Directory
-
The initial
[working directory] for processes started
by a [user]. It is part of the user's account
information.
- Integer
-
A positive or negative natural number (including zero).
Computer memory, conceptually consisting of a sequence of bits,
naturally lends itself to referring to binary data as integers
in base 2. An integer is said to be
[unsigned] if it
cannot represent negative values (it is then, somewhat
confusingly, a natural number). As memory is finite, integers
comes in various [precision]s. Unlike [floating
point] numbers, they always retain perfect accuracy within
their range, but cannot express fractional parts.
- IP Address
-
A few bytes of information that uniquely identify a system on a
network. In IPv4, these were 32-bit, and often written as four
numbers separated with three dots; e.g.,
128.153.145.3). Newer IPv6 is 128-bit and has a far
more complicated address syntax. Most, but not all, IP
addresses are globally unique; in particular, LANs typically
have "private" networks in which addresses are only unique
within that LAN.
- Iteration
-
Doing repeatedly, multiple times; in mathematics and computer
science, it is a characteristic of functions or programs which
must do something repeatedly. In
[C], various
[control flow] [statement]s like
while, do/while, and for serve to
implement it.
- Job
-
A
[process], running under and managed by a
[shell] which is said to be controlling it.
Jobs may either be running in the [foreground] (that
is, using the [terminal]) or [background]
(running, but not using the [terminal]). See Job Control.
- Library
-
See
[code reuse].
- Linux
-
An
[operating system] designed to be compatible with
[Unix] that grew out of a [terminal] emulator
designed by Linus Torvalds.
- Macro
-
A piece of
[source code] text that the [C]
[preprocessor] replaces with some other source code.
They are declared with the #define
[directive].
- Man Page
-
A technical document (often more than one page) distributed
with a
[program], detailing its usage, results, bugs,
authors, etc.. Usually accessed via man.
- Object
-
Precisely, either a
[file] or [directory],
but sometimes (imprecisely) also a [process].
- Operating System
-
The part of a system which manages
[user]s,
[process]es, [object]s, and the resources
allocated to each.
- Parameter
-
An input value to a
[function]. The [type]s
of parameters, and their order, are made apparent in the
function's [signature]; in [C], they can be
seen in the parentheses after the function's name.
- Path
-
A name referring to an
[object]. This may be specified
absolutely (with a leading slash), as in
/home/username/dir/foo (which is always unambiguous),
or relatively, as in dir/foo if the current
[working directory] is /home/username. A path
consists of components separated by slashes ("/"); all
but the last one should name a directory (the last may refer to
anything, including possibly something that doesn't yet exist).
The root path is simply /, and begins all
absolute paths. The special component .. always refers
to the parent directory ("up one level") and can be
used in both relative and absolute paths (e.g.,
/home/user1/../user2/foo is the same as
/home/user2/foo).
- POSIX
-
A standards document and community centered around creating and
ensuring the interoperability of the many diverse
[Unix]-derived [operating system]s in
existence today.
- Precision
-
Mathematically, the logarithm of the number of
discrete values that can be represented as a finite datum
(piece of data). For example, an
[integer] which
consists of 8 bits has an "8-bit precision" and can represent
the values from -128 to 127 (-27
to 27-1, respectively; the 7 comes from 8 -
1), or 0 to 255 if [unsigned]
(28-1). In [C], the precision of an integer
is part of its type, and the keywords short and
long specify a reduced or increased precision,
respectively. [floating point] values have two
distinct precisions (float and double),
though they can represent much larger ranges (around
-2127 to 2127, but cannot do so without a
loss of [accuracy]).
- Preprocessor
-
In
[C] and many derived languages, an early part of
the [compile]r which understands the preprocessor
[directive]s (which start a line with the pound sign,
#) and does many simple text-based operations, such as
[macro] substitution and the inclusion of
[header]s.
- Process
-
A unit of execution in a running system. A process has state,
some amount of memory, an allocation of processor time, an
owning user, and resources loaned to it by the system. It
generally exists to do useful work on the behalf of a user.
Most processes result from the user specifying a
[program] as a [command] in a
[shell], but there need not always be such a
correlation.
- Program
-
A general name for an application, service, or other entity running
on a system. In more precise usage, it refers to the
[file] as stored, as opposed to the running
[process].
- Programming Language
-
A format and grammar for entering
[source code], which
a [compile]r can be said to understand or use.
- Prompt
-
Some text (usually including the
[user] name, system
name, [working directory], and either $ or
#) indicating that a running [shell] is ready
to accept user [command]s.
- Prototype
-
In
[C], and of a [function], a
[declaration] of that function, but without its
[body], used to tell the compiler of the function's
[signature] without defining what it does.
[Header] [file]s are usually replete with
function prototypes that name functions provided by the system,
like the [method]s of [cin] and
[cout].
- Return
-
Generally, to restore
[control flow] to where it was
previously; especially of [function]s, a special
"return statement" causes this to happen, while simultaneously
providing a "return [value]", if any—such a value is
the "result" of the expression in which the function was
[call]ed. The return [type] of a function is
made apparent in its [signature]; in [C], it
precedes the name of the function.
- Shell
-
A
[program] used to execute [command]s on the
behalf of a [user], usually with the intent of running
more programs to do useful work.
- Signature
-
Information about a
[function] that describes the
[type]s of [parameter]s that it takes, as
well as the [return] type. In [C], this
information is made available through a function
[prototype], as well as its definition—where the
signatures must agree.
- Source Code
-
The text, almost always directly or indirectly written by
humans, that, when
[compile]d, results in a runnable
[program].
- Statement
-
In
[C] and many other languages, a unit of
[execution]. This includes all [function]
[call]s, [control flow], and
[expression]s ended with a semicolon (;).
While apparently similar, they are distinct from
[declaration]s, despite both ending with a semicolon
(;), because they do declare (state the existence of)
a [variable].
- String
-
A sequence of
[character]s. In the [C Programming
Language] (and C++), strings are written between two
" (double quotes).
- Syntax
-
Related to the actual structure of a
[programming
language], such as the punctuation used to separate names,
the ways to enter numbers, whether or not to balance
parentheses, etc.; errors in syntax are usually discriminated
by the [compile]r, and are usually the first errors
encountered by beginners. Compare [bug]s, which
include "logic errors".
- Terminal
-
Precisely, a piece of hardware that displays characters in a
regular grid, and directly accepts input from the keyboard to
send to the system for processing. Modern computers have
monitors and directly-connected keyboard instead, so one more
properly uses a terminal emulator nowadays. Each
terminal in use has a controlling
[program],
which is usually a [shell] or whatever is running in
that shell.
- Treasonous
-
Jargon; of a practice, strictly forbidden in some older
standard, while only tenuously allowed in some newer
standard—especially in a way that is confusing or generally
undesirable. For example, declaring an
[array] with a
non-literal size is absolutely forbidden in [C], but,
while allowed in [C++], usually never does what you
want it to anyway.
- Type
-
The "kind" of data stored in a
[variable] or other
location. In various languages (including [C] and
[C++]), this instructs the [compile]r as to
how to handle it—for example, a [string] is handled
very differently from an [integer].
- Unix
-
An
[operating system] created as a successor to
MULTICS by Kernighan, Ritchie, and Thompson, notable for
influencing several later systems, including BSD (and
thenceforth Mac OS), HP/UX, Solaris, [Linux], and many
others.
- Unsigned
-
Said of an
[integer] when it cannot represent negative
values. This allows an integer of a fixed [precision]
to hold larger positive values at the expense of not
representing negative ones. Care must be taken that values
which "underflow" below zero will be read back as arbitrarily
large integers.
- User
-
An object which conceptually represents a person's (or,
sometimes, a service's) identity as known by a system. It is
associated with a unique identifier, a name, a password, a
[home directory], a [shell], and some other information.
- Value
-
Of a
[variable], the data contained in the memory to
which the variable refers. For example, if foo is set
to the [integer] 3, then foo's value
is 3 from then on (until it changes).
- Variable
-
In a
[program] (or, more accurately, its [source
code]), a named piece of memory that has a [type]
(known to the [compile]r) and a [value]
(which is manipulated and used by the program when it runs,
under most circumstances). All variables are "declared" or
defined in some fashion.
- Working Directory
-
The "current directory" in which a program (e.g., your
[shell], [editor], etc.) does its "work".
Generally, specifying a relative [path] in these
programs will operate on the named [object] relative
to this directory.
Important Keystrokes
Most shells understand these keys or key combinations specially, but note that some programs (like vim, emacs, ssh, etc.) that are long-running and immersive may handle them in other ways:
- Ctrl + C
-
Interrupts the current
[process] or [shell]
[command]. Useful for returning to a [prompt]
if a rogue program is running endlessly or uncontrollably, or
if the shell is behaving oddly.
- Ctrl + Z
-
Takes the foreground
[job] and suspends it, putting it in the [background]. See Job Control.
- Ctrl + D
-
Sends the "end of file" signal to the
[foreground]
[process], or the [shell] if there is no
foreground process (see Job Control).
Most [program]s consider this to be the effective end
of [user] interaction (that is, they will no longer
expect [command]s), and so they will typically exit.
In most shells, this is (nearly) equivalent to using
exit explicitly.
- Tab
-
When pressed in the middle of typing a word, "tab completes" a
name; this is most frequently used to complete the names of
long or otherwise obnoxious components of
[path]s. For
example, if the [working directory] contains
[object]s named dir1, dir2, and
file, typing just fi or even f and
tapping Tab will cause the shell to type out the
rest of file. Shells will only complete up to the next
conflict, so typing d and pressing Tab will
complete up to dir but omit the next "1" or "2". In
some shells, tapping Tab at least twice will show
you all the possible matches so far, allowing you to see what
option you have to continue completing a name. Some very
complex shells (notably bash) let other
[program]s override their tab completion mechanisms,
so as to provide completions for arguments which are not paths.
Directories
These commands are mostly concerned with using or manipulating
directories:
- ls
-
Lists a
[directory]'s contents.
- mkdir path
-
Creates a new, empty
[directory] ("make directory") with the given [path].
- cd path
-
Instructs your
[shell] to change [working directory] ("change directory") to the named [path].
Files
These commands manipulate and utilize files:
- touch path
-
Creates a
[file] at the given [path], if it does not already exist.
- cat path
-
Writes the
[file] with the named [path] to your [terminal]. (Given more than one [path], concatenates those files' contents in order.)
- cp srcpath dstpath
-
Copies an
[object] specified by the
[path] srcpath to the path specified by
dstpath. If dstpath names a
[directory], it is silently assumed that the
real destination path will be inside that
directory, retaining the same [base name] (e.g.
copying /home/user/dir/foo to /home/user/bar,
if /home/user/bar is already a [directory],
will implicitly copy to /home/user/bar/foo). After a
successful copy, both srcpath and dstpath
(possibly modifies, as described before) will name two
different objects with the same contents.
- mv srcpath dstpath
-
Moves an
[object] specified by the
[path] srcpath to the path specified by
dstpath. Functionally, works just like cp
(including intelligent handling of destination directories),
except after the move, only dstpath will refer to
the object, and srcpath will no longer exist. This
can be used to rename objects.
- rm path
-
Removes an
[object] specified by the
[path] given. This cannot easily be undone.
Editors
These [program]s are fairly ubiquitous text
[editor]s found on most [Unix]es that you'll find
yourself working with:
- vim path
-
Vim, the Vi-improved text editor (descended from
vi, a visual editor, further from ex, the
extended editor, and finally from ed, the standard
editor) is a somewhat light and quite powerful text
editor geared toward working on line-based text files (as most
[source code] is written). Vim is modal,
meaning that it is in one of many different "input modes"
at any given time, which will cause it to react differently
to keypresses. Vim starts in normal mode; to
begin entering text, tap I to enter
insert mode and begin entering text. To quit,
tap Esc a few times (returning to normal
mode), then tap Shift + ; (that is,
colon: :) to get to a [command] line; type
wq to save changes, or q! to discard your
work, then tap Enter to end the program.
- emacs path
-
Emacs ("extensible macros", because it was
originally an extension from TECo, the tape
editor and corrector) is another "editor" program
developed by Richard Stallman as part of the GNU project, often
cited as a direct competitor of Vim. It is a bit larger than
Vim, but can also do quite a bit more than just edit text.
Emacs is technically modal, but not quite as severely as Vim;
for example, one can begin typing immediately into Emacs
without worrying about switching modes. Most commands in Emacs
are given by chording—pressing multiple keys at the
same time. For example, to quit and save changes, press
Ctrl + X, followed by Ctrl +
C.
- nano path
-
Nano (derived by the GNU project from Pico, another small
program) is a very small and lightweight text editor
reminiscent of Notepad on Windows. It has few functions
(limited mostly to copying/cutting and pasting, finding text,
and opening and closing files), but is extremely
straightforward—just begin typing to edit the file. Nano
commands rarely take more than one chord; for example, to exit,
just press Ctrl + X, and it will ask you
if you want to save changes on the way out.
Working Remotely
One nice thing about the [terminal] interface is that it
is easily and quickly adapted to networks; in that vein, commands
for working on remote machines—that is, across some
network from you—are ingrained into most [Unix]
derivatives. Please see the list
of hosts for some systems that you can try to remote into;
it is, of course, not an exhaustive list.
- ssh user@host
-
Connects to, and begins a session on, another machine
identified by host, which is usually either a
[domain name] or an [IP address].
user is the username as which you would like to
authenticate on that host. ssh is so named because
it is the secure shell, and purports to prevent
both eavesdropping and, as long as you've trusted that host at
least once, man-in-the-middle attacks; so far, it's made good
on that promise for over three decades. To end an ssh session,
as with any other shell, use
exit, or press Ctrl
+ D.
- scp srcspec dstspec
-
Like cp, copies srcspec to
dstspec, copying into
[directory] by
[base name] if either refers to a directory. Either of
the arguments may be:
- A regular
[path], in which case the file is
stored or read locally, or
- of the form user@host:path, where
user and host are interpreted and
used exactly as for ssh above, and
path is given relative to that user's
[home
directory].
It is indeed possible to copy from one remote machine to
another remote machine this way. scp, unlike
ssh, is not interactive (at least after asking for a
password), and the shell will return to the local prompt after
the copy is complete.
- sftp user@host
-
Manages files on a remote machine interactively. The arguments
are the same as for ssh, and, like it, this program
is interactive, and will continue until you tell it to exit;
however, instead of interacting with a
[shell], you
are instead giving [command]s to something resembling
the old ftp [program]; in particular, you
can use get path to download a file,
put path to upload a file, and
cd path to change [working
directory] on the remote machine. exit works as
expected.
- wget URL
-
Downloads a file give a URL, which usually looks like
http://some-site.com/path/to/file.ext or
ftp://cool-site.edu/~user/files.zip—id est, these are
the things you would type in to, say, your web browser's
address bar. The
[file] downloads to your
[working directory] with the same name as the
[base name] of the URL, possibly with a
number appended for uniqueness.
Programming
These [compile]rs are widely available, and indispensable
for creating executable [program]s:
- gcc path
-
The GNU C Compiler; expects one or more
[path]s to
[file]s containing programs written in the [C
programming language]; unless told otherwise, it will
generate an executable called a.out in the working
directory that is the result of compiling the
[program].
- g++ path
-
The GNU C++ Compiler; expects one or more
[path]s to
[file]s containing programs written in the [C++
Programming Language]; unless told otherwise, it will
generate an executable [program] in the [working
directory] with the same [base name] as the first
argument, but with any [extension] and the associated
dot removed, if any.
- gdb executable
-
The GNU Debugger; expects a
[path] to an executable
[program]. It runs interactively, expecting
[command]s from the [user], much like the
[editor]s. The most important of them are:
- break linenumber: Instruct gdb to pause the program and return to its
[prompt] when [control flow] reaches this line.
- print expression: Displays the value of an arbitrary
[expression] evaluates in the context of the [variable]s you've declared.
- continue: Unpause a program and return it to the
[foreground].
- run: Start and run a program; the same as start followed by continue. It runs in the
[foreground] unless you interrupt it or it reaches a breakpoint—see break above.
- next: Go to the next line in the
[source code], skipping over any [function] [call]s.
- step: Go to the next line in the
[source code], going inside any [function] [call]s.
- until linenumber: Same as continue, but will temporarily also set a break at the given linenumber. Useful for skipping over long loops.
- kill: Terminate the program while it is paused in the
[background].
- quit: Exit gdb after killing any
[background] [process]es.
Shells
As stated before, [shell]s are a critical part of a
[user]'s interaction with a system; while one does not
normally need to launch one explicitly, it is useful to know that,
just like all other [program]s, they too can be located
and run:
- sh
-
The "default
[shell]"; located absolutely at
/bin/sh, it is required by the
[POSIX] standard. In most cases, it is just a link to
another shell on the system.
- bash
-
The "Bourne-again
[shell]", a de-facto standard for
many [Linux] installations, insofar as sh
usually refers to it. Unlike pure sh,
bash supports various quite advanced features,
including the advanced tab completion and
powerful text processing, making it the shell of choice for
very involved scripting.
- zsh
-
The "Zed
[shell]" is another serious attempt at a
rather full-fledged, functional shell, focused more directly on
ease of user interaction and extensibility instead of powerful
commands for scripting. It remains popular in the BSD
communities.
Job Control
[Job]s are [process]es that are "owned by" (run
from within) your [shell]; while one session with a shell
can have an arbitrary number of [background] jobs, only
one at a time can read from your keyboard—this is the singular
[foreground] job, if any; otherwise, it is your shell. The
foreground job can be paused with Ctrl + Z, which will return
your shell to its [prompt], allowing you to run another command while
it is suspended. Additionally, the following commands are useful for
manipulating jobs:
- bg
-
[Background] the [job] most recently
suspended with Ctrl +
Z; after running this, it is no longer suspended
and will respond to other events (if it is programmed to do that),
but it will no longer accept input from your keyboard until you
foreground it again.
- fg num
-
[Foreground] a [job] that is running in the
[background]; the job can either be selected by its ID
as shown by jobs, or, if num is omitted,
the most recently backgrounded job will be foregrounded. That
job will have full access to the keyboard again, until it is
either suspended again, or terminates.
- jobs
-
Writes to your
[terminal] the currently running
[job]s.
- exit
-
Attempts to end the
[shell] [program]. The
first time you try this, if you have [background]
[job]s running, it will notify you of this fact; if
you don't care, enter it once more, and it will end forcibly,
killing any background jobs that are remaining.
Getting Help
[Linux] developers try to be developer-friendly, and this
includes writing good, accurate documentation. Much of it is made
to be simply accessible from the [shell]:
- man topic
-
Loads and displays a "
[man page]", a so called manual
for the given topic. topic is usually the
name of a program (such as any of the programs given in this
file); most implementations of man will open up a
"pager" and interact with you, allowing you to scroll and
search through the documentation; tap
Q to exit.
- apropos phrase
-
Searches through the
[man page]s for the given
phrase, listing the topic names and summaries of
matches it finds. The command is so called for finding the
"apropos" command for a given topic; for example, it will
quickly find cat given either write or
concatenate as an argument.
- command --help
-
If all else fails, if no
[man page]s exist for a given
program, or if you just want a quick summary, most commands
listed here (even ones that don't normally accept arguments)
support a special argument --help, which will
give an abbreviated overview of their function
and arguments.