≡ Menu

grep command

How to find out why squid proxy exited due to signal 9 with status 0

I am getting an error that read as “The proxy server is refusing connections.” I am using Squid 3 with Ubuntu Linux 16.04 LTS server and how can I find out why my squid proxy server died unexpectedly?
[click to continue…]

How to assign a grep command value to a variable in Linux/Unix

How do I store grep command output in shell variable? What is the syntax to store the command output into a variable in Linux or Unix?
[click to continue…]

Clear Squid Proxy Cache And Re-create the Cache Directories

How do I clear squid cache? How do I re-create the cache directories on a server where Squid version 3.x is currently running in Linux or Unix based server?
[click to continue…]

Linux: Find Out What Is Using TCP Port 80

How do I find out what is listing or using tcp port number 80 on Linux based systems using command line options?
[click to continue…]

CentOS / RHEL: Install KornShell (KSH)

I am porting ksh script from Sun/Oracle Unix to Linux. How do I install ksh (KornShell) in CentOS / Fedora / Red Hat Enterprise Linux? How do I run and test ksh script on RHEL/CentOS Linux?
[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…]

CentOS / RHEL: Check If A Service Is Running Or Not

How do I find out if a service such as MySQL or Apache running on my Centos/RHEL/Fedora Linux server?
[click to continue…]

HowTo: Save The Output Of A Linux/Unix Command To A File

I am new Linux and Unix-like system user who recently switched from MS-Windows XP. How do I save the output of a Linux / Unix ls command to a file named “lists.txt” using command prompt or POSIX shell such as SH/KSH/BASH?
[click to continue…]

Linux: Find Out What Process Are Using Swap Space

The top and free command display the total amount of free and used physical and swap memory in the server. How do I determine which process is using swap space under Linux operating systems? How do I find out swap space usage of particular process such as memcached?
[click to continue…]

HowTo: grep All Sub-directory For Files

How do I grep all sub directories? How can I use grep command through all sub-directories on Linux or Unix like operating systems? How do I use grep to find pattern including all subdirectories on OS X/BSD/Unix-like operating systems?
[click to continue…]