LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > 4MLinux
User Name
Password
4MLinux This forum is for the discussion of 4MLinux.

Notices


Reply
  Search this Thread
Old 11-17-2020, 11:07 AM   #1
4ML220
LQ Newbie
 
Registered: Aug 2017
Posts: 16

Rep: Reputation: Disabled
What symlinks leading into itself are good for?


Hi, I found that there are some symlinks which are leading into itself in live 4MLinux filesystem /:
folder /usr/local/ is symlink leads into itself /usr/local/
folder /usr/samba/ is symlink leads into itself /usr/samba/

'Cos when I go into it - it goes into /usr/local/local/local/local/local/local/local/local/local/local/local/local/local/local/local/local/local/local/ ... and so on ... dependency rate on as far as many clicks ...

Just curious about it - what is it good for if it leads to (seems to me) 'nowhere'.
(both folders are empty at this time).


Q1:
Why they are just not simply 'straight' folder instead of symlink?



Q2:
Speaks about symlinks - can someone tell me please, what is good for in '/usr' folder to create additional symlinks,
but which leads back to basic '/' linux folders:
/etc
/var

Does some software or access rights need it?
(but 4MLinux uses root acct anyway so no access troubles I guess right?)

'Cos (seems to me as laik) the whole linux is based on directory structure rootpaths /etc & /var - so why additional symlinks inside /usr of the same please? Isn't the path '/etc' shorter than path '/usr/etc'?

Thank you guys for info or links to help me understand it.
 
Old 11-17-2020, 11:13 AM   #2
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 17,216

Rep: Reputation: 5825Reputation: 5825Reputation: 5825Reputation: 5825Reputation: 5825Reputation: 5825Reputation: 5825Reputation: 5825Reputation: 5825Reputation: 5825Reputation: 5825
/usr/local/local/local/.... that is not good, most probably that is a bug somewhere.
/usr/bin will lead to /bin (and so on), that can be useful, do not need to maintain both /usr/bin and /bin. But that has probably a historical reason.
 
Old 11-17-2020, 12:48 PM   #3
4ML220
LQ Newbie
 
Registered: Aug 2017
Posts: 16

Original Poster
Rep: Reputation: Disabled
Thanx for reply & info :-).

Yes - and also symlink
/usr/samba/
... works the same way - clickin' into multiple /usr/samba/samba/samba/samba/samba/samba/samba/samba/samba/samba/samba/samba/samba/ ... and so on ... dependency rate on as far as many clicks ... (using pcmanfm).

In 4MLinux34.1 & Server too ... in "OutOfTheBox live CD" ... & I do rememember it was this way definitely already in versin 4MLinux30 (& Server) 'cos I was playing with it :-).

Could it do some errors with 'owerflow ...'? I can try how many times it can go into itself ...


About:
/usr/bin will lead to /bin (and so on), that can be useful, do not need to maintain both /usr/bin and /bin.

OK, thanx, now I've got it :-). I understand that /bin will be diferent for diferent users and system.
I just told that /etc & /var is always only the one version - for all of them, so just the one in root is enough.
I'm sorry, my apologize here :-).
 
Old 11-17-2020, 01:24 PM   #4
zk1234
4MLinux Maintainer
 
Registered: Oct 2010
Location: Poland
Distribution: 4MLinux, Slackware
Posts: 1,153

Rep: Reputation: 212Reputation: 212Reputation: 212
Hi,

That's only an illusion :-)
This is a part of the 4MLinux sysinit script:
Code:
busybox rm -fr /usr/etc
busybox ln -s /etc /usr/etc
busybox rm -fr /usr/var
busybox ln -s /var /usr/var
busybox rm -fr /usr/local
busybox ln -s /usr /usr/local
busybox rm -fr /usr/lib64
busybox ln -s /usr/lib /usr/lib64
The above means that, for example, there is only one /usr/etc symlink.
The rest is an illusion (= the way how file managers use symlinks).

.

Last edited by zk1234; 11-17-2020 at 01:27 PM.
 
