You are on page 1of 28

Installation guide

This document is a guide for installing Arch Linux from the live system booted with the official
installation image. Before installing, it would be advised to view the FAQ. For conventions used in
this document, see Help:Reading. In particular, code examples may contain placeholders
(formatted in italics) that must be replaced manually.
For more detailed instructions, see the respective ArchWiki articles or the various programs' man
pages, both linked from this guide. For interactive help, the IRC channel and the forums are also
available.
Arch Linux should run on any x86_64-compatible machine with a minimum of 512 MB RAM. A basic
installation with all packages from the base group should take less than 800 MB of disk space. As
the installation process needs to retrieve packages from a remote repository, this guide assumes a
working internet connection is available.

 1Pre-installation
o1.1Set the keyboard layout
o1.2Verify the boot mode
o1.3Connect to the Internet
o1.4Update the system clock
o1.5Partition the disks
o1.6Format the partitions
o1.7Mount the file systems
 2Installation
o2.1Select the mirrors
o2.2Install the base packages
 3Configure the system
o3.1Fstab
o3.2Chroot
o3.3Time zone
o3.4Localization
o3.5Network configuration
o3.6Initramfs
o3.7Root password
o3.8Boot loader
 4Reboot
 5Post-installation

Pre-installation
Download and boot the installation medium as explained in Category:Getting and installing Arch.
You will be logged in on the first virtual console as the root user, and presented with a Zsh shell
prompt.
To switch to a different console—for example, to view this guide with ELinks alongside the
installation—use the Alt+arrow shortcut. To edit configuration files, nano, vi and vim are
available.
Set the keyboard layout
The default console keymap is US. Available layouts can be listed with:
# ls /usr/share/kbd/keymaps/**/*.map.gz

To modify the layout, append a corresponding file name to loadkeys(1), omitting path and file
extension. For example, to set a German keyboard layout:

# loadkeys de-latin1

Console fonts are located in /usr/share/kbd/consolefonts/ and can likewise be set


with setfont(8).
Verify the boot mode
If UEFI mode is enabled on an UEFI motherboard, Archiso will boot Arch Linux accordingly
via systemd-boot. To verify this, list the efivars directory:

# ls /sys/firmware/efi/efivars

If the directory does not exist, the system may be booted in BIOS or CSM mode. Refer to your
motherboard's manual for details.
Connect to the Internet
The installation image enables the dhcpcd daemon for wired network devices on boot. The
connection may be verified with ping:

# ping archlinux.org

If no connection is available, stop the dhcpcd service with systemctl stop


dhcpcd@interface where the interface name can be tab-completed. Proceed to configure the
network as described in Network configuration.
Update the system clock
Use timedatectl(1) to ensure the system clock is accurate:

# timedatectl set-ntp true

To check the service status, use timedatectl status.


Partition the disks
When recognized by the live system, disks are assigned to a block device such
as /dev/sda or /dev/nvme0n1. To identify these devices, use lsblk or fdisk.

# fdisk -l

Results ending in rom, loop or airoot may be ignored.


The following partitions are required for a chosen device:

One partition for the root directory /.


If UEFI is enabled, an EFI system partition.
Note: Swap space can be set on a separate partition or a swap file.
To modify partition tables, use fdisk or parted.

# fdisk /dev/sda

See Partitioning for more information.


Note: If you want to create any stacked block devices for LVM, disk encryption or RAID, do it now.
Format the partitions
Once the partitions have been created, each must be formatted with an appropriate file system. For
example, to format the root partition on /dev/sda1 with ext4, run:

# mkfs.ext4 /dev/sda1

If you created a partition for swap (for example /dev/sda3), initialize it with mkswap:

# mkswap /dev/sda3
# swapon /dev/sda3

See File systems#Create a file system for details.


Mount the file systems
Mount the file system on the root partition to /mnt, for example:

# mount /dev/sda1 /mnt

Create mount points for any remaining partitions and mount them accordingly:

# mkdir /mnt/boot
# mount /dev/sda2 /mnt/boot

genfstab will later detect mounted file systems and swap space.

Installation
Select the mirrors
Packages to be installed must be downloaded from mirror servers, which are defined
in /etc/pacman.d/mirrorlist. On the live system, all mirrors are enabled, and sorted by their
synchronization status and speed at the time the installation image was created.
The higher a mirror is placed in the list, the more priority it is given when downloading a package.
You may want to edit the file accordingly, and move the geographically closest mirrors to the top of
the list, although other criteria should be taken into account.
This file will later be copied to the new system by pacstrap, so it is worth getting right.
Install the base packages
Use the pacstrap script to install the base package group:

# pacstrap /mnt base

This group does not include all tools from the live installation, such as btrfs-progs or specific
wireless firmware; see packages.x86_64 for comparison.
To install packages and other groups such as base-devel, append the names to pacstrap (space
separated) or to individual pacman commands after the #Chroot step.

Configure the system


Fstab
Generate an fstab file (use -U or -L to define by UUID or labels, respectively):

# genfstab -U /mnt >> /mnt/etc/fstab

Check the resulting file in /mnt/etc/fstab afterwards, and edit it in case of errors.
Chroot
Change root into the new system:

# arch-chroot /mnt

Time zone
Set the time zone:

# ln -sf /usr/share/zoneinfo/Region/City /etc/localtime

Run hwclock(8) to generate /etc/adjtime:

# hwclock --systohc

This command assumes the hardware clock is set to UTC. See Time#Time standard for details.
Localization
Uncomment en_US.UTF-8 UTF-8 and other needed locales in /etc/locale.gen, and generate
them with:
# locale-gen

Set the LANG variable in locale.conf(5) accordingly, for example:

/etc/locale.conf

LANG=en_US.UTF-8

If you set the keyboard layout, make the changes persistent in vconsole.conf(5):

/etc/vconsole.conf

KEYMAP=de-latin1

Network configuration
Create the hostname file:

/etc/hostname

myhostname

Add matching entries to hosts(5):

/etc/hosts

127.0.0.1 localhost
::1 localhost
127.0.1.1 myhostname.localdomain myhostname

If the system has a permanent IP address, it should be used instead of 127.0.1.1.


Complete the network configuration for the newly installed environment.
Initramfs
Creating a new initramfs is usually not required, because mkinitcpio was run on installation of
the linux package with pacstrap.
For special configurations, modify the mkinitcpio.conf(5) file and recreate the initramfs image:

# mkinitcpio -p linux
Root password
Set the root password:

# passwd

Boot loader
A Linux-capable boot loader must be installed in order to boot Arch Linux. See Category:Boot
loaders for available choices.
If you have an Intel CPU, install the intel-ucode package in addition, and enable microcode
updates.

Reboot
Exit the chroot environment by typing exit or pressing Ctrl+D.
Optionally manually unmount all the partitions with umount -R /mnt: this allows noticing any "busy"
partitions, and finding the cause with fuser(1).
Finally, restart the machine by typing reboot: any partitions still mounted will be automatically
unmounted by systemd. Remember to remove the installation media and then login into the new
system with the root account.
Post-installation
See General recommendations for system management directions and post-installation tutorials
(like setting up a graphical user interface, sound or a touchpad).
For a list of applications that may be of interest, see List of applications.

 1Internet
o 1.1Network connection
 1.1.1Network managers
 1.1.2VPN clients
 1.1.3Proxy servers
 1.1.4Anonymizing networks
o 1.2Web browsers
 1.2.1Console
 1.2.2Graphical
 1.2.2.1Gecko-based
 1.2.2.1.1Firefox spin-offs
 1.2.2.2Blink-based
 1.2.2.2.1Chromium spin-offs
 1.2.2.2.2Browsers based on qt5-webengine
 1.2.2.2.3Browsers based on electron/muon
 1.2.2.3WebKit-based
 1.2.2.3.1Browsers based on webkit2gtk
 1.2.2.3.2Browsers based on qt5-webkit
 1.2.2.4Other
o 1.3Web servers
o 1.4ACME clients
o 1.5File sharing
 1.5.1Download managers
 1.5.1.1Console
 1.5.1.2Graphical
 1.5.2Cloud storage servers
 1.5.3Cloud synchronization clients
 1.5.4File transfer clients
 1.5.5File transfer servers
 1.5.6BitTorrent clients
 1.5.6.1Console
 1.5.6.2Graphical
 1.5.7Other P2P networks
 1.5.8Pastebin clients
