I am trying to access calendar by "cal" command in terminal but there is error message.

hetz@hetz-Lappy:~$ cal
bash: cal: command not found
  • Are you using Ubuntu?
    – Pilot6
    Jun 25, 2022 at 6:37
  • I have upgraded from 20.04 LTS to 22.04 LTS recently.
    – learner
    Jun 29, 2022 at 18:01

2 Answers 2


I would recommend first installing command-not-found to help with errors like this:

sudo apt install command-not-found

Then open a new terminal to ensure its features will be available within it.

Now when you try to run cal, you will get an more useful error message which will tell you which package to install:

Command 'cal' not found, but can be installed with:
sudo apt install ncal
  • Running zsh, command-not-found does not appear to work -- still get the same command not found Nov 30, 2022 at 4:01
  • 1
    @OskarAustegard For Zsh, you need to add the command_not_found_handle function to .zshrc (see my answer for an example). Dec 8, 2022 at 13:31

Install the ncal package:

sudo apt install ncal

If you have command-not-found installed and enabled (which it is by default in Bash) you should get a suggestion to install the package. If you use Zsh, copy these lines from /etc/bash.bashrc to your .zshrc (or enable a relevant plugin for your Zsh framework):

# if the command-not-found package is installed, use it
if [ -x /usr/lib/command-not-found -o -x /usr/share/command-not-found/command-not-found ]; then
    function command_not_found_handle {
        # check because c-n-f could've been removed in the meantime
        if [ -x /usr/lib/command-not-found ]; then
           /usr/lib/command-not-found -- "$1"
           return $?
        elif [ -x /usr/share/command-not-found/command-not-found ]; then
           /usr/share/command-not-found/command-not-found -- "$1"
           return $?
           printf "%s: command not found\n" "$1" >&2
           return 127

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.