You are on page 1of 23

23/09/2018 teste.

txt

PACMAN(8) Pacman Manual PACMAN(8)

NAME
pacman - package manager utility

SYNOPSIS
pacman <operation> [options] [targets]

DESCRIPTION
Pacman is a package management utility that tracks installed packages
on a Linux system. It features dependency support, package groups,
install and uninstall scripts, and the ability to sync your local
machine with a remote repository to automatically upgrade packages.
Pacman packages are a zipped tar format.

Since version 3.0.0, pacman has been the front-end to libalpm(3), the
“Arch Linux Package Management” library. This library allows
alternative front-ends to be written (for instance, a GUI front-end).

Invoking pacman involves specifying an operation with any potential


options and targets to operate on. A target is usually a package name,
file name, URL, or a search string. Targets can be provided as command
line arguments. Additionally, if stdin is not from a terminal and a
single hyphen (-) is passed as an argument, targets will be read from
stdin.

OPERATIONS
-D, --database
Operate on the package database. This operation allows you to
modify certain attributes of the installed packages in pacman’s
database. It also allows you to check the databases for internal
consistency. See Database Options below.

-Q, --query
Query the package database. This operation allows you to view
installed packages and their files, as well as meta-information
about individual packages (dependencies, conflicts, install date,
build date, size). This can be run against the local package
database or can be used on individual package files. In the first
case, if no package names are provided in the command line, all
installed packages will be queried. Additionally, various filters
can be applied on the package list. See Query Options below.

-R, --remove
Remove package(s) from the system. Groups can also be specified to
be removed, in which case every package in that group will be
removed. Files belonging to the specified package will be deleted,
and the database will be updated. Most configuration files will be
saved with a .pacsave extension unless the --nosave option is used.
See Remove Options below.

-S, --sync
Synchronize packages. Packages are installed directly from the
remote repositories, including all dependencies required to run the
packages. For example, pacman -S qt will download and install qt
and all the packages it depends on. If a package name exists in
more than one repository, the repository can be explicitly
specified to clarify the package to install: pacman -S testing/qt.
You can also specify version requirements: pacman -S "bash>=3.2".
Quotes are needed, otherwise the shell interprets ">" as
redirection to a file.

In addition to packages, groups can be specified as well. For


example, if gnome is a defined package group, then pacman -S gnome

file:///home/ghost/Desktop/Notas/teste.txt 1/23
23/09/2018 teste.txt

will provide a prompt allowing you to select which packages to


install from a numbered list. The package selection is specified
using a space- and/or comma-separated list of package numbers.
Sequential packages may be selected by specifying the first and
last package numbers separated by a hyphen (-). Excluding packages
is achieved by prefixing a number or range of numbers with a caret
(^).

Packages that provide other packages are also handled. For example,
pacman -S foo will first look for a foo package. If foo is not
found, packages that provide the same functionality as foo will be
searched for. If any package is found, it will be installed. A
selection prompt is provided if multiple packages providing foo are
found.

You can also use pacman -Su to upgrade all packages that are
out-of-date. See Sync Options below. When upgrading, pacman
performs version comparison to determine which packages need
upgrading. This behavior operates as follows:

Alphanumeric:
1.0a < 1.0b < 1.0beta < 1.0p < 1.0pre < 1.0rc < 1.0 < 1.0.a < 1.0.1
Numeric:
1 < 1.0 < 1.1 < 1.1.1 < 1.2 < 2.0 < 3.0.0

Additionally, version strings can have an epoch value defined that


will overrule any version comparison, unless the epoch values are
equal. This is specified in an epoch:version-rel format. For
example, 2:1.0-1 is always greater than 1:3.6-1.

-T, --deptest
Check dependencies; this is useful in scripts such as makepkg to
check installed packages. This operation will check each dependency
specified and return a list of dependencies that are not currently
satisfied on the system. This operation accepts no other options.
Example usage: pacman -T qt "bash>=3.2".

-U, --upgrade
Upgrade or add package(s) to the system and install the required
dependencies from sync repositories. Either a URL or file path can
be specified. This is a “remove-then-add” process. See Upgrade
Options below; also see Handling Config Files for an explanation on
how pacman takes care of configuration files.

-F, --files
Query the files database. This operation allows you to look for
packages owning certain files or display files owned by certain
packages. Only packages that are part of your sync databases are
searched. See File Options below.

-V, --version
Display version and exit.

-h, --help
Display syntax for the given operation. If no operation was
supplied, then the general syntax is shown.

OPTIONS
-b, --dbpath <path>
Specify an alternative database location (the default is
/var/lib/pacman). This should not be used unless you know what you
are doing. NOTE: If specified, this is an absolute path, and the
root path is not automatically prepended.

-r, --root <path>


file:///home/ghost/Desktop/Notas/teste.txt 2/23
23/09/2018 teste.txt

Specify an alternative installation root (default is /). This


should not be used as a way to install software into /usr/local
instead of /usr. NOTE: If database path or log file are not
specified on either the command line or in pacman.conf(5), their
default location will be inside this root path. NOTE: This option
is not suitable for performing operations on a mounted guest
system. See --sysroot instead.

-v, --verbose
Output paths such as as the Root, Conf File, DB Path, Cache Dirs,
etc.

--arch <arch>
Specify an alternate architecture.

--cachedir <dir>
Specify an alternative package cache location (the default is
/var/cache/pacman/pkg). Multiple cache directories can be
specified, and they are tried in the order they are passed to
pacman. NOTE: This is an absolute path, and the root path is not
automatically prepended.

--color <when>
Specify when to enable coloring. Valid options are always, never,
or auto. always forces colors on; never forces colors off; and
auto only automatically enables colors when outputting onto a tty.

--config <file>
Specify an alternate configuration file.

--debug
Display debug messages. When reporting bugs, this option is
recommended to be used.

--gpgdir <dir>
Specify a directory of files used by GnuPG to verify package
signatures (the default is /etc/pacman.d/gnupg). This directory
should contain two files: pubring.gpg and trustdb.gpg. pubring.gpg
holds the public keys of all packagers. trustdb.gpg contains a
so-called trust database, which specifies that the keys are
authentic and trusted. NOTE: This is an absolute path, and the
root path is not automatically prepended.

