Q:

Power on/off USB ports

Is it possible to on/off a specific USB port using the terminal in Ubuntu? 
lsusb displays the following result:
Bus 001 Device 002: ID 8087:0020 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 002: ID 8087:0020 Intel Corp. Integrated Rate Matching Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 003: ID 2232:1020
Bus 002 Device 009: ID 0bc2:a013 Seagate RSS LLC
Bus 002 Device 003: ID 0a5c:219c Broadcom Corp.

Seagate is my external hard disk drive.  Can I power it off in the terminal? 
I tried Controlling a USB power supply (on/off) with Linux.  But I am confused about what should be replaced in place of usbX.

A:

All of the previous answers talk about a USB suspend mechanism, i.e. a "logical power-off", they will never physically cut the VBUS +5V from the USB port. 
Only a few hubs can actually cut VBUS as described here. 
The hubpower tool can do it (if the hub supports it). 

A:

After running into the same problem, I found that the commands should be entered differently so that "sudo" would apply rights appropriately. 
Use the "tee" command. 
echo 0 | sudo tee /sys/bus/usb/devices/usb2/power/autosuspend_delay_ms

will apply root rights to the "tee" command which will write the 0 into the specified file, replacing anything that is currently there.   To append, use the tee command with option -a.   
for info see the man page of tee

A:

Actually usbX is nothing but the USB ports numbers where X denotes the number like 1 or 2 and so on... For example, usb1 and usb2 for ports 1 and 2.  In general, a laptop may have three or four USB ports with USB 2.0 and USB 3.0 ports. 
In Ubuntu, usb1, usb2...usbX are the links to /sys/devices/pci000:00/*.  To understand it well, run this command:
ls -l /sys/bus/usb/devices/

So to enable/disable USB ports usbX will be replaced with usb1 when you want to enable/disable USB Port Number 1 (or refer Stack Exchange):

Edit: Thanks to Stefan Denchev to tell the correct way to echo some text to a file using sudo. ( Check his comment also.)  You should not get the permission denied message now. 
sudo sh -c "echo '0' > /sys/bus/usb/devices/usb1/power/autosuspend_delay_ms"
sudo sh -c "echo 'auto' > /sys/bus/usb/devices/usb1/power/control"

After seeing your lsusb result, it looks like your Seagate device is connected to Port No.  2, so you need to disable usb2.  Then the commands would be:
sudo sh -c "echo '0' > /sys/bus/usb/devices/usb2/power/autosuspend_delay_ms"
sudo sh -c "echo 'auto' > /sys/bus/usb/devices/usb2/power/control"