o 1.6Communication
 1.6.1Email clients
 1.6.1.1Console
 1.6.1.2Graphical
 1.6.2Mail servers
 1.6.3Mail retrieval agents
 1.6.4Instant messaging clients
 1.6.4.1Multi-protocol clients
 1.6.4.1.1Console
 1.6.4.1.2Graphical
 1.6.4.2IRC clients
 1.6.4.2.1Console
 1.6.4.2.2Graphical
 1.6.4.3XMPP clients
 1.6.4.3.1Console
 1.6.4.3.2Graphical
 1.6.4.4SIP clients
 1.6.4.5Matrix clients
 1.6.4.6Tox clients
 1.6.4.7Serverless (decentralized) clients
 1.6.4.8Other
 1.6.5Instant messaging servers
 1.6.5.1IRC servers
 1.6.5.2XMPP servers
 1.6.5.3SIP servers
 1.6.5.4Other
 1.6.6Collaborative software
o 1.7News, RSS, and blogs
 1.7.1News aggregators
 1.7.1.1Console
 1.7.1.2Graphical
 1.7.2Podcast clients
 1.7.2.1Console
 1.7.2.2Graphical
 1.7.3Usenet newsreaders
 1.7.3.1Console
 1.7.3.2Graphical
 1.7.4Blog engines
 1.7.5Microblogging clients
 1.7.5.1Console
 1.7.5.2Graphical
o 1.8Remote desktop
 1.8.1Remote desktop clients
 1.8.2Remote desktop servers
 2Multimedia
o 2.1Codecs
o 2.2Image
 2.2.1Image viewers
 2.2.1.1Console
 2.2.1.2Graphical
 2.2.2Image organizers
 2.2.3Image processing
 2.2.4Raster graphics editors
 2.2.5Photo editors
 2.2.6Vector graphics editors
 2.2.7Font editors
 2.2.82D animation
 2.2.93D computer graphics
 2.2.10Color pickers
 2.2.11Screenshot
 2.2.12Digital camera managers
o 2.3Audio
 2.3.1Audio systems
 2.3.2Audio players
 2.3.2.1Console
 2.3.2.2Graphical
 2.3.2.2.1GStreamer-based
 2.3.2.2.2Phonon-based
 2.3.2.2.3Qt Multimedia-based
 2.3.2.2.4Other
 2.3.3Audio tag editors
 2.3.3.1Console
 2.3.3.2Graphical
 2.3.4Lyrics
 2.3.5Audio converters
 2.3.6Audio editors
 2.3.7Digital audio workstations
 2.3.8Audio analyzers
 2.3.9Scorewriters
 2.3.10Audio synthesis environments
 2.3.11Sound generators
 2.3.12Music trackers
 2.3.13DJ
 2.3.14Audio effects
 2.3.15Audio visualizers
 2.3.16Volume control
 2.3.17CD ripping
o 2.4Video
 2.4.1Video players
 2.4.1.1Console
 2.4.1.2Graphical
 2.4.1.2.1GStreamer-based
 2.4.1.2.2mpv-based
 2.4.1.2.3MPlayer-based
 2.4.1.2.4Other
 2.4.2Video converters
 2.4.2.1Console
 2.4.2.2Graphical
 2.4.3Video editors
 2.4.4Subtitles
 2.4.5Screencast
 2.4.6Webcam
 2.4.7DVD authoring
 2.4.8DVD ripping
o 2.5Collection managers
o 2.6Media servers
o 2.7Metadata
o 2.8Mobile device managers
o 2.9Optical disc burning
 3Utilities
o 3.1Terminal
 3.1.1Command shells
 3.1.2Terminal emulators
 3.1.2.1VTE-based
 3.1.2.2KMS-based
 3.1.2.3framebuffer-based
 3.1.3Terminal pagers
 3.1.4Terminal multiplexers
o 3.2Files
 3.2.1File managers
 3.2.1.1Console
 3.2.1.2Graphical
 3.2.2Trash management
 3.2.3File synchronization
 3.2.4Archiving and compression tools
 3.2.4.1Console
 3.2.4.2Graphical
 3.2.5Comparison, diff, merge
 3.2.6Batch renamers
 3.2.7Finders
o 3.3Development
 3.3.1Integrated development environments
 3.3.2GUI builders
 3.3.3Hex editors
 3.3.4JSON tools
 3.3.5Debuggers
 3.3.6UML modelers
 3.3.7API documentation browsers
 3.3.8Build automation
 3.3.9Version control systems
 3.3.10Game development
o 3.4Text input
 3.4.1Character selectors
 3.4.2Virtual keyboards
 3.4.3Keyboard layout switchers
 3.4.4Input methods