--hookdir <dir>
Specify a alternative directory containing hook files (the default
is /etc/pacman.d/hooks). Multiple hook directories can be specified
with hooks in later directories taking precedence over hooks in
earlier directories. NOTE: This is an absolute path, and the root
path is not automatically prepended.

--logfile <file>
Specify an alternate log file. This is an absolute path, regardless
of the installation root setting.

--noconfirm
Bypass any and all “Are you sure?” messages. It’s not a good idea
to do this unless you want to run pacman from a script.

--confirm
Cancels the effects of a previous --noconfirm.

--disable-download-timeout
Disable defaults for low speed limit and timeout on downloads. Use
this if you have issues downloading files with proxy and/or
security gateway.
file:///home/ghost/Desktop/Notas/teste.txt 3/23
23/09/2018 teste.txt

--sysroot <dir>
Specify an alternative system root. Pacman will chroot and chdir
into the system root prior to running. This allows mounted guest
systems to be properly operated on. Any other paths given will be
interpreted as relative to the system root. Requires root
privileges.

TRANSACTION OPTIONS (APPLY TO -S, -R AND -U)


-d, --nodeps
Skips dependency version checks. Package names are still checked.
Normally, pacman will always check a package’s dependency fields to
ensure that all dependencies are installed and there are no package
conflicts in the system. Specify this option twice to skip all
dependency checks.

--assume-installed <package=version>
Add a virtual package "package" with version "version" to the
transaction to satisfy dependencies. This allows to disable
specific dependency checks without affecting all dependency checks.
To disable all dependency checking, see the --nodeps option.

--dbonly
Adds/removes the database entry only, leaving all files in place.

--noprogressbar
Do not show a progress bar when downloading files. This can be
useful for scripts that call pacman and capture the output.

--noscriptlet
If an install scriptlet exists, do not execute it. Do not use this
unless you know what you are doing.

-p, --print
Only print the targets instead of performing the actual operation
(sync, remove or upgrade). Use --print-format to specify how
targets are displayed. The default format string is "%l", which
displays URLs with -S, file names with -U, and pkgname-pkgver with
-R.

--print-format <format>
Specify a printf-like format to control the output of the --print
operation. The possible attributes are: "%n" for pkgname, "%v" for
pkgver, "%l" for location, "%r" for repository, and "%s" for size.
Implies --print.

UPGRADE OPTIONS (APPLY TO -S AND -U)


--asdeps
Install packages non-explicitly; in other words, fake their install
reason to be installed as a dependency. This is useful for makepkg
and other build-from-source tools that need to install dependencies
before building the package.

--asexplicit
Install packages explicitly; in other words, fake their install
reason to be explicitly installed. This is useful if you want to
mark a dependency as explicitly installed so it will not be removed
by the --recursive remove operation.

--ignore <package>
Directs pacman to ignore upgrades of package even if there is one
available. Multiple packages can be specified by separating them
with a comma.

--ignoregroup <group>
file:///home/ghost/Desktop/Notas/teste.txt 4/23
23/09/2018 teste.txt

Directs pacman to ignore upgrades of all packages in group, even if


there is one available. Multiple groups can be specified by
separating them with a comma.

--needed
Do not reinstall the targets that are already up-to-date.

--overwrite <glob>
Bypass file conflict checks and overwrite conflicting files. If the
package that is about to be installed contains files that are
already installed and match glob, this option will cause all those
files to be overwritten. Using --overwrite will not allow
overwriting a directory with a file or installing packages with
conflicting files and directories. Multiple patterns can be
specified by separating them with a comma. May be specified
multiple times. Patterns can be negated, such that files matching
them will not be overwritten, by prefixing them with an exclamation
mark. Subsequent matches will override previous ones. A leading
literal exclamation mark or backslash needs to be escaped.

QUERY OPTIONS (APPLY TO -Q)


-c, --changelog
View the ChangeLog of a package if it exists.

-d, --deps
Restrict or filter output to packages installed as dependencies.
This option can be combined with -t for listing real orphans -
packages that were installed as dependencies but are no longer
required by any installed package.

-e, --explicit
Restrict or filter output to explicitly installed packages. This
option can be combined with -t to list explicitly installed
packages that are not required by any other package.

-g, --groups
Display all packages that are members of a named group. If a name
is not specified, list all grouped packages.

-i, --info
Display information on a given package. The -p option can be used
if querying a package file instead of the local database. Passing
two --info or -i flags will also display the list of backup files
and their modification states.

-k, --check
Check that all files owned by the given package(s) are present on
the system. If packages are not specified or filter flags are not
provided, check all installed packages. Specifying this option
twice will perform more detailed file checking (including
permissions, file sizes, and modification times) for packages that
contain the needed mtree file.

-l, --list
List all files owned by a given package. Multiple packages can be
specified on the command line.

-m, --foreign
Restrict or filter output to packages that were not found in the
sync database(s). Typically these are packages that were downloaded
manually and installed with --upgrade.

-n, --native
Restrict or filter output to packages that are found in the sync
database(s). This is the inverse filter of --foreign.
file:///home/ghost/Desktop/Notas/teste.txt 5/23
23/09/2018 teste.txt

-o, --owns <file>


Search for packages that own the specified file(s). The path can be
relative or absolute, and one or more files can be specified.

-p, --file
Signifies that the package supplied on the command line is a file
and not an entry in the database. The file will be decompressed and
queried. This is useful in combination with --info and --list.

-q, --quiet
Show less information for certain query operations. This is useful
when pacman’s output is processed in a script. Search will only
show package names and not version, group, and description
information; owns will only show package names instead of "file is
owned by pkg" messages; group will only show package names and omit
group names; list will only show files and omit package names;
check will only show pairs of package names and missing files; a
bare query will only show package names rather than names and
versions.

-s, --search <regexp>


Search each locally-installed package for names or descriptions
that match regexp. When including multiple search terms, only
packages with descriptions matching ALL of those terms are
returned.

-t, --unrequired
Restrict or filter output to print only packages neither required
nor optionally required by any currently installed package. Specify
this option twice to include packages which are optionally, but not
directly, required by another package.

-u, --upgrades
Restrict or filter output to packages that are out-of-date on the
local system. Only package versions are used to find outdated
packages; replacements are not checked here. This option works best
if the sync database is refreshed using -Sy.

REMOVE OPTIONS (APPLY TO -R)


