Mysterious X11: Linux shenanigans

Prof.bubs
4 min readMay 23, 2024

Well well well!..

https://tenor.com/view/hello-there-gif-26201817

it's been quite a long time since I wrote any medium blog post, And I wanted to start writing again not only about cybersecurity-related stuff but more on a general aspect when it comes to information technology, So from now you can expect articles about AI wars, new techs from google I/O launch and much more interesting, intriguing and DEFINITELY COOL stuffs. Like the one RIGHT NOW!!

Anyways, So what is this X11 directory? and why is it there in Linux and most importantly how did I come across this?

I will start my answering with the last question, I stumbled upon this directory..quite..randomly ¯\_(ツ)_/¯. I was just cleaning up my drive to free up my space and I came across this folder in my /usr/bin/, I was going through files in it and X11 was a directory, which opened another X11 directory, which opened another X11 directory, which opened another X11 directory, which…you get the idea right!

I freaked out! I thought this was eating my space. The contents on every level were the same as the contents on the previous directory. So I was pretty confused. Did I somehow recursively create folder after folder on my own? , Since when did this start happening? How much space did it eat?

command to check storage: df

Immediately I thought of deleting ALL the directories except one because it did have a lot of other important directories inside. For a second there I was also relieved because deleting this guy would mean I get to have half my space back(or so I thought :)).But first!, I decided to do a bit of research on my own. So I googled it and found that it was intentional by Linux

https://giphy.com/gifs/hyperrpg-design-rat-queens-game-plan-dAp4MAderKL72ILzAp

BIG REVEAL:

The /usr/bin/X11 is a symlink(symbolic link) that points to /usr/bin itself.

YES! That's correct, it's a link pointing to its own, there weren't infinite X11 directories, there was only one which was pointing to /usr/bin (it was at this point I started flushing down my dream of having more space🥲).

It is like those horror movies where the main character keeps on climbing up the floor but never actually progresses a single floor further up so the protagonist is stuck in a loop on the same floor. Likewise, you can keep moving to an infinite number of X11 directories but YOU.ARE.ACTUALLY.FACTUALLY.STANDING.ON.THE.SAME.DIRECTORY!!. BUT YOU WILL NEVER PROGRESS A SINGLE DIRECTORY UP, YOU NEVER DID, AND YOU NEVER WILL. DUN DUN DUNNN!!!!

REASON:

According to my source:askubuntu, this is done for compatibility reasons as few programs expect other programs to be in /usr/bin. Now honestly I don't exactly understand how that works, If my understanding is correct maybe some program in /usr/bin requires it to access another program in /usr/bin, which for some reason it can't access directly, so I think it will go around by jumping into X11 directory and land back to /usr/bin to choose the program it requires.

I checked the permissions for this directory. The ‘l’ and the start say that it is a link which is pointing to ./ .

CONCLUSION:

This was really an interesting find. Every day I get to learn cool stuff about Linux. (“Everyday” might be overkill). But I do hope you found this as interesting and intriguing as I did. If you did, please throw in some claps and give me suggestions on what we can discuss next in the comments. Until then TAKE CARE!

--

--