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
openSUSE
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

Tuesday, November 14, 2017

ERROR: Exiting with exit code 1. REASON: Server not yet listening on http port 8080 after 50 seconds. Exiting



Error While starting Ambari-server

Ever seen this error? ERROR: Exiting with exit code 1. REASON: Server not yet listening on HTTP port 8080 after 50 seconds. Exiting

I received this error while starting up the Ambari server, I added following configuration and startup of the server was successful and I could access the WebUI.

In the following File:

/etc/ambari-server/conf/ambari.properties

Put the following configuration :

server.startup.web.timeout=120

Restart the server and check on the WebUI 8080.

Saturday, November 4, 2017

Exception: java.lang.NoClassDefFoundError thrown from the UncaughtExceptionHandler in thread "main"

Following error appeared during installation of Netbeans I found the solution as NetBeans is not able to find the java path.

Exception: java.lang.NoClassDefFoundError thrown from the UncaughtExceptionHandler in thread "main"

So the solution is to either correct the java path and correct the environment variables or just put the command line parameter -javahome as following while installing NetBeans.


./netbeans*   --javahome /usr/lib/jvm/java-8-oracle


--or--


sh -x netbeans-8.2-linux.sh --javahome /usr/lib/jvm/java-8-oracle


Note: You should have Java 1.8 or less as NetBeans 8.2 does not seems to work with Java 1.9

Featured Posts

#Linux Commands Unveiled: #date, #uname, #hostname, #hostid, #arch, #nproc

 #Linux Commands Unveiled: #date, #uname, #hostname, #hostid, #arch, #nproc Linux is an open-source operating system that is loved by millio...