The Modern .NET Show

Episode 92 - A Few Things I Wish I Knew Before Writing .NET On Linux

Embedded Player

Episode 92 - A Few Things I Wish I Knew Before Writing .NET On Linux
The .NET Core Podcast

Episode 92 - A Few Things I Wish I Knew Before Writing .NET On Linux

Supporting The Show

If this episode was interesting or useful to you, please consider supporting the show with one of the above options.

Episode Transcription

Hello everyone and welcome to THE .NET Core Podcast. An award-winning podcast where we reach into the core of the .NET technology stack and, with the help of the .NET community, present you with the information that you need in order to grok the many moving parts of one of the biggest cross-platform, multi-application frameworks on the planet.

I am your host, Jamie “GaProgMan” Taylor. In this episode, I wanted to share with you all an edited version of a talk that I gave at the Orlando .NET User Group back in January. The talk is about some of the things that I wish I knew about before I started wrtiing .NET on Linux. I’ve used Linux-based operating systems on my computers for around 10 years, and using Windows only when I need to. This is a personal choice, but with the prevalence of “Linux on the desktop”, I thought that I would share some advice and experience for those who are looking to use a Linux desktop as a development environment.

As I said earlier, this is recording is taken from a talk that I gave at the Orlando .NET User Group. I would recommend joining this group, as they are wonderfully approachable and have lots of very interesting talks. As with a lot of meetup groups, they are currently hosting their events online, so you don’t necessarily have to be in Orlando to attend. I’ll leave a link to the meetup group, the video version of my talk, and the slide deck in the show notes.

So let’s sit back, open up a terminal, type in dotnet new podcast and let the show begin.

Hello, everyone. So yeah, thank you all so much for agreeing to have me on, and to talk about Linux and dotnet. I appreciate for a lot of you it’s very, very, very early in the morning. So thank you ever so much for sort of tuning in. I am looking at multiple screens. So if I’m looking across and you don’t see where I’m looking, I do apologise. I’ll try and focus on looking into the camera.

Thank you Santosh and Todd for reaching out and asking me to do this, this is a great pleasure to talk to you all. And I’m going to be stumbling a little bit because I always fall over my words. So please bear with me.

Okay, so in the intervening time between submitting the idea for this talk, and actually finishing up writing it, I actually came up with a slightly different title. Because I originally wanted to talk about the 10 things that I wish I knew. And then I started writing all sorts of slides, and ended up with 12, 13, 25, 30. And so I took some time and cut them down, and I’ve got it down to 12. I’m a bit of a weird sort of cove. So I’m happy with changing the title ever so slightly, giving you 12 things rather than 10. So I guess it’s kind of like a bonus thing.

But I guess, before we move on to that first slide, I guess the thing I want to say before we even start is, “why Linux and why now?” right. A lot of us, especially if we are not new to .NET development, a lot of us are primarily Windows users. Because .NET framework - with a capital F - was originally a Windows only technology. And so a lot of people were it was just accepted that you would be a Windows user, and you’re writing dotnet. But obviously, over time, we’ve had - if you don’t know these things, these are good things to Google - we’ve had mono, which was an attempt at making a blackbox reimplementation of .NET for Linux and Mac OS. We then had Xamarin came off the back of Mono. That’s now a .NET technology. Mono, the team and the technology were bought and brought into .NET to make, to start the work into making it cross platform. And now that it’s cross platform, it can run pretty much anywhere. You’re not just limited to Windows machines anymore. You can run it on Mac OS, you can run it on “Linuxes” - I’m using the bunny quotes there because, “what is Linux?” right. Well, we’ll cover that in a moment, you can run it on a Raspberry Pi, I have several of these sitting here. Pretty much anything that’s embedded runs Linux, the machine that I’m using to talk to you all now is running a desktop Linux. So it’s kind of important to know at least a little bit about them enough to sort of Google and continue on. And so what I thought with this is I’m trying to aim at the people who maybe have no experience of what a Linux is, or maybe have a little bit of experience or want to know some of the things to know if you’re doing .NET development.

