perintah linux lanjutan

top

top [options]

Provide information (frequently refreshed) about the most CPU-intensive processes currently running. You do not need to include a – before options. See ps for explanations of the field descriptors.
Options
-b

Run in batch mode; don’t accept command-line input. Useful for sending output to another command or to a file.

-c

Show command line in display instead of just command name.

-d delay

Specify delay between refreshes.

-f

Add or remove fields or columns.

-h

Print a help message and exit.

-i

Suppress display of idle and zombie processes. -i is a toggle; top starts with the last remembered setting.

-n num

Update display num times, then exit.

-p pid

Monitor only processes with the specified process ID.

-s

Secure mode. Disable some (dangerous) interactive commands.

-S

Cumulative mode. Print total CPU time of each process, including dead child processes.

-u user

Monitor only processes with the specified effective UID or username.

-U user

Monitor only processes with the specified UID or username, matching real, effective, saved, and filesystem ids.

-v

Print version information and exit.

Interactive commands
=

Remove restrictions on which tasks are shown. Reverses the effect of an active i or n command.

space, Enter

Update display immediately.

Move the sort field. Use to move one column to the right.

A

Toggle alternate display mode between a single window or multiple windows. See the following section Alternate display mode commands for the commands that work with A.

b

Toggle between bold and reverse display. Only works with x or y.

B

Globally toggle bold display.

c

Toggle display of command name or full command line.

d, s

Change delay between refreshes. Prompt for new delay time, which should be in seconds. Suppressed in secure mode.

f

Prompt to add fields to or remove fields from the display.

F, O

Select sort field.

G

Select another field group and make it current, or change by selecting a number from the following list:
1

Def

2

Job

3

Mem

4

Usr

h, ?

Display help about commands and the status of secure and cumulative modes.

I, 1

Toggle SMP view. Use I to toggle IRIX/Solaris mode, 1 to toggle single/separate states.

k

Prompt for process ID to kill, and signal to send (default is 15) to kill it.

i

Toggle suppression of idle and zombie processes.

l

Toggle display of load-average and uptime information.

m

Toggle display of memory information.

n, #

Prompt for maximum number of processes to show. If 0 is entered, show as many as will fit on the screen (default).

N

Sort numerically by process ID.

o

Prompt to change order of displayed fields.

P

Sort tasks by CPU usage (default).

q

Exit.

r

Apply renice to a process. Prompt for PID and renice value. Suppressed in secure mode.

R

Toggle normal or reverse sort.

S

Toggle cumulative mode. (See the -S option.)

t

Toggle display of processes and CPU states lines.

T

Sort tasks by time/cumulative time.

u

Prompt for specific user to show.

W

Write current setup to ~/.toprc. This is the recommended way to write a top configuration file.

x

Toggle highlighting for sort field.

y

Toggle highlights for running tests.

z

Toggle between color and mono display.

Z

Globally change color mappings.

Alternate display mode commands
=

Rebalance tasks in the current window.

+

Rebalance tasks in every window.

-

Show or hide the current window.

_

Show all invisible windows or hide all visible windows.

a

Cycle forward through all four windows.

g

Change the name of the current window or group.

w

Cycle backward through all four windows.

Field descriptions

The first five entries in the following list describe the lines that appear at the top of the top display. The rest are the fields that can be displayed for each task (sizes are in kilobytes). Use the interactive f command to add or remove fields.
top

Display the time the system has been up, the number of users, and three load averages consisting of the average number of processes ready to run in the last 1, 5, and 15 minutes.

Tasks

The total number of processes running when the last update was taken, shown as the number of running, sleeping, stopped, or undead tasks.

Cpu(s)

The percentage of CPU time spent in user mode, in system mode, on tasks with a negative nice value, and idle.

Mem

Memory statistics, including total available memory, free memory, memory used, shared memory, and memory used for buffers.

Swap

Swapspace statistics, including total, available, used, and cached.

PID

Process ID.

PPID

Parent process ID.

UID

Effective user ID of task’s owner.

USER

Effective username of task’s owner.

RUSER

Real username of task’s owner.

GROUP

The effective group name of task’s owner.

PR

Priority.

NI

Nice value.

nFLT

Page fault count.

CODE

Code size.

DATA

Data plus stack size.

RES

Resident task size.

SWAP

Size of swapped-out portion of task.

VIRT

The total amount of virtual memory used by the task.

nDRT

Size of pages marked dirty.

#C

Last-used processor, for multiprocessor systems.

SHR

Amount of shared memory used.

S

State of the task. Values are S (sleeping), D (uninterruptible sleep), R (running), Z (zombies), or T (stopped or traced), possibly followed by backup.tar

(The – tells tar to store the archive on standard output, which is then redirected.)

Filter an archive through gzip, extracting the contents but leaving the original file compressed:

tar xvfz chapters.tar.gz

touch

touch [options] files

For one or more files, update the access time and modification time (and dates) to the current time and date. touch is useful

in forcing other commands to handle files a certain way; for example, the operation of make, and sometimes find, relies on a

file’s access and modification time. If a file doesn’t exist, touch creates it with a file size of 0.
Options
-a, –time=atime, –time=access, –time=use

Update only the access time.

-c, –no-create

Do not create any file that doesn’t already exist.

-d time, –date time

Change the time value to the specified time instead of the current time. time can use several formats and may contain

month names, time zones, a.m. and p.m. strings, etc.

-m, –time=mtime, –time=modify

Update only the modification time.

-r file, –reference file

Change times to be the same as those of the specified file, instead of the current time.

-t time

Use the time specified in time instead of the current time. This argument must be of the format [[cc] yy] mmddhhmm[.ss] ,

indicating optional century and year, month, date, hours, minutes, and optional seconds.

–help

Print help message and then exit.

–version

Print the version number and then exit.

as

as [options] files

Generate an object file from each specified assembly-language source file. Object files have the same root name as source

files but replace the .s suffix with .o. There may be some additional system-specific options.
Options
– [ | files]

Read input files from standard input, or from files if the pipe is used.

-a[cdhlmns] [=file]

With only the -a option, list source code, assembler listing, and symbol table. The other options specify additional

things to list or omit:
-ac

Omit false conditionals.

-ad

Omit debugging directives.

-ah

Include the high-level source code, if available.

-al

Include an assembly listing.

-am

Include macro expansions.

-an

Suppress forms processing.

-as

Include a symbol listing.

=file

Set the listing filename to file.

–defsym symbol=value

Define the symbol to have the value value, which must be an integer.

-f

Skip whitespace and comment preprocessing.

–fatal-warnings

Treat warnings as errors.

–gstabs

Generate debugging information in stabs format.

–gdwarf2

Generate DWARF2 debugging information.

-o objfile

Place output in object file objfile (default is file.o).

–statistics

Print information on how much time and space assembler uses.

-v

Display the version number of the assembler.

-I path

Include path when searching for .include directives.

-J

Don’t warn about signed overflow.

-R

Combine both data and text in text section.

-W

Don’t show warnings.

-Z

Generate object file even if there are errors.

cp

cp [options] file1 file2 cp [options] files directory

Copy file1 to file2, or copy one or more files to the same names under directory. If the destination is an existing file, the

file is overwritten; if the destination is an existing directory, the file is copied into the directory (the directory is not

overwritten).
Options
-a, –archive

Preserve attributes of original files where possible. The same as -dpr.

-b, –backup

Back up files that would otherwise be overwritten.

-d, –no-dereference

Do not dereference symbolic links; preserve hard-link relationships between source and copy.

-f, –force

Remove existing files in the destination.

