Mounting Particular NAS directory to Linux File System

Now a days, most of the NAS storage devices come with a support to access the storage in multiple ways/protocols for different operating systems. In windows you can map drive option or you can better use ftp and sftp clients like FileZilla. In case of Unix/Linux distros. You can use command line based utility with easy syntax called “mount.cifs” to access remote storage devices. Following example illustrates the usage of above command.

NAS devices facilitate user based restricted acesses to directories. Such directories can be remotely accessed i.e. Read/Write and mounted in a linux filesystem to manage natively.

Let’s mount such directory as below:

1.Create Folder in /mnt to mount remote location in it.Usually mnt directory is preferred to maintain uniformity in mount locations.

mkdir /mnt/shared_data

2.Mount/Connect/Link command :
mount.cifs -o username=typeyournasusername //IPorHostname/shared_data/ /mnt/shared_data

The above command will mount/link NAS directory named “shared_data” with username having authority to access to local directory
“/mnt/shared_data”.You can list the contents using ls command.Here response time would depend upon network bandwidth between local and NAS.

Important Tips:
1.Do not use rm command inside mounted directory,as it will delete the same file from NAS as well.
2.Avoid mounting bigger/parent  directories directly, rather use specific directory. As it would be safer in case of disasterous condition like accidental removal/renaming/processing etc..

3.Unmount/Unlink/Safe To Remove/Disconnect :

umount /mnt/shared_data

If it doesnt work due to message like “device is busy ,unable to unmount” please verify and ensure that all files are closed.Retry again , if it still doesnt work use lazy loading option as:

umount -l /mnt/shared_data

Sometimes it takes couple of minutes depending upon mounted directory size, network and local system resource usage.

Extract lines between Pattern using sed and awk

One Liners to extract lines :  

1) To extract lines including Pattern : 

sed -n ‘/Pattern_Start/ , /Pattern_End/p ‘ Filename

2) To extract lines excluding Pattern : 

awk ‘/Pattern_Start/ { p=1; next } /Pattern_End/ {exit} p’ Filename

Find and delete files using “find” shell command

Find and Delete Files in Linux/Unix:


1) Find .log files in current directory and delete

$ find . -name “*.log” -type f -exec rm {} \;

2) Find the directories starting with ERO and delete

$ find -name “ERO*” -type d -exec rm {} \;

3) Find .log files in current directory and delete interactively

$ find . -name “*.log” -type f -exec rm -i {} \;

Installing R Packages over proxy authentication

If you are running behind the proxy sever and you need to install the R packages ex : Bioconductor packages  first you need to set the proxy environment on the terminal using the command like given below :

export http_proxy= proxy_user_name : proxy_usesr’s_password @ Proxy_IP_Address:Proxy_Port_no.

example :

$export http_proxy=user:password@

type bash and enter to set the proxy.

similarly you can export ftp_proxy , https_proxy  if needed otherwise http_proxy is enough to set.

Installing from the Linux Terminal :

Start R Terminal by pressing R and enter key.




Installing from archive(tar.gz)  :