-c, --cascade
Remove all target packages, as well as all packages that depend on
one or more target packages. This operation is recursive and must
be used with care, since it can remove many potentially needed
packages.

-n, --nosave
Instructs pacman to ignore file backup designations. Normally, when
a file is removed from the system, the database is checked to see
if the file should be renamed with a .pacsave extension.

-s, --recursive
Remove each target specified including all of their dependencies,
provided that (A) they are not required by other packages; and (B)
they were not explicitly installed by the user. This operation is
recursive and analogous to a backwards --sync operation, and it
helps keep a clean system without orphans. If you want to omit
condition (B), pass this option twice.

-u, --unneeded
Removes targets that are not required by any other packages. This
is mostly useful when removing a group without using the -c option,
to avoid breaking any dependencies.

SYNC OPTIONS (APPLY TO -S)


file:///home/ghost/Desktop/Notas/teste.txt 6/23
23/09/2018 teste.txt

-c, --clean
Remove packages that are no longer installed from the cache as well
as currently unused sync databases to free up disk space. When
pacman downloads packages, it saves them in a cache directory. In
addition, databases are saved for every sync DB you download from
and are not deleted even if they are removed from the configuration
file pacman.conf(5). Use one --clean switch to only remove packages
that are no longer installed; use two to remove all files from the
cache. In both cases, you will have a yes or no option to remove
packages and/or unused downloaded databases.

If you use a network shared cache, see the CleanMethod option in


pacman.conf(5).

-g, --groups
Display all the members for each package group specified. If no
group names are provided, all groups will be listed; pass the flag
twice to view all groups and their members.

-i, --info
Display information on a given sync database package. Passing two
--info or -i flags will also display those packages in all
repositories that depend on this package.

-l, --list
List all packages in the specified repositories. Multiple
repositories can be specified on the command line.

-q, --quiet
Show less information for certain sync operations. This is useful
when pacman’s output is processed in a script. Search will only
show package names and not repository, version, group, and
description information; list will only show package names and omit
databases and versions; group will only show package names and omit
group names.

-s, --search <regexp>


This will search each package in the sync databases for names or
descriptions that match regexp. When you include multiple search
terms, only packages with descriptions matching ALL of those terms
will be returned.

-u, --sysupgrade
Upgrades all packages that are out-of-date. Each
currently-installed package will be examined and upgraded if a
newer package exists. A report of all packages to upgrade will be
presented, and the operation will not proceed without user
confirmation. Dependencies are automatically resolved at this level
and will be installed/upgraded if necessary.

Pass this option twice to enable package downgrades; in this case,


pacman will select sync packages whose versions do not match with
the local versions. This can be useful when the user switches from
a testing repository to a stable one.

Additional targets can also be specified manually, so that -Su foo


will do a system upgrade and install/upgrade the "foo" package in
the same operation.

-w, --downloadonly
Retrieve all packages from the server, but do not install/upgrade
anything.

-y, --refresh
Download a fresh copy of the master package database from the
file:///home/ghost/Desktop/Notas/teste.txt 7/23
23/09/2018 teste.txt

server(s) defined in pacman.conf(5). This should typically be used


each time you use --sysupgrade or -u. Passing two --refresh or -y
flags will force a refresh of all package databases, even if they
appear to be up-to-date.

DATABASE OPTIONS (APPLY TO -D)


--asdeps <package>
Mark a package as non-explicitly installed; in other words, set
their install reason to be installed as a dependency.

--asexplicit <package>
Mark a package as explicitly installed; in other words, set their
install reason to be explicitly installed. This is useful it you
want to keep a package installed even when it was initially
installed as a dependency of another package.

-k, --check
Check the local package database is internally consistent. This
will check all required files are present and that installed
packages have the required dependencies, do not conflict and that
multiple packages do not own the same file. Specifying this option
twice will perform a check on the sync databases to ensure all
specified dependencies are available.

-q, --quiet
Suppress messages on successful completion of database operations.

FILE OPTIONS (APPLY TO -F)


-y, --refresh
Download fresh package databases from the server. Use twice to
force a refresh even if databases are up to date.

-l, --list
List the files owned by the queried package.

-s, --search
Search package file names for matching strings.

-x, --regex
Treat arguments to --search as regular expressions.

-o, --owns
Search for packages that own a particular file.

-q, --quiet
Show less information for certain file operations. This is useful
when pacman’s output is processed in a script, however, you may
want to use --machinereadable instead.

--machinereadable
Use a machine readable output format for --list, --search and
--owns. The format is repository\0pkgname\0pkgver\0path\n with \0
being the NULL character and \n a linefeed.

HANDLING CONFIG FILES


Pacman uses the same logic as rpm to determine action against files
that are designated to be backed up. During an upgrade, three MD5
hashes are used for each backup file to determine the required action:
one for the original file installed, one for the new file that is about
to be installed, and one for the actual file existing on the file
system. After comparing these three hashes, the follow scenarios can
result:

original=X, current=X, new=X


All three files are the same, so overwrites are not an issue.
file:///home/ghost/Desktop/Notas/teste.txt 8/23
23/09/2018 teste.txt

Install the new file.

original=X, current=X, new=Y


The current file is the same as the original, but the new one
differs. Since the user did not ever modify the file, and the new
one may contain improvements or bug fixes, install the new file.

original=X, current=Y, new=X


Both package versions contain the exact same file, but the one on
the file system has been modified. Leave the current file in place.

original=X, current=Y, new=Y


The new file is identical to the current file. Install the new
file.

original=X, current=Y, new=Z


All three files are different, so install the new file with a
.pacnew extension and warn the user. The user must then manually
merge any necessary changes into the original file.

original=NULL, current=Y, new=Z


The package was not previously installed, and the file already
exists on the file system. Install the new file with a .pacnew
extension and warn the user. The user must then manually merge any
necessary changes into the original file.

EXAMPLES
pacman -Ss ne.hack
Search for regexp "ne.hack" in package database.

pacman -S gpm
Download and install gpm including dependencies.

pacman -U /home/user/ceofhack-0.6-1-x86_64.pkg.tar.gz
Install ceofhack-0.6-1 package from a local file.

pacman -Syu
Update package list and upgrade all packages afterwards.

pacman -Syu gpm


Update package list, upgrade all packages, and then install gpm if
it wasn’t already installed.

