Skip to content

Core Utilities

GNU coreutils is the package that provides the fundamental file, shell, and text manipulation Utilities on virtually every Linux distribution. These utilities implement the POSIX specifications And extend them with GNU-specific options. The package contains roughly 105 programs, grouped into:

  • File utilities: ls``cp``mv``rm``ln``chmod``chown``touch``mkdir``rmdir stat``du``df``sync
  • Text utilities: cat``head``tail``sort``uniq``tr``cut``paste``join``wc nl``fmt``fold``pr
  • Shell utilities: echo``printf``date``tee``basename``dirname``sleep``true false``test``expr``yes``timeout

The Unix philosophy of composing small, single-purpose tools into pipelines is the foundation of Linux systems administration. Understanding how to chain these tools effectively is a core Competency.

grep searches input lines for patterns matching a regular expression and prints matching lines. Three main variants exist:

VariantRegex FlavorDescription
grepBREBasic Regular Expressions (default)
grep -EEREExtended Regular Expressions
grep -PPCREPerl-Compatible Regular Expressions
Terminal window
# Basic pattern matching
grep "error" /var/log/syslog
# Case-insensitive
grep -i "warning" /var/log/syslog
# Invert match (lines that do NOT match)
grep -v "debug" /var/log/syslog
# Show line numbers
grep -n "error" /var/log/syslog
# Count matches
grep -c "error" /var/log/syslog
# Show only matching portion
grep -o "error:[0-9]*" /var/log/syslog
# Recursive search through directories
grep -r "TODO" --include="*.py" src/
# Context lines (2 before, 2 after)
grep -C 2 "panic" /var/log/kern.log
# Extended regex (alternation, quantifiers without escaping)
grep -E "error|warning|critical" /var/log/syslog
# PCRE — lookahead, lookbehind, non-greedy quantifiers
grep -P "(?<=status: )\d{3}" response.txt
# Fixed string (no regex interpretation)
grep -F "file.name" search.log
# Color output
grep --color=always "pattern" file
FeatureBREEREPCRE
Literal matchabcabcabc
Any character...
Zero or more***
One or more\{1,\}++
Zero or one\???
Alternation|||
Grouping\(\)()()
Character class[abc][abc][abc]
LookaheadNoNo(?=...)
LookbehindNoNo(?&lt;=...)
Non-capturing groupNoNo(?:...)
Named captureNoNo(?P&lt;name&gt;...)
Backreference\1\1\1 or \k&lt;name&gt;
Unicode propertiesNoNo\p{L}