How To Install binfmtc on Ubuntu 22.04

In this tutorial we learn how to install binfmtc on Ubuntu 22.04. binfmtc is Execute C program as script

Introduction

In this tutorial we learn how to install binfmtc on Ubuntu 22.04.

What is binfmtc

binfmtc is:

Linux binfmt_misc handler for C, C++, Assembly languages, Pascal, Fortran, Java(GCJ).

Using the binfmt_misc interface, binfmtc allows users to seamlessly execute C source code as if they were scripts.

Includes example utilities realcsh.c, realksh.c, which are for your real C scripting pleasures.

There are three ways to install binfmtc on Ubuntu 22.04. We can use apt-get, apt and aptitude. In the following sections we will describe each method. You can choose one of them.

Install binfmtc Using apt-get

Update apt database with apt-get using the following command.

sudo apt-get update

After updating apt database, We can install binfmtc using apt-get by running the following command:

sudo apt-get -y install binfmtc

Install binfmtc Using apt

Update apt database with apt using the following command.

sudo apt update

After updating apt database, We can install binfmtc using apt by running the following command:

sudo apt -y install binfmtc

Install binfmtc Using aptitude

If you want to follow this method, you might need to install aptitude first since aptitude is usually not installed by default on Ubuntu. Update apt database with aptitude using the following command.

sudo aptitude update

After updating apt database, We can install binfmtc using aptitude by running the following command:

sudo aptitude -y install binfmtc

How To Uninstall binfmtc on Ubuntu 22.04

To uninstall only the binfmtc package we can use the following command:

sudo apt-get remove binfmtc

Uninstall binfmtc And Its Dependencies

To uninstall binfmtc and its dependencies that are no longer needed by Ubuntu 22.04, we can use the command below:

sudo apt-get -y autoremove binfmtc

Remove binfmtc Configurations and Data

To remove binfmtc configuration and data from Ubuntu 22.04 we can use the following command:

sudo apt-get -y purge binfmtc

Remove binfmtc configuration, data, and all of its dependencies

We can use the following command to remove binfmtc configurations, data and all of its dependencies, we can use the following command:

sudo apt-get -y autoremove --purge binfmtc

References

Summary

In this tutorial we learn how to install binfmtc package on Ubuntu 22.04 using different package management tools: apt, apt-get and aptitude.