How to add link to a device permanently

Multi tool use
Multi tool use

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
0
down vote

favorite












Using the command: ln -s /dev/ttyUSB0 /dev/gps0 I link the device gps0 to ttyUSB0. The problem is after rebooting the machine, the created link will disappear and I should create it again. Is there any way to create the link permanently?



The OS is CentOS 7.










share|improve this question

























    up vote
    0
    down vote

    favorite












    Using the command: ln -s /dev/ttyUSB0 /dev/gps0 I link the device gps0 to ttyUSB0. The problem is after rebooting the machine, the created link will disappear and I should create it again. Is there any way to create the link permanently?



    The OS is CentOS 7.










    share|improve this question























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      Using the command: ln -s /dev/ttyUSB0 /dev/gps0 I link the device gps0 to ttyUSB0. The problem is after rebooting the machine, the created link will disappear and I should create it again. Is there any way to create the link permanently?



      The OS is CentOS 7.










      share|improve this question













      Using the command: ln -s /dev/ttyUSB0 /dev/gps0 I link the device gps0 to ttyUSB0. The problem is after rebooting the machine, the created link will disappear and I should create it again. Is there any way to create the link permanently?



      The OS is CentOS 7.







      centos symlink udev






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Oct 1 at 13:33









      Soheil Pourbafrani

      1032




      1032




















          2 Answers
          2






          active

          oldest

          votes

















          up vote
          1
          down vote













          Given the name of your device --- /dev/gps0 --- I assume that you're dealing with some sort of GPS device. If so, your best bet would be to define a custom udev rule that matches the device and creates a device with the name that you want. Arch Linux's udev wiki might help to get you started; I don't think there will be fundamental differences between that and CentOS.






          share|improve this answer




















          • Thanks, I read about the udev. Could you pls give me an example?
            – Soheil Pourbafrani
            Oct 1 at 13:55






          • 1




            Unfortunately I don't have a Linux machine in front of me. Did you see the wiki to which I referred you? The bit that talks about 83-webcam.rules is very similar to what you're after. You'll want to use udevadm to find out properties of your GPS (e.g., vendor, product id), and create a rule that generates the symlink.
            – Andy Dalton
            Oct 1 at 14:00

















          up vote
          0
          down vote













          Add it /etc/rc.local. Make sure /etc/rc.local is executable.



          vim /etc/rc.local
          ln -s /dev/ttyUSB0 /dev/gps0

          ls -l /etc/rc.local
          lrwxrwxrwx. 1 root root 13 Sep 26 05:46 /etc/rc.local -> rc.d/rc.local





          share|improve this answer






















          • I did but after reboot, it didn't create the link. Maybe because the command needs sudo privileges
            – Soheil Pourbafrani
            Oct 1 at 13:57










          Your Answer







          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "106"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          convertImagesToLinks: false,
          noModals: false,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













           

          draft saved


          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f472577%2fhow-to-add-link-to-a-device-permanently%23new-answer', 'question_page');

          );

          Post as a guest






























          2 Answers
          2






          active

          oldest

          votes








          2 Answers
          2






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          1
          down vote













          Given the name of your device --- /dev/gps0 --- I assume that you're dealing with some sort of GPS device. If so, your best bet would be to define a custom udev rule that matches the device and creates a device with the name that you want. Arch Linux's udev wiki might help to get you started; I don't think there will be fundamental differences between that and CentOS.






          share|improve this answer




















          • Thanks, I read about the udev. Could you pls give me an example?
            – Soheil Pourbafrani
            Oct 1 at 13:55






          • 1




            Unfortunately I don't have a Linux machine in front of me. Did you see the wiki to which I referred you? The bit that talks about 83-webcam.rules is very similar to what you're after. You'll want to use udevadm to find out properties of your GPS (e.g., vendor, product id), and create a rule that generates the symlink.
            – Andy Dalton
            Oct 1 at 14:00














          up vote
          1
          down vote













          Given the name of your device --- /dev/gps0 --- I assume that you're dealing with some sort of GPS device. If so, your best bet would be to define a custom udev rule that matches the device and creates a device with the name that you want. Arch Linux's udev wiki might help to get you started; I don't think there will be fundamental differences between that and CentOS.






          share|improve this answer




















          • Thanks, I read about the udev. Could you pls give me an example?
            – Soheil Pourbafrani
            Oct 1 at 13:55






          • 1




            Unfortunately I don't have a Linux machine in front of me. Did you see the wiki to which I referred you? The bit that talks about 83-webcam.rules is very similar to what you're after. You'll want to use udevadm to find out properties of your GPS (e.g., vendor, product id), and create a rule that generates the symlink.
            – Andy Dalton
            Oct 1 at 14:00












          up vote
          1
          down vote










          up vote
          1
          down vote









          Given the name of your device --- /dev/gps0 --- I assume that you're dealing with some sort of GPS device. If so, your best bet would be to define a custom udev rule that matches the device and creates a device with the name that you want. Arch Linux's udev wiki might help to get you started; I don't think there will be fundamental differences between that and CentOS.






          share|improve this answer












          Given the name of your device --- /dev/gps0 --- I assume that you're dealing with some sort of GPS device. If so, your best bet would be to define a custom udev rule that matches the device and creates a device with the name that you want. Arch Linux's udev wiki might help to get you started; I don't think there will be fundamental differences between that and CentOS.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Oct 1 at 13:47









          Andy Dalton

          4,9791520




          4,9791520











          • Thanks, I read about the udev. Could you pls give me an example?
            – Soheil Pourbafrani
            Oct 1 at 13:55






          • 1




            Unfortunately I don't have a Linux machine in front of me. Did you see the wiki to which I referred you? The bit that talks about 83-webcam.rules is very similar to what you're after. You'll want to use udevadm to find out properties of your GPS (e.g., vendor, product id), and create a rule that generates the symlink.
            – Andy Dalton
            Oct 1 at 14:00
















          • Thanks, I read about the udev. Could you pls give me an example?
            – Soheil Pourbafrani
            Oct 1 at 13:55






          • 1




            Unfortunately I don't have a Linux machine in front of me. Did you see the wiki to which I referred you? The bit that talks about 83-webcam.rules is very similar to what you're after. You'll want to use udevadm to find out properties of your GPS (e.g., vendor, product id), and create a rule that generates the symlink.
            – Andy Dalton
            Oct 1 at 14:00















          Thanks, I read about the udev. Could you pls give me an example?
          – Soheil Pourbafrani
          Oct 1 at 13:55




          Thanks, I read about the udev. Could you pls give me an example?
          – Soheil Pourbafrani
          Oct 1 at 13:55




          1




          1




          Unfortunately I don't have a Linux machine in front of me. Did you see the wiki to which I referred you? The bit that talks about 83-webcam.rules is very similar to what you're after. You'll want to use udevadm to find out properties of your GPS (e.g., vendor, product id), and create a rule that generates the symlink.
          – Andy Dalton
          Oct 1 at 14:00




          Unfortunately I don't have a Linux machine in front of me. Did you see the wiki to which I referred you? The bit that talks about 83-webcam.rules is very similar to what you're after. You'll want to use udevadm to find out properties of your GPS (e.g., vendor, product id), and create a rule that generates the symlink.
          – Andy Dalton
          Oct 1 at 14:00












          up vote
          0
          down vote













          Add it /etc/rc.local. Make sure /etc/rc.local is executable.



          vim /etc/rc.local
          ln -s /dev/ttyUSB0 /dev/gps0

          ls -l /etc/rc.local
          lrwxrwxrwx. 1 root root 13 Sep 26 05:46 /etc/rc.local -> rc.d/rc.local





          share|improve this answer






















          • I did but after reboot, it didn't create the link. Maybe because the command needs sudo privileges
            – Soheil Pourbafrani
            Oct 1 at 13:57














          up vote
          0
          down vote













          Add it /etc/rc.local. Make sure /etc/rc.local is executable.



          vim /etc/rc.local
          ln -s /dev/ttyUSB0 /dev/gps0

          ls -l /etc/rc.local
          lrwxrwxrwx. 1 root root 13 Sep 26 05:46 /etc/rc.local -> rc.d/rc.local





          share|improve this answer






















          • I did but after reboot, it didn't create the link. Maybe because the command needs sudo privileges
            – Soheil Pourbafrani
            Oct 1 at 13:57












          up vote
          0
          down vote










          up vote
          0
          down vote









          Add it /etc/rc.local. Make sure /etc/rc.local is executable.



          vim /etc/rc.local
          ln -s /dev/ttyUSB0 /dev/gps0

          ls -l /etc/rc.local
          lrwxrwxrwx. 1 root root 13 Sep 26 05:46 /etc/rc.local -> rc.d/rc.local





          share|improve this answer














          Add it /etc/rc.local. Make sure /etc/rc.local is executable.



          vim /etc/rc.local
          ln -s /dev/ttyUSB0 /dev/gps0

          ls -l /etc/rc.local
          lrwxrwxrwx. 1 root root 13 Sep 26 05:46 /etc/rc.local -> rc.d/rc.local






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Oct 1 at 13:51

























          answered Oct 1 at 13:43









          EBIN GLADSON

          3316




          3316











          • I did but after reboot, it didn't create the link. Maybe because the command needs sudo privileges
            – Soheil Pourbafrani
            Oct 1 at 13:57
















          • I did but after reboot, it didn't create the link. Maybe because the command needs sudo privileges
            – Soheil Pourbafrani
            Oct 1 at 13:57















          I did but after reboot, it didn't create the link. Maybe because the command needs sudo privileges
          – Soheil Pourbafrani
          Oct 1 at 13:57




          I did but after reboot, it didn't create the link. Maybe because the command needs sudo privileges
          – Soheil Pourbafrani
          Oct 1 at 13:57

















           

          draft saved


          draft discarded















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f472577%2fhow-to-add-link-to-a-device-permanently%23new-answer', 'question_page');

          );

          Post as a guest













































































          XV8,pThnNhvpzUNYAaR1nEilb88ZlF jgd5cvR7 3842n1 Icp7KKxmrUDm1kqH V0
          V,H94u7UwIW8JyzjKCZ9e uQBsey9yAR5bw1eNpv3JMMgBNFi PV

          Popular posts from this blog

          How to check contact read email or not when send email to Individual?

          How many registers does an x86_64 CPU actually have?

          Displaying single band from multi-band raster using QGIS