So firstly, do you even need to know Linux? I would say that, no, you don’t need to know Linux. I’ve been using Linux based operating systems on my computers for around 10 years. And I didn’t need to do it. I sort of explored one day. In fact, what happened was, I was using Windows 7, I think, and some really esoteric blue screen happened and it was talking about something to do with the the ALU in my CPU, something had gone wrong on a hardware level. And I couldn’t get it to boot. And so a friend of mine said, “use my USB.” He gave me a USB memory stick and I had a Linux operating system on it. And he said, “boot into it. And if you can get it to run, then there’s nothing wrong with your computer is probably the operating system, you may need to sort of pave it and reinstal.”

And on the USB, there was a an option to instal or try it without installing. So I tried it out, kinda liked it. And I went, “you know what, I’ve got nothing going on now. I’m on a bit of a vacation, I may as well instal it and if everything goes wrong, I can drop back to Windows, it’s not a problem because I can just reinstall Windows.” And I gave it a try. But what I’m saying is it might be useful to to know rather than, “oh my goodness, I need to know all about the Linux.” I do know that a lot of the DevOps things, use Linux servers, and Docker and podman and things like that. So it may be worth knowing about these things. If success to you means being paid lots of money. Some people have different values of success. Some people think that lots of money is how you value it. Some people think that having all the knowledge in the world is how you value it. Whatever works for you. This may help you achieve that.

But then what I’d like to say is that I’m not going to teach you everything you’re going to need to know. And all of life is a lesson. And so I want to start with some ancient wisdom from a Japanese swordsman called Yamaoka Tesshu. The full quote is, “do not think that this is all there is. More and more wonderful teachings exist. The sword is unfathomable.” Now what he meant by “the sword” was whatever tool technique, thing, knowledge that you are learning, there’s always going to be a little bit more that you can learn if you want to. And so truly mastering something will take lots and lots of time for you to actually attain. And you shouldn’t really be put off by that. I like to celebrate the fact that I don’t know everything, because that means I can learn something new, right? Whenever I’m learning something, I try to think of it in this way I try to think of this quote when I’m learning something.

So what is Linux? I mean, that’s one of the points that we want to reach, right? Quite literally, Linux is everywhere, right. At my desk where I am sitting, I’ve got two laptops, one running Linux; I’ve got a NAS that I’ve built, which runs Linux; I’ve got a Bluetooth speaker, which is likely running a version of Linux; I’ve got my e-reader; I’ve got a couple of Raspberry Pi’s dotted about. What I’m saying is they’re all around you.

And there is that penguin thing if you’ve ever seen Linus, the penguin. And if you’re not sure about Linus, the penguin, you should google it, you’ll see a little penguin just sort of sitting there chilling, that’s the unofficial mascot of Linux. If you have an Android device, you’ve been running Linux all this time, and maybe you knew maybe you didn’t know. Not everybody does, and that’s fine. You can celebrate knowing and not knowing if you want.

Pretty much anything that runs IoT runs Linux. And that is largely because it’s free to use, it’s there for you to use, you can use it for whatever you want. And so a lot of people who are trying to start startup businesses get some funding really quickly and get something out to market, rather than writing their own operating system from the ground up. They can take off the shelf components to build something, throw a Linux kernel on it, make some changes, and boom, there you go. You’ve got it out there in the world. And so this helps us to sort of get started; that whole idea of a fast iteration is helped by the fact that Linux exist.

And then even then, right, Linux isn’t actually the real name of it. It’s actually good GNU Linux, g-n-u Linux. GNU stands for “GNU is not Unix.” So Linux is the kernel of the operating system, kind of like how Windows has the NT kernel. And Mac has the XNU kernel, it’s kind of the same, everything else builds on top of it. And the kernel manages all of the hardware and time slicing and memory acquisition, all that kind of stuff. Device drivers on top of it; file systems on top of it; that kind of thing. So Linux itself isn’t something that you can easily run by itself, you need a whole heap of stuff piled on top of it to make something work.

So how do you go about getting a Linxu? Right. That’s the most important question. If you are new to Linux, and you don’t know what it is, we’re gonna go? What’re you gonna do? And the problem is, there are literally hundreds and hundreds and hundreds of Linuxes; so how do you pick? How do you choose?

My own personal opinion is you go with the most famous ones. So that’s Fedora; Open SUSE; Red-Hat Enterprise Linux, Debian, or Ubuntu. And my personal choice would be to go with Ubuntu because it was designed from the ground up, the very first version of Ubuntu was designed to be the most user friendly thing that they could make.

