How to find all files containing specific text in Linux?

One of the common commands that I use most frequently in my day-to-day Linux life is for finding files that contains a particular text. Take for an example that I want to search all the files in the current directory that contains string “Hello! this is my file”. The command that is use mostly is this:

find . -type f -exec grep -il 'Hello! this is my file' {} ; 

This search ignores the cases. If you want to search with definite cases (upper or lower) remove the “-i” from grep. You can replace “.” (dot, which means current directory) by the path of the directory in which you want to conduct the search. If you want to search in the whole system then use “/” (it means root directory).

How to mount a windows partition on Linux automatically on each start up

In Ubuntu (and other LiUbuntunux OS) , the external drives are mounted automatically but the Windows drives (NTFS partitions) are required to be mounted manually in each login. Though this mounting is just a click away, in some situation one requires the other partitions to be mounted automatically in each start up. In this tutorial I’ll try to explain the procedure to mount a Windows partition automatically on each start up. Again, the tutorial is performed on Ubuntu but most of the commands are applicable to other major Linux OS. Please follow these steps:

Step 1.

Check what is the name of the drive/partition you want to automatically mount. The name is like /dev/sda. Check the partition with NTFS format. Check the size and otherthing to select the partition you want to mount. Go to the terminal (Ctrl+Alt+T) and enter this command:

sudo fdisk -l

For me the command output looks like this:

Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 102400 7 HPFS/NTFS
/dev/sda2 13 13417 107667456 7 HPFS/NTFS
/dev/sda3 13418 38914 204798797 f W95 Ext’d (LBA)
/dev/sda5 13418 26165 102398278+ 7 HPFS/NT

Step 2.

Now we need the UUID of the desired drive/partition. The UUID can be obtained by using the following command:

sudo blkid

The command output looks like this:

/dev/sda1: LABEL=”System Reserved” UUID=”E400CABD00CA95C8″ TYPE=”ntfs”
/dev/sda2: UUID=”E61CD55A1CD525F9″ TYPE=”ntfs”
/dev/sda5: UUID=”01CB76F7C2628FB0″ TYPE=”ntfs”
/dev/sda6: UUID=”01CB76F7F289ADE0″ TYPE=”ntfs”
/dev/sda7: UUID=”b9a176e1-d122-4ea7-815b-555063d

Step 3.

Now make a directory in Ubuntu where you want to mount the drive. Lets say you want to mount the Windows drive in root folder. We will create a directory name mount and under that a directory say WindowsDrive. For this use the command:

mkdir /mount/WindowsDrive

Step 4.

The mount information can then be added to fstab file which stores the information about the storage devices. In the terminal enter:

gksu gedit /etc/fstab

The command will open the fstab file. In here, at the end of the file add this line like this:

UUID=insert_the_UUID_here /mount/WindowsDrive ntfs defaults 0 0

Note: Replace the insert_the_UUID_here with UUID you noted from the blkid command. Save and exit. Now, in terminal enter:

sudo mount -a


The following errors may be generated:


“The file system wasn’t safely closed on Windows. Fixing.
fuse: failed to access mountpoint /mnt/win7: No such file or directory”


“Gtk-WARNING **: Attempting to store changes into `/root/.local/share/recently-used.xbel’, but failed: Failed to create file ‘/root/.local/share/recently-used.xbel.CNQ0UV': No such file or directory”

The reason (in both cases) is that it is looking for the directory specified in the fstab file and cannot find it. Check the path and verify that the directory exists at the specified path. If the directory /root/.local/share doesn’t exist, make it manually.

Hope this article helped you. Suggestions, feedbacks and tiny thanks is always welcomed. Enjoy :)

How to know which network adapter I’m using?

To know the manufacturer of the network adapter of your computer in Linux, type this command in terminal:

sudo lshw -C network

The output of the command may look something like this:

       description: Wireless interface
       product: BCM4313 802.11b/g/n Wireless LAN Controller
       vendor: Broadcom Corporation
       physical id: 0
       bus info: pci@0000:03:00.0
       logical name: wlan0
       version: 01
       serial: 70:f1:a1:c2:f2:e9
       width: 64 bits
       clock: 33MHz
       capabilities: pm msi pciexpress bus_master cap_list ethernet physical wireless
       configuration: broadcast=yes driver=brcm80211 driverversion=2.6.38-8-generic firmware=N/A ip= latency=0 link=yes multicast=yes wireless=IEEE 802.11bgn
       resources: irq:17 memory:f0500000-f0503fff
       description: Ethernet interface
       product: AR8152 v1.1 Fast Ethernet
       vendor: Atheros Communications
       physical id: 0
       bus info: pci@0000:04:00.0
       logical name: eth0
       version: c1
       serial: b8:ac:6f:67:11:46
       capacity: 100Mbit/s
       width: 64 bits
       clock: 33MHz
       capabilities: pm msi pciexpress vpd bus_master cap_list ethernet physical tp 10bt 10bt-fd 100bt 100bt-fd autonegotiation
       configuration: autonegotiation=on broadcast=yes driver=atl1c driverversion= firmware=N/A latency=0 link=no multicast=yes port=twisted pair
       resources: irq:43 memory:f0400000-f043ffff ioport:2000(size=128)

Check the output closely. It gives information about both Wired and Wireless Network Adapter. No need to specify that one with Wireless Interface describes wireless adapter and one with Ethernet Interface describes Wired Network Adapter. As you can see in the output, I have Broadcom’s wireless adapter and Atheros Ethernet (wired) adapter.

Questions, suggestions and feedbacks are welcomed. If you liked the post then please acknowledge it by liking/voting/commenting on the post. Enjoy :)