Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In Linux, Is there a way to remember/change a path to a USB device?

In my case, I need linux to remember that my USB serial adapter will stay on /dev/ttyUSB0, but when I unplug it and plug it back in, it switches to /dev/ttyUSB1.

I'm using a debian-based distro(mint), if that helps. Thanks!

share|improve this question
Custom udev rules can help here. I don't know how to write them, though. – grawity Nov 18 '10 at 20:08
btw, udev can't manage devices that were stopped improperly; if you just tear off usb flash drive, the /dev/sdb1 would live the whole way to reboot. (more a FS bug, but seen other cases) – kagali-san Nov 18 '10 at 22:29
up vote 3 down vote accepted
  1. Get to know properties of the device while it is switched in:

    udevinfo -a -p $(udevinfo -q path -n /dev/ttyUSB0)

    If you have some newer distribution where udevinfo is not available, use this instead:

    udevadm info -q all -p $(udevadm info -q path -n /dev/ttyUSB0)

  2. Find some property that can identify the device (uniquely), for instance "serial"

  3. Create a file called /etc/udev/rules.d/10-usb-serial which contains the line:

    BUS=="usb", ATTR{serial}=="xxxx", NAME="ttyUSB0"

    Note the two equal signs for properties that are tested, and one for that which is assigned to.

share|improve this answer
Sweet, That did it! Thank you kindly. I tested it with: udevadm test /sys/class/tty/ttyUSB0/ and I saw the line: node_symlink: creating symlink '/dev/customdevice' to 'ttyUSB0' Success! – dhulihan Nov 18 '10 at 22:47

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.