And you don’t even need to get a Linux. I mentioned earlier on, I have a number of Raspberry Pi’s. I’ve got like five of these hidden around the house. I’ve disconnected these ones, so I can show you them. If you get one of these, there are about $25. And you just get the circuit board and an SD card. And the software is already on there. So all you need to do is plug in power, a monitor, and a keyboard and mouse, and get it on the network. And you don’t you’ve got a Linux on the network. And in fact, you don’t even need to plug it in via the network. Because they have Wi-Fi built onto them. They have Bluetooth built on. Most mobile phone chargers will power one of these. So you don’t even need to buy the power supply, if you’re willing to sacrifice a mobile phone charger whilst you’re working with it.

And the great thing about this is you get a new toy, right? There’s all sorts you can do with these. This one is a local playback only Kodi box. So this sits under my TV, and it’s connected over the network to a server which has a whole bunch of videos on it, and pictures and music and all that kind of stuff. And I can go through it and go, “right I want to watch this today.” And the bluetooth receiver is for a remote control. This one is my music playback device. So I have a personal on the network, almost like a Spotify using a piece of software called Jellyfin which is a wonderful piece of media playback written in .NET and runs on Linux. So if you get one of those, you can try those out. You can set them up with like RetroPi and play video games if you want. There’s all sorts that you can do with them.

So you can get one of those, or you can go over to websites like copy.sh/v86. And on here, you can see - I don’t know how easy it is to see let me zoom in a little bit. There’s a number of different operating systems listed on the left, you can go, “let’s boot into Arch Linux. And you’ve got yourself a Linux box right there.” It is the command line. But you’ve got something you can play with. So you don’t even have to buy anything. You can run it inside the browser and get used to it.

So ls list all the files. If we got anything, we’ve got some files. Oh, brilliant. We’ve got some assembly files, some see some JavaScript. Let’s just see what hello.js looks like, what is that? So does a console.log('Hello, world');, so I could run that. Alright, so that gives me an experience of sort of playing around without ever having to worry about breaking my machine or installing anything.

The other thing, of course, is that you can instal WSL. Santosh mentioned it earlier on. You can instal it on top of your Windows, if you have Windows 10 version 2004 or higher, or indeed windows 11. And there’s actually a version of WSL. Now that allows you to boot GUI based applications that run on Linux in Windows, right. So that’s even better. So you don’t even have to go away from Windows to get an idea of what a Linux is.

But if you do want to go away from windows to try them out, I’d recommend Ubuntu. And what you can do is you can go to the website, if I go to the Ubuntu Website, which I have here, I’m going to go to download. And there’s an Ubuntu Desktop. That’s what I want to run if I want to run it on a desktop computer. Ubuntu server, if I want to run it on a server, and it gives me a download option at click that it will give me the correct one, dump it onto a USB, boot into the USB and you can run it without touching your computer, you don’t have to worry about replacing anything on your computer. So that’s a great way to get started. And then once you’ve got it on the USB, you can say, “okay, I’m happy. I’ve backed everything up, install it on my computer,” and it will wipe your computer and install Ubuntu.

The app here is called Ventoy. What you do with this one is you plug the USB in, you run a shell script or an exe if you’re on Windows, and it sets up a bunch of partitions, you drag and drop ISO files onto here. You drop the ISOs on that as ISO files, and then plug your USB in, and reboot your computer. And you can run any of these without having to instal them. But it’s a great way of sort of trying them out.

But the point I’m getting at is it’s become really super easy to actually try these things out. And each of those different Linuxes are called distributions, or distros for short. Because you get the kernel and you get loads of other applications and packages on top of that. In this instance, you could think of Windows as a distribution of the NT kernel and a bunch of stuff to make Windows work, right.

