≡ Menu

FAQ

CentOS / RHEL 6: Install Midnight Commander File Manager

I am a new CentOS Linux user. How do I install GNU mc (Midnight Commander) on Red Hat Enterprise Linux or CentOS Linux server version 5.x/6.x using bash command line?
[click to continue…]

Awk Floating Point Number Addition Results Are Unexpected

I am using awk to grep ‘foo’ from a text file and cacluate sum of field # 7. But, result is rounded to an integer. I need exact result such as 385858.66 and not 385858 using the following command:

grep ‘foo’ 2012-2013.txt | awk ‘BEGIN{ sum=0.0}{ sub(“,”,””,$7); sum +=$7}END{ print “$” sum}’
$682444

I want $682444.57 as output. How can I force “awk” to do floating point math?
[click to continue…]

Awk Find And Replace Fields Values

I have a data as follows :

foo bar 12,300.50
foo bar 2,300.50
abc xyz 1,22,300.50

How do I replace all , from 3rd field using awk and pass output to bc -l in the following format to get sum of all numbers:
12300.50+2300.50+1,22,300.50
[click to continue…]

Linux / Unix: curl Command Pass Host Headers

I‘m currently using Amazon EBS block level storage volumes for use with Amazon EC2 instances powered by Red Hat Enterprise Linux. This volume stores critical webapp and user data. We are moving out to another cloud provider. How do I find files such as *.logs, *.php, *.gz and few other file patterns and securely delete them so that no one can recover it ever?
[click to continue…]

Linux / Unix: Find Out DNS Server IP Address / Names

I‘m trying to install latest version of Hewlett-Packard’s Linux Imaging and Printing software (HPLIP) for my office jet printer. In order to install latest version of HPLIP I removed the hplip-gui, hplip, hplip-cups, hplip-data, hpijs, and hpijs-ppds Debian Linux packages However, I’m getting the following error:

Debian warning: CUPSEXT could not be loaded. Please check HPLIP installation.

How do I fix this error while installing hplip-3.12.9.run under Debian Linux 6.0.5 amd64 bit?
[click to continue…]

Red Hat / CentOS Command To Find Dell Service Tag

How do I find out my Dell server service tag using command line under RHEL / Fedora / Red Hat / CentOS / Scientific Linux operating systems?
[click to continue…]

Linux / Unix: whoami Command Examples

whoami command

I am a new Linux and Unix system user. How do I listing my own username? How can I display my login name on Linux or Unix-like systems?
[click to continue…]