Your /etc/apt/sources.list is missing or corrupted. You can create file using command line tools by simply typing following commands.
Add four main repositories
sudo add-apt-repository main
sudo add-apt-repository universe
sudo add-apt-repository restricted
sudo add-apt-repository multiverse
Add security and update repositories for 18.04 LTS
sudo -- sh -c "echo 'deb http://security.ubuntu.com/ubuntu/ bionic-security multiverse main restricted universe' >> /etc/apt/sources.list"
sudo -- sh -c "echo 'deb http://archive.ubuntu.com/ubuntu bionic-updates multiverse main restricted universe' >> /etc/apt/sources.list"
sudo -- sh -c "echo 'deb http://archive.ubuntu.com/ubuntu bionic-backports multiverse main restricted universe' >> /etc/apt/sources.list"
At the end /etc/apt/sources.list should look as follows when viewed with the cat command on Linux
cat /etc/apt/sources.list
Sample file for Ubuntu 19.04 created using above commands:
deb http://archive.ubuntu.com/ubuntu bionic main universe restricted multiverse
deb http://security.ubuntu.com/ubuntu/ bionic-security multiverse main restricted universe
deb http://archive.ubuntu.com/ubuntu bionic-updates multiverse main restricted universe
deb http://archive.ubuntu.com/ubuntu bionic-backports multiverse main restricted universe
Sample file for Ubuntu 20.04 LTS desktop with additional repos:
deb http://archive.ubuntu.com/ubuntu/ focal main restricted
deb http://archive.ubuntu.com/ubuntu/ focal-updates main restricted
deb http://archive.ubuntu.com/ubuntu/ focal universe
deb http://archive.ubuntu.com/ubuntu/ focal-updates universe
deb http://archive.ubuntu.com/ubuntu/ focal multiverse
deb http://archive.ubuntu.com/ubuntu/ focal-updates multiverse
deb http://archive.ubuntu.com/ubuntu/ focal-backports main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu focal-security main restricted
deb http://security.ubuntu.com/ubuntu focal-security universe
deb http://security.ubuntu.com/ubuntu focal-security multiverse
Now update the system:
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install foo
sudo apt-get install nginx
How to fix “Unable to locate package” while trying to install packages with apt or apt-get using GUI tools
The above commands works great on server. But, if you have a gnome or kde or any other Ubuntu Linux desktop installed simply try a tool called software-properties-gtk
Software tab
Type the following command to start the tool
software-properties-gtk
Make sure the “Ubuntu Software” tab displays a list of repositories or “Channels”. The four main repositories are selected as follows:
The update tab
The Updates tab is where you set when and how Ubuntu receives security updates. Make sure you select it as follows and click on the Close button.
When prompted click on the “Reload” button:

The system will update cache as follows:
Update the system and install packages
Once updated you are ready to install or update your system using the apt-get command or apt command:
sudo apt update
sudo apt upgrade
sudo apt install nginx
I strongly suggest that you read this page here for more info.