CONFIGURATION
See pacman.conf(5) for more details on configuring pacman using the
pacman.conf file.

SEE ALSO
alpm-hooks(5), libalpm(3), makepkg(8), pacman.conf(5)

See the pacman website at https://www.archlinux.org/pacman/ for current


information on pacman and its related tools.

BUGS
Bugs? You must be kidding; there are no bugs in this software. But if
we happen to be wrong, send us an email with as much detail as possible
to pacman-dev@archlinux.org.

AUTHORS
Current maintainers:

· Allan McRae <allan@archlinux.org>

· Andrew Gregory <andrew.gregory.8@gmail.com>

file:///home/ghost/Desktop/Notas/teste.txt 9/23
23/09/2018 teste.txt

· Dan McGee <dan@archlinux.org>

· Dave Reisner <dreisner@archlinux.org>

Past major contributors:

· Judd Vinet <jvinet@zeroflux.org>

· Aurelien Foret <aurelien@archlinux.org>

· Aaron Griffin <aaron@archlinux.org>

· Xavier Chantry <shiningxc@gmail.com>

· Nagy Gabor <ngaba@bibl.u-szeged.hu>

For additional contributors, use git shortlog -s on the pacman.git


repository.

Pacman 5.1.1 2018-07-27 PACMAN(8)


LS(1) User Commands LS(1)

NAME
ls - list directory contents

SYNOPSIS
ls [OPTION]... [FILE]...

DESCRIPTION
List information about the FILEs (the current directory by default).
Sort entries alphabetically if none of -cftuvSUX nor --sort is speci-
fied.

Mandatory arguments to long options are mandatory for short options


too.

-a, --all
do not ignore entries starting with .

-A, --almost-all
do not list implied . and ..

--author
with -l, print the author of each file

-b, --escape
print C-style escapes for nongraphic characters

--block-size=SIZE
with -l, scale sizes by SIZE when printing them; e.g.,
'--block-size=M'; see SIZE format below

-B, --ignore-backups
do not list implied entries ending with ~

-c with -lt: sort by, and show, ctime (time of last modification of
file status information); with -l: show ctime and sort by name;
otherwise: sort by ctime, newest first

-C list entries by columns

--color[=WHEN]
colorize the output; WHEN can be 'always' (default if omitted),
'auto', or 'never'; more info below

file:///home/ghost/Desktop/Notas/teste.txt 10/23
23/09/2018 teste.txt

-d, --directory
list directories themselves, not their contents

-D, --dired
generate output designed for Emacs' dired mode

-f do not sort, enable -aU, disable -ls --color

-F, --classify
append indicator (one of */=>@|) to entries

--file-type
likewise, except do not append '*'

--format=WORD
across -x, commas -m, horizontal -x, long -l, single-column -1,
verbose -l, vertical -C

--full-time
like -l --time-style=full-iso

-g like -l, but do not list owner

--group-directories-first
group directories before files;

can be augmented with a --sort option, but any use of


--sort=none (-U) disables grouping

-G, --no-group
in a long listing, don't print group names

-h, --human-readable
with -l and -s, print sizes like 1K 234M 2G etc.

--si likewise, but use powers of 1000 not 1024

-H, --dereference-command-line
follow symbolic links listed on the command line

--dereference-command-line-symlink-to-dir
follow each command line symbolic link

that points to a directory

--hide=PATTERN
do not list implied entries matching shell PATTERN (overridden
by -a or -A)

--hyperlink[=WHEN]
hyperlink file names; WHEN can be 'always' (default if omitted),
'auto', or 'never'

--indicator-style=WORD
append indicator with style WORD to entry names: none (default),
slash (-p), file-type (--file-type), classify (-F)

-i, --inode
print the index number of each file

-I, --ignore=PATTERN
do not list implied entries matching shell PATTERN

-k, --kibibytes
default to 1024-byte blocks for disk usage; used only with -s
file:///home/ghost/Desktop/Notas/teste.txt 11/23
23/09/2018 teste.txt

and per directory totals

-l use a long listing format

-L, --dereference
when showing file information for a symbolic link, show informa-
tion for the file the link references rather than for the link
itself

-m fill width with a comma separated list of entries

-n, --numeric-uid-gid
like -l, but list numeric user and group IDs

-N, --literal
print entry names without quoting

-o like -l, but do not list group information

-p, --indicator-style=slash
append / indicator to directories

-q, --hide-control-chars
print ? instead of nongraphic characters

--show-control-chars
show nongraphic characters as-is (the default, unless program is
'ls' and output is a terminal)

-Q, --quote-name
enclose entry names in double quotes

--quoting-style=WORD
use quoting style WORD for entry names: literal, locale, shell,
shell-always, shell-escape, shell-escape-always, c, escape
(overrides QUOTING_STYLE environment variable)

-r, --reverse
reverse order while sorting

-R, --recursive
list subdirectories recursively

-s, --size
print the allocated size of each file, in blocks

-S sort by file size, largest first

--sort=WORD
sort by WORD instead of name: none (-U), size (-S), time (-t),
version (-v), extension (-X)

--time=WORD
with -l, show time as WORD instead of default modification time:
atime or access or use (-u); ctime or status (-c); also use
specified time as sort key if --sort=time (newest first)

--time-style=TIME_STYLE
time/date format with -l; see TIME_STYLE below

-t sort by modification time, newest first

-T, --tabsize=COLS
assume tab stops at each COLS instead of 8

file:///home/ghost/Desktop/Notas/teste.txt 12/23
23/09/2018 teste.txt

-u with -lt: sort by, and show, access time; with -l: show access
time and sort by name; otherwise: sort by access time, newest
first

-U do not sort; list entries in directory order

-v natural sort of (version) numbers within text

-w, --width=COLS
set output width to COLS. 0 means no limit

-x list entries by lines instead of by columns

-X sort alphabetically by entry extension

-Z, --context
print any security context of each file

-1 list one file per line. Avoid '\n' with -q or -b

--help display this help and exit

--version
output version information and exit

The SIZE argument is an integer and optional unit (example: 10K is


10*1024). Units are K,M,G,T,P,E,Z,Y (powers of 1024) or KB,MB,...
(powers of 1000).

The TIME_STYLE argument can be full-iso, long-iso, iso, locale, or


