Tech | Linux
shivam kumar
Backend @ TATA (Prime) || Codeforces Pupil (1320) || CodeChef 4?? (1835) || Leetcode (1595) || AIR - 987 (Google Kick Start) || Full Stack Web Developer || Mobile App Developer
Most system resources are represented as files in Linux.
Why ?
A simple explanation could be that everything on your system is just stream of bytes, so why not treat almost everything as files.
Is directory also a file ?
YES, a directory is just a special type of file, but it functions slightly differently than a regular text file.
what is ls command that is used above ?
you guessed it right, its just a file. So, executables in Linux are just a file. Navigate to /bin directory. This directory has essential binary executable required for the system to boot.
ls executable is just a regular file.
what about processes, are they also files ?
Processes are not files, but they are represented as files in the Linux file system.
领英推荐
Let's take a look at an example:
Open your terminal and type ps and press enter.
The ps (process status) command in Linux is used to display some process attributes. This command reads through the kernel's data structure and process table to fetch the characteristics of the processes. Below you can see that the PID (process id) for my current terminal (zsh) is 14829.
now lets navigate to /proc directory and try to find out 14829.
The process with id 14829 belonged to my terminal (zsh) and is just treated as a directory.
So my terminal is just represented as a directory, although it is a process.
One important things to note about /proc is that it's just an illusionary file system that doesn't actually exist on the disk, but is created on the fly by Linux kernel to keep track of running process.
I hope this article gave you a deeper understanding of Linux and its unique design philosophy. If you have any questions fell free to comment and I will make sure to answer each and every question with the best of my knowledge. Also if you have any suggestion on how to improve the quality of the article, feel free to share them as well.
CS'25 Undergrad | Full Stack Developer | MERN | Blockchain | C/C++
2 个月Insightful
Backend @ TATA (Prime) || Codeforces Pupil (1320) || CodeChef 4?? (1835) || Leetcode (1595) || AIR - 987 (Google Kick Start) || Full Stack Web Developer || Mobile App Developer
3 个月article: https://www.dhirubhai.net/pulse/tech-linux-shivam-kumar-pd3oc