Core utilities

From ArchWiki
Revision as of 14:49, 19 October 2011 by Pointone (Talk | contribs) (Undo revision 165205 by Aroko (talk) scope is not limited to coreutils package (e.g. less, grep))

Jump to: navigation, search

This template has only maintenance purposes. For linking to local translations please use interlanguage links, see Help:i18n#Interlanguage links.

Local languages: Català – Dansk – English – Español – Esperanto – Hrvatski – Indonesia – Italiano – Lietuviškai – Magyar – Nederlands – Norsk Bokmål – Polski – Português – Slovenský – Česky – Ελληνικά – Български – Русский – Српски – Українська – עברית – العربية – ไทย – 日本語 – 正體中文 – 简体中文 – 한국어

External languages (all articles in these languages should be moved to the external wiki): Deutsch – Français – Română – Suomi – Svenska – Tiếng Việt – Türkçe – فارسی

Template:Article summary start Template:Article summary text Template:Article summary heading Template:Article summary wiki Template:Article summary wiki Template:Article summary wiki Template:Article summary end

This article deals with so-called "core" utilities on a GNU/Linux system, such as less, ls, and grep. The scope of this article includes -- but is not limited to -- those utilities included with the GNU Template:Package Official package. What follows are various tips and tricks and other helpful information related to these utilities. If sections grow too detailed, please split into separate articles.


grep is a command line text search utility originally written for Unix. The Template:Codeline command searches files or standard input globally for lines matching a given regular expression, and prints them to the program's standard output.

Beyond aesthetics, Template:Codeline's color output is immensely useful for learning Template:Codeline and Template:Codeline's functionality.

To add it, write the following entry to Template:Filename:

export GREP_COLOR="1;33"
alias grep='grep --color=auto'

The variable Template:Codeline is used to specify the output color, in this example a light yellow color.

Although Template:Codeline's man page states that Template:Codeline is deprecated and that Template:Codeline is preferable, this variable does not work as of Template:Package Official version 2.5.4, so use Template:Codeline for now.


less is a terminal pager program used to view the contents of a text file one screen at a time. Whilst similar to other pages such as Template:Codeline and Template:Codeline, Template:Codeline offers a more advanced interface and complete feature-set.[1]

Enable code syntax coloring by adding this line to .bashrc:

export LESS="-R"

Frequent users of the command line interface might want to install Template:Package Official:

# pacman -S lesspipe

Users may now list the compressed files inside of an archive using their pager:


Template:Codeline also grants Template:Codeline the ability of interfacing with files other than archives; serving as an alternative for the specific command associated for that file-type (such as viewing HTML via Template:Package Official).

Re-login after installing Template:Codeline in order to activate it, or source Template:Filename.


ls is a command to list files in Unix and Unix-like operating systems.

Colored output can be enabled with a simple alias. File Template:Filename should already have the following entry copied from Template:Filename:

alias ls='ls --color=auto'

The next step will further enhance the colored Template:Codeline output; for example, broken (orphan) symlinks will start showing in a red hue. Add the following to Template:Filename and relogin, or source the file:

eval $(dircolors -b)