You probably have already heard about ChatGPT, the AI chatbot that took over the world faster than a Skynet apocalypse.

There is no doubt that OpenAI researchers have achieved great progress in this model. However, there has been a lot of marketing hype about ChatGPT that caused it to become a buzzword in the tech world; people claiming it would replace Google, or that it’s gonna take over the entire medical industry… bunch of nonsense being spread by self-proclaimed “influencers” to drive clicks and views.

The technology is great and AI is indeed the future, but we still need a lot of developments and progress points to get it there in our everyday lives.

5 Ways to Make use of ChatGPT on Linux

However, there are indeed legit use cases where ChatGPT could be a fantastic companion that can save you a lot of time. And together, we will be seeing 5 ways through which a Linux user can make use of ChatGPT.

1. Ask it to get a Linux Command

You can pretty much ask it to bring you the command needed to do any task on your Linux OS, and it will probably get it correctly.

In this example, we asked ChatGPT to bring us a command that removes all installed kernels on our Ubuntu installation with apt package manager, except the current one, and it didn’t disappoint:

Pasted image 0

The command is correct and pretty safe to run, if you would like to:

sudo apt-get remove $(dpkg --list | grep linux-image | awk '{ print $2 }' | grep -v `uname -r`)

Only exception where it shouldn’t be run on could be the Pop!_OS distribution; because removing linux-image-generic or linux-generic packages could lead to the removal of linux-system76 package, which is – apparently – the dummy package System76 uses to control the recommended kernel version for its users (your current kernel won’t be removed; but you may get stuck on it forever and not receive updates).

Other than such situations, yes, it is actually correct.

2. Check Where Software Configuration Files are Stored

Sometimes it may be the first time you start to learn a new software on your Linux system, or how it works, and you may be wondering where the software’s configuration files are stored.

Of course, a quick Google search can show you the result as well, but why bother with the nastiness of web results, when you can just ask a bot like ChatGPT?

Here, we asked it for the location of GDM settings (which is the display manager responsible for the login screen and session management on GNOME desktop for Linux) and it correctly brought the settings directory:

Pasted image 0

It also included a small tip on how to change the login screen background… Nice!

3. Bring the Installation Command for a Software With Flatpak

There are many ways a Linux user can go through to install software on his/her system, and one of them is Flatpak.

Flatpak is a universal software distribution channel that works on all Linux distributions. It has a main community repository that hosts hundreds of open source applications, called Flathub.

We asked ChatGPT how it would be possible to install Steam from Flathub using Flatpak? And it directly brought the needed commands for us to run:

Pasted image 0

These might sound like simple and straightforward commands, but we wouldn’t have known the flatpak install flathub com.valvesoftware.Steam command without checking the website, because the package name is not that straightforward (e.g how would you know it is valvesoftware and not valve?).

It also pointed us to the fact that the Flatpak version of Steam may not be in the same performance level as the native Steam package coming from our Linux distribution (press X to doubt, but that could be true because of the library differences).

4. Teach You What’s the Job of a Filesystem Directory

You can also just ask ChatGPT about the job of a Linux filesystem directory, so that you learn what it does on your system.

For example, we asked it about the goal of the /usr/libexec directory that exists on most Linux distributions? And it provided the following detailed answer:

Pasted image 0

Indeed, it is fully correct.

5. Create a Shell Script With Cron Job According to your Needs

One of the greatest areas where ChatGPT can aid a Linux user is Shell scripting.

You can ask it to create any Shell script for you, and if it is not complicated or rarely talked about on the possible training dataset (e.g the public internet prior to 2021), then it can create it for you successfully.

Here we asked it to create a Shell script that removes all files from our “Downloads” folder automatically after they are one week old. We also wanted to use it as a Cron job, so it provided us with the needed syntax:

Pasted image 0

Here is the Shell script code:

#!/bin/bash

# Set the path to the Downloads folder
downloads_folder=~/Downloads

# Find all files in the Downloads folder that are older than one week
find $downloads_folder -type f -mtime +7 -delete

And here is the crontab line:

0 3 * * * /path/to/script.sh

Yes, as you can expect, it is entirely correct and you can run it (if you wish to) to do the same task on your system.

Conclusion

As you have seen so far, there are many legit use cases where a Linux user can actually make something out of ChatGPT.

The hype about ChatGPT and AI in general is indeed very widely spread, and sometimes it becomes a hysteria to drive up views and clicks for “influencers”, but that does not mean there are no real use cases for the technology.

It would be great if ChatGPT becomes fully open source just like Stable Diffusion from Stability AI, so that it can be used and integrated everywhere.

Perhaps one day it may become a simple Linux command that can be invoked any time instead of the default Bash interpreter! Time will tell…

Subscribe
Notify of
guest

2 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments

Newsletter

Enter your email address to subscribe to our newsletter. We only send you an email when we have a couple of new posts or some important updates to share.

Recent Comments

Open Source Directory

Join the Force!

For the price of one cup of coffee per month:

  • Support the FOSS Post to produce more content.
  • Get a special account on our website.
  • Remove all the ads you are seeing (including this one!).
  • Get an OPML file containing +70 RSS feeds for various FOSS-related websites and blogs, so that you can import it into your favorite RSS reader and stay updated about the FOSS world!