Basic CLI

Posted by zbrom on June 25, 2021 · 2 mins read

Here you will find some basic useful command line interface (CLI) commands for Arch Linux. Commands should apply to all Arch builds assuming you are using systemd. For additional flags, please view the man pages of any of the following applications.

Package Management:

Update your system:

pacman -Syu

Download a new package:

pacman -S

Display information about a package:

pacman -Si

Search for a locally installed package:

pacman -Ss

Yay (Download from the Arch User Repository):

Update your system:

yay -Syu

Download a new package:

yay -S

Display information about a package:

yay -Si

Systemd Commands


Start a service:

systemctl start [name of service].service

Stop a service:

systemctl stop [name of service].service

Enable a service permanently:

systemctl enable [name of service].service

Disable a service:

systemctl disable [name of service].service

Check the status of a service:

systemctl status [name of service].service

User Management

Adding Users

Add users with: useradd

useradd -m -g [initial_group] -G [additional_groups] -s [login_shell] [username]

-m creates the user home directory as /home/[username]; within their home directory, a non-root user can write files, delete them, install programs, and so on.
-g defines the group name or number of the user’s initial login group; the group name must exist; if a group number is provided, it must refer to an already existing group; if not specified, the behavior of useradd will depend on the USERGROUPS_ENAB variable contained in /etc/login.defs.
-G introduces a list of supplementary groups which the user is also a member of; each group is separated from the next by a comma, with no intervening spaces; the default is for the user to belong only to the initial group.
-s defines the path and filename of the user’s default login shell; Arch Linux init scripts use Bash; after the boot process is complete, the default login shell is the one specified here; ensure the chosen shell package is installed if choosing something other than Bash.

Change a password:


Remove a user:

userdel -r [username]

Group Management

Display group membership along with the user’s UID and associated GIDs:

id [user]

List all groups on the system:

cat /etc/group

Create a new group:

groupadd [group]

Remove a group:

groupdel [group]

Add a user to a group:

gpasswd -a [user] [group]

Remove a user from a group:

gpasswd -d [user] [group]