-i, –interactive

Prompt before overwriting destination files. On most systems, this flag is turned off by default except for the root

user, who is normally prompted before overwriting files.

-l, –link

Make hard links, not copies, of nondirectories.

-p, –preserve

Preserve all information, including owner, group, permissions, and timestamps.

-P, –parents

Preserve intermediate directories in source. The last argument must be the name of an existing directory. For example,

the command:

cp –parents jphekman/book/ch1 newdir

copies the file jphekman/book/ch1 to the file newdir/jphekman/book/ch1, creating intermediate directories as necessary.

-r, -R, –recursive

Copy directories recursively.

-S backup-suffix, –suffix=backup-suffix

Set suffix to be appended to backup files. This may also be set with the SIMPLE_BACKUP_SUFFIX environment variable. The

default is ~. You need to explicitly include a period if you want one before the suffix (for example, specify .bak, not bak).

-s, –symbolic-link

Make symbolic links instead of copying. Source filenames must be absolute.

–sparse=[always|auto|never]

Handle files that have “holes” (are defined as a certain size but have less data). always creates a sparse file, auto

creates one if the input file is sparse, and never creates a non-sparse file without holes.

-u, –update

Do not copy a file to an existing destination with the same or newer modification time.

-v, –verbose

Before copying, print the name of each file.

-V type, –version-control=type

Set the type of backups made. You may also use the VERSION_CONTROL environment variable. The default is existing. Valid

arguments are:
t, numbered

Always make numbered backups.

nil, existing

Make numbered backups of files that already have them; otherwise, make simple backups.

never, simple

Always make simple backups.

-x, –one-file-system

Ignore subdirectories on other filesystems.

Example

Copy the contents of the guest directory recursively into the /archives/guest/ directory, and display a message for each file

copied:

cd /archives && cp -av /home/guest guest

eject

eject [options] [device]

Eject removable media such as a CD-ROM, floppy, tape, or JAZ or ZIP disk. You may name the device by its /dev or /mnt

filename. The /dev and /mnt prefixes are optional for any items in the /dev and /mnt directories. If no device is named, it

is assumed that “cdrom” should be ejected.
Options

The eject command takes the following option flags:
-h

Display help information.

-v, –verbose

Verbose mode: display additional information about actions.

-d, –default

List the default device name rather than doing anything.

-a, –auto on|1|off|0

Set the auto-eject mode to on or off (equivalent to 1 or 0, respectively). If auto-eject mode is on, the device is

ejected when closed or unmounted.

-c, –changerslot slotnumber

If using a CD-ROM changer, select a CD from one of the slots. Slots are enumerated starting with 0, and the CD-ROM drive

must not be playing music or mounted to read data.

-t, –trayclose

Close the CD-ROM drive. Not all drives will respond to this command.

-x, –cdspeed speed

Set the speed multiplier for the CD-ROM to an integer, usually a power of 2. Not all devices support this command.

Setting the speed to 0 indicates that the drive should operate at its maximum speed.

-n, –noop

Do not perform any actions; merely display the actions that would be performed.

-r, –cdrom

Use CD-ROM commands to eject the drive. Normally, the system will try all methods (CD-ROM, SCSI, floppy, tape) to eject.

-s, –scsi

Use SCSI commands to eject the drive. Normally, the system will try all methods (CD-ROM, SCSI, floppy, tape) to eject.

-f, –floppy

Use floppy commands to eject the drive. Normally, the system will try all methods (CD-ROM, SCSI, floppy, tape) to eject.

-q, –tape

Use tape commands to eject the drive. Normally, the system will try all methods (CD-ROM, SCSI, floppy, tape) to eject.

-p, –proc

Use the mounted files listed in /proc/mounts rather than in /etc/mtab.

-V, –version

Display version information, then quit.

whatis

whatis keywords

Search the short manual page descriptions in the whatis database for each keyword and print a one-line description to

standard output for each match. Like apropos, except that it searches only for complete words. Equivalent to man -f.

groupadd

groupadd [options] group

System administration command. Create new group of accounts for the system.
Options
-f

Exit with error if group being added already exists. If a gid requested with -g already exists and the -o option has not

been specified, assign a different gid as if -g had not been specified. This option is not available on all distributions.

-g gid

Assign numerical group ID. (By default, the first available number above 500 is used.) The value must be unique, unless

the -o option is used.

–help

Display a help message.

-o

Accept a nonunique gid with the -g option.

-p,–password string

Use the string encrypted by crypt(3), as the initial password for the group.

-P,–path pathname

Specify the path for the group definition file. Normally, the file is placed in /etc/group.

-r,–system

Add a system account. Assign the first available number lower than 499.

–service servicename

Add the group to a special service category. Normally, this is “files,” but it may also be “ldap.”

–usage

Display a very short list of acceptable options for the command.

-v,–version

Print the version number, then quit.

at

at [options] time [date]

Execute commands at a specified time and optional date. The commands are read from standard input or from a file. (See also

batch.) End input with EOF. time can be formed either as a numeric hour (with optional minutes and modifiers) or as a

keyword. It can contain an optional date, formed as a month and date, a day of the week, or a special keyword (today or

tomorrow). An increment can also be specified.

The at command can always be issued by a privileged user. Other users must be listed in the file /etc/at.allow if it exists;

otherwise, they must not be listed in /etc/at.deny. If neither file exists, only a privileged user can issue the command.
Options
-c job [job...]

Display the specified jobs on the standard output. This option does not take a time specification.

-d job [job...]

Delete the specified jobs. Same as atrm.

-f file

Read job from file, not from standard input.

-l

Report all jobs that are scheduled for the invoking user. Same as atq.

-m

Mail user when job has completed, regardless of whether output was created.

-q letter

