whoami: command not found [How To Fix]

Learn how to fix whoami: command not found error message in this article. We will learn fixing this error message on several Linux distributions including Ubuntu and CentOS / AlmaLinux. We will also learn to resolve this problem on MacOS X

Problem

When you run whoami command in linux terminal / console, you get the following error message

whoami: command not found

Solutions to whoami: command not found

How To Fix whoami: command not found in Ubuntu / Debian / Kali Linux / Raspbian

To fix this problem, we can install whoami using the command below.

sudo apt-get -y install coreutils

This command might take some time to finish depending on your machine internet connection.

You can also use apt command to install coreutils.

sudo apt -y install coreutils

Or if you have aptitude installed you can use the following command.

sudo aptitude install coreutils

How To Fix whoami: command not found in Alpine

In Alpine Linux, we can install whoami using the command below.

apk add coreutils

How To Fix whoami: command not found in Arch Linux

In Arch Linux, to fix this error message, we can install whoami using the command below.

pacman -S coreutils

How To Fix whoami: command not found CentOS / Alma Linux / Oracle Linux / Red Hat Enterprise Linux (RHEL)

In CentOS or other RHEL based Linux distribution, we can install whoami using the command below.

yum install coreutils

How To Fix whoami: command not found in Fedora

In Fedora we can use dnf command to install whoami using the command below.

dnf install coreutils

How To Fix whoami: command not found in OS X

To fix this problem, we can install whoami using the command below.

brew install coreutils

Related Articles