Make a bootable Ubuntu USB drive on a Mac in under 20 minutes.

This article details how to easily create a bootable Ubuntu USB drive that be completed in less than 20 mins (May be 10 if you’ve a fast usb drive). Having a faster USB drive would help in the long run too!

osx_versus_ubuntu_linux_thumb800

Note: this procedure requires that you create an .img file from the .iso file you download. It will also change the filesystem that is on the USB stick to make it bootable, so backup all data before continuing.

Tip: Drag and drop a file from Finder to Terminal to ‘paste’ the full path without risking typing errors.

  1. Download Ubuntu Desktop
  2. Open the Terminal (in /Applications/Utilities/ or query Terminal in Spotlight)
  3. Convert the .iso file to .img using the convert option of hdiutil. Example:
    hdiutil convert -format UDRW ~/path/to/target.iso -o ~/path/to/ubuntu.img
    

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

  4. Run diskutil list to get the current list of devices
  5. Insert your flash media
  6. Run diskutil list again and determine the device node assigned to your flash media
    (e.g. /dev/disk2)
  7. Run
    diskutil unmountDisk /dev/diskN
    

    (replace N with the disk number from the last command; in the previous example, N would be 2) If if fails to unmount with errors, use the ‘force’ command:

    sudo diskutil unmountDisk force /dev/diskN
  8. Execute the following command while replacing /path/to/downloaded.img with the path where the image file is located; for example, ./ubuntu.img or ./ubuntu.dmg).
    sudo dd if=/path/to/downloaded.img of=/dev/rdiskN bs=1m
    
    • 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:/devdiskN: Resource busy, make sure the disk is not in use. Start the Disk Utility.app and unmount (don’t eject) the drive.
  9. Run diskutil eject /dev/diskN and remove your flash media when the command completes
  10. Restart your Mac and press Alt while the Mac is restarting to choose the USB-Stick (This should also work on a PC)
Advertisements

Mac OS X El Capitan Spotlight Tip

For those who still do not use Mac OS X’s handy spotlight feature, this is a sample of how powerful and comprehensive this search tool is:

Apologies for the dimensions on the GIF, this shows a currency conversion from dollars to pounds which only takes about 1 second for the result.

ZInwIhT

How to rename multiple files on Mac

Sometimes its a bit of a pain to rename a batch of files in a directory to something more meaningful, right? For instance, lets say I have 300 files that are named in two parts (e.g. London_Canon.jpg, Toronto_Canon.jpg, Muscat_Canon.jpg)and I only want to remove the recurring “_Canon” from these files instead of a rename across the board that would remove the unique identifier (In this case, London, Toronto and Muscat).

http://mrrsoftware.com/namechanger/
Credits: http://mrrsoftware.com/namechanger/

If you like a challenge and some mental stimuli, use can script something and learn! or,
use this application called NameChanger for Mac. It’s free and very efficient. Got a few options under its sleeve:

Replace First Occurrence
Replace Last Occurrence
Replace All Occurrences
Wildcard
Append
Prepend
Date
Sequence
Character Removal
Regular Expression

Adding/ Removing rules in iptables

I have been fascinated about IT security and firewalls. I was able to get some hands on exposure to firewall scripting if you like, during my Masters that I just completed. To rekindle my love towards this, I went back on my Ubuntu virtual machine and thought lets ‘try two simple tasks to do with iptables; adding and removing a basic rule’.

So, in Terminal, I type in :

iptables -A INPUT -s 192.168.0.6 -j DROP

This will drop all packets from the IP address after -s (for source IP). The IP here is my iPhone’s IP address. I use the Fing app on the iPhone to ping my machine after the iptables rule is activated and the packets are dropped, this is evident from the app returning the ‘unreachable’ message.

Now, to make the machine accept connections or packets from this IP address, all I have to do is delete this rule in the table. For this, I just change one character in the line as below. I would leave it for you to spot it and ponder the ‘why-hows’.

iptables -D INPUT -s 192.168.0.6 -j DROP

Now, I tried the ping from the same app on the iPhone and the machine was accepting connections.

IMG_0514

While this is just a basic task, I would advise anyone interested in this area to explore and experiment more on iptables, its truly interesting!

Ping Flooding on Controllers

Dear readers,

Apologies for boring you out with all my geek stuff here. These are saved for linking my reports to a permanent location on the web to be accessed by anyone interested in my report (my supervisor or marker :D).

This also helps me in keeping track of my data and related images/ charts organized in a clutter-filled way (I know it contradicts to have ‘clutter-free’ and ‘organised’ in one sentence!)

Ping flood with 10k packets to get some information on RTT and IPG on the ONOS controller
Ping flood with 10k packets to get some information on RTT and IPG on the ONOS controller
Ping flood with 10k packets to get some information on RTT and IPG on the OpenDayLight controller
Ping flood with 10k packets to get some information on RTT and IPG on the OpenDayLight controller
Ping flood with 10k packets to get some information on RTT and IPG on the RYU controller
Ping flood with 10k packets to get some information on RTT and IPG on the RYU controller

Project Images

Dear followers on my blog,

These posts are solely for my academic use and please ignore if they don’t make sense.

These are linked to my reports.

Pinging with 100,000 packets on all controllers; the output on terminal.
Pinging with 100,000 packets on all controllers; the output on terminal.
Pinging with 100,000 packets on OpenDayLight controller for the second time to be monitored by TCPDUMPinorder to verify that the ping arguments are generating the requested 100k packets.
Pinging with 100,000 packets on OpenDayLight controller for the second time to be monitored by TCPDUMPinorder to verify that the ping arguments are generating the requested 100k packets.
OpenDayLight 100,000 packets succesfully transmitted and logged in TCPDUMP
OpenDayLight 100,000 packets succesfully transmitted and logged in TCPDUMP
100K pings, output on Terminal; failure of OpenDayLight evident. See highlighted area
100K pings, output on Terminal; failure of OpenDayLight evident.
See highlighted area

How to Open/ Export capture file as CSV from TCPDUMP in Wireshark

This is a short clip that demonstrates how to use a script that will run TCPDUMP, save the capture file and then open this file in Wireshark which then can be exported as CSV.
As there is no direct way to save TCPDUMP files in CSV format, I decided to write a shell script that will automate most processes for this task.
I also look forward to adding more commands in order to automate the whole process of exporting as CSV via Wireshark using the Script.
Share your views and tips.