forcing apt-get to always use ipv4 instead of ipv6

echo ‘Acquire::ForceIPv4 “true”;’ | sudo tee /etc/apt/apt.conf.d/99force-ipv4


Command line view webcam from ubuntu to browser

This took hours to figure out. I was trying to install MJPG-streamer and running VLC command lines and all this crap but nothing worked.

First install motion:

~> sudo apt-get install motion

Then create a config file:

~> mkdir ~/.motion
~> nano ~/.motion/motion.conf

In it, the bare minimum to run a web server and view it on other computers:

webcam_port 8081
webcam_localhost off

Then run motion:

~> motion

Now you can view the webcam at http://hostname:8081 If it doesn’t work, try rebooting between steps or something.


disable renaming of ethernet interfaces in ubuntu 14.04

Having problem with auto renaming of network interfaces from eth0->em1 or xyz , here is the fix .

added one line to /etc/default/grub:
and rebooted after update-grub



Making bootable USB from MAC osx without any apps

  1. Convert the .iso file to .img using the convert option of hdiutil e.g.,

    hdiutil convert -format UDRW -o ~/path/to/target.img ~/path/to/ubuntu.iso

    Note: OS X tends to put the .dmg ending on the output file automatically.

  2. Z


    diskutil list

    to get the current list of devices.


  3. Z

    Insert your flash media.

  4. Z


    diskutil list

    again and determine the device node assigned to your flash media (e.g. /dev/disk2).


  5. Z


    diskutil unmountDisk /dev/diskN

    (replace N with the disk number from the last command; in the previous example, N would be 2).


  6. Z


    sudo dd if=/path/to/downloaded.img of=/dev/rdiskN bs=1m

    (replace /path/to/downloaded.img with the path where the image file is located; for example, ./ubuntu.img or ./ubuntu.dmg).

    • Using /dev/rdisk instead of /dev/disk may be faster
    • If you see the error dd: Invalid number ‘1m’, you are using GNU dd. Use the same command but replace bs=1m with bs=1M
    • If you see the error dd: /dev/diskN: Resource busy, make sure the disk is not in use. Start the ‘Disk’ and unmount (don’t eject) the drive
  7. ZNOTE : If you get the error in the end that DIsk is unable to read by this computer .Dont do any thing , just run the command below and physically remove USB.. after that simply click the Ignore of this error.
  8. Run

    diskutil eject /dev/diskN

    and remove your flash media when the command completes.



Linux Find All File Names With White Spaces

How do I find all files with one ore more blank space (while spaces) in their name under UNIX like operating systems?

Simple use ls command along with egrep to list only file names with white spaces


ls  | egrep '. '

if you want to do it recursively

ls -R | egrep '. '

and if you want to count it use

ls -R | egrep '. ' | wc