+FORMAT. FORMAT is interpreted like in date(1). If FORMAT is FOR-
MAT1<newline>FORMAT2, then FORMAT1 applies to non-recent files and FOR-
MAT2 to recent files. TIME_STYLE prefixed with 'posix-' takes effect
only outside the POSIX locale. Also the TIME_STYLE environment vari-
able sets the default style to use.

Using color to distinguish file types is disabled both by default and


with --color=never. With --color=auto, ls emits color codes only when
standard output is connected to a terminal. The LS_COLORS environment
variable can change the settings. Use the dircolors command to set it.

Exit status:
0 if OK,

1 if minor problems (e.g., cannot access subdirectory),

2 if serious trouble (e.g., cannot access command-line argument).

AUTHOR
Written by Richard M. Stallman and David MacKenzie.

REPORTING BUGS
GNU coreutils online help: <https://www.gnu.org/software/coreutils/>
Report ls translation bugs to <https://translationproject.org/team/>

COPYRIGHT
Copyright © 2018 Free Software Foundation, Inc. License GPLv3+: GNU
GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

SEE ALSO
Full documentation at: <https://www.gnu.org/software/coreutils/ls>
or available locally via: info '(coreutils) ls invocation'

file:///home/ghost/Desktop/Notas/teste.txt 13/23
23/09/2018 teste.txt

GNU coreutils 8.30 August 2018 LS(1)


GREP(1) General Commands Manual GREP(1)

NAME
grep, egrep, fgrep - print lines matching a pattern

SYNOPSIS
grep [OPTIONS] PATTERN [FILE...]
grep [OPTIONS] -e PATTERN ... [FILE...]
grep [OPTIONS] -f FILE ... [FILE...]

DESCRIPTION
grep searches for PATTERN in each FILE. A FILE of “-” stands for
standard input. If no FILE is given, recursive searches examine the
working directory, and nonrecursive searches read standard input. By
default, grep prints the matching lines.

In addition, the variant programs egrep and fgrep are the same as
grep -E and grep -F, respectively. These variants are deprecated, but
are provided for backward compatibility.

OPTIONS
Generic Program Information
--help Output a usage message and exit.

-V, --version
Output the version number of grep and exit.

Matcher Selection
-E, --extended-regexp
Interpret PATTERN as an extended regular expression (ERE, see
below).

-F, --fixed-strings
Interpret PATTERN as a list of fixed strings (instead of regular
expressions), separated by newlines, any of which is to be
matched.

-G, --basic-regexp
Interpret PATTERN as a basic regular expression (BRE, see
below). This is the default.

-P, --perl-regexp
Interpret the pattern as a Perl-compatible regular expression
(PCRE). This is experimental and grep -P may warn of
unimplemented features.

Matching Control
-e PATTERN, --regexp=PATTERN
Use PATTERN as the pattern. If this option is used multiple
times or is combined with the -f (--file) option, search for all
patterns given. This option can be used to protect a pattern
beginning with “-”.

-f FILE, --file=FILE
Obtain patterns from FILE, one per line. If this option is used
multiple times or is combined with the -e (--regexp) option,
search for all patterns given. The empty file contains zero
patterns, and therefore matches nothing.

-i, --ignore-case
Ignore case distinctions, so that characters that differ only in
case match each other.

file:///home/ghost/Desktop/Notas/teste.txt 14/23
23/09/2018 teste.txt

-v, --invert-match
Invert the sense of matching, to select non-matching lines.

-w, --word-regexp
Select only those lines containing matches that form whole
words. The test is that the matching substring must either be
at the beginning of the line, or preceded by a non-word
constituent character. Similarly, it must be either at the end
of the line or followed by a non-word constituent character.
Word-constituent characters are letters, digits, and the
underscore. This option has no effect if -x is also specified.

-x, --line-regexp
Select only those matches that exactly match the whole line.
For a regular expression pattern, this is like parenthesizing
the pattern and then surrounding it with ^ and $.

-y Obsolete synonym for -i.

General Output Control


-c, --count
Suppress normal output; instead print a count of matching lines
for each input file. With the -v, --invert-match option (see
below), count non-matching lines.

--color[=WHEN], --colour[=WHEN]
Surround the matched (non-empty) strings, matching lines,
context lines, file names, line numbers, byte offsets, and
separators (for fields and groups of context lines) with escape
sequences to display them in color on the terminal. The colors
are defined by the environment variable GREP_COLORS. The
deprecated environment variable GREP_COLOR is still supported,
but its setting does not have priority. WHEN is never, always,
or auto.

-L, --files-without-match
Suppress normal output; instead print the name of each input
file from which no output would normally have been printed. The
scanning will stop on the first match.

-l, --files-with-matches
Suppress normal output; instead print the name of each input
file from which output would normally have been printed. The
scanning will stop on the first match.

-m NUM, --max-count=NUM
Stop reading a file after NUM matching lines. If the input is
standard input from a regular file, and NUM matching lines are
output, grep ensures that the standard input is positioned to
just after the last matching line before exiting, regardless of
the presence of trailing context lines. This enables a calling
process to resume a search. When grep stops after NUM matching
lines, it outputs any trailing context lines. When the -c or
--count option is also used, grep does not output a count
greater than NUM. When the -v or --invert-match option is also
used, grep stops after outputting NUM non-matching lines.

-o, --only-matching
Print only the matched (non-empty) parts of a matching line,
with each such part on a separate output line.

-q, --quiet, --silent


Quiet; do not write anything to standard output. Exit
immediately with zero status if any match is found, even if an
error was detected. Also see the -s or --no-messages option.
file:///home/ghost/Desktop/Notas/teste.txt 15/23
23/09/2018 teste.txt

-s, --no-messages
Suppress error messages about nonexistent or unreadable files.

Output Line Prefix Control


-b, --byte-offset
Print the 0-based byte offset within the input file before each
line of output. If -o (--only-matching) is specified, print the
offset of the matching part itself.

-H, --with-filename
Print the file name for each match. This is the default when
there is more than one file to search.

-h, --no-filename
Suppress the prefixing of file names on output. This is the
default when there is only one file (or only standard input) to
search.

--label=LABEL
Display input actually coming from standard input as input
coming from file LABEL. This is especially useful when
implementing tools like zgrep, e.g., gzip -cd foo.gz | grep
--label=foo -H something. See also the -H option.

