Use the following command to create a new file in /usr/bin directory and launch the gedit.
sudo gedit /usr/bin/extract-file
Copy and paste the following code in gedit and save the file.
if [ -f $1 ] ; then
This is essentially the same code but instead of using it as a function, we’ll use it as a script.
Now we’ll add the executable bit to the file:
sudo chmod +x /usr/bin/extract-file
You can now use the following command in terminal to extract (almost) any kind of archive.