o 3.5Disks
 3.5.1Partitioning tools
 3.5.2Formatting tools
 3.5.3Cloning tools
 3.5.4Mount tools
 3.5.5Disk usage display
 3.5.6Disk health status
 3.5.7File recovery tools
 3.5.8Disk cleaning
 3.5.9Disk image writing
o 3.6System
 3.6.1System monitoring
 3.6.2Hardware sensor monitoring
 3.6.3System information viewers
 3.6.3.1Console
 3.6.3.2Graphical
 3.6.4System log viewers
 3.6.5Font viewers
 3.6.6Help viewers
 3.6.7Command schedulers
 3.6.8Shutdown timers
 3.6.9Clock synchronization
 3.6.10Screen management
 3.6.11Backlight management
 3.6.12Color management
 3.6.13Printer management
 3.6.14Bluetooth management
 3.6.15Power management
 3.6.16Package management
 4Documents and texts
o 4.1Text editors
 4.1.1Console
 4.1.2Graphical
 4.1.3Emacs text editors
 4.1.4Vi text editors
o 4.2Office
 4.2.1Office suites
 4.2.2Word processors
 4.2.3Presentations
 4.2.4Spreadsheets
 4.2.5Database tools
 4.2.6Formula editors
o 4.3Markup languages
 4.3.1Markdown
 4.3.1.1Markdown editors
 4.3.2Typesetting systems
 4.3.3TeX editors
 4.3.4TeX formula editors
 4.3.5XML editors
o 4.4Document converters
o 4.5Bibliographic reference managers
o 4.6Readers and viewers
 4.6.1E-book
 4.6.2PDF and DjVu
 4.6.2.1Console
 4.6.2.2Graphical
 4.6.2.2.1Annotation
 4.6.2.2.2Manipulation
 4.6.3CHM
 4.6.4Comic book
o 4.7Scanning software
o 4.8OCR software
 4.8.1OCR engines
 4.8.2Layout analyzers
o 4.9Notes
 4.9.1Note-taking software
 4.9.1.1Console
 4.9.1.2Graphical
 4.9.2Diary
 4.9.3Mind-mapping
 4.9.4Sticky notes
o 4.10Special writing environments
 4.10.1Distraction-free writing
 4.10.2Story writing
 4.10.3Screenwriting
o 4.11Language
 4.11.1Dictionary and thesaurus
 4.11.2Spell checkers
 4.11.3Translation and localization
o 4.12Barcode generators and readers
 4.12.1Console
 4.12.2Graphical
 5Security
o 5.1Network security
o 5.2Firewall management
o 5.3Threat and vulnerability detection
o 5.4File security
o 5.5Anti malware
o 5.6Backup programs
o 5.7Screen lockers
o 5.8Password managers
 5.8.1Console
 5.8.2Graphical
o 5.9Cryptography
 5.9.1Hash checkers
 5.9.2Encryption, signing, steganography
 5.9.3Disk encryption
 6Science
o 6.1Mathematics
 6.1.1Calculator
 6.1.2Computer algebra system
 6.1.3Scientific or technical computing
 6.1.4Statistics
 6.1.5Data evaluation
 6.1.6Proof assistants
o 6.2Chemistry and biology
 6.2.1Computational biology and bioinformatics
 6.2.2Molecules
 6.2.2.1Viewers
 6.2.2.2Drawing
 6.2.2.3Modeling
 6.2.3Periodic table
 6.2.4Biochemistry
 6.2.5Image manipulation
o 6.3Meteorology
o 6.4Astronomy
o 6.5Engineering
 6.5.1Computer-aided design
o 6.6Physics
 6.6.1Electronics
 6.6.1.1Digital logic
 6.6.1.2HDL
 6.6.1.3MCU IDE
 6.6.1.4Schematic capture editor
 6.6.2Physics simulation
 6.6.3Unit conversion
o 6.7Geography
o 6.8Communication systems
 6.8.1Amateur radio
o 6.9Simulation modeling
 7Others
o 7.1Organization
 7.1.1Personal information managers
 7.1.2Time management
 7.1.2.1Console
 7.1.2.2Graphical
 7.1.3Time trackers
 7.1.4Task management
 7.1.4.1Console
 7.1.4.2Graphical
 7.1.5Contacts management
 7.1.6Financial management
 7.1.7Cryptocurrency
 7.1.8Project management
