xxxxxxxxxx
sudo must be used before and after &&
Example:
sudo apt-get update && sudo apt-get upgrade
xxxxxxxxxx
#You can delete the lock file with the following command.
sudo rm /var/lib/apt/lists/lock
#You may also need to delete the lock file in the cache directory
sudo rm /var/cache/apt/archives/lock
sudo rm /var/lib/dpkg/lock
xxxxxxxxxx
Method 1
ps aux | grep -i apt
sudo kill -9 <process_id>
Method 2
sudo lsof /var/lib/dpkg/lock
sudo lsof /var/lib/apt/lists/lock
sudo lsof /var/cache/apt/archives/lock
sudo kill -9 <process_id>
xxxxxxxxxx
just add 'sudo' before the exsiting command
xxxxxxxxxx
// This occurs due to permission denial
// simply add sudo
sudo apt install something
// Then input your password