Error to Create symbolic binary link












0















I want to create a symbolic link for vi to see this program when calling
from console run vim:



ln -s /usr/bin/vi /usr/bin/vim



ln: failure to create symbolic link «/ usr / bin / vim»: The file already exists



how can I do it so I saw it point to vim










share|improve this question





























    0















    I want to create a symbolic link for vi to see this program when calling
    from console run vim:



    ln -s /usr/bin/vi /usr/bin/vim



    ln: failure to create symbolic link «/ usr / bin / vim»: The file already exists



    how can I do it so I saw it point to vim










    share|improve this question



























      0












      0








      0








      I want to create a symbolic link for vi to see this program when calling
      from console run vim:



      ln -s /usr/bin/vi /usr/bin/vim



      ln: failure to create symbolic link «/ usr / bin / vim»: The file already exists



      how can I do it so I saw it point to vim










      share|improve this question
















      I want to create a symbolic link for vi to see this program when calling
      from console run vim:



      ln -s /usr/bin/vi /usr/bin/vim



      ln: failure to create symbolic link «/ usr / bin / vim»: The file already exists



      how can I do it so I saw it point to vim







      linux symlink vi






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited 4 hours ago









      Rui F Ribeiro

      41.6k1483141




      41.6k1483141










      asked 6 hours ago









      ortigaortiga

      83




      83






















          3 Answers
          3






          active

          oldest

          votes


















          1














          Given your original tag of CentOS, I'll assume that you have an /etc/profile.d/vim.sh file that sets up an alias:



          alias vi >/dev/null 2>&1 || alias vi=vim


          If you want to run vi when you enter vim, I'd suggest adding to your own ~/.bashrc:



          unalias vi
          alias vim=vi





          share|improve this answer































            0














            Yes, if you already have /usr/bin/vim, you cannot have another file of the same name in that directory. However, /usr/bin is (usually) not the only location checked for executables.



            Run echo $PATH to see the list of directories that is checked, left to right. Hopefully, you'll have locations like /home/(username)/bin or /usr/local/bin in there. In that case,



            ln -s /usr/bin/vi /usr/local/bin/vim 


            will override the default vim for all users. (They can still call /usr/bin/vim to get the original.)






            share|improve this answer































              0














              Solution:



              You can force to remove the destination file using -f (Test before changing anything!)



              ln -sf /usr/bin/vi /usr/bin/vim



              Works for me!



              Example:



              [root@vvek-workstation grep]# ln -ss ./vi ./vim 
              ln: failed to create symbolic link ‘./vim’: File exists
              [root@vvek-workstation grep]# ln -sf ./vi ./vim
              [root@vvek-workstation grep]# ls -lart
              total 0
              drwxr-xr-x. 9 root root 228 Mar 20 15:20 ..
              -rw-r--r-- 1 root root 0 Mar 20 16:00 vi
              lrwxrwxrwx 1 root root 4 Mar 20 16:00 vim -> ./vi
              drwxr-xr-x 2 root root 27 Mar 20 16:00 .





              share|improve this answer








              New contributor




              Vivek Kanadiya is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
              Check out our Code of Conduct.





















              • and to remove the symbolic link without deleting vim ??

                – ortiga
                6 hours ago











              • ln -sf /usr/bin/vim /usr/bin/vi perfect but i need to remove the symbolic link without deleting vim ??

                – ortiga
                6 hours ago











              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',
              autoActivateHeartbeat: false,
              convertImagesToLinks: false,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: null,
              bindNavPrevention: true,
              postfix: "",
              imageUploader: {
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              },
              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%2f507529%2ferror-to-create-symbolic-binary-link%23new-answer', 'question_page');
              }
              );

              Post as a guest















              Required, but never shown

























              3 Answers
              3






              active

              oldest

              votes








              3 Answers
              3






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              1














              Given your original tag of CentOS, I'll assume that you have an /etc/profile.d/vim.sh file that sets up an alias:



              alias vi >/dev/null 2>&1 || alias vi=vim


              If you want to run vi when you enter vim, I'd suggest adding to your own ~/.bashrc:



              unalias vi
              alias vim=vi





              share|improve this answer




























                1














                Given your original tag of CentOS, I'll assume that you have an /etc/profile.d/vim.sh file that sets up an alias:



                alias vi >/dev/null 2>&1 || alias vi=vim


                If you want to run vi when you enter vim, I'd suggest adding to your own ~/.bashrc:



                unalias vi
                alias vim=vi





                share|improve this answer


























                  1












                  1








                  1







                  Given your original tag of CentOS, I'll assume that you have an /etc/profile.d/vim.sh file that sets up an alias:



                  alias vi >/dev/null 2>&1 || alias vi=vim


                  If you want to run vi when you enter vim, I'd suggest adding to your own ~/.bashrc:



                  unalias vi
                  alias vim=vi





                  share|improve this answer













                  Given your original tag of CentOS, I'll assume that you have an /etc/profile.d/vim.sh file that sets up an alias:



                  alias vi >/dev/null 2>&1 || alias vi=vim


                  If you want to run vi when you enter vim, I'd suggest adding to your own ~/.bashrc:



                  unalias vi
                  alias vim=vi






                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered 6 hours ago









                  Jeff SchallerJeff Schaller

                  43.8k1161141




                  43.8k1161141

























                      0














                      Yes, if you already have /usr/bin/vim, you cannot have another file of the same name in that directory. However, /usr/bin is (usually) not the only location checked for executables.



                      Run echo $PATH to see the list of directories that is checked, left to right. Hopefully, you'll have locations like /home/(username)/bin or /usr/local/bin in there. In that case,



                      ln -s /usr/bin/vi /usr/local/bin/vim 


                      will override the default vim for all users. (They can still call /usr/bin/vim to get the original.)






                      share|improve this answer




























                        0














                        Yes, if you already have /usr/bin/vim, you cannot have another file of the same name in that directory. However, /usr/bin is (usually) not the only location checked for executables.



                        Run echo $PATH to see the list of directories that is checked, left to right. Hopefully, you'll have locations like /home/(username)/bin or /usr/local/bin in there. In that case,



                        ln -s /usr/bin/vi /usr/local/bin/vim 


                        will override the default vim for all users. (They can still call /usr/bin/vim to get the original.)






                        share|improve this answer


























                          0












                          0








                          0







                          Yes, if you already have /usr/bin/vim, you cannot have another file of the same name in that directory. However, /usr/bin is (usually) not the only location checked for executables.



                          Run echo $PATH to see the list of directories that is checked, left to right. Hopefully, you'll have locations like /home/(username)/bin or /usr/local/bin in there. In that case,



                          ln -s /usr/bin/vi /usr/local/bin/vim 


                          will override the default vim for all users. (They can still call /usr/bin/vim to get the original.)






                          share|improve this answer













                          Yes, if you already have /usr/bin/vim, you cannot have another file of the same name in that directory. However, /usr/bin is (usually) not the only location checked for executables.



                          Run echo $PATH to see the list of directories that is checked, left to right. Hopefully, you'll have locations like /home/(username)/bin or /usr/local/bin in there. In that case,



                          ln -s /usr/bin/vi /usr/local/bin/vim 


                          will override the default vim for all users. (They can still call /usr/bin/vim to get the original.)







                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered 6 hours ago









                          Ulrich SchwarzUlrich Schwarz

                          9,95313047




                          9,95313047























                              0














                              Solution:



                              You can force to remove the destination file using -f (Test before changing anything!)



                              ln -sf /usr/bin/vi /usr/bin/vim



                              Works for me!



                              Example:



                              [root@vvek-workstation grep]# ln -ss ./vi ./vim 
                              ln: failed to create symbolic link ‘./vim’: File exists
                              [root@vvek-workstation grep]# ln -sf ./vi ./vim
                              [root@vvek-workstation grep]# ls -lart
                              total 0
                              drwxr-xr-x. 9 root root 228 Mar 20 15:20 ..
                              -rw-r--r-- 1 root root 0 Mar 20 16:00 vi
                              lrwxrwxrwx 1 root root 4 Mar 20 16:00 vim -> ./vi
                              drwxr-xr-x 2 root root 27 Mar 20 16:00 .





                              share|improve this answer








                              New contributor




                              Vivek Kanadiya is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                              Check out our Code of Conduct.





















                              • and to remove the symbolic link without deleting vim ??

                                – ortiga
                                6 hours ago











                              • ln -sf /usr/bin/vim /usr/bin/vi perfect but i need to remove the symbolic link without deleting vim ??

                                – ortiga
                                6 hours ago
















                              0














                              Solution:



                              You can force to remove the destination file using -f (Test before changing anything!)



                              ln -sf /usr/bin/vi /usr/bin/vim



                              Works for me!



                              Example:



                              [root@vvek-workstation grep]# ln -ss ./vi ./vim 
                              ln: failed to create symbolic link ‘./vim’: File exists
                              [root@vvek-workstation grep]# ln -sf ./vi ./vim
                              [root@vvek-workstation grep]# ls -lart
                              total 0
                              drwxr-xr-x. 9 root root 228 Mar 20 15:20 ..
                              -rw-r--r-- 1 root root 0 Mar 20 16:00 vi
                              lrwxrwxrwx 1 root root 4 Mar 20 16:00 vim -> ./vi
                              drwxr-xr-x 2 root root 27 Mar 20 16:00 .





                              share|improve this answer








                              New contributor




                              Vivek Kanadiya is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                              Check out our Code of Conduct.





















                              • and to remove the symbolic link without deleting vim ??

                                – ortiga
                                6 hours ago











                              • ln -sf /usr/bin/vim /usr/bin/vi perfect but i need to remove the symbolic link without deleting vim ??

                                – ortiga
                                6 hours ago














                              0












                              0








                              0







                              Solution:



                              You can force to remove the destination file using -f (Test before changing anything!)



                              ln -sf /usr/bin/vi /usr/bin/vim



                              Works for me!



                              Example:



                              [root@vvek-workstation grep]# ln -ss ./vi ./vim 
                              ln: failed to create symbolic link ‘./vim’: File exists
                              [root@vvek-workstation grep]# ln -sf ./vi ./vim
                              [root@vvek-workstation grep]# ls -lart
                              total 0
                              drwxr-xr-x. 9 root root 228 Mar 20 15:20 ..
                              -rw-r--r-- 1 root root 0 Mar 20 16:00 vi
                              lrwxrwxrwx 1 root root 4 Mar 20 16:00 vim -> ./vi
                              drwxr-xr-x 2 root root 27 Mar 20 16:00 .





                              share|improve this answer








                              New contributor




                              Vivek Kanadiya is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                              Check out our Code of Conduct.










                              Solution:



                              You can force to remove the destination file using -f (Test before changing anything!)



                              ln -sf /usr/bin/vi /usr/bin/vim



                              Works for me!



                              Example:



                              [root@vvek-workstation grep]# ln -ss ./vi ./vim 
                              ln: failed to create symbolic link ‘./vim’: File exists
                              [root@vvek-workstation grep]# ln -sf ./vi ./vim
                              [root@vvek-workstation grep]# ls -lart
                              total 0
                              drwxr-xr-x. 9 root root 228 Mar 20 15:20 ..
                              -rw-r--r-- 1 root root 0 Mar 20 16:00 vi
                              lrwxrwxrwx 1 root root 4 Mar 20 16:00 vim -> ./vi
                              drwxr-xr-x 2 root root 27 Mar 20 16:00 .






                              share|improve this answer








                              New contributor




                              Vivek Kanadiya is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                              Check out our Code of Conduct.









                              share|improve this answer



                              share|improve this answer






                              New contributor




                              Vivek Kanadiya is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                              Check out our Code of Conduct.









                              answered 6 hours ago









                              Vivek KanadiyaVivek Kanadiya

                              1858




                              1858




                              New contributor




                              Vivek Kanadiya is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                              Check out our Code of Conduct.





                              New contributor





                              Vivek Kanadiya is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                              Check out our Code of Conduct.






                              Vivek Kanadiya is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                              Check out our Code of Conduct.













                              • and to remove the symbolic link without deleting vim ??

                                – ortiga
                                6 hours ago











                              • ln -sf /usr/bin/vim /usr/bin/vi perfect but i need to remove the symbolic link without deleting vim ??

                                – ortiga
                                6 hours ago



















                              • and to remove the symbolic link without deleting vim ??

                                – ortiga
                                6 hours ago











                              • ln -sf /usr/bin/vim /usr/bin/vi perfect but i need to remove the symbolic link without deleting vim ??

                                – ortiga
                                6 hours ago

















                              and to remove the symbolic link without deleting vim ??

                              – ortiga
                              6 hours ago





                              and to remove the symbolic link without deleting vim ??

                              – ortiga
                              6 hours ago













                              ln -sf /usr/bin/vim /usr/bin/vi perfect but i need to remove the symbolic link without deleting vim ??

                              – ortiga
                              6 hours ago





                              ln -sf /usr/bin/vim /usr/bin/vi perfect but i need to remove the symbolic link without deleting vim ??

                              – ortiga
                              6 hours ago


















                              draft saved

                              draft discarded




















































                              Thanks for contributing an answer to Unix & Linux Stack Exchange!


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid



                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.


                              To learn more, see our tips on writing great answers.




                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function () {
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f507529%2ferror-to-create-symbolic-binary-link%23new-answer', 'question_page');
                              }
                              );

                              Post as a guest















                              Required, but never shown





















































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown

































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown







                              Popular posts from this blog

                              Accessing regular linux commands in Huawei's Dopra Linux

                              Can't connect RFCOMM socket: Host is down

                              Kernel panic - not syncing: Fatal Exception in Interrupt