If you’re new to Linux and you’ve been following along a tutorial or something somewhere tells you to use the nano command, you may get this error at first:
-bash: nano: command not found
Fear not. It’s a fairly simple fix. Nano is a text editor and although your Linux server may have the package, it may not already be installed. Before installing nano, give vi a try. Vi or Vim Editor is widely accepted as the most popular text editor in Linux. If you’re running CentOS, Vim Editor is already installed and you’ll be good to go.
So for instance if I want to edit a file located at /home/dan/example.conf I’d execute the following:
But if you’d like to install nano and you have an updated version of Linux, you can install it using this command:
sudo apt-get install nano
Afterwards, running nano will work just fine. But keep in mind, you’ll always want to update Linux right away or packages like this won’t be readily available for install. For easy installation of things like this, you can install yum. If you are running CentOS, yum is installed already and you can run this command to install from the internet:
yum install nano
But, as I said before, you should be keeping your Linux server up to date, or at least do a full update before it goes into production. That said, running a full yum update will really help.