So if there are this many, how are they different? Or are they different? And this is where I’m going to sit on the fence because this is a very tricky question to answer without going into loads and loads of details. Essentially, all of the different Linux distributions are kind of the same. They all have a version of the Linux kernel on there. Some may have the very latest. So I believe this week or next week is the release of Linux kernel 5.13. Some may be on old versions that are maybe 5.02, Summer, even Linux 2.6 - er, 2.6 was released in around the 2000 timeframe, I believe. And so the core part of it, the kernel is pretty much the same. It’s just everything else that’s piled on top, some distributions ship with an office suite called OpenOffice some ship with an office suite called LibreOffice. Some have Firefox is the default browser, so have Chrome as the default browser. It literally is which bits do you want to choose? And because of that some of those differences are indeed just cosmetic. Some are based on what are called the package manager, which is how you instal software. And some of them are different due to licencing.

From an end users perspective, if you’re running it on your computer, there’s very little difference, it just looks different. And then you swap out your desktop wallpaper, and it looks almost like any other computer. We’ll talk about them in a moment. But there’s lots of different ways to instal software. Some people prefer using apt. Some prefer using yum. Some prefer using rpm. These are all words that you can Google if you want, but they’re essentially all solving the same thing: “how do we do a desktop operating system, or indeed a server operating system, using the Linux kernel?”

The one thing to point out though: I said, “fedora and Red-Hat Enterprise Linux.” Red-Hat Enterprise Linux is the enterprise version, and you would pay for access to that one, but it is the enterprise version of Fedora. Fedora is quite literally at the bleeding edge of everything; every time a new package is released it goes on to Fedora and Arch Linux first, and then other distributions adopt it. The other thing to consider as well as if you’re going to do .NET on Linux, you need to make sure that the tools you’re going to use are available. And the easiest way to do that is to search for “Fedora .NET install” like quite literally tha. And it will say, “hey, how do you instal it? “And you’ve got the steps for installing it. I know that I tried out the latest version of Fedora in November, and I couldn’t instal VS code; so that I like to use VS code. So I couldn’t. For me, that was a deal breaker, for you that may not be a deal breaker. And so it’s worth doing a little bit of Googling and learning how to do it.

And what’s great about these is: A) is the Microsoft documentation and B) it literally gives you the commands to do it. And it’s walking you through the steps. So that’s something to be aware of is that, unlike Windows, if you’re if you want to instal an application, you download an exe, you run it, and it will start working, right. There’s a few caveats involved with installing software on different Linuxes. And each one handles it differently, I’ll come on to that in a moment.

Because I’ve said earlier on, from a user’s perspective, it’s just like Windows, it’s just an operating system, right? Visually, yes, but there are some differences. So Windows and Linux distros, can be completely different. But they can be very similar. For instance, when the Windows 11 user interface was first showed off, a lot of people went, “oh, that looks like the Linux interface for XFCE.” And so a lot of people said, “oh that looks pretty similar. If I’m used to using XFCE then I can use that.”

So the file system on a Linux machine. So there are no drive letters, that’s one of the first things to know about the differences between a Linux and Windows is that there are no drive letters. All of my drives that are on this device will be in /dev. So if I look in the /dev folder, I can see there’s lots of devices that are running on this machine. And what’s great about Linux is the different security model. So if you’ve used a Windows machine, and you want to do something as an admin, you get that annoying pop up that nobody reads that everybody finds the “yes” button clicks yes, “I know what I’m doing. Let me do it.” Well, on Linux, the equivalent is sudo - or “pseudu” depending on how you want to pronounce it. It stands for “Substitute User, Do Operation.” So I can substitute my user for the administrator and type in my administrator password and do a command.

The other thing as well is that Windows binaries and Linux binaries are completely different. So you can’t just just drag an exe from Windows and double click it and run it. There is a thing called wine - which is a backronym for Wine Is Not an Emulator - and with that, you can say, “hey, run this exe,” and it will try its hardest to actually run it. What it does, from my understanding is it translates all of the windows system calls into Linux system calls. So there’s a whole compatibility layer for talking to the screen using DirectX, which is what - if you’ve heard of proton, which is what the Steam Deck is going to use, not the Stream Deck, the Steam Deck, that’s going to use proton to be able to boot games on to a Linux system. And over the last few years Valve have made huge strides in that. Almost every game that is built for windows that they sell on Steam, at least boots, not all of them run but at least a large amount of them boot. You can use Wine to run Windows applications in that sort of weird position where you can’t find an alternative for your Linux machine.

