← Previous lessonFree lesson 3 of 3 · lesson 3 of 49

Unlock all 49 lessons of Introduction to OpenFOAM DevelopmentFull course ₹40,000 · paid

Price & syllabus
Free lesson · 16 min · no payment

Basic Linux Commands, Building OpenFOAM and Setting Up WSL

A free lesson from Skill-Lync's Introduction to OpenFOAM Development course, on Grow by Skill-Lync · Last updated 16 Nov 2026 · Session: “Introduction to OpenFOAM Development: Installation and Basic Linux Commands”

What will you learn in this free Introduction to OpenFOAM Development lesson?

The instructor introduces the Linux terminal commands needed for OpenFOAM: pwd, ls, cd, cp, rm, mv and mkdir, with a warning that removed files cannot be recovered. The lesson then shows building OpenFOAM from source tarballs, sourcing the bashrc file, and enabling WSL2 on Windows through PowerShell.

  • Navigation and file commands: pwd, ls, cd, cp, rm, mv
  • Copying and removing folders with the recursive flag
  • Unpacking tarballs and sourcing the OpenFOAM bashrc
  • Enabling WSL2 and checking the Windows version

What comes after lesson 3?

Later in Skill-Lync's Introduction to OpenFOAM Development course (paid): lesson 4, OpenFOAM Case Structure and Compilation; lesson 5, Setting Up Development Environment and Debugging in OpenFOAM; lesson 6, Introduction to Visual Studio Code for OpenFOAM Development. The full course has 49 lessons (18 h 16 min of video); see the course overview or its price and syllabus.

Lesson transcript

Machine transcript of the lesson audio (lightly cleaned). Technical terms may contain errors; the video is the reference.

Welcome back to another session of Introduction to Openform Development. We are still getting familiar with the structure and installation of Openform. We're going to go ahead and do a lot of interesting things today, mainly dealing with the installation of Openform, as well as trying out a little bit of the code, as well as the case structure that we saw in the last session. So as you can see here, for those of you that do not have a good introduction to Linux, we are going to have a little bit of a walkthrough of the Linux commands that you need to work your way through Openform.

And we are going to work on installing the system on Linux, as well as installing it on Windows. Well, the only way to install it on Windows is through a Linux subsystem, which we are going to be looking at. Then, getting started is our next main concern. We are going to look at a case that we are going to do, as well as setting up a development environment. So if you want to code, if you want to be more serious with your development work in Openform, how do you optimize that? That's our goal for today.

So Linux is important to learn, as I've stressed a lot of times now, while using Openform and any other numerical computing software. So you will be needing this for any HPC software that you will probably have to use in the near future for CFD. So Linux, as I said, is the kernel of an operating system or an OS. As I mentioned before, there are a host of distributions, colloquially called as distros, that run Linux. For example, the ones that are very common are Ubuntu or Fedora or Debian.

We, as I said, will be using Ubuntu. That is our distribution of choice. As I mentioned before, we do not have a GUI or any window when we are working with Linux, at least in our subsystem. We'll have to do everything in the terminal. So you'll have to get used to typing commands. But it's really simple and it's really intuitive. So if you get used to a few basic commands, you'll probably be well on your way. For example, PVD will print out the current directory path.

Without going into too much details of how I got the terminal, I'm just going to scroll through to a terminal and just show you what the commands are. For example, PWD shows you where the directory is. For example, this is where the directory would be. It's already shown and it will give you the full path of where the directory is. This is just like searching in Windows for properties and then looking up what the file path is. One of the most used commands is LS, which tells you what are the contents of the folder.

So it will give you all the folders that are present in this folder. Then you have CD. CD is important if you want to switch folders, if you want to go in a directory or come out a directory. For example, if I want to go within the directory called cavity, I will write cd cavity and that's it. I'm inside cavity. If I want to go to directory back, I just do cd double dot and I'm outside the directory and back to the original one. Copy or cp is the copy command.

For example, if I want to copy all run, which is just a script. If I want to copy it into something called all run 2, I just do that. Now I have two things. I have an all run and all run 2, which I've just done. Just in addition to a command that's not given here, now I want to delete all run 2. What do I do? I just do a remove. Remove all run 2 and that's it. So now I can see that all run 2 has been deleted.

Just remember, however, that a remove command is not reversible on Linux. That is, if you remove something by mistake, you will not be able to recover it. So it's not like the recycle bin in Windows where you have an option to get it back. Be very careful with what you remove. Just another reminder, if you want to copy folders, normally the command would be cp, as I've shown you already. But if you want to copy folders, you have to put a flag called cpr. For example, system, if I want to copy it into system 2, that's it.

So as you can see here, I have a system and I have a system 2 folder. And again, if I want to remove that folder, I have to always pass in the R flag. But in this case, I've passed in the F, which is horse. But I can pass in the remove R flag and I can get rid of system 2. That's it. It's disappeared. Or I can move directories. As we've seen before, copy just copies the directory. If I want to move system to system 2, as you can see, system has been replaced with system 2, which means that move is basically like a rename command if you're doing it in the same folder.

So I'm just going to go and rename it back. Of course, if I move it to another folder, then it's a direct move command. That is, I'm just moving without copying. So we've done move as well. The last command that you should know is make directory. Make directory test. And you can see that there is a test directory that's been created. So this is a simple create directory command. So you shouldn't be worried too much about this. Okay, great. So I hope you've got an introduction to Linux and the commands that we'll be needing to navigate through most of it.

The rest of the commands I'll describe as and when we need them. Of course, I'll give you an introduction to any additional commands we may need. Okay. So as you've seen before, this is the terminal of a Linux OS. This is the terminal of Ubuntu 2004 that we have here. It's probably not visible. If I can show you, no, it's not visible. But this is an Ubuntu 2004 terminal. I recommend using a Linux OS like Ubuntu greater than 18.04. So 18.04 is the version of Ubuntu.

Any version greater than this version is okay for this course. As I've explained to you before, we will prefer building Openform from source, which means that we will be pulling the Openform code and then building the code right into the terminal. For example, let's navigate to openform.com. This is the version as I've referred to that we'll be using for the entirety of this course. So it's the ESI OpenCFT version. So you're going to go to download, and then you're going to look at the various options that are available to you.

So as I said before, it could be Linux binary, which are basically binary files that you can directly install without compiling. It could be Windows WSL, and it could be source. Windows WSL is going to redirect you to source, basically. So we're just going to look at source first. Right. So what is described here? So it's giving you two tar balls that you have to... So these are basically like zip files, but for Linux operating systems. Well, not necessarily, but very often used. So you have to take the tar balls, and you have to download them into the folder that you use.

Once you've downloaded it, you can use the command tar, which you see here. So tar is basically like an unzip command. So along with this flag that you have here, it will unzip the command into a folder, which in this case would be OpenForm version 20 or 6. So it will create a folder. Same case for third party, it will create a folder with this name, and then you will be able to compile the code present inside this folder. That is the goal. I'm not going to go into detail about this now.

We'll come back to this later, but this is the general procedure about installing any source code into your system, especially for OpenForm. In the case of OpenForm, we'll have to source the bash HRC file. So as you can see here, this is the bash HRC file. What is this? So as you can see here, this is a terminal. This is called a bash terminal. So we check out a home directory, which is represented by the stilt sign, and we try to open a bash file. So it is this mess of material that you have here, which are a range of commands that are loaded by the terminal once it opens.

So these are things that are important to the terminal that need to be loaded. So in this case, whenever you download something that has a bash RC file of its own, you'll have to source it. By source, it means that everything from that file is loaded onto the terminal. For example, if I want to do that, if I want to source OpenForms file, I will just do OpenForm version 20 or 6, press R and bash RC. That's it. So I've sourced all the OpenForm environment variables and everything OpenForm requires to set up an OpenForm environment into my bash HRC terminal.

That is what it means basically. But this will come to later. We'll show you how to do this exactly. So if you're going to install OpenForm by source from source, I recommend and you have to have the dependencies of OpenForm installed. So the dependencies are basically everything that OpenForm needs to install and compile properly. The basic command for this is sudo apt-get update. This command basically gathers All the repositories where packages are stored. Now, Ubuntu needs packages to operate just like the ones here. These are all packages that Ubuntu will install into its system with this command. So it needs to first update as to where it's getting these packages from. So you usually run a command like this. You enter your password. Right. So it gathers all the repositories from which packages can be downloaded. And then you run these install commands.

I already have these packages installed in my system, so I won't run them again. But these are the commands you need to be copying and pasting into your terminal. td, openform. So at the end, once you've extracted everything, you will get this folder, which is openform version 20 or 6, as we discussed earlier. So this is what you'll see once you have extracted everything. All you need to do is run this command, all wmake. Once you do that, openform will start building. It'll start compiling. And then you just have to wait for a few hours depending on how many cores you run your all wmake command on.

You don't have to worry about the particulars of all this. We'll go into detail much later. This is just for you to set it up. So this is the golden command. This is all you need to execute to get ahead. Before we go into installing openform, I'm sure you're wondering where I got this big black screen from. This is basically essentially a Windows terminal, which I'm using to load my Ubuntu into. So this becomes my Windows subsystem for Linux. For example, when I open it, this is a basic PowerShell terminal. PowerShell is the advanced terminal that is present on Microsoft Windows.

And the only thing I have to do then is press this, which loads my Windows subsystem for Linux. And the moment my WSL is loaded in, you can see that now I have a bash terminal, which is indicative of a Linux distro. But how do I get this? Isn't that the big question? So this link is more than sufficient to guide you through what you need to do to be getting WSL. It has everything. So I'm not going to go into detail and waste your time by telling you step by step what is required, because this has everything.

We're going to scroll through that link and see how and what is required. So this is the link that I linked you to in the PowerPoint. What is required of you is you have to enable the Windows subsystem for Linux. So this feature must be enabled inside your Microsoft Windows operating system. So you go into PowerShell, which is what I showed you before, or it will probably look a bit different if you don't have the newest version of Windows. Right. So I just copied and pasted this command and executed it here.

I haven't run this as administrator. That's why it's telling me I do not have the permission. But that's what you need to do. And I've already installed it, so I don't need to do it twice. But you need to open Windows PowerShell with administrator and just run this command. It will enable the subsystem for Linux. Then the rest of the commands show you how to update to something called WSL2. Now, WSL1 or the normal Windows subsystem for Linux was developed a few years ago, but it just isn't as quick.

It isn't as quick at reading and writing from disk. And so when you're actually doing simulations, it can mean a big lag in terms of the performance you want from a simulation. So the change that Microsoft has introduced over the last year is WSL2. So WSL2 is the new virtual machine based Linux subsystem that actually is much, much faster than WSL. All you need to do is actually enable this, but it's not often that easy. Well, first things first, you will have to check what version of Windows you have.

To do this, you can type WinWir. You just need to type WinWir on your search bar. So this will tell you the version of Windows you have. So as you can see, I have the 2004 version of Windows. So in my case, this is compatible to Windows subsystem for Linux 2, which requires a certain version of Windows. For example, it requires version for X64 systems, which is actually my case. It requires version 1903 or higher. So you'll have to check Windows version by typing WinWir and then find out what version of Windows you have.

And if it is indeed version 1903 or higher, you can upgrade to WSL2, which is pretty simple. You need to just run by the steps that they've given here. You have to enable the virtual machine platform by pasting this command, just like I pasted the other command in your PowerShell. You have to download the kernel update for WSL2 and then just set WSL, the default version to WSL2, which is what I've shown you here. So at the end of it, if you actually have the correct version of Windows and then you can set it to the correct default version of WSL, voila, you'll have WSL2, which is what is recommended for this course.

But you can obviously run the things that we've shown you on WSL as well. It'll just be a little bit slower. We'll deal with the next steps in terms of installing your operating system and looking through an OpenForm case file in the next session. So at the end of it, we'll be able to install your operating system and install your operating system and install your operating system and install your operating system.

Want the rest of Introduction to OpenFOAM Development?

Get the full course syllabus and fees.

The full course is paid (₹40,000). We'll send the syllabus and call you back within one working day.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.

Full course · paid

Unlock the full Introduction to OpenFOAM Development course

The remaining 46 lessons, mentor-reviewed projects and a certificate come with the paid course (₹40,000). Leave your details: we'll send the syllabus and fees and call you back.

Get the syllabus and fees

A counsellor calls you back within one working day.

By submitting you agree to our Terms and Privacy Policy.

Grow by Skill-Lync · free lesson

Start watching

Free, no payment. Leave your details once and every free lesson on Grow plays straight away. A Skill-Lync counsellor may call you about the full Introduction to OpenFOAM Development course.

By submitting you agree to our Terms and Privacy Policy.

Talk to a career counsellor

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.