Running a programme with your system command line interface is nothing much of a work if you are familiar with the basics of a command line for your system. Using a command line is structure wise identical in both Windows and UNIX based operating systems like macOS and Linux. If you are into software engineering, computer engineering, tech, command line is a must know skill for you.
Navigate to your programme through a command line on Windows
Assuming you are already familiar with basic commands to navigate around directories, exploring directories etc, let’s now look at how we can run any programme via a command line. All you have to do is to first locate where the programme is, usually with an .exe (executable) extension, and simply type in the name of the programme and hit enter. Let’s try out an example.
Navigate to C:\Windows\System32 directory from your command line. Once you are inside this directory, run dir/p, this will show you the list of the content on the page at a time. This is not efficient but extremely useful when you will be looking for a file and the directory is filled with thousands of files. There are other efficient ways of detecting or locating file but stick with the playground for now.
Then, you have to press any key or space bar to get the next page of contents. Do this and look for the file name mmc.exe. Note that all sort of .exe and .com files are executable programmes. Once you detect mmc.exe, type in mmc and hit enter. To run an executable programme you do not need to type in the extension. Once you hit the enter you will see the Microsoft management console being opened up for you.
Start a programme through a command line on macOS and Linux
Now how would you run a programme in macOS and Linux? Not everybody is using Windows for some tasks or preference in general. Running a programme in these UNIX operating system is a little work out at first. One of the top reason for that is, on these operating systems, there is no .exe extension programmes. The way it works is any sort of file, be it a compiled code or a simple text file, you can check executable from its properties. That is to say, right-click and select properties of the file, look for execute and check the checkbox to allow executing file as programmes. Thus, running a programme on macOS and Linux is really up to you to verify and make the programme a programme.
Since there is no .exe , .com file that you will detect as executable programmes on mac and Linux, they do help you with that from the command line. There is a fun fact about mac and Linux is that, every version of these operating systems comes in with a built-in colour-coded command line unlike Windows. You can still get this colour coded command line on Windows as well but for that you have to burn extra fuel to make it happen on Windows. Well, that is for another time.
With the command line on mac and Linux, you will be shown the number of executable programmes coded in greenish colour and another unique colour will be given to any file that is executable by anyone. This is an orange kind of a colour. Also you can configure your terminal/ command line for different theme as well.
All macOS and Linux systems have two different file types, one is built-in and the other executables. Built-in programmes are the ones that come in with the operating system, like ls, mkdir, rm etc which is one of the most used types of commands. Executable programmes are the ones that did not come in built-in with operating systems but any sort of third party applications you may have downloaded from somewhere.
Possible issues
One of the thing you may stumble upon trying to run a third party programme on Linux is that, the moment you will try to run the programme, the programme cannot run. Simply because Linux does not find it. No matter how much you try to run, even though you are in the same folder where the programme is, you do not see it in the command line.
This is because of the operating system architecture Linux has. Linux very first, look through the folders called path the moment you run a programme. You can see the path with the echo $PATH command. This will show you the series of folders Linux go through to run a programme. To run a programme in Linux command line, you need to type a dot-slash and the programme name. Something like, this – ./programme and you are good to go.