The problem, of course, is that if you’re running anything created by a Adobe, or any of the Office Suite from Microsoft, they tend to not work. But other things have a bit of a wobbly support. There is a website I believe WineHQ, let’s find it. You can actually search for an application. It tells you whether it’s obsolete, whether it works or not. And if you desperately need to run those, you can run them. And so that exists as a sort of get out clause for, “whoops, I’ve moved over to Linux, I need to run this exe and I can’t run this exe.”

And so earlier when I said that there are lots of different ways to instal and manage your applications on a Linux system. There’s apt which is usually used by Debian; rpm which is used by Fedora I believe; yum which is used by Arch Linux; flat pack; appimage; snap; DLLs. All sorts of stuff. And there are hundreds and hundreds of different ways to run different apps on Linux. This isn’t a .NET thing. This is just a, “how do we instal things?” things. So you might see commands for run rpm install or apt install or flatpack get from... you know, these kinds of things. And so this is, it’s good to know that these exists. Depending on the distribution you choose, different ones of these will be available. If you choose an Ubuntu based distribution, you’ll have snap, because that’s an Ubuntu technology; you’ll have flatpack; you’ll have app image; and you’ll have apt. If you run a Fedora or Red-Hat, Enterprise Linux, you’ll have rpm; and you’ll have flatpack; and you’ll have an appimage. So it’s all about which things and how easy it is to instal. All of them are solving the same problem but in slightly different ways. And this is the thing with Linux is that everybody has hundreds of different ways to run things. And so these are the ways that you’re going to need to know to instal things.

If you use Docker, you’ve used Linux, maybe. There was a period of time, and they still do exist, where you could have Windows containers within Docker. The biggest problem with these is that you can’t run Windows containers and Linux containers on the same machine at the same time. At least as far as I know, they may have changed recently, I don’t tend to run Windows containers. So I don’t really know so much about those. Except to say that Windows containers are really rather huge. They’re around a gigabyte each and then you instal your app on top of that. And so if you want that fast dev loop of, “shut down the thing, destroy the thing, start it back up,” as long as you’ve got that one gigabyte of stuff cached, you can actually pull that back and get it. But if you don’t have that one gigabyte of stuff cached, all bets are off, right. And so it’s usually a good idea to have a Linux Docker container - it’s just like a Linux machine, except that you can spin it up and shut it down whenever you want. And that you need to run Docker to be able to do it. But you can use Docker, if you don’t want to run a Linux, you will be running Linux, but you won’t see it. And so that’s a way of running Linux as well, if you wanted.

A lot of the stuff we’ve talked about is kind of, “what is Linux?” we’re coming to some of the .NET specific stuff. What about the CLI? Do I need to know all of these commands? And I will say, “no, do you need to know the commands on Windows?” Maybe you do need to know the commands for .NET stuff. Because the command line is built from the ground up for modern .NET - so that’s dotnet, five, dotnet, six .NET core - it was built from the ground up to be used by Linux people, and to be automated. Because what they wanted to do is to make it super easy for you to go dotnet help, and get all of your help and see all the commands. But then to also then be able to go let’s have a look, where are we? And I can say okay, “cool. Do a dotnet build.” I haven’t had to load anything, right. I’ve not loaded an IDE. I’ve not loaded, any kind of software, it’s all in here. And if I wanted to, I could edit it in here. I’m not going to but let’s see what files we’ve got. And if I go nano program.cs. Ta-da. I’m actually editing my .NET code without actually running any kind of application, which is pretty cool.

But the great thing about the CLI for .NET is that it is built to be able to make those CI/CD pipelines, super easy to build. Because all you’re doing is issuing these commands, you’re saying dotnet clean, and then it cleans it. And you may say dotnet clean && dotnet build. So what I’m doing here is I’m saying I’m saying “dotnet cleanand if it completes, run dotnet build.” And so it will clean, it will complete and then it will build. How great is that? Right? There’s one command.

But I will say that VS Code and Rider, are your friends . So if I open code. I can use breakpoints, I can write code in here, I can do it with Rider as well. I’ve got Rider installed. And what I’m saying is you don’t have to live in the command line. I can build from here. So I can hit f5, and if I supply the right things, it will start building my application, which is wonderful. So I don’t have to worry about that.