Old 11-17-2020, 03:49 PM   #5
4ML220
LQ Newbie
 
Registered: Aug 2017
Posts: 16

Original Poster
Rep: Reputation: Disabled
ps: Misspelling correction - please read in all my previous posts - the incorrect "told" in correct form "thought".
... damn autocorrection :-).
Than you.


OK, zk, thank you also for info, now I've got it & understand the answer for Q2 from abowe:
I can see also in pcmanfm that folders are symlinks and 'Properties' of it shows where it leads.



About Q1: I was just wonder if is there any purpose that symlinks:
/usr/local
/usr/samba
... goes into still the same folder in cycle on & on & on ...?

In pcmanfm if I click on that folder to get into folder - it goes (by each click) inside more and more multiple times:
/usr/local/local/local/local/local/local/local/local/local/local/local/local/local/ ... and so on ...
/usr/samba/samba/samba/samba/samba/samba/samba/samba/samba/samba/samba/samba/samba/ ... and so on ...
I just tried - maximum is 40 times.

Then it shows all symlinks in /usr as they are broken - so not only those two:
/usr/local
/usr/samba

... but show that broken are all symlinks which are in /usr - so it means also:
/usr/etc
/usr/lib64
/usr/var

I was just wonder why & what is it for :-).
 
Old 11-18-2020, 11:55 AM   #6
zk1234
4MLinux Maintainer
 
Registered: Oct 2010
Location: Poland
Distribution: 4MLinux, Slackware
Posts: 1,153

Rep: Reputation: 212Reputation: 212Reputation: 212
Quote:
Originally Posted by 4ML220 View Post
I was just wonder why & what is it for :-).
There is only one possible answer: some applications in 4MLinux make use of these links.
For example, they look for libraries in /usr/local/lib (and not just /usr/lib).

.
 
Old 11-18-2020, 03:33 PM   #7
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 18,138
Blog Entries: 12

Rep: Reputation: 5535Reputation: 5535Reputation: 5535Reputation: 5535Reputation: 5535Reputation: 5535Reputation: 5535Reputation: 5535Reputation: 5535Reputation: 5535Reputation: 5535
Quote:
Originally Posted by 4ML220 View Post
'Cos when I go into it - it goes into /usr/local/local/local/local/local/local/local/local/local/local/local/local/local/local/local/local/local/local/ ... and so on ...
Technically, this symlink doesn't lead back into itself then.

About your question: there's no need to rely on your gui filemanager when going into system directories. There.
If you want to continue the discussion, post terminal output, e.g.:
Code:
ls -ld /usr/local
 
Old 11-23-2020, 02:29 PM   #8
4ML220
LQ Newbie
 
Registered: Aug 2017
Posts: 16

Original Poster
Rep: Reputation: Disabled
The terminal output is:
lrwxrwxrwx 1 root root 1 Nov 17 16:22 /usr/local -> /usr

OK, I can see that you are right guys here, zk1234 + ondodo. Thank you.
Also you're right about the 'Technically, this symlink doesn't lead back into itself then.'
It realy doesn't.

It was my mystake 'cos just 'doing clickin'' on that symlink again & again i pcmanfm showes still the same screen with the same 'stuff' in the same folder.
Only later I realized that in the top addres bar is 'grouing up' line with more '/local' or '/samba' ... up to 40 times max.

It seems to it is not realy important - so I don't wanna waste your time here.
Thank you a lot :-)
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Add leading zeroes that aren't really leading LXer Syndicated Linux News 0 09-13-2019 01:31 PM
Combine symlinks into one file? iantresman Linux - Server 10 11-24-2011 09:12 AM
[SOLVED] Computer turns off by itself, then boots by itself to a blank screen Lyle Linux - Hardware 8 07-25-2010 08:27 PM
How to insert leading 0 into a string within bash patje999 Programming 4 10-02-2009 06:29 AM
How do I cd into a directory with a leading backslash? closet geek Linux - General 28 07-20-2006 05:56 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > 4MLinux

All times are GMT -5. The time now is 10:25 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration