How To Install shc on Ubuntu
Posted on April 1, 2023  (Last modified on May 20, 2023 )
3 minutes • 449 words
Introduction
In this tutorial we learn how to install shc on Ubuntu.
What is shc
shc is:
SHC is a generic shell script compiler. It takes a script, which is specified on the command line and produces C source code. The generated source code is then compiled and linked to produce a stripped binary.
The compiled binary will still be dependent on the shell specified in the first line of the shell code, thus shc does not create completely independent binaries.
shc itself is not a compiler such as cc, it rather encodes and encrypts a shell script and generates C source code with the added expiration capability. It then uses the system compiler to compile a stripped binary which behaves exactly like the original script. Upon execution, the compiled binary will decrypt and execute the code with the shells’ -c option.
There are three methods to install shc on Ubuntu. We can use apt-get, apt and aptitude. In the following sections we will describe each method. You can choose one of them.
Install shc Using apt-get
Update apt database with apt-get using the following command.
sudo apt-get update
After updating apt database, We can install shc using apt-get by running the following command:
sudo apt-get -y install shc
Install shc Using apt
Update apt database with apt using the following command.
sudo apt update
After updating apt database, We can install shc using apt by running the following command:
sudo apt -y install shc
Install shc 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 shc using aptitude by running the following command:
sudo aptitude -y install shc
How To Uninstall shc on Ubuntu
To uninstall only the shc package we can use the following command:
sudo apt-get remove shc
Uninstall shc And Its Dependencies
To uninstall shc and its dependencies that are no longer needed by Ubuntu, we can use the command below:
sudo apt-get -y autoremove shc
Remove shc Configurations and Data
To remove shc configuration and data from Ubuntu we can use the following command:
sudo apt-get -y purge shc
Remove shc configuration, data, and all of its dependencies
We can use the following command to remove shc configurations, data and all of its dependencies, we can use the following command:
sudo apt-get -y autoremove --purge shc
Dependencies
shc have the following dependencies:
References
Summary
In this tutorial we learn how to install shc package on Ubuntu using different package management tools: apt, apt-get and aptitude.