First download the package(tar.gz) from Bioconductor or CRAN(

The go to the download place from terminal and then type:

$R CMD INSTALL tar.gz_package

Awk –helpful

awk '{ if (NF > max) max = NF } END { print max }'

This program prints the maximum number of fields on any input line.
awk 'length($0) > 80'
This program prints every line longer than 80 characters. The sole rule has a relational expression as its pattern, and has no action (so the default action, printing the record, is used).
awk 'NF > 0'
This program prints every line that has at least one field. This is an easy way to delete blank lines from a file (or rather, to create a new file similar to the old file but from which the blank lines have been deleted).
awk '{ if (NF > 0) print }'
This program also prints every line that has at least one field. Here we allow the rule to match every line, then decide in the action whether to print.
awk 'BEGIN { for (i = 1; i <= 7; i++) print int(101 * rand()) }'
This program prints 7 random numbers from 0 to 100, inclusive.
ls -l files | awk '{ x += $4 } ; END { print "total bytes: " x }'
This program prints the total number of bytes used by files.
expand file | awk '{ if (x < length()) x = length() } END { print "maximum line length is " x }'
This program prints the maximum line length of file. The input is piped through the expand program to change tabs into spaces, so the widths compared are actually the right-margin columns.
awk 'BEGIN { FS = ":" } { print $1 | "sort" }' /etc/passwd
This program prints a sorted list of the login names of all users.
awk '{ nlines++ } END { print nlines }'
This programs counts lines in a file.
awk 'END { print NR }'
This program also counts lines in a file, but lets awk do the work.
awk '{ print NR, $0 }'
This program adds line numbers to all its input files, similar to`cat -n’.

Tweak Gnome Desktop using gnome-tweak-tool

Gnome Tweak Tool is a tool for Gnome Desktop customisation . It has fixes for  recent fedora distributions. It can be able to fix bugs like lack of  different components such as minimise and maximise buttons , classic application menu extension etc.

First install from terminal Type : sudo yum install gnome-tweak-tool

Then install the extension settings Type : sudo yum install gnome-shell-extensions

Delete file contents using ‘sed’

[Sed] Delete one or more lines from a file

Here is how to remove one or more lines from a file.


sed '{[/]<n>|<string>|<regex>[/]}d' <fileName>      
sed '{[/]<adr1>[,<adr2>][/]d' <fileName>
  • /…/=delimiters
  • n = line number
  • string = string found in in line
  • regex = regular expression corresponding to the searched pattern
  • addr = address of a line (number or pattern )
  • d = delete


Remove the 3rd line:

sed '3d' fileName.txt

Remove the line containing the string “awk”:

sed '/awk/d' filename.txt

Remove the last line:

sed '$d' filename.txt

Remove all empty lines:

sed '/^$/d' filename.txt      
sed '/./!d' filename.txt

Remove the line matching by a regular expression (by eliminating one containing digital characters, at least 1 digit, located at the end of the line):

sed '/[0-9/][0-9]*$/d' filename.txt

Remove the interval between lines 7 and 9:

sed '7,9d' filename.txt

The same operation as above but replacing the address with parameters:

sed '/-Start/,/-End/d' filename.txt

The above examples are only changed at the display of the file (stdout1= screen).

For permanent changes to the old versions (<4) use a temporary file for GNU sed using the “-i[suffix]”:

sed -i".bak" '3d' filename.txt

How to do Advanced file search in Windows 7?

Here’s a list of search filters you can Type into the search box to narrow things down:

Filter Explanation
kind: This will only search for files of the type that you specify.  Some examples are document, folder, picture, and calendar.
datemodified: This will search for anything based on the date that they were last modified.
Note that the mini-calendar will allow you to Select a range of dates if you hold down the Shift key.
datetaken: Searches for photos based on the day they were captured.
datecreated: Searches for anything created on the specified date or time range.
name: Windows will only search for files by their name, not contents.
type: This will search for files of a specified extension. Some examples are .bmp, .pdf, .doc, and .mp3.  This is similar to the “kind:” filter, but much more specific.
tags: This will search for files based on the metadata tags that are included in the file.
size: Search for a file of a specific size, or you can broaden the search by looking for a range of sizes.  To make a custom range, put two periods in-between variables.  For example:
length: Searches for audio and video clips by length.
authors: You can enter the username of the person who created a file, and search will only display results by that user.

Essential Repositories for RedHat(RHEL)/Fedora/CentOS

  • EPEL:  Extra Packages for Enterprise Linux (or EPEL) is a Fedora Special Interest Group that creates, maintains, and manages a high quality set of additional packages for Enterprise Linux, including, but not limited to, Red Hat Enterprise Linux (RHEL),CentOS and Scientific Linux (SL).
  • RPMforge: RPMforge is a collaboration of Dag and other packagers. They provide over 5000 packages for CentOS, including wine, vlc, mplayer, xmms-mp3, and other popular media tools. It is not part of Red Hat or CentOS but is designed to work with those distributions.
  • RPM Fusion :RPM Fusion provides software that the Fedora Project or Red Hat doesn’t want to ship. That software is provided as precompiled RPMs for all current Fedora versions and Red Hat Enterprise Linux 5 and 6; you can use the RPM Fusion repositories with tools like yum and PackageKit.RPM Fusion is a merger of DribbleFreshrpms, and Livna; our goal is to simplify end-user experience by grouping as much add-on software as possible in a single location.

Linux Reader for Windows ,Get access to any files from Windows!

DiskInternals Linux Reader is a new easy way to do this. This program plays the role of a bridge between your Windows and Ext2/Ext3/Ext4, HFS and ReiserFS file systems.

Linux Reader is 100% FREE. Try it now.

ssh over Authenticated proxy in Ubuntu

To connect to the remote Linux system using ssh we have to configure the proxy settings.

1) First install corkscrew by sudo apt-get install corkscrew

2) Create a file vi /home/username/.corkscrew-auth  replace username of yours & edit the file by adding your proxy username:password and save the file.

3) Edit the ssh configuration file  vi /etc/ssh/ssh_config  and append the following line to it and save :

ProxyCommand corkscrew 8080 %h %p /home/username/.corkscrew-auth

where replace with your proxy host name , 8080 with the port no,file /home/username/.corkscrew-auth having username and password

Get Linux Hardware Information


Memory Information : sudo cat /proc/meminfo

CPU Information : sudo cat /proc/cpuinfo

PCI  Information : sudo lspci

For Ubuntu:

All Information : sudo lshw


Mount NTFS disks in CentOS

Just follow the guidelines given on following link.

%d bloggers like this: