csharp command not found

In this troubleshooting guide we learn how to fix csharp command not found error message

Introduction

When you run more command in linux terminal / console, you get the following error message

csharp: command not found

or when using sudo you get the following error message

sudo: csharp: command not found

Solutions to csharp: command not found

How To Fix csharp: command not found in Ubuntu / Debian / Kali Linux / Raspbian

In Ubuntu csharp is provided by mono-csharp-shell package.

mono-csharp-shell is:

Mono is a platform for running and developing applications based on the ECMA/ISO Standards. Mono is an open source effort led by Xamarin. Mono provides a complete CLR (Common Language Runtime) including compiler and runtime, which can produce and execute CIL (Common Intermediate Language) bytecode (aka assemblies), and a class library.

This package contains the interactive C# shell named csharp. csharp permits dynamically evaluating C# statements, and can be used for writing scripts or testing code fragments. For examples and a brief overview of the commands see: http://www.mono-project.com/CsharpRepl

To fix this problem, we can install more using the command below.

sudo apt-get -y install mono-csharp-shell

This command might take some time to finish depending on your machine internet connection.

You can also use apt command to install mono-csharp-shell.

sudo apt -y install mono-csharp-shell

Or if you have aptitude installed you can use the following command.

sudo aptitude install mono-csharp-shell

Summary

In this tutorial we learn how to fix csharp command not found error in Ubuntu / Debian / Kali Linux or Raspbian distribution.