Place job in queue denoted by letter, where letter is any single letter from a-z or A-Z. Default queue is a. (The batch q

poweroff

poweroff [options]

System administration command. Close out filesystems, shut down the system, and power off. Because this command immediately

stops all processes, it should be run only in single-user mode. If the system is not in runlevel 0 or 6, poweroff calls

shutdown -h, then performs a poweroff.
Options
-d

Suppress writing to /var/log/wtmp.

-f

Call reboot or halt and not shutdown, even when shutdown would normally be called. This option is used to force a hard

halt or reboot.

-h

Place hard drives in standby mode before halt or poweroff.

-i

Shut down network interfaces before reboot.

-n

Suppress normal call to sync.

-w

Suppress normal execution; simply write to /var/log/wtmp.

users

users [file] users option

Print a space-separated list of each login session on the host. Note that this may include the same user multiple times.

Consult file or, by default, /var/log/utmp or /var/log/wtmp.
Options
–help

Print usage information and exit.

–version

Print version information and exit.

login

login [name | option]

Log into the system. login asks for a username (name can be supplied on the command line) and password (if appropriate).

If successful, login updates accounting files, sets various environment variables, notifies users if they have mail, and

executes startup shell files.

Only the root user can log in when /etc/nologin exists. That file is displayed before the connection is terminated.

Furthermore, root may connect only on a tty that is listed in /etc/securetty. If ~/.hushlogin exists, execute a quiet login.

If /var/adm/lastlog exists, print the time of the last login.
Options
-f

Suppress second login authentication.

-h host

Specify name of remote host. Normally used by servers, not humans; may be used only by root.

-p

Preserve previous environment.

shutdown

shutdown [options] when [message]

System administration command. Terminate all processing. when may be a specific time (in hh:mm format), a number of minutes

to wait (in +m format), or now. A broadcast message notifies all users to log off the system. Processes are signaled with

SIGTERM to allow them to exit gracefully. /etc/init is called to perform the actual shutdown, which consists of placing the

system in runlevel 1. Only privileged users can execute the shutdown command, although init may call shutdown with root

privileges when the Ctrl-Alt-Del key combination is pressed from the console keyboard. Broadcast messages, default or

defined, are displayed at regular intervals during the grace period; the closer the shutdown time, the more frequent the

message.
Options
-a

When called from init, shut down only if one of the users listed in the file /etc/shutdown.allow is currently logged in.

-c

Cancel a shutdown that is in progress.

-f

Reboot fast, by suppressing the normal call to fsck when rebooting.

-F

Force a filesystem check (fsck) on reboot.

-h

Halt the system when shutdown is complete.

-k

Print the warning message, but suppress actual shutdown.

-r

Reboot the system when shutdown is complete.

-t num

Ensure a num-second delay between killing processes and changing the runlevel.

logname

logname [option]

Consult /var/run/utmp for user’s login name. If found, print it; otherwise, exit with an error message.
Options
–help

Print a help message and then exit.

–version

Print version information and then exit.

ipcs

ipcs [options]

System administration command. Print report on interprocess communication (IPC) message queues, shared memory segments, and

semaphore arrays for which the current process has read access. Options can be used to specify the type of resources to

report on and the output format of the report.
Options

Resource specification options:
-a

Report on all IPC facilities: shared memory segments, message queues, and semaphore arrays. This is the default.

-m

Report on shared memory segments.

-q

Report on message queues.

-s

Report on semaphore arrays.

Output format options:
-b

Print information on maximum size of the resource: size in bytes of messages or shared memory segments, and the number of

semaphores per set in the case of semaphore arrays.

-c

Print creator and owner user IDs for IPC facilities.

-l

Print resource maximum and minimum limits.

-o

Print outstanding usage of the resource in question: the number of messages and the total size of the message queue, or

the number of processes using shared memory segments.

-p

Print creator and last operation process identifiers.

-t

Print attach, detach, and change times for shared memory segments, last operation and change times for semaphore arrays,

and send, receive, and change times for message queues.

-u

Print summary of current resource usage.

Other options:
-h

Print help message, then exit.

-i identifier

Used in combination with the -m, -q, or -s options. Report only on the resource specified by numeric identifier.

userdel

userdel [option] user

System administration command. Delete all entries for user in system account files.
Option
-r

Remove the home directory of user and any files contained in it.

route

route [options] [command]

TCP/IP command. Add or remove entries in the routing tables maintained by routed. route accepts two commands: add, to add a

route, and del, to delete a route. The two commands have the following syntax:

add [-net | -host] address [modifiers] del [-net | -host] address [modifiers]

address is treated as a plain route, unless -net is specified or address is found in /etc/networks. -host can be used to

specify that address is a plain route whether or not it is found in /etc/networks. Using route modifiers, you can specify the

gateway through which to route packets headed for that address, its netmask, TCP mss, or the device with which to associate

the route; you can also mask certain routes. Only a privileged user may modify the routing tables.

If no command is specified, route prints the routing tables.
Options
-A family, –family

Specify an address family to use with an add or del command. family may be inet, inet6, ax25, netrom, ipx, ddp, or x25.

-C, –cache

Perform command on the routing cache instead of the forwarding information base (FIB) routing table.

-e, –extend

Use netstat -r format to print routing table. Use twice to print extended information. Same as netstat -ree.

-F, –fib

Perform command on the forwarding information base (FIB) routing table. This is the default behavior.

-h, –help

Print help message, then exit.

-n, –numeric

Show numerical addresses; do not look up hostnames. (Useful if DNS is not functioning properly.)

-v, –verbose

Verbose mode.

-V, –version

Print version and configuration options, then exit.

Route modifiers
[dev] interface

Associate route with specified device. When the interface is given as the last argument on a command line, the word dev

is optional.

netmask mask

Use netmask mask.

gw gateway

Route packets through gateway.

metric n

Set routing metric to n.

mss bytes

Set maximum segment size for connections over this route.

reject

Cause route lookup for target to fail. Used to mask out networks from a default route.

Example

Add a default gateway for interface eth0:

route add default gw 192.168.0.1 dev eth0

which

which [options] [--] [commands]

List the full pathnames of the files that would be executed if the named commands had been run. which searches the user’s

$PATH environment variable.
Options
-a, –all

Print all matches, not just the first.

-i, –read-alias

Read aliases from standard input and write matches to standard output. Useful for using an alias for which.

–read-functions

Read shell functions from standard input and report matches to standard output. Useful for also using a shell function

for which itself.

–skip-alias

Ignore –read-alias if present. Useful for finding normal binaries while using –read-alias in an alias for which.

–skip-dot

Skip directories that start with a dot.

–skip-functions

Ignore –read-functions if present. Useful when searching for normal binaries while using –read-functions in an alias or

function for which.

–skip-tilde

Skip directories that start with a tilde (~) and executables in $HOME.

–show-dot

If a matching command is found in a directory that starts with a dot, print ./cmdname instead of the full pathname.

–show-tilde

Print a tilde (~) to indicate the user’s home directory. Ignored if the user is root.

–tty-only

Stop processing options on the right if not on a terminal.

-v, -V, –version

Print version information and then exit.

–help

Print help information and then exit.

Example

$ which cc ls /usr/bin/cc ls: aliased to ls -sFC

ls

ls [options] [names]

List contents of directories. If no names are given, list the files in the current directory. With one or more names, list

files contained in a directory name or that match a file name. names can include filename metacharacters. The options let you

display a variety of information in different formats. The most useful options include -F, -R, -l, and -s. Some options don’t

make sense together (e.g., -u and -c).
Options
-1, –format=single-column

Print one entry per line of output.

-a, –all

List all files, including the normally hidden files whose names begin with a period.

-b, –escape

Display nonprinting characters in octal and alphabetic format.

-c, –time-ctime, –time=status

List files by status change time (not creation/modification time).

–color =when

Colorize the names of files depending on the type of file. Accepted values for when are never, always, or auto.

-d, –directory

Report only on the directory, not its contents.

-f

Print directory contents in exactly the order in which they are stored, without attempting to sort them.

–full-time

List times in full, rather than using the standard abbreviations.

-g

Long listing like -l, but don’t show file owners.

-h

Print sizes in kilobytes and megabytes.

–help

Print a help message and then exit.

-i, –inode

List the inode for each file.

–indicator-style=none

Display filenames without the flags assigned by -p or -f (default).

-k, –kilobytes

If file sizes are being listed, print them in kilobytes. This option overrides the environment variable POSIXLY_CORRECT.

-l, –format=long, –format=verbose

Long format listing (includes permissions, owner, size, modification time, etc.).

-m, –format=commas

Merge the list into a comma-separated series of names.

-n, –numeric-uid-gid

Like -l, but use group ID and user ID numbers instead of owner and group names.

-o

Long listing like -l, but don’t show group information.

-p, –filetype, –indicator-style=file-type

Mark directories by appending / to them.

-q, –hide-control-chars

Show nonprinting characters as ? (default for display to a terminal).

-r, –reverse

List files in reverse order (by name or by time).

-s, –size

Print file size in blocks.

–show-control-chars

Show nonprinting characters verbatim (default for printing to a file).

–si

Similar to -h, but uses powers of 1,000 instead of 1,024.

-t, –sort=time

Sort files according to modification time (newest first).

-u, –time=atime, –time=access, –time=use

Sort files according to file-access time.

–version

Print version information on standard output, then exit.

-x, –format=across, –format=horizontal

List files in rows going across the screen.

-v, –sort=version

Interpret the digits in names such as file.6 and file.6.1 as versions, and order filenames by version.

-w, –width=n

Format output to fit n columns.

-A, –almost-all

List all files, including the normally hidden files whose names begin with a period. Does not include the . and ..

directories.

-B, –ignore-backups

Do not list files ending in ~ unless given as arguments.

-C, –format=vertical

List files in columns (the default format).

-D, –dired

List in a format suitable for Emacs dired mode.

-F, –classify, –indicator-style=classify

Flag filenames by appending / to directories, * to executable files, @ to symbolic links, | to FIFOs, and = to sockets.

-G, –no-group

In long format, do not display group name.

-H, –dereference-command-line

When symbolic links are given on the command line, follow the link and list information from the actual file.

-I, –ignore pattern

Do not list files whose names match the shell pattern pattern, unless they are given on the command line.

-L, –dereference

List the file or directory referenced by a symbolic link rather than the link itself.

-N, –literal

Display special graphic characters that appear in filenames.

-Q, –quote-name

Quote filenames with “; quote nongraphic characters.

-R, –recursive

List directories and their contents recursively.

-Rfile, –reload-state file

Load state from file before starting execution.

-S, –sort=size

Sort by file size, largest to smallest.

-U, sort=none

Do not sort files.

-X, sort=extension

Sort by file extension, then by filename.

groups

groups [options] [users]

Show the groups that each user belongs to (default user is the owner of the current group). Groups are listed in /etc/passwd

and /etc/group.
Options
–help

Print help message.

–version

Print version information.

chpasswd

chpasswd [option]

System administration command. Change user passwords in a batch. chpasswd accepts input in the form of one username:password

pair per line. If the -e option is not specified, password is encrypted before being stored.
Option
-e

Passwords given are already encrypted.

whereis

whereis [options] files

Locate the binary, source, and manual page files for specified commands/files. The supplied filenames are first stripped of

leading pathname components and any (single) trailing extension of the form .ext (for example, .c). Prefixes of s. resulting

from use of source code control are also dealt with. whereis then attempts to locate the desired program in a list of

standard Linux directories (/bin, /etc, /usr/bin, /usr/local/bin/, etc.).
Options
-b

Search only for binaries.

-f

Terminate the last directory list and signal the start of filenames. Required when the -B, -M, or -S option is used.

-m

Search only for manual sections.

-s

Search only for sources.

-u

Search for unusual entries—that is, files that do not have one entry of each requested type. Thus, the command whereis -m

-u * asks for those files in the current directory that have no documentation.

-B directories

Change or otherwise limit the directories to search for binaries.

-M directory

Change or otherwise limit the directories to search for manual sections.

-S directory

Change or otherwise limit the directories to search for sources.

Example

Find all files in /usr/bin that are not documented in /usr/share/man/man1 but that have source in /usr/src:

$ cd /usr/bin $ whereis -u -M /usr/share/man/man1 -S /usr/src -f *

umount

umount [options] [directory]

System administration command. Unmount filesystem specified by directory. You may also specify the filesystem by device name.

umount announces to the system that the removable file structure previously mounted on the specified directory is to be

removed. Any pending I/O for the filesystem is completed, and the file structure is flagged as clean. A busy filesystem

cannot be unmounted.
Options
-a

Unmount all filesystems listed in /etc/mtab other than /proc.

-d

If the unmounted device was a loop device, free the loop device too. See also the losetup command.

-f

Force the unmount. This option requires kernel 2.1.116 or later.

-h

Print help message and exit.

-l

Lazy unmount. Detach the filesystem from the hierarchy immediately, but don’t clean up references until it is no longer

busy. Requires kernel 2.4.11 or later.

-n

Unmount, but do not record changes in /etc/mtab.

-O options

Unmount only filesystems with the specified options in /etc/fstab. Specify multiple options as a comma-separated list.

Add no as a prefix to an option to indicate filesystems that should not be unmounted.

-r

If unmounting fails, try to remount read-only.

-t type

Unmount only filesystems of type type. Multiple types can be specified as a comma-separated list, and any type can be

prefixed with no to specify that filesystems of that type should not be unmounted.

-v

Verbose mode.

-V

Print version information and exit.

useradd

useradd [options] [user]

System administration command. Create new user accounts or update default account information. Unless invoked with the -D

option, user must be given. useradd will create new entries in system files. Home directories and initial files may also be

created as needed.
Options
-c comment

Comment field.

-d dir

Home directory. The default is to use user as the directory name under the home directory specified with the -D option.

-e date

Account expiration date. Use the format MM/DD/YYYY. Two-digit year fields are also accepted. The value is stored as the

number of days since January 1, 1970. This option requires the use of shadow passwords.

-f days

Permanently disable account this many days after the password has expired. A value of -1 disables this feature. This

option requires the use of shadow passwords.

-g group

Initial group name or ID number. If a different default group has not been specified using the -D option, the default

group is 1.

-G groups

Supplementary groups given by name or number in a comma-separated list with no whitespace.

-k [dir]

Copy default files to the user’s home directory. Meaningful only when used with the -m option. Default files are copied

from /etc/skel/ unless an alternate dir is specified.

-m

Make user’s home directory if it does not exist. The default is not to make the home directory.

-M

Do not create a home directory for the user, even if the system default in /etc/login.defs is to create one.

-n

Red Hat-specific option. Turn off the Red Hat default that creates a group with the same name as the username and puts

the user in that group.

-o

Override. Accept a nonunique uid with the -u option. (Probably a bad idea.)

-p passwd

The encrypted password, as returned by crypt(3).

-r

Red Hat-specific option. Create a system account with a non-expiring password and a UID lower than the minimum defined in

/etc/login.defs. Do not create a home directory for the account unless -m is also specified.

-s shell

Login shell.

-u uid

Numerical user ID. The value must be unique unless the -o option is used. The default value is the smallest ID value

greater than 99 and greater than every other uid.

-D [options]

Set or display defaults. If options are specified, set them. If no options are specified, display current defaults. The

options are:
-b dir

Home directory prefix to be used in creating home directories. If the -d option is not used when creating an account,

the user name will be appended to dir.

-e date

Expire date. Requires the use of shadow passwords.

-f days

Number of days after a password expires to disable an account. Requires the use of shadow passwords.

-g group

Initial group name or ID number.

-s shell

Default login shell.

mount

mount [options] [[device] directory]

System administration command. Mount a file structure. The file structure on device is mounted on directory. If no device is

specified, mount looks for an entry in /etc/fstab to find out what device is associated with the given directory. The

directory, which must already exist and should be empty, becomes the name of the root of the newly mounted file structure. If

mount is invoked with no arguments, it displays the name of each mounted device, the directory on which it is mounted, its

filesystem type, and any mount options associated with the device.
Options
-a

Mount all filesystems listed in /etc/fstab. Use -t to limit this to all filesystems of a particular type.

–bind olddirectory newdirectory

Bind a mounted subtree to a new location. The tree will be available from both the old and new directory. This binding

does not include any volumes mounted below the specified directory.

-f

Fake mount. Go through the motions of checking the device and directory, but do not actually mount the filesystem.

-F

When used with -a, fork a new process to mount each system.

-h

Print help message, then exit.

-l

When reporting on mounted filesystems, show filesystem labels for filesystems that have them.

-L label

Mount filesystem with the specified label.

–move olddirectory newdirectory

Move a mounted device to a new location. Keep in place any options and submounts.

-n

Do not record the mount in /etc/mtab.

-o option

Qualify the mount with a mount option. Many filesystem types have their own options. The following are common to most

filesystems:
async

Read input and output to the device asynchronously.

atime

Update inode access time for each access. This is the default behavior.

auto

Allow mounting with the -a option.

defaults

Use all options’ default values (async, auto, dev, exec, nouser, rw, suid).

dev

Interpret any special devices that exist on the filesystem.

dirsync

Perform all directory updates to the filesystem synchronously.

exec

Allow binaries to be executed.

_netdev

Filesystem is a network device requiring network access.

noatime

Do not update inode access time for each access.

noauto

Do not allow mounting via the -a option.

nodev

Do not interpret any special devices that exist on the filesystem.

noexec

Do not allow the execution of binaries on the filesystem.

nosuid

Do not acknowledge any suid or sgid bits.

nouser

Only privileged users will have access to the filesystem.

remount

Expect the filesystem to have already been mounted, and remount it.

ro

Allow read-only access to the filesystem.

rw

Allow read/write access to the filesystem.

suid

Acknowledge suid and sgid bits.

sync

Read input and output to the device synchronously.

user

Allow unprivileged users to mount or unmount the filesystem. The defaults on such a system will be nodev, noexec, and

nosuid, unless otherwise specified.

users

Allow any user to mount or unmount the filesystem. The defaults on such a system will be nodev, noexec, and nosuid,

unless otherwise specified.

-O option

Limit systems mounted with -a by -O’s filesystem options (as used with -o). Use a comma-separated list to specify more

than one option, and prefix an option with no to exclude filesystems with that option. Options -t and -O are cumulative.

-r

Mount filesystem read-only.

–rbind olddirectory newdirectory

Bind a mounted subtree to a new location. The tree will be available from both the old and new directory. Include any

volumes mounted below the specified directory.

-s

Where possible, ignore mount options specified by -o that are not supported by the filesystem.

-t type

Specify the filesystem type. Possible values include adfs, affs, autofs, coda, cramfs, devpts, efs, ext2, ext3, hfs,

hpfs, iso9660, jfs, minix, msdos, ncpfs, nfs, nfs4, ntfs, proc, qnx4, reiserfs, romfs, smbfs, sysv, tmpfs, udf, ufs, umsdos,

vfat, xfs, and xiafs. The default type is iso9660. The type auto may also be used to set mount to autodetect the filesystem.

When used with -a, this option can limit the types mounted. Use a comma-separated list to specify more than one type to

mount. Prefix a list (or type) with no to exclude those types.

-U uuid

Mount filesystem with the specified uuid.

-v

Display mount information verbosely.

-V

Print version, then exit.

-w

Mount filesystem read/write. This is the default.

Files
/etc/fstab

List of filesystems to be mounted and options to use when mounting them.

/etc/mtab

List of filesystems currently mounted and the options with which they were mounted.

/proc/partitions

Used to find filesystems by label and uuid.

du

du [options] [directories]

Print disk usage (as the number of 1 KB blocks used by each named directory and its subdirectories; default is the current

directory).
Options
-a, –all

Print disk usage for all files, not just subdirectories.

-b, –bytes

Print sizes in bytes.

-c, –total

In addition to normal output, print grand total of all arguments.

-D, –dereference-args

Follow symbolic links, but only if they are command-line arguments.

-h, –human-readable

Print sizes in human-readable format.

-H, –si

Like -h, but show as power of 1000 rather than 1024.

-k, –kilobytes

Print sizes in kilobytes (this is the default).

-l, –count-links

Count the size of all files, whether or not they have already appeared (i.e., via a hard link).

-L, –dereference

Follow symbolic links.

–exclude=pattern

Exclude files that match pattern.

–max-depth=num

Report sizes for directories only down to num levels below the starting point (which is level 0).

-m, –megabytes

Print sizes in megabytes.

-s, –summarize

Print only the grand total for each named directory.

-S, –separate-dirs

Do not include the sizes of subdirectories when totaling the size of parent directories.

-x, –one-file-system

Display usage of files in current filesystem only.

-X, –exclude-from=file

Exclude files that match any pattern in file.

–help

Print help message and then exit.

–version

Print the version and then exit.

kill

kill [options] [pids | commands]

Send a signal to terminate one or more process IDs. You must own the process or be a privileged user. If no signal is

specified, TERM is sent.

This entry describes the /bin/kill command, which offers several powerful features. There are also built-in shell commands of

the same name; the bash and ksh versions are described in Chapter 6.

In particular, /bin/kill allows you to specify a command name, such as gcc or xpdf, instead of a process ID (PID). All

processes running that command with the same UID as the process issuing /bin/kill will be sent the signal.

If /bin/kill is issued with a pid of 0, it sends the signal to all processes of its own process group. If /bin/kill is issued

with a pid of -1, it sends the signal to all processes except process 1 (the system’s init process).
Options
-a

Kill all processes of the given name (if privileges allow), not just processes with the same UID. To use this option,

specify the full path (e.g., /bin/kill -a gcc).

-l

List all signals.

-p

Print the process ID of the named process, but don’t send it a signal. To use this option, specify the full path (e.g.,

/bin/kill -p).

-s SIGNAL, -SIGNAL

The signal number (from /usr/include/sys/signal.h) or name (from kill -l). With a signal number of 9 (KILL), the kill

cannot be caught by the process; use this to kill a process that a plain kill doesn’t terminate. The default is TERM. The

letter flag itself is optional: both kill -9 1024 and kill -s 9 1024 terminate process 1024.

wall

wall [file] wall [-n] [message]

Write to all users. Depending on your Linux distribution, wall uses one of the two syntaxes shown. In both versions, the

default is for wall to read a message from standard input and send the message to all users currently logged in, preceded by

“Broadcast Message from…” With the first syntax, which comes with Debian, for example, if file is specified, wall reads

input from that file rather than from standard input, and only the superuser can write to a terminal if the user has

disallowed messages. With the second syntax, distributed by Red Hat, for example, the text of the message can be included on

the command line, and the message is limited to 20 lines. In this form, if -n is specified, the default banner message is

replaced with “Remote broadcast message”. -n can only be specified by the superuser, and only if wall was installed

set-group-id.
Example

Send the message contained in the file message.txt to all users:

$ wall operator to combine several files into a new file,

or >> to append files to an existing file. When appending to an existing file, use Ctrl-D, the end-of-file symbol, to end the

session.
Options
-A, –show-all

Same as -vET.

-b, –number-nonblank

Number all nonblank output lines, starting with 1.

-e

Same as -vE.

-E, –show-ends

Print $ at the end of each line.

-n, –number

Number all output lines, starting with 1.

-s, –squeeze-blank

Squeeze down multiple blank lines to one blank line.

-t

Same as -vT.

-T, –show-tabs

Print TAB characters as ^I.

-u

Ignored; retained for Unix compatibility.

-v, –show-nonprinting

Display control and nonprinting characters, with the exception of LINEFEED and TAB.

Examples

cat ch1 Display a file cat ch1 ch2 ch3 > all Combine files cat note5 >> notes Append to a file cat > temp1 Create file at

terminal. To exit, enter EOF (Ctrl-D). cat > temp2 << STOP Create file at terminal. To exit, enter STOP.

mattrib

mattrib [options] filenames

Change attributes of MS-DOS files. See mtools for more information.
Attributes

To set an attribute, use one of the following letters preceded by a + (to turn the attribute on) or – (to turn it off):
a

Archive; mark the file as a new file that should be archived by backup programs.

r

Read-only.

s

System; files with this attribute are marked as operating system files.

h

Hide this file when displaying directory contents with DIR.

Options
-/

When listing attributes, descend into all subdirectories recursively.

-X

Concise output.

-p

Display commands for mformat that can reproduce the current attributes and settings for a given disk.

fdisk

fdisk [options] [device]

System administration command. fdisk displays information about disk partitions, creates and deletes disk partitions, and

changes the active partition. It is possible to assign a different operating system to each of the four possible primary

partitions, though only one partition is active at any given time. You can also divide a physical partition into several

logical partitions. The minimum recommended size for a Linux system partition is 40 MB. Normally, each device will be

/dev/hda, /dev/hdb, /dev/sda, /dev/sdb, /dev/hdc, /dev/hdd, and so on. An interactive, menu-driven mode is also available.

Note that this command can be destructive if used improperly.
Options
-b sectorsize

Set the size of individual disk sectors. May be 512, 1024, or 2048. Most systems now recognize sector sizes, so this is

not necessary.

-l

List partition tables and exit.

-u

Report partition sizes in sectors instead of cylinders.

-s partition

Display the size of partition, unless it is a DOS partition.

-v

Print version number, then exit.

-C cylinders

Specify the number of cylinders on the disk.

-H heads

Specify the number of heads per cylinder.

-S sectors

Specify sectors per track for partitioning.

Commands
a

Toggle a bootable flag on current partition.

b

Edit disklabel of a BSD partition.

c

Toggle DOS compatibility flag.

d

Delete current partition.

l

List all partition types.

m

Main menu.

n

Create a new partition; prompt for more information.

o

Create an empty DOS partition table.

p

Print a list of all partitions and information about each.

q

Quit; do not save.

t

Replace the type of the current partition.

u

Modify the display/entry units, which must be cylinders or sectors.

v

Verify: check for errors, and display a summary of the number of unallocated sectors.

w

Save changes and exit.

x

Switch to expert commands.

Example

To list all partitions currently on the system:

fdisk -l

setquota

setquota [options] [name] [limits] filesystems

System administration command. Set quotas from the command line. Provide limits in the format soft-block-limit

hard-block-limit soft-inode-limit hard-inode-limit. To disable a quota, set it to 0. See also edquota, a vi editor interface

for editing and setting quotas.
Options
-a

Apply settings to all filesystems listed in /etc/mtab that support quotas.

-b

Read new settings from standard input. Provide as a list, each line in the form of “name limits.”

-Fformat

Specify filesystem quota format to use. See quota for a list of accepted values.

-g

Set group quotas instead of users.

-pprototype

Apply the same settings as used for the specified user or group: prototype.

-tblockgrace inodegrace

Specify overall grace times in seconds for block and inode quotas.

-Tname blockgrace inodegrace

Specify grace times in seconds for individual user or group name. Use the string unset to remove existing grace times.

-u

Set user quotas. (This is the default.)

halt

halt [options]

System administration command: turns off the computer. Insert a note in the file /var/log/wtmp; if the system is in runlevel

0 or 6, stop all processes; otherwise, call shutdown -h.
Options
-d

Suppress writing to /var/log/wtmp.

-f

Call halt even when shutdown -nf would normally be called (i.e., force a call to halt, even when not in runlevel 0 or 6).

-h

Place hard drives in standby mode before halt or power off.

-i

Shut down network interfaces before halt.

-n

No sync before reboot or halt.

-p

Perform power-off when halting system.

-n

Suppress normal call to sync.

-w

Suppress normal execution; simply write to /var/log/wtmp.

passwd

passwd [options] [user]

Create or change a password associated with a user name. Only the owner or a privileged user may change a password. Owners

need not specify their user name. Users can change their own passwords. For any other operation, you must be root.
Options
-d, –delete

Delete the password for the user’s account.

-f, –force

Force the operation. Overrides -u.

-?, –help

Display a help message describing the options. See also –usage.

-i days, –inactive=days

Set the number of days after a password has expired before the account is disabled.

-k, –keep-tokens

Keep passwords (authentication tokens) that have not expired.

-l, –lock

Lock the user’s account.

-n days, –minimum=days

Set the minimum number of days that the password is valid.

-S, –status

Print the status of the user’s password.

–stdin

Read new passwords from standard input.

-u, –unlock

Unlock the user’s account

–usage

Display a brief usage message. See also –help.

-w days, –warning=days

Set the number of days of warning users will get before their password expires.

-x days, –maximum=days

Set the maximum number of days that the password is valid.

init

init [bootflags] [runlevel]

System administration command. Initialize system. Usually run from the boot loader—e.g., lilo or grub.
Boot flags
-a,auto

Set the AUTOBOOT environment variable to yes. The boot loader will do this automatically when booting with the default

command line.

-b

Boot directly into a single-user shell for emergency recovery.

-s,S,single

Single-user mode.

-b,emergency

Boot into single-user mode but do not run any other startup scripts.

-z characters

The specified characters are ignored, but will make the command line take up a bit more room on the stack. init uses the

extra space to show the current runlevel when running the ps command.

Files

init is the first process run by any Unix machine at boot time. It verifies the integrity of all filesystems and then creates

other processes, using fork and exec, as specified by /etc/inittab. Which processes may be run is controlled by runlevel. All

process terminations are recorded in /var/run/utmp and /var/log/wtmp. When the runlevel changes, init sends SIGTERM and then,

after 20 seconds, SIGKILL to all processes that cannot be run in the new runlevel.
Runlevels

The current runlevel may be changed by telinit, which is often just a link to init. The default runlevels vary from

distribution to distribution, but these are standard:
0

Halt the system.

1, s, S

Single-user mode.

3

Multiuser mode, console login. This is commonly used in server configurations.

5

Full graphical mode. This is a common default for desktop configurations.

6

Reboot the system. Never set the default runlevel to 6.

q, Q

Reread /etc/inittab.

Check the /etc/inittab file for runlevels on your system.

man

man [options] [section] [title]

Display information from the online reference manuals. man locates and prints the named title from the designated reference

section.

Traditionally, manpages are divided into nine sections, where section 1 consists of user commands, section 2 contains system

calls, and so forth. By default, all sections are consulted, so the section option serves to bypass the most common entry and

find an entry of the same name in a different section (e.g., man 2 nice).

Numerous other utilities—such as info, xman, and the Konqueror browser—can also display manpages.
Options
-7, –ascii

Expect a pure ASCII file, and format it for a 7-bit terminal or terminal emulator.

-a, –all

Show all pages matching title.

-b

Leave blank lines in output.

-d, –debug

Display debugging information. Suppress actual printing of manual pages.

-f, –whatis

Same as whatis command.

-k, –apropos

Same as apropos command.

-l filename, –local-file=filename

Search local files, not system files, for manual pages. If i is given as filename, search standard input.

-m systems, –systems=systems

Search systems’ manual pages. systems should be a comma-separated list.

-p preprocessors, –preprocessor=preprocessors

Preprocess manual pages with preprocessors before turning them over to nroff, troff, or groff. Always runs soelim first

to read in files to be included in the one currently being processed. preprocessors can be any combination of e for

equations, p for pictures, t for tables, and r for bibliographical references.

-r prompt, –prompt=prompt

Set prompt if less is used as pager.

-t, –troff

Format the manual page with /usr/bin/groff -Tgv -mandoc. Implied by -T and -Z.

-u, –update

Perform a consistency check between manual page cache and filesystem.

-w, -W, –path, –where

Print pathnames of entries on standard output.

-D

Display debugging information about how the page was retrieved.

-K directory

A kind of super-k option. Search for a term in all manpages and display the name of each page, along with a prompt asking

whether you want to view the page.

-L locale, –locale=locale

Assume current locale to be locale; do not consult the setlocale( ) function.

-M path, –manpath=path

Search for manual pages in path. Ignore -m option.

-Ppager, –pager=pager

Select paging program pager to display the entry.

-S sections

Sections to look in for an entry. Like specifying section on the command line, except that multiple section numbers can

be specified, separated by colons.

-T device, –troff-device[=device]

Format groff or troff output for device, such as dvi, latin1, X75, and X100.

-Z, –ditroff

Do not allow postprocessing of manual page after groff has finished formatting it.

Section names

Manual pages are divided into sections for various audiences:
1

Executable programs or shell commands.

2

System calls (functions provided by the kernel).

3

Library calls (functions within system libraries).

4

Special files (usually found in /dev).

5

File formats and conventions (e.g., /etc/passwd).

6

Games.

7

Macro packages and conventions.

8

System administration commands (usually only for a privileged user).

9

Kernel routines (nonstandard).

gzip

gzip [options] [files] gunzip [options] [files] zcat[options] [files]

Compress specified files (or data read from standard input) with Lempel-Ziv coding (LZ77). Rename compressed file to

filename.gz; keep ownership modes and access/modification times. Ignore symbolic links. Uncompress with gunzip, which takes

all of gzip’s options except those specified. zcat is identical to gunzip -c and takes the options -fhLV, described here.

Files compressed with the compress command can be decompressed using these commands.
Options
-n, –fast, –best

Regulate the speed of compression using the specified digit n, where -1 or –fast indicates the fastest compression

method (less compression), and -9 or –best indicates the slowest compression method (most compression). The default

compression level is -6.

-a, –ascii

ASCII text mode: convert end-of-lines using local conventions. This option is supported only on some non-Unix systems.

-c, –stdout, –to-stdout

Print output to standard output, and do not change input files.

-d, –decompress, –uncompress

Same as gunzip.

-f, –force

Force compression. gzip would normally prompt for permission to continue when the file has multiple links, its .gz

version already exists, or it is reading compressed data to or from a terminal.

-h, –help

Display a help screen and then exit.

-l, –list

Expects to be given compressed files as arguments. Files may be compressed by any of the following methods: gzip,

deflate, compress, lzh, or pack. For each file, list uncompressed and compressed sizes (the latter being always -1 for files

compressed by programs other than gzip), compression ratio, and uncompressed name. With -v, also print compression method,

the 32-bit CRC of the uncompressed data, and the timestamp. With -N, look inside the file for the uncompressed name and

timestamp.

-L, –license

Display the gzip license and quit.

-n, –no-name

When compressing, do not save the original filename and timestamp by default. When decompressing, do not restore the

original filename if present, and do not restore the original timestamp if present. This option is the default when

decompressing.

-N, –name

Default. Save original name and timestamp. When decompressing, restore original name and timestamp.

-q, –quiet

Print no warnings.

-r, –recursive

When given a directory as an argument, recursively compress or decompress files within it.

-S suffix, –suffix suffix

Append .suffix. Default is gz. A null suffix while decompressing causes gunzip to attempt to decompress all specified

files, regardless of suffix.

-t, –test

Test compressed file integrity.

-v, –verbose

Print name and percent size reduction for each file.

-V, –version

Display the version number and compilation options.

who

who [options] [file] who am i

Show who is logged into the system. With no options, list the names of users currently logged in, their terminal, the time

they have been logged in, and the name of the host from which they have logged in. An optional system file (default is

/etc/utmp) can be supplied to give additional information.
Options
-a, –all

Equivalent to -b -d –login -p -r -t -T -u.

am i

Print the username of the invoking user.

-b, –boot

Print time of last system boot.

-d, –dead

Print a list of dead processes.

–help

Print a help message and then exit.

-i, –idle

Include idle times. An idle time of . indicates activity within the last minute; one of old indicates no activity in more

than a day.

-l, –login

Print list of system login processes.

–lookup

Attempt to include canonical hostnames via DNS.

-m

Same as who am i.

-p, –process

Print active processes spawned by init.

-q, –count

“Quick.” Display only the usernames and total number of users.

-r, –runlevel

Print the current runlevel.

-s, –short

Print only name, line, and time. This is the default behaviour.

-t, –time

Print the last system clock change.

-u, –users

Print a list of the users who are logged in.

–version

Print version information and then exit.

-w, -T, –mesg, –message, –writable

Include user’s message status in the output:
+

mesg y (write messages allowed)

-

mesg n (write messages refused)

?

Cannot find terminal device

-H, –heading

Print headings.

Example

This sample output was produced at 8 a.m. on April 17:

&dollar; who -uH NAME LINE TIME IDLE PID COMMENTS Earvin ttyp3 Apr 16 08:14 16:25 2240 Larry ttyp0 Apr 17 07:33 . 15182

Since Earvin has been idle since yesterday afternoon (16 hours), it appears that he isn’t at work yet. He simply left himself

logged in. Larry’s terminal is currently in use.

ifconfig

ifconfig [interface] ifconfig [interface address_family parameters addresses]

TCP/IP command. Assign an address to a network interface and/or configure network interface parameters. ifconfig is typically

used at boot time to define the network address of each interface on a machine. It may be used at a later time to redefine an

interface’s address or other parameters. Without arguments, ifconfig displays the current configuration for a network

interface. Used with a single interface argument, ifconfig displays that particular interface’s current configuration. Note

that interfaces are numbered starting at zero: eth0, eth1, eth2, and so forth. In most cases, eth0 will be the primary PCI

Ethernet interface, and wireless network interfaces will begin with ath0 or wlan0.
Arguments
interface

String of the form name unit: for example, en0.

address_family

Since an interface may receive transmissions in differing protocols, each of which may require separate naming schemes,

you can specify the address_family to change the interpretation of the remaining parameters. You may specify inet (for

TCP/IP, the default), ax25 (AX.25 Packet Radio), ddp (Appletalk Phase 2), or ipx (Novell).

parameters

The following parameters may be set with ifconfig:
add address/prefixlength

Add an IPv6 address and prefix length.

address address

Assign the specified IP address to the interface.

allmulti/-allmulti

Enable/disable sending of incoming frames to the kernel’s network layer.

arp/-arp

Enable/disable use of the Address Resolution Protocol in mapping between network-level addresses and link-level

addresses.

broadcast [address]

(inet only) Specify address to use to represent broadcasts to the network. Default is the address with a host part of

all ones (i.e., x.y.z.255 for a class C network).

debug/-debug

Enable/disable driver-dependent debugging code.

del address/prefixlength

Delete an IPv6 address and prefix length.

down

Mark an interface “down” (unresponsive).

hw class address

Set the interface’s hardware class and address. class may be ether (Ethernet), ax25 (AX.25 Packet Radio), or ARCnet.

io_addr addr

I/O memory start address for device.

irq addr

Set the device’s interrupt line.

metric n

Set routing metric of the interface to n. Default is 0.

mem_start addr

Shared memory start address for device.

media type

Set media type. Common values are 10base2, 10baseT, and AUI. If auto is specified, ifconfig will attempt to autosense

the media type.

mtu n

Set the interface’s Maximum Transfer Unit (MTU).

multicast

Set the multicast flag.

netmask mask

(inet only) Specify how much of the address to reserve for subdividing networks into subnetworks. mask can be

specified as a single hexadecimal number with a leading 0x, with a dot notation Internet address, or with a pseudo-network

name listed in the network table /etc/networks.

pointopoint/-pointopoint [address]

Enable/disable point-to-point interfacing, so that the connection between the two machines is dedicated.

promisc/-promisc

Enable/disable promiscuous mode. Promiscuous mode allows the device to receive all packets on the network.

txqueuelen n

Specify the transmit queue length.

tunnel addr

Create an IPv6-in-IPv4 (SIT) device, tunneling to IPv4 address addr.

up

Mark an interface “up” (ready to send and receive).

addresses

Each address is either a hostname present in the hostname database (/etc/hosts), or an Internet address expressed in the

Internet standard dot notation.

Examples

To list all interfaces:

ifconfig -a

To add a second IP address to wlan0:

ifconfig wlan0:1 192.168.2.41 netmask 255.255.255.0

To change the hardware address (MAC address) assigned to eth0 (useful when setting up a router for a DSL or cable modem):

ifconfig eth0 hw ether 01:02:03:04:05:06

install

install [options] destination

System administration command. Used primarily in Makefiles to update files. install copies files into user-specified

directories. Similar to cp, but attempts to set permission modes, owner, and group. The source may be a file or directory, or

a list of files and directories. The destination should be a single file or directory.
Options
-b, –backup[=control]

Back up any existing files. When using the long version of the command, the optional control parameter controls the kind

of backup. When no control is specified, install will attempt to read the control value from the VERSION_CONTROL environment

variable. Accepted values are:
none, off

Never make backups.

numbered, t

Make numbered backups.

existing, nil

Match existing backups, numbered or simple.

simple, never

Always make simple backups.

-d, –directory

Create any missing directories.

-g group, –group group

Set group ID of new file to group (privileged users only).

–help

Print help message, then exit.

-m mode, –mode mode

Set permissions of new file to mode (octal or symbolic). By default, the mode is 0755.

-o [owner] , –owner[=owner]

Set ownership to owner or, if unspecified, to root (privileged users only).

-p, –preserve-timestamps

Preserve access and modification times on source files and directories.

-s, –strip

Strip symbol tables.

-v, –verbose

Print name of each directory as it is created.

–version

Print version, then exit.

-C

Do not overwrite file when the target exists and is identical to the new file. Preserve original timestamp.

-D

Create leading components of destination except the last, then copy source to destination.

-S suffix, –suffix=suffix

Use suffix instead of the default backup suffix, usually ~.

mpartition

mpartition [options] drive

Create the MS-DOS partition specified by drive; used mostly on proprietary Unix systems where fdisk is unavailable. See

mtools for more information. When a partition is being created, the default is for the number of sectors and heads and the

length to be automatically determined, but they can also be specified as options.
Options
-a

Activate the partition, making it the bootable partition.

-b offset

The starting offset of the partition to be created, in sectors. The default is the start of the disk (partition 1) or

immediately after the end of the previous partition.

-B bootsector

Read the template master boot record from the file specified by bootsector. Can be specified with -I.

-c

Create the partition.

-d

Deactivate the partition, making it nonbootable.

-f

Allow overriding of safeguards that perform consistency checking before any change is made to a partition. Can be

specified with any operation that modifies the partition table.

-h heads

The number of heads for a partition being created.

-I

Initialize the partition table and remove all partitions.

-l length

The size of the partition to be created, in sectors.

-p

Print a command line to re-create the partition. With -v, print the current partition table.

-r

Remove the partition.

-s sectors

The number of sectors per track of the partition to be created.

-t cylinders

The number of cylinders of the partition to be created.

-v

With -p, print the current partition table; otherwise, for commands that modify the partition table, print it after it

has been modified.

-vv

Print a hexadecimal dump of the partition table when reading and writing it.

chattr

chattr [options] mode files

Modify file attributes. Specific to Linux Second and Third Extended Filesystem (ext2 and ext3). Behaves similarly to symbolic

chmod, using +, -, and =. mode is in the form opcode attribute. See also lsattr.
Options
-R

Modify directories and their contents recursively.

-V

Print modes of attributes after changing them.

-v version

Set the file’s version.

Opcodes
+

Add attribute.

-

Remove attribute.

=

Assign attributes (removing unspecified attributes).

Attributes
A

Don’t update access time on modify.

a

Append only for writing. Can be set or cleared only by a privileged user.

c

Compressed.

d

No dump.

i

Immutable. Can be set or cleared only by a privileged user.

j

Journalled file. This is useful only in cases where you are using an ext3 filesystem mounted with the data=”ordered” or

data=”writeback” attributes. The data=”journalled” option for the filesystem causes this operation to be performed for all

files in the system and makes this option irrelevant.

S

Synchronous updates.

s

Secure deletion. The contents are zeroed on deletion, and the file cannot be undeleted or recovered in any way.

u

Undeletable. This causes a file to be saved even after it has been deleted, so that a user can undelete it later.

Example

chattr +a myfile As superuser

rmmod

rmmod [options] modules

System administration command. Unload a module or list of modules from the kernel. This command is successful only if the

specified modules are not in use and no other modules are dependent on them. This simplified program provides some backward

compatibility. In general, use modprobe -r instead.
Options
-s, –syslog

Write messages to syslogd instead of to the terminal.

-v, –verbose

Verbose mode.

-V, –version

Print version number, then exit.

-w, –wait

If module is in use, disable it so no new processes can use it. Remove the module when it is no longer in use.

chmod

chmod [options] mode files chmod [options] –reference=filename files

Change the access mode (permissions) of one or more files. Only the owner of a file or a privileged user may change the mode.

mode can be numeric or an expression in the form of who opcode permission. who is optional (if omitted, default is a); choose

only one opcode. Multiple modes are separated by commas.
Options
-c, –changes

Print information about files that are changed.

-f, –silent, –quiet

Do not notify user of files that chmod cannot change.

–help

Print help message and then exit.

-R, –recursive

Traverse subdirectories recursively, applying changes.

–reference=filename

Change permissions to match those associated with filename.

-v, –verbose

Print information about each file, whether changed or not.

–version

Print version information and then exit.

Who
u

User.

g

Group.

o

Other.

a

All (default).

Opcode
+

Add permission.

-

Remove permission.

=

Assign permission (and remove permission of the unspecified fields).

Permissions
r

Read.

w

Write.

x

Execute.

s

Set user (or group) ID.

t

Sticky bit; used on directories to prevent removal of files by non-owners.

u

User’s present permission.

g

Group’s present permission.

o

Other’s present permission.

Alternatively, specify permissions by a three-digit octal number. The first digit designates owner permission; the second,

group permission; and the third, other’s permission. Permissions are calculated by adding the following octal values:
4

Read.

2

Write.

1

Execute.

Note that a fourth digit may precede this sequence. This digit assigns the following modes:
4

Set user ID on execution to grant permissions to process based on the file’s owner, not on permissions of the user who

created the process.

2

Set group ID on execution to grant permissions to process based on the file’s group, not on permissions of the user who

created the process.

1

Set sticky bit.

Examples

Add execute-by-user permission to file:

chmod u+x file

Either of the following will assign read/write/execute permission by owner (7), read/execute permission by group (5), and

execute-only permission by others (1) to file:

chmod 751 file chmod u=rwx,g=rx,o=x file

Any one of the following will assign read-only permission to file for everyone:

chmod =r file chmod 444 file chmod a-wx,a+r file

The following makes the executable setuid, assigns read/write/execute permission by owner, and assigns read/execute

permission by group and others:

chmod 4755 file

2 Tanggapan

  1. ya bagai mana ya?

Tinggalkan Balasan