o 7.2Education
 7.2.1Flashcards
 7.2.2Touch typing
 7.2.2.1Console
 7.2.2.2Graphical
 7.2.3Recipe management
 7.2.4Education management engines
o 7.3Accessibility
 7.3.1Speech synthesizers
 7.3.2Speech recognition
 7.3.3Screen magnifiers
 7.3.4Mouse
o 7.4Display managers
o 7.5Desktop environments
 7.5.1Window managers
 7.5.1.1Console
 7.5.1.2Graphical
 7.5.1.3Composite managers
 7.5.2Window tilers
 7.5.3Taskbars
 7.5.4System tray
 7.5.5Application launchers
 7.5.6Application menu editors
 7.5.7Wallpaper setters
 7.5.8Virtual desktop pagers
 7.5.9Desktop widgets
 7.5.10Desktop notifications
 7.5.11Clipboard managers
Core utilities
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 coreutils package. What follows are various tips and tricks and other helpful information
related to these utilities.
Most command-line interfaces are documented in man pages, GNU commands tend to be
documented in info(1) pages, some shells provide a help command for shell-builtin commands.
Additionally most commands print their usage when run with the --help argument.

Contents
[hide]

 1File management
o 1.1ls
 1.1.1Long format
 1.1.2File names containing spaces enclosed in quotes
o 1.2cat
o 1.3less
 1.3.1Vim as alternative pager
o 1.4mkdir
o 1.5mv
o 1.6rm
o 1.7chmod
o 1.8chown
o 1.9find
o 1.10locate
 2Text streams
o 2.1grep
o 2.2sed
o 2.3awk
o 2.4pv
 3System administration
o 3.1sudo
o 3.2which
o 3.3lsblk
o 3.4ip
o 3.5ss
 4Miscellaneous
o 4.1dd
o 4.2iconv
 4.2.1Convert a file in place
o 4.3od
o 4.4seq
o 4.5tar
o 4.6wipefs
 5See also
File management

Manual
Command Description Example
page

Change directory (shell built-in


cd cd(1p) cd /etc/pacman.d
command)

mkdir Create a directory mkdir(1) mkdir ~/newfolder

rmdir Remove empty directory rmdir(1) rmdir ~/emptyfolder

rm Remove a file rm(1) rm ~/file.txt

rm -r Remove directory and contents rm -r ~/.cache

ls List files ls(1) ls *.mkv

ls -a List hidden files ls -a /home/archie

ls -al List hidden files and file properties

mv ~/compressed.zip
mv Move a file mv(1)
~/archive/compressed2.zip

cp Copy a file cp(1) cp ~/.bashrc ~/.bashrc.bak

chmod +x Make a file executable chmod(1) chmod +x ~/.local/bin/myscript.sh

cat Show file contents cat(1) cat /etc/hostname


find Search for a file find(1) find ~ -name myfile

ls
ls lists directory contents.
See info ls or the online manual for more information.
exa is a modern, and more user friendly alternative to ls and tree, that has more features, such as
displaying Gitmodifications along with filenames, colouring differently each columnn in --
long mode, or displaying --long mode metadata along with a tree view. exa
Long format
The -l option displays some metadata, for example:

$ ls -l /path/to/directory

total 128
drwxr-xr-x 2 archie users 4096 Jul 5 21:03 Desktop
drwxr-xr-x 6 archie users 4096 Jul 5 17:37 Documents
drwxr-xr-x 2 archie users 4096 Jul 5 13:45 Downloads
-rw-rw-r-- 1 archie users 5120 Jun 27 08:28 customers.ods
-rw-r--r-- 1 archie users 3339 Jun 27 08:28 todo
-rwxr-xr-x 1 archie users 2048 Jul 6 12:56 myscript.sh

The total value represents the total disk allocation for the files in the directory, by default in
number of blocks.
Below, each file and subdirectory is represented by a line divided into 7 metadata fields, in the
following order:

 type and permissions:


 the first character is the entry type, see info ls -n "What information is
listed" for an explanation of all the possible types; for example:
 - denotes a normal file;
 d denotes a directory, i.e. a folder containing other files or folders;
 p denotes a named pipe (aka FIFO);
 l denotes a symbolic link;
 the remaining characters are the entry's permissions;
 number of hard links for the entity; files will have at least 1, i.e. the showed reference itself;
folders will have at least 2: the showed reference, the self-referencing . entry, and then
a .. entry in each of its subfolders;
 owner user name;
 group name;
 size;
 last modification timestamp;
 entity name.
