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
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
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
command_not_found_handle
function to .zshrc
(see my answer for an example).
Commented
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 $?
else
printf "%s: command not found\n" "$1" >&2
return 127
fi
}
fi
I had the same problem, for some reason cal is no more present on the distribution installation, what I recommend is to install fcal as following:
snap install fcal
- Must run it as a root user
After this you will have the command fcal avaible, it will act like cal (it's not but it's kind of work around).