-n, --line-number
Prefix each line of output with the 1-based line number within
its input file.

-T, --initial-tab
Make sure that the first character of actual line content lies
on a tab stop, so that the alignment of tabs looks normal. This
is useful with options that prefix their output to the actual
content: -H,-n, and -b. In order to improve the probability
that lines from a single file will all start at the same column,
this also causes the line number and byte offset (if present) to
be printed in a minimum size field width.

-u, --unix-byte-offsets
Report Unix-style byte offsets. This switch causes grep to
report byte offsets as if the file were a Unix-style text file,
i.e., with CR characters stripped off. This will produce
results identical to running grep on a Unix machine. This
option has no effect unless -b option is also used; it has no
effect on platforms other than MS-DOS and MS-Windows.

-Z, --null
Output a zero byte (the ASCII NUL character) instead of the
character that normally follows a file name. For example, grep
-lZ outputs a zero byte after each file name instead of the
usual newline. This option makes the output unambiguous, even
in the presence of file names containing unusual characters like
newlines. This option can be used with commands like find
-print0, perl -0, sort -z, and xargs -0 to process arbitrary
file names, even those that contain newline characters.

Context Line Control


-A NUM, --after-context=NUM
Print NUM lines of trailing context after matching lines.
Places a line containing a group separator (--) between
contiguous groups of matches. With the -o or --only-matching
option, this has no effect and a warning is given.

-B NUM, --before-context=NUM
Print NUM lines of leading context before matching lines.
file:///home/ghost/Desktop/Notas/teste.txt 16/23
23/09/2018 teste.txt

Places a line containing a group separator (--) between


contiguous groups of matches. With the -o or --only-matching
option, this has no effect and a warning is given.

-C NUM, -NUM, --context=NUM


Print NUM lines of output context. Places a line containing a
group separator (--) between contiguous groups of matches. With
the -o or --only-matching option, this has no effect and a
warning is given.

File and Directory Selection


-a, --text
Process a binary file as if it were text; this is equivalent to
the --binary-files=text option.

--binary-files=TYPE
If a file's data or metadata indicate that the file contains
binary data, assume that the file is of type TYPE. Non-text
bytes indicate binary data; these are either output bytes that
are improperly encoded for the current locale, or null input
bytes when the -z option is not given.

By default, TYPE is binary, and when grep discovers that a file


is binary it suppresses any further output, and instead outputs
either a one-line message saying that a binary file matches, or
no message if there is no match.

If TYPE is without-match, when grep discovers that a file is


binary it assumes that the rest of the file does not match; this
is equivalent to the -I option.

If TYPE is text, grep processes a binary file as if it were


text; this is equivalent to the -a option.

When type is binary, grep may treat non-text bytes as line


terminators even without the -z option. This means choosing
binary versus text can affect whether a pattern matches a file.
For example, when type is binary the pattern q$ might match q
immediately followed by a null byte, even though this is not
matched when type is text. Conversely, when type is binary the
pattern . (period) might not match a null byte.

Warning: The -a option might output binary garbage, which can


have nasty side effects if the output is a terminal and if the
terminal driver interprets some of it as commands. On the other
hand, when reading files whose text encodings are unknown, it
can be helpful to use -a or to set LC_ALL='C' in the
environment, in order to find more matches even if the matches
are unsafe for direct display.

-D ACTION, --devices=ACTION
If an input file is a device, FIFO or socket, use ACTION to
process it. By default, ACTION is read, which means that
devices are read just as if they were ordinary files. If ACTION
is skip, devices are silently skipped.

-d ACTION, --directories=ACTION
If an input file is a directory, use ACTION to process it. By
default, ACTION is read, i.e., read directories just as if they
were ordinary files. If ACTION is skip, silently skip
directories. If ACTION is recurse, read all files under each
directory, recursively, following symbolic links only if they
are on the command line. This is equivalent to the -r option.

--exclude=GLOB
file:///home/ghost/Desktop/Notas/teste.txt 17/23
23/09/2018 teste.txt

Skip any command-line file with a name suffix that matches the
pattern GLOB, using wildcard matching; a name suffix is either
the whole name, or any suffix starting after a / and before a
+non-/. When searching recursively, skip any subfile whose base
name matches GLOB; the base name is the part after the last /.
A pattern can use *, ?, and [...] as wildcards, and \ to quote
a wildcard or backslash character literally.

--exclude-from=FILE
Skip files whose base name matches any of the file-name globs
read from FILE (using wildcard matching as described under
--exclude).

--exclude-dir=GLOB
Skip any command-line directory with a name suffix that matches
the pattern GLOB. When searching recursively, skip any
subdirectory whose base name matches GLOB. Ignore any redundant
trailing slashes in GLOB.

-I Process a binary file as if it did not contain matching data;


this is equivalent to the --binary-files=without-match option.

--include=GLOB
Search only files whose base name matches GLOB (using wildcard
matching as described under --exclude).

-r, --recursive
Read all files under each directory, recursively, following
symbolic links only if they are on the command line. Note that
if no file operand is given, grep searches the working
directory. This is equivalent to the -d recurse option.

-R, --dereference-recursive
Read all files under each directory, recursively. Follow all
symbolic links, unlike -r.

Other Options
--line-buffered
Use line buffering on output. This can cause a performance
penalty.

-U, --binary
Treat the file(s) as binary. By default, under MS-DOS and MS-
Windows, grep guesses whether a file is text or binary as
described for the --binary-files option. If grep decides the
file is a text file, it strips the CR characters from the
original file contents (to make regular expressions with ^ and $
work correctly). Specifying -U overrules this guesswork,
causing all files to be read and passed to the matching
mechanism verbatim; if the file is a text file with CR/LF pairs
at the end of each line, this will cause some regular
expressions to fail. This option has no effect on platforms
other than MS-DOS and MS-Windows.

-z, --null-data
Treat input and output data as sequences of lines, each
terminated by a zero byte (the ASCII NUL character) instead of a
newline. Like the -Z or --null option, this option can be used
with commands like sort -z to process arbitrary file names.

REGULAR EXPRESSIONS
A regular expression is a pattern that describes a set of strings.
Regular expressions are constructed analogously to arithmetic
expressions, by using various operators to combine smaller expressions.