So you don’t really need to know the CLI. But it’s a great value-add, right. Because it will help you with your DevOps practices and speeding up that dev loop. You can even do, I believe dotnet watch and build I believe, and what will happen there. So that’s done a build, it’s then going to watch and wait for me to make changes to those files. And as soon as I make changes, it will start building it. Which is wonderful, because then that decreases that dev loop. As soon as I hit save, it rebuilds again. And there’s even something in .NET 6 - the modern .NET - that is worth looking into called .NET hot reload, which can do that. But without having to stop and start your application. It can halt it, rebuild it, put it back where it was. And then you can continue on and the app will still run and it will go straight back to where it was. It’s not a Linux specific thing. But that’s a wonderful thing that you can do.

So talking about .NET specifically on Linux, there’s loads of stuff that doesn’t work. .NET outside of Windows doesn’t support registry, because registry doesn’t exist; doesn’t support native GUIs - but apparently, according to the people I’ve spoken to outside of Microsoft that is coming. And it doesn’t support Windows-based authentication. So there is a thing called .NET Maui, which is coming which will allow you to build native GUI apps for Linux, but the Linux portion of it isn’t coming yet. From what I’ve been told, the idea is there will be a number of interfaces that you can use. And those interfaces will allow anyone to draw a window on screen and interact with it - and this is public domain knowledge, this isn’t anything super secret - the idea is those interfaces will be released to the public, and the .NET devs may ask for help implementing them on Linux. Because Linux doesn’t have one way of drawing windows, right, it has about 12-tybajillion different ways of drawing windows. And depending on how you got your system configured, you may not have all of those different ways to draw windows. And so it becomes an NP difficult task, or it becomes difficult to solve.

So not everything works. But a lot of stuff does. In fact, a huge amount of stuff does. And so if you need Windows specific things, it’s worth having a Windows machine that you can communicate with, to actually talk with to get those windows specific applications and things that you need. This fits really well in the the idea of microservices, but it helps with those kinds of things. You’re separating out those concerns, you have one service that does Windows stuff, you talk to it and say, “hey, can you do the Windows thing?” It says, “brilliant, here’s your response.”

Now, the difficult thing is debugging. How do I debug my app on Linux, I know how to do on Windows. Because I’ve got Visual Studio, Visual Studio is wonderful. It has this wonderful suite of tools. It’s got all of these things, it works almost like a Swiss army knife: it’s got the spoon; it’s got the can opener’ it’s got a mobile phone - it hasn’t got a mobile phone, I’m just being silly. But how do I then debug on on Linux, if I’m used to running on Windows?

Well, if you’re on Linux, then windbg, which is a Windows debugger, doesn’t exist. But there is something called SOS, which exists to use with LLDB. So if you want to debug a running application, you can use SOS to actually inspect a running application and get a trace out of it, and run through that. In fact, what I would recommend if you’re interested in running .NET on Linux, and all of the debugging things, is I’d recommend getting a book called .NET Core in action, it was written by Dustin Metzger. Now, this book was written in the .NET core 1.0 days, but released in the .NET Core 2.0 days. So some of the information is a little out of date. But what’s great about this book, as it has a 20 page chapter on debugging in .NET across Windows and Linuxes. The information that’s in there is way out of scope for this talk. But I would definitely recommend getting it. You don’t actually have to get the book, because I’m going to share with you some of the tools that you can use.

Debugging dotnet, on Linux used to be super hard. But it’s not so hard now, because there are lots of tools: there’s SOS; there’s .NET dump. So you can get a memory dump of an application that’s running that is then compatible with other dump systems. So you can dump the memory, throw it into LLDB or into windbg, and it will just read through it. And you can get a GC dump, which is the heap dump rather than just the actual content. And you can even do tracing. So if your application is already running, you can run this global tool trace and attach it to a process and you will see all of the steps that are happening. So there’s lots of lots of ways that you can debug your application.

Of course, you can also in Visual Studio Code, you can put a breakpoint in, hit f5 and run your application. And you’re off to the races, right. And it will stop here you get the full debugging experience. And so you don’t really need a huge amount of tools to do it. But if your application takes you down the path of having to trace through things and look at memory dumps, then this is a great set of tools to use. I’ve got all of these links, I will happily share them after that’s not a problem. And so it depends on what your use case is. It used to be hard, but it’s getting way better. Like I say you can use Rider; you can use Visual Studio Code; or you can use all of these bits and pieces.

