Reassigning su command

Dimitris

I accidentally linked my "su" command to Sublime Text binary (that's what you get when you trust hitting tab without looking...) Now, "su" just opens a SublimeTExt session. Does anybody know how can I revert to the previous version and point "su" to what it is supposed to be pointing at? Thank you!

EDIT: the command that was accidentaly issued was

sudo ln -s /opt/Sublime\ Text\ 2/sublime_text /usr/bin/su
user.dz

Original su is in /bin/su, so just delete your link:

sudo rm /usr/bin/su

Check which su if it's back to /bin/su

There a priority in executable paths, see:

echo $PATH

/usr/bin comes before /bin, So your link will be executed first. But to learn create that link again and run which su you will get /usr/bin/su.

Well, all $PATH can hold executable itself or its link. So most of those paths hold a mixture, give ls -l /usr/bin a try (I cut long results) :

total 925272
-rwxr-xr-x 1 root   root       39552 Dec 18 14:36 [
lrwxrwxrwx 1 root   root           8 Dec 21 15:14 2to3 -> 2to3-2.7
-rwxr-xr-x 1 root   root          96 Jan 12 10:12 2to3-2.7
-rwxr-xr-x 1 root   root          96 Jan 27 17:21 2to3-3.3
-rwxr-xr-x 1 root   root          96 Jan 27 17:23 2to3-3.4
-rwxr-xr-x 1 root   root        5655 Jan  7 12:12 404main
-rwxr-xr-x 1 root   root       10320 Feb  7  2013 411toppm
-rwxr-xr-x 1 root   root          39 Feb 17  2012 7z
-rwxr-xr-x 1 root   root          40 Feb 17  2012 7za
-rwxr-xr-x 1 root   root          40 Feb 17  2012 7zr
-rwxr-xr-x 1 root   root      106584 Jan 15 06:49 a2p
lrwxrwxrwx 1 root   root          52 Jan 25 00:22 a2ping -> ../share/texlive/texmf-dist/scripts/a2ping/a2ping.pl
-rwxr-xr-x 1 root   root         883 Apr 30  2007 a5booklet
lrwxrwxrwx 1 root   root          54 Jan 25 00:22 a5toa4 -> ../share/texlive/texmf-dist/scripts/pfarrei/a5toa4.tlu
-rwxr-xr-x 1 root   root       10328 Apr 28  2009 aa3d

Links are clear now, 3 links, others are files:

  • l in the beginning of lrwxrwxrwx (l link, d directory, - normal file, c char device).

  • -> point to the target file.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related