Skip to main content

Less Known Commands and Facts: Linux

Need some questions to impress your office colleagues? Or simply going to take a telephonic interview? Below are some less know Linux commands:

1. grep -e and grep -E

The -e option to grep simply says that the following argument is the regular expression

e.g. :  grep -e 'apple.*mango' -r -l

The -E option changes the regular expressions from 'basic' to 'extended'. It can be used with -e:

grep   -E -e "[0-9]{3}-[0-9]{3}-[0-9]{4}" pineapple.txt

2. DSH: ( The Distributed Shell )

A program which runs a single command on multiple computers at the same time.

Simply put the list of servers in /etc/dsh/machines.list and run command like:

#dsh -a -c -- uname -a ( This will run on all machines )

3. CSSH (ClusterSSH )

CSSH is a client program that allows systems administrators to login to one or many remote ssh servers and perform tasks from one central location using either straight command line or configuration files

4. MTR 

mtr combines the functionality of the traceroute and ping in a single tool.

5. DIG

 It can query DNS name servers for your DNS lookup related tasks.

e.g. dig

6. Netcat

Netcat is a computer networking service for reading from and writing to network connections using TCP or UDP

echo -n "$1" | nc -4u -w1 $HOST $PORT.

You can even transfer a file using this.

 7. Http Debuggers:

Allows you to monitor, trace, debug and analyze HTTP/HTTPS traffic in real-time. Software like

HTTP Analyzer will be an example of such software

8. Screen Command

Screen command offers the ability to detach a long running process (or program, or shell-script) from a session and then attach it back at a later time.

e.g. :screen unix-command-to-be-executed When the command is executing, press CTRL+A followed by d to detach the screen.


9. Tmux

It is similar to screen as it lets you run numerous TTY’s in the same terminal window.It can allow you to run different panes in same terminal.

10.Interprocess Communication Mechanisms:

Processes communicate with each other and with the kernel to coordinate their activities. Linux supports a number of Inter-Process Communication (IPC) mechanisms. Signals and pipes are two of them but Linux also supports the System V IPC mechanisms named after the Unix TM release in which they first appeared.

Signals are one of the oldest inter-process communication methods used by Unix TM systems.

11. Chef:
Configuration management to your entire infrastructure. Cookbooks and recipes automate common infrastructure tasks



Popular posts from this blog

Python: Rename all files in a folder with names as numbers in ascending order

Hi Friends,

This script will rename files as,, 3.xls etc for all files in same folder as scripts:

import os
x = 0
for filename in os.listdir(os.path.dirname(os.path.abspath(__file__))):
    ext = filename.split('.')
    extension = ext[1]
    os.rename(filename, str(x) + '.' + extension)
    x = x + 1



1. extension = ext[1] collects the extension of file. If you skip this line, the files will be renamed without any extension.

2. Script should be in same folder as files. There should not be any folder in the folder.

Tunneling through putty: Accessing a internal website or service outside the network

Hello friends, there are many situation where you have to open a service or website that is neither in your network nor running with a public IP. The site or service is running properly inside the network, but you have to use it outside the network. Is it simple? Yes. 

First you need to download putty.exe. Go, download and then read further. 

All right, let us assume you are working on a local PC, lets say its IP is  There is another website, which you cannot open on your local PC, as this is on different network. If you can access it directly, because of something you have already done, then no need to read further. Lets say you have another server,,  be it different or same as the website hosting server, but it must be on 192.168.3.x network. Then do as below figures:

You will use the port as per the website. In my experience, even if you use any different port, it will work.
Now, put IP of website in destination, port in source port and then add…

Python: Send mail with attachment ( Any file format)

So you want to send mail with any file as attachment. This script works with any type of attachment. I have given the example of .kml file, an unusual one. You can use pdf, docx etc.

import mimetypes
import email
import email.mime.application
from email.MIMEMultipart import MIMEMultipart
from email.MIMEText import MIMEText
from email.MIMEImage import MIMEImage
import smtplib

# Create a text/plain message
msg = email.mime.Multipart.MIMEMultipart()
msg['Subject'] = 'Groove'
msg['From'] = ''
msg['To'] = ''

# The main body is just another attachment
body = email.mime.Text.MIMEText("""Hello, how are you? """)

# KML attachment
att = email.mime.application.MIMEApplication(,_subtype="kml")