Now when it comes to getting support. Now, I’m not necessarily talking about support for .NET on Linux, but support for Linux, right? If you’re learning something new, you’re going to have to learn some stuff and pick up some support somewhere, read some documentation, maybe watch some YouTube videos, some Linux or Enterprisey. So Red-Hat Enterprise Linux: you have to pay to get the support for that. But most of the Linux distributions have completely free support forums and documentation. And they have other companies that write documentation for them. If you’re ever stuck with a Linux question, go have a look at DigitalOcean. I’m not trying to convince you to use DigitalOcean. But what’s great about DigitalOcean is they have this tutorial section, and quite literally anything you can think of that you want to run on Linux, they’ve got documentation for it.

And to Santosh’s question here about techniques where you don’t have to worry about the distro: using the command line you’re communicating with the Linux kernel itself, most of the techniques will work across all of them. So if you find a way to fix something on an Ubuntu machine, it will more than likely work on a Fedora, but you may have to change one or two of the commands. So let’s say you have a problem with your Ubuntu machine, you have to instal some software. Well, you could take that same command and run it on an Ubuntu but change apt for rpm and it will work and it will instal, because they just that good, right? That’s why I would start there. I’d start with an Ubuntu, because Ubuntu is designed from the ground up to be user friendly.

And if you do get stuck, you can go to the arch wiki. Now, arch or arc, I’m not sure how you pronounce it is a distribution of Linux. And this is known as Linux the hard way. Because you literally have to build everything yourself, you start with a command line interface, and you start installing packages and building things for your machine. The arch wiki is really good for looking at, “how do I fix this problem with my Linux? And I don’t know what Linux I’m using.”

One good application to instal, I suppose, would be neofetch. What’s great about neofetch is it tells you everything about your computer. It tells you the operating system you’re running; maybe the model number of your computer; which kernel; how long you’ve been running it for; how much RAM you’ve got. It gives you a bunch of colour patches, so then you can check your colour configuration, and the CPU and all that kind of stuff. So it’s really useful for identifying what your computer is running. That’s a great way, I used to use - when I was on Windows - I used to use dxdiag to get this information. But I could do this get the same information from a command line.

And so how do you pick one, Ubuntu. Ubuntu. Ubuntu, right? That’s where I would start Ubuntu super easy to get on with. You plug it in, you get it right in your has drivers for pretty much everything. Or indeed get yourself a Raspberry Pi. Because they’re super cheap loads of fun to play with. And you can get on with it. If you are looking at different distros pick one that has been around for a long time, the longer that they have lived for, the more support they will be. That’s not a hard and fast rule. But it’s a good way to sort of get started. And so that’s where I would start Ubuntu, great place to start. And you can instal that on WSL. You can get it in the Windows Store and just run that and when it’s ready, you just type in Ubuntu wherever you are in the command line. And it will mount that directory inside of Linux. So you can do Linux things with your windows stuff. Brilliant.

And if you’re interested, you can find out more about me by going to dotnetcore.show, wafflingtaylors.rocks, or tabsandspaces.io; I also hang around in the Coding Blocks Slack. So if you’re aware of the Coding Blocks podcast check out their slack. With Tabs and Spaces we’ve got a discord and there’s people coming in and going all the time. And we do like live streams of apps that we’re working on. We do video game nights, all that kind of stuff.

I’m going to shut up now and hand back to Santosh because I’ve been talking about waiting long.

Wrapping Up

That was an edited version of my talk “A Few Things I Wish I Knew Before Writing .NET On Linux” from January’s Orlando .NET User Group meetup.. Be sure to check out the show notes for a bunch of links to some of the stuff that we covered, and full transcription of the interview. The show notes, as always, can be found at dotnetcore.show, and there will be a link directly to them in your podcatcher.

And don’t forget to spread the word, leave a rating or review on your podcatcher of choice - head over to dotnetcore.show/subscribe for ways to do that - reach out via our contact page, and to come back next time for more .NET goodness.

I will see you again real soon. See you later folks.

Follow the show

You can find the show on any of these places