File names containing spaces enclosed in quotes
By default, file and directory names that contain spaces are displayed surrounded by single quotes.
To change this behavior use the -N or --quoting-style=literal options. Alternatively, set
the QUOTING_STYLE environment variable to literal. [1]
cat
cat is a standard Unix utility that concatenates files to standard output.

 Because cat is not built into the shell, on many occasions you may find it more convenient to use
a redirection, for example in scripts, or if you care a lot about performance. In fact < file does
the same as cat file.

 cat can work with multiple lines:

$ cat << EOF >> path/file


first line
...
last line
EOF

Alternatively, using printf:

$ printf '%s\n' 'first line' ... 'last line'

 If you need to list file lines in reverse order, there is a coreutil command
called tac (cat reversed).
less

This article or section needs expansion.


Reason: less is a complex beast, and this section should explain some of the basic less commands (Discuss
in Talk:Core utilities#)

less is a terminal pager program used to view the contents of a text file one screen at a time. Whilst
similar to other pagers such as more and the deprecated pg, less offers a more advanced interface
and complete feature-set.

See List of applications#Terminal pagers for alternatives.


Vim as alternative pager
Vim includes a script to view the content of text files, compressed files, binaries and directories. Add
the following line to your shell configuration file to use it as a pager:

~/.bashrc
alias less='/usr/share/vim/vim80/macros/less.sh'

There is also an alternative to the less.sh macro, which may work as the PAGER environment
variable. Install vimpagerand add the following to your shell configuration file:

~/.bashrc

export PAGER='vimpager'
alias less=$PAGER

Now programs that use the PAGER environment variable, like git, will use vim as pager.

mkdir
mkdir makes directories.
To create a directory and its whole hierarchy, the -p switch is used, otherwise an error is printed.
Changing mode of a just created directory using chmod is not necessary as the -m option lets you
define the access permissions.
Tip: If you just want a temporary directory, a better alternative may be mktemp: mktemp -d

mv
mv moves and renames files and directories.
Note: "Security aliases" are dangerous because you get used to them, resulting in potential data
loss when you use another system / user that doesn't have these aliases.

To limit potential damage caused by the command, use an alias:

alias mv='mv -iv'

This alias asks for confirmation before overwriting any existing files and lists the operations in
progress.
rm
rm removes files or directories.
Note: "Security aliases" are dangerous because you get used to them, resulting in potential data
loss when you use another system / user that doesn't have these aliases.

To limit potential damage caused by the command, use an alias:

alias rm='rm -Iv --one-file-system'


This alias asks confirmation to delete three or more files, lists the operations in progress, does not
involve more than one file systems. Substitute -I with -i if you prefer to confirm even for one file.
Zsh users may want to prefix noglob to avoid implicit expansions.
To remove directories believed to be empty, use rmdir as it fails if there are files inside the target.
chmod
See File permissions and attributes#Changing permissions.
chown
See File permissions and attributes#Changing ownership.
find
find is part of the findutils package, which belongs to the base package group.
Tip: fd is a simple, fast and user-friendly alternative to find that provides more sensible defaults
(e.g. ignores hidden files, directories and .gitignore'd files, fd PATTERN instead of find -iname
'*PATTERN*'). It features colorized output (similar to ls), Unicode awareness, regular expressions
and more.

One would probably expect a find command to take as argument a file name and search the
filesystem for files matching that name. For a program that does exactly that see #locate below.
Instead, find takes a set of directories and matches each file under them against a set of
expressions. This design allows for some very powerful "one-liners" that would not be possible using
the "intuitive" design described above. See GregsWiki:UsingFind for usage details.
locate
Install the mlocate package. The package contains an updatedb.timer unit, which invokes a
database update each day. The timer is enabled right after installation, start it manually if you want
to use it before reboot. You can also manually run updatedb as root at any time. By default, paths
such as /media and /mnt are ignored, so locate may not discover files on external devices.
See updatedb(8) for details.
The locate command is a common Unix tool for quickly finding files by name. It offers speed
improvements over the find tool by searching a pre-constructed database file, rather than the
filesystem directly. The downside of this approach is that changes made since the construction of
the database file cannot be detected by locate.
Before locate can be used, the database will need to be created. To do this, execute updatedb as
root.
See also How locate works and rewrite it in one minute.

Text streams
grep
grep is a command line text search utility originally written for Unix. The grep command searches
files or standard input for lines matching a given regular expression, and prints these lines to
standard output.

 Remember that grep handles files, so a construct like cat file | grep pattern is
replaceable with grep pattern file
 There are grep alternatives optimized for VCS source code, such
as ripgrep, the_silver_searcher, and ack.
 To include file line numbers in the output, use the -n option.
 grep can also be used for hexadecimal search in a binary file, to look for let say the A1
F2 sequence in a file, the command line is:

$ LANG=C grep --text --perl-regexp "\xA1\xF2" /path/to/file

Note: Some commands send their output to stderr(3), and grep has no apparent effect. In this
case, redirect stderrto stdout with command 2>&1 | grep args or (for Bash 4) command |&
grep args. See also I/O Redirection.

For color support, see Color output in console#grep.


See grep(1) for more details.
sed
sed is stream editor for filtering and transforming text.
Here is a handy list of sed one-liners examples.
Tip: More powerful alternatives are awk and the Perl language.

awk
AWK is a pattern scanning and processing language. There are multiple implementations:

 gawk — GNU version of awk, see gawk(1).


https://www.gnu.org/software/gawk/ || gawk (part of base)

 nawk — The one, true implementation of AWK, see nawk(1).


https://www.cs.princeton.edu/~bwk/btl.mirror/ || nawk

 mawk — A very fast AWK implementation.


http://invisible-island.net/mawk/ || mawkAUR

 BusyBox also includes an AWK implementation.


pv

This section is being considered for removal.


Reason: Not part of coreutils, util-linux, or base. Is it a "core utility"? (Discuss
in Talk:Core utilities#)

You can use pv to monitor the progress of data through a pipeline, for example:
# dd if=/source/filestream | pv -monitor_options -s size_of_file | d
d of=/destination/filestream

In most cases pv functions as a drop-in replacement for cat.

System administration

Command Description Manual page Example

mount Mount a partition mount(8) mount /dev/sdc1 /media/usb

df -h Show remaining space on all partitions df(1)

ps -A Show all running processes ps(1)

killall Kill all running instances of a process killall(1)

ss -at Display a list of open TCP sockets ss(8)

sudo
See Sudo.

which
which shows the full path of shell commands. In the following example the full path
of ssh is used as an argument for journalctl:

# journalctl $(which sshd)

lsblk
lsblk(8) will show all available block devices along with their partitioning schemes,
for example:

$ lsblk -f
NAME FSTYPE LABEL UUID MOU
NTPOINT
sda
├─sda1 vfat C4DA-2C4D /bo
ot
├─sda2 swap 5b1564b2-2e2c-452c-bcfa-d1f572ae99f2 [SW
AP]
└─sda3 ext4 56adc99b-a61e-46af-aab7-a6d07e504652 /

The beginning of the device name specifies the type of block device. Most modern
storage devices (e.g. hard disks, SSDs and USB flash drives) are recognised as SCSI
disks (sd). The type is followed by a lower-case letter starting from a for the first device
(sda), b for the second device (sdb), and so on. Existing partitions on each device will
be listed with a number starting from 1 for the first partition (sda1), 2 for the second
(sda2), and so on. In the example above, only one device is available (sda), and that
device has three partitions (sda1 to sda3), each with a different file system.
Other common block device types include for example mmcblk for memory cards
and nvme for NVMe devices. Unknown types can be searched in the kernel
documentation.
ip
ip allows you to show information about network devices, IP addresses, routing tables,
and other objects in the Linux IP software stack. By appending various commands, you
can also manipulate or configure most of these objects.
Note: The ip utility is provided by the iproute2 package, which is included in
the base group.

Object Purpose Manual page

ip addr protocol address management ip-address(8)

ip addrlabel protocol address label management ip-addrlabel(8)

ip l2tp tunnel Ethernet over IP (L2TPv3) ip-l2tp(8)

ip link network device configuration ip-link(8)


ip maddr multicast addresses management ip-maddress(8)

ip monitor watch for netlink messages ip-monitor(8)

ip mroute multicast routing cache management ip-mroute(8)

ip mrule rule in multicast routing policy db

ip neigh neighbour/ARP tables management ip-neighbour(8)

ip netns process network namespace management ip-netns(8)

ip ntable neighbour table configuration ip-ntable(8)

ip route routing table management ip-route(8)

ip rule routing policy database management ip-rule(8)

ip tcp_metrics management for TCP Metrics ip-tcp_metrics(8)

ip tunnel tunnel configuration ip-tunnel(8)

ip tuntap manage TUN/TAP devices

ip xfrm manage IPsec policies ip-xfrm(8)

The help command is available for all objects. For example, typing ip addr help will
show you the command syntax available for the address object. For advanced usage
see the iproute2 documentation.
The Network configuration article shows how the ip command is used in practice for
various common tasks.
Note: You might be familiar with the ifconfig command, which is deprecated in Arch
Linux; use ip instead.

ss
ss is a utility to investigate network ports and is part of the iproute2 package in
the base group. It has a similar functionality to the deprecated netstat utility.
Common usage includes:
Display all TCP Sockets with service names:

$ ss -at

Display all TCP Sockets with port numbers:

$ ss -atn

Display all UDP Sockets:

$ ss -au

For more information see ss(8) or ss.html from the iproute2 package.

Miscellaneous

Command Description Manual page Example

strings Show printable characters in binary files strings(1) strings /usr/bin/free

dd
dd is a utility for Unix and Unix-like operating systems whose primary purpose is to
convert and copy a file.
Similarly to cp, by default dd makes a bit-to-bit copy of the file, but with lower-level I/O
flow control features.
Some notable applications of dd are:

 Disk cloning#Using dd,

 Binary file patching: let say one wants to replace offset 0x123AB of a file with the FF
C0 14 hexadecimal sequence, this can be done with the command line:
# printf '\xff\xc0\x14' | dd seek=$((0x123AB)) conv=notrunc bs=1
of=/path/to/file

For more information see dd(1) or the full documentation.


Tip: By default, dd outputs nothing until the task has finished. To monitor the progress
of the operation, add the status=progress option to the command.

Warning: One should be extremely cautious using dd, as with any command of this kind
it can destroy data irreversibly.

iconv
iconv converts the encoding of characters from one codeset to another.
The following command will convert the file foo from ISO-8859-15 to UTF-8, saving it
to foo.utf:

$ iconv -f ISO-8859-15 -t UTF-8 foo > foo.utf

See iconv(1) for more details.


Convert a file in place
Tip: You can use recode instead of iconv if you do not want to touch the mtime.

Unlike sed, iconv does not provide an option to convert a file in place.
However, sponge from the moreutils package can help:

$ iconv -f WINDOWS-1251 -t UTF-8 foobar.txt | sponge foobar.txt

See sponge(1) for details.


od
The od (octal dump) command is useful for visualizing data that is not in a human-
readable format, like the executable code of a program, or the contents of an
unformatted device. See the manual for more information.
seq
seq prints a sequence of numbers. Shell built-in alternatives are available, so it is good
practice to use them as explained on Wikipedia.
tar
As an early Unix archiving format, .tar files—known as "tarballs"—are widely used for
packaging in Unix-like operating systems. Both pacman and AUR packages are
compressed tarballs, and Arch uses GNU's tar program by default.
For .tar archives, tar by default will extract the file according to its extension:
$ tar xvf file.EXTENSION

Forcing a given format:

File Type Extraction Command

file.tar tar xvf file.tar

file.tgz tar xvzf file.tgz

file.tar.gz tar xvzf file.tar.gz

file.tar.bz bzip -cd file.bz | tar xvf -

tar xvjf file.tar.bz2


file.tar.bz2
bzip2 -cd file.bz2 | tar xvf -

tar xvJf file.tar.xz


file.tar.xz
xz -cd file.xz | tar xvf -

file.tar.zst tar -I zstd xvf file.tar.zst

The construction of some of these tar arguments may be considered legacy, but they
are still useful when performing specific operations. See tar(1) for details.
Note: Although GNU's tar is installed as the default tar program, official Arch Linux
projects like pacman and mkinitcpio use bsdtar from the libarchive package.

wipefs

This article or section needs expansion.


Reason: Why would you want to erase magic strings? (Discuss in Talk:Core utilities#)

wipefs can list or erase file system, RAID or partition-table signatures (magic strings)
from the specified device. It does not erase the file systems themselves nor any other
data from the device.
See wipefs(8) for more information.
For example, to erase all signatures from the device /dev/sdb and create a signature
backup ~/wipefs-sdb-offset.bakfile for each signature:

# wipefs --all --backup /dev/sdb

You might also like