Monday, March 1, 2021

Python 3: ImportError “No Module named Setuptools”

If you receive this error please try the following command:

  sudo apt-get install python3-setuptools

For other versions like python2 run the following command:

  sudo apt-get install python-setuptools

Permission denied while trying to connect to the Docker daemon socket

Try the following command in the terminal after installing Docker.

  • sudo groupadd docker

  • sudo usermod -aG docker $USER

  • newgrp docker

  • docker ps              

  • Either reboot or log off and login and done.

Tuesday, February 16, 2021

Ubuntu Bluetooth doesn't Turn On

 If you are also facing this issue that suddenly you are not able to turn on your Bluetooth in Ubuntu or any other Linux distro then you can try following, I got it fixed using the following:

Open terminal and run following command:

sudo rmmod btusb

sudo modprobe btusb

Sunday, August 30, 2020

module_stderr": "sudo: a password is required

 This error appears when we try to run an ansible script with a user that is not enabled for passwordless sudo. 

On this error we have two options with us:

1. Make the user run sudo without a password, for which open /etc/sudoers and put the following line for the user for which passwordless ssh is needed"


shashwat          ALL=(ALL:ALL) NOPASSWD: ALL

#Note: Add this line to the end of the file

Save and Exit and run the ansible script again.

2. option is to enable ansible to ask sudo password on command line. For which you need to pass parameter

--ask-become-pass or -K 

And this will ask for password on command line and ansible will run sucessfully.

Wednesday, October 10, 2018

Linux : Find the top 10 directories containing largest number of files/directories in sorted order

Command Combination:

find -xdev -type d -print0 | while IFS= read -d '' dir; do echo "$(find "$dir" -maxdepth 1 -print0 | grep -zc .) $dir" ;done | sort -rn | head -10


find /opt -xdev -type d -print0 | while IFS= read -d '' dir; do echo "$(find "$dir" -maxdepth 1 -print0 | grep -zc .) $dir" ;done | sort -rn | head -10

Thursday, November 30, 2017

Sed replace a text with a variable of output of command

Sometimes we need to replace a string with a variable or output of a Linux command we can use Sed in following way to do that

sed -i "s/textTOreplace/${variablename}/g" /file_path

If you also want a backup of the original file to be created after replacement that you can use .bak after -i parameter as follows:

sed -i.bak "s/textTOreplace/${variablename}/g" /file_path

Wednesday, November 22, 2017

Available package managers on different Linux flavors

Here is the list of package managers available in different Linux flavour, for managing packages like searcing installing removing the package from the system.

Task to perfomr and commands
apt (deb file formats)
zypp (rpm)
yum/dnf (rpm)
urpmi (rpm)
Debian, Ubuntu
Fedora, CentOS
Mandriva, Mageia
Install new software from package repository
apt-get/apt install package_name/apt install package_name
zypper install package_name
yum install package_name
urpmi package_name
Install new software from package file
dpackage_name -i package_name
zypper install package_name
yum localinstall package_name
urpmi package_name
Update existing software
apt-get/apt install package_name
zypper update -t package package_name
yum update package_name
urpmi package_name
Remove unwanted software
apt-get/apt remove package_name
zypper remove package_name
yum erase package_name
urpme package_name
System update

Update the system
apt-get/apt update
zypper refresh
yum check-update
urpmi.update -a
aptitude update
Update the system to recent packages
apt-get/apt upgrade
zypper update
yum update
urpmi --auto-select
aptitude safe-upgrade
Searcing a package on the system

Search a package name
apt-cache search package_name
zypper search package_name
yum list package_name
urpmq package_name
Searcing a package using pattern
apt-cache search pattern
zypper search -t pattern pattern
yum search pattern
urpmq --fuzzy package_name
Searching package using file name
apt-file search path
zypper wp file
yum provides file
urpmf file
Listing the installed packages available
dpackage_name -l
zypper search -is
rpm -qa
rpm -qa
About Repository

Looking for the list of repositories
cat /etc/apt/sources.list
zypper repos
yum repolist
urpmq --list-media
Where to add new repository
(edit /etc/apt/sources.list)
zypper addrepo path name
(add repo to /etc/yum.repos.d/)
urpmi.addmedia name path
Removing unwanted repository
(edit /etc/apt/sources.list)
zypper removerepo name
(remove repo from /etc/yum.repos.d/)
urpmi.removemedia media

Google Ads