file:///home/ghost/Desktop/Notas/teste.txt 18/23
23/09/2018 teste.txt

grep understands three different versions of regular expression syntax:


“basic” (BRE), “extended” (ERE) and “perl” (PCRE). In GNU grep there
is no difference in available functionality between basic and extended
syntaxes. In other implementations, basic regular expressions are less
powerful. The following description applies to extended regular
expressions; differences for basic regular expressions are summarized
afterwards. Perl-compatible regular expressions give additional
functionality, and are documented in pcresyntax(3) and pcrepattern(3),
but work only if PCRE is available in the system.

The fundamental building blocks are the regular expressions that match
a single character. Most characters, including all letters and digits,
are regular expressions that match themselves. Any meta-character with
special meaning may be quoted by preceding it with a backslash.

The period . matches any single character.

Character Classes and Bracket Expressions


A bracket expression is a list of characters enclosed by [ and ]. It
matches any single character in that list; if the first character of
the list is the caret ^ then it matches any character not in the list.
For example, the regular expression [0123456789] matches any single
digit.

Within a bracket expression, a range expression consists of two


characters separated by a hyphen. It matches any single character that
sorts between the two characters, inclusive, using the locale's
collating sequence and character set. For example, in the default C
locale, [a-d] is equivalent to [abcd]. Many locales sort characters in
dictionary order, and in these locales [a-d] is typically not
equivalent to [abcd]; it might be equivalent to [aBbCcDd], for example.
To obtain the traditional interpretation of bracket expressions, you
can use the C locale by setting the LC_ALL environment variable to the
value C.

Finally, certain named classes of characters are predefined within


bracket expressions, as follows. Their names are self explanatory, and
they are [:alnum:], [:alpha:], [:cntrl:], [:digit:], [:graph:],
[:lower:], [:print:], [:punct:], [:space:], [:upper:], and [:xdigit:].
For example, [[:alnum:]] means the character class of numbers and
letters in the current locale. In the C locale and ASCII character set
encoding, this is the same as [0-9A-Za-z]. (Note that the brackets in
these class names are part of the symbolic names, and must be included
in addition to the brackets delimiting the bracket expression.) Most
meta-characters lose their special meaning inside bracket expressions.
To include a literal ] place it first in the list. Similarly, to
include a literal ^ place it anywhere but first. Finally, to include a
literal - place it last.

Anchoring
The caret ^ and the dollar sign $ are meta-characters that respectively
match the empty string at the beginning and end of a line.

The Backslash Character and Special Expressions


The symbols \< and \> respectively match the empty string at the
beginning and end of a word. The symbol \b matches the empty string at
the edge of a word, and \B matches the empty string provided it's not
at the edge of a word. The symbol \w is a synonym for [_[:alnum:]] and
\W is a synonym for [^_[:alnum:]].

Repetition
A regular expression may be followed by one of several repetition
operators:
? The preceding item is optional and matched at most once.
* The preceding item will be matched zero or more times.
file:///home/ghost/Desktop/Notas/teste.txt 19/23
23/09/2018 teste.txt

+ The preceding item will be matched one or more times.


{n} The preceding item is matched exactly n times.
{n,} The preceding item is matched n or more times.
{,m} The preceding item is matched at most m times. This is a GNU
extension.
{n,m} The preceding item is matched at least n times, but not more
than m times.

Concatenation
Two regular expressions may be concatenated; the resulting regular
expression matches any string formed by concatenating two substrings
that respectively match the concatenated expressions.

Alternation
Two regular expressions may be joined by the infix operator |; the
resulting regular expression matches any string matching either
alternate expression.

Precedence
Repetition takes precedence over concatenation, which in turn takes
precedence over alternation. A whole expression may be enclosed in
parentheses to override these precedence rules and form a
subexpression.

Back References and Subexpressions


The back-reference \n, where n is a single digit, matches the substring
previously matched by the nth parenthesized subexpression of the
regular expression.

Basic vs Extended Regular Expressions


