r/linuxquestions • • 7h ago

How does linux code work.

So ive read about Linux or Ubuntu switching some things to rust a while ago and im also trying to learn about C and how its used to program Linux but I don't really get yet how all these things work together. So for example im using Linux mint right now and if you go to their github theirs a lot of thing like the cinnamon desktop but I don't know if thats all the code thats used for mint or what lol.

0 Upvotes

13 comments sorted by

12

u/proverbialbunny 6h ago

What you’re asking about is large enough to cover an entire university course. Here’s a few courses that cover this topic:

MIT 6.828  (Operating System Engineering) requires students to build a small Unix-inspired kernel in  C and x86 assembly , focusing on virtual memory, threads, and synchronization. 

Carnegie Mellon 15-410/605  (Operating System Design and Implementation) involves writing a small Unix-inspired OS kernel in  C , emphasizing team programming and debugging complex concurrency issues. 

Stanford CS212  (Operating Systems and Systems Programming) reinforces concepts through four kernel programming projects in the  Pintos operating system, covering threads, scheduling, and virtual memory. 

Purdue ECE469  teaches OS internals by building an OS from scratch using the  JOS  educational project, progressing from booting to file systems.

The C part is the Linux kernel and hardware drivers inside of the kernel. That is the lowest level (outside of writing code directly on the hardware). Linux has started allowing drivers written in Rust into the kernel. 

On a higher level the applications can be written in any programming language. Most GUI software is written in C or C++. The Mint parts built on top of Ubuntu like the control panel are written in Python. 

2

u/CardOk755 6h ago

And, of course, all those things apply to Windows as well.

-1

u/AdministrativeFile78 6h ago

Yehhhh but how do u do it

6

u/SirGlass 7h ago

Well linux is really a collection of programs

THe linux kernel is the core part of the system mostly written in C. The kernel is basically drivers, it talks to the hardware and gets the hardware to do stuff like save a file

For the most part all linux systems user the same kernel although the versions may be different

The other stuff may or may not be programmed in C. The GNU core utilies I think were re-written in rust

The core utils are like command line programs that you can use to do simple things like list the directories out, find a file, replace text in a file, move a file , create a file, delete a file ect.

Mint does not make the entire linux system they make two Desktop environments cinnimon and mate. The rest of MINT is the standard linux programs

6

u/ludonarrator senior software engineer 7h ago

trying to learn about (?) C

Make some basic projects first, much much smaller in scope than an entire operating system or even just the kernel. I'm talking as dumb and simple as hangman (on the console) or a really stripped down cat (read a file and print it). As you learn and grow, more and more things will become clear. At this stage it's largely impossible to explain "how does linux code work".

3

u/CardOk755 6h ago

OP. Please understand that windows is also (largely) written in C.

The only major difference between Windows and Linux is that the source code of Linux is publicly available.

They do similar things in slightly different ways for historical reasons, but they are not radically different.

(If you do think they are radically different please study IBM VM, Multics and the Burroughs operating systems).

4

u/ipsirc 7h ago

I don't know if thats all the code thats used for mint or what lol.

LinuxMint is based on Ubuntu, so you can find only the differences between ubuntu and mint in mint repositories. All the rest are in ubuntu repos.

1

u/Adrenolin01 5h ago

You’re talking about completely different things. The Linux kernel, distributions, Desktop environments… if you want to start learning at the base level for Linux.. look into Linux From Scratch (LFS). It’s a guide to quite literally build a Linux system from scratch. If you have a second PC I’d recommend installed Proxmox on that to create a virtualization server first. Then create a Base Debian VM and then start following the LFS documentation.

1

u/Jwhodis 5h ago

Cinnamon Desktop is the graphical interface (known as Desktop Environment on Linux), on Mint there are a couple DEs to pick from.

1

u/MasterGeekMX Mexican Linux nerd trying to be helpful 4h ago

A linux-based OS is in fact a cluster of several programs, each handling one aspect of the entire OS. Heck, even Linux is in reality one of those components: the kernel. We simply call the whole thing Linux for short. Other core components come from a project called GNU, hence why some people insist the OS should be named GNU/Linux.

Now, a computer in reality can only run one kind of code: machine language, which is the pure binary language your CPU understands. Every single thing you do in your computer is comprised of machine language instructions. C and other languages need to be converted into machine code in order to be runable. C is translsted in one sweep by a program called thr compiler, while other languages like Python are translated in real-time by a program called an interpreter.

Well, for many years Linux and the programs around it were developed in C, but in recent years there has been some that want to make things with Rust, as it prevents memory issues.

One example is Ubuntu, which has been working on replacing the GNU Coreutils (which are made in C) with a version made in Rust. Ubuntu 26.10, which literally released today, has finished that move.

-3

u/AdministrativeFile78 6h ago

Sudo rm -rf / --no-preserve-root hacks u into the linux mainframe and from there its pretty straight forward bro there is like this tutorial called vimtutor

3

u/MeetingExtension5771 6h ago

Cool beans but if I use the recursive flag I might accidentally hack into the cia mainframe at the same time and I don't want them to send someone to kill me.

2

u/AdministrativeFile78 5h ago

I thought i was on r/masterhacker how did i get here