In basic regular expressions the meta-characters ?, +, {, |, (, and )
lose their special meaning; instead use the backslashed versions \?,
\+, \{, \|, \(, and \).

ENVIRONMENT VARIABLES
The behavior of grep is affected by the following environment
variables.

The locale for category LC_foo is specified by examining the three


environment variables LC_ALL, LC_foo, LANG, in that order. The first
of these variables that is set specifies the locale. For example, if
LC_ALL is not set, but LC_MESSAGES is set to pt_BR, then the Brazilian
Portuguese locale is used for the LC_MESSAGES category. The C locale
is used if none of these environment variables are set, if the locale
catalog is not installed, or if grep was not compiled with national
language support (NLS). The shell command locale -a lists locales that
are currently available.

GREP_OPTIONS
This variable specifies default options to be placed in front of
any explicit options. As this causes problems when writing
portable scripts, this feature will be removed in a future
release of grep, and grep warns if it is used. Please use an
alias or script instead.

GREP_COLOR
This variable specifies the color used to highlight matched
(non-empty) text. It is deprecated in favor of GREP_COLORS, but
still supported. The mt, ms, and mc capabilities of GREP_COLORS
have priority over it. It can only specify the color used to
highlight the matching non-empty text in any matching line (a
selected line when the -v command-line option is omitted, or a
context line when -v is specified). The default is 01;31, which
means a bold red foreground text on the terminal's default
background.
file:///home/ghost/Desktop/Notas/teste.txt 20/23
23/09/2018 teste.txt

GREP_COLORS
Specifies the colors and other attributes used to highlight
various parts of the output. Its value is a colon-separated
list of capabilities that defaults to
ms=01;31:mc=01;31:sl=:cx=:fn=35:ln=32:bn=32:se=36 with the rv
and ne boolean capabilities omitted (i.e., false). Supported
capabilities are as follows.

sl= SGR substring for whole selected lines (i.e., matching


lines when the -v command-line option is omitted, or non-
matching lines when -v is specified). If however the
boolean rv capability and the -v command-line option are
both specified, it applies to context matching lines
instead. The default is empty (i.e., the terminal's
default color pair).

cx= SGR substring for whole context lines (i.e., non-matching


lines when the -v command-line option is omitted, or
matching lines when -v is specified). If however the
boolean rv capability and the -v command-line option are
both specified, it applies to selected non-matching lines
instead. The default is empty (i.e., the terminal's
default color pair).

rv Boolean value that reverses (swaps) the meanings of the


sl= and cx= capabilities when the -v command-line option
is specified. The default is false (i.e., the capability
is omitted).

mt=01;31
SGR substring for matching non-empty text in any matching
line (i.e., a selected line when the -v command-line
option is omitted, or a context line when -v is
specified). Setting this is equivalent to setting both
ms= and mc= at once to the same value. The default is a
bold red text foreground over the current line
background.

ms=01;31
SGR substring for matching non-empty text in a selected
line. (This is only used when the -v command-line option
is omitted.) The effect of the sl= (or cx= if rv)
capability remains active when this kicks in. The
default is a bold red text foreground over the current
line background.

mc=01;31
SGR substring for matching non-empty text in a context
line. (This is only used when the -v command-line option
is specified.) The effect of the cx= (or sl= if rv)
capability remains active when this kicks in. The
default is a bold red text foreground over the current
line background.

fn=35 SGR substring for file names prefixing any content line.
The default is a magenta text foreground over the
terminal's default background.

ln=32 SGR substring for line numbers prefixing any content


line. The default is a green text foreground over the
terminal's default background.

bn=32 SGR substring for byte offsets prefixing any content


line. The default is a green text foreground over the
file:///home/ghost/Desktop/Notas/teste.txt 21/23
23/09/2018 teste.txt

terminal's default background.

se=36 SGR substring for separators that are inserted between


selected line fields (:), between context line fields,
(-), and between groups of adjacent lines when nonzero
context is specified (--). The default is a cyan text
foreground over the terminal's default background.

ne Boolean value that prevents clearing to the end of line


using Erase in Line (EL) to Right (\33[K) each time a
colorized item ends. This is needed on terminals on
which EL is not supported. It is otherwise useful on
terminals for which the back_color_erase (bce) boolean
terminfo capability does not apply, when the chosen
highlight colors do not affect the background, or when EL
is too slow or causes too much flicker. The default is
false (i.e., the capability is omitted).

Note that boolean capabilities have no =... part. They are


omitted (i.e., false) by default and become true when specified.

See the Select Graphic Rendition (SGR) section in the


documentation of the text terminal that is used for permitted
values and their meaning as character attributes. These
substring values are integers in decimal representation and can
be concatenated with semicolons. grep takes care of assembling
the result into a complete SGR sequence (\33[...m). Common
values to concatenate include 1 for bold, 4 for underline, 5 for
blink, 7 for inverse, 39 for default foreground color, 30 to 37
for foreground colors, 90 to 97 for 16-color mode foreground
colors, 38;5;0 to 38;5;255 for 88-color and 256-color modes
foreground colors, 49 for default background color, 40 to 47 for
background colors, 100 to 107 for 16-color mode background
colors, and 48;5;0 to 48;5;255 for 88-color and 256-color modes
background colors.

LC_ALL, LC_COLLATE, LANG


These variables specify the locale for the LC_COLLATE category,
which determines the collating sequence used to interpret range
expressions like [a-z].

LC_ALL, LC_CTYPE, LANG


These variables specify the locale for the LC_CTYPE category,
which determines the type of characters, e.g., which characters
are whitespace. This category also determines the character
encoding, that is, whether text is encoded in UTF-8, ASCII, or
some other encoding. In the C or POSIX locale, all characters
are encoded as a single byte and every byte is a valid
character.

LC_ALL, LC_MESSAGES, LANG


These variables specify the locale for the LC_MESSAGES category,
which determines the language that grep uses for messages. The
default C locale uses American English messages.

POSIXLY_CORRECT
If set, grep behaves as POSIX requires; otherwise, grep behaves
more like other GNU programs. POSIX requires that options that
follow file names must be treated as file names; by default,
such options are permuted to the front of the operand list and
are treated as options. Also, POSIX requires that unrecognized
options be diagnosed as “illegal”, but since they are not really
against the law the default is to diagnose them as “invalid”.
POSIXLY_CORRECT also disables _N_GNU_nonoption_argv_flags_,
described below.
file:///home/ghost/Desktop/Notas/teste.txt 22/23
23/09/2018 teste.txt

_N_GNU_nonoption_argv_flags_
(Here N is grep's numeric process ID.) If the ith character of
this environment variable's value is 1, do not consider the ith
operand of grep to be an option, even if it appears to be one.
A shell can put this variable in the environment for each
command it runs, specifying which operands are the results of
file name wildcard expansion and therefore should not be treated
as options. This behavior is available only with the GNU C
library, and only when POSIXLY_CORRECT is not set.

EXIT STATUS
Normally the exit status is 0 if a line is selected, 1 if no lines were
selected, and 2 if an error occurred. However, if the -q or --quiet or
--silent is used and a line is selected, the exit status is 0 even if
an error occurred.

COPYRIGHT
Copyright 1998–2000, 2002, 2005–2017 Free Software Foundation, Inc.

This is free software; see the source for copying conditions. There is
NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.

BUGS
Reporting Bugs
Email bug reports to the bug-reporting address ⟨bug-grep@gnu.org⟩. An
email archive ⟨http://lists.gnu.org/mailman/listinfo/bug-grep⟩ and a
bug tracker ⟨http://debbugs.gnu.org/cgi/pkgreport.cgi?package=grep⟩ are
available.

Known Bugs
Large repetition counts in the {n,m} construct may cause grep to use
lots of memory. In addition, certain other obscure regular expressions
require exponential time and space, and may cause grep to run out of
memory.

Back-references are very slow, and may require exponential time.

SEE ALSO
Regular Manual Pages
awk(1), cmp(1), diff(1), find(1), gzip(1), perl(1), sed(1), sort(1),
xargs(1), zgrep(1), read(2), pcre(3), pcresyntax(3), pcrepattern(3),
terminfo(5), glob(7), regex(7).

POSIX Programmer's Manual Page


grep(1p).

Full Documentation
A complete manual ⟨http://www.gnu.org/software/grep/manual/⟩ is
available. If the info and grep programs are properly installed at
your site, the command

info grep

should give you access to the complete manual.

NOTES
This man page is maintained only fitfully; the full documentation is
often more up-to-date.

User Commands GNU grep 3.1 GREP(1)

file:///home/ghost/Desktop/Notas/teste.txt 23/23

You might also like