Last night I was nearly tearing my hair out trying to get a crappy inkjet printer installed when I turned to ChatGPT for help; 5 minutes later it was done (driver issues).

I realised that I use it a lot for all sorts of things but haven’t really seen any posts on here about it, and was wondering if other people do the same.

I’ve used it to create bash scripts, write small, niche python programs (eg sort photos into separate folders based on their orientation), and create cron jobs among other things.

In particular, I find it useful when I want to use a command line program that has a complicated set of options / syntax, but I might only ever want to use it once, or very infrequently. So I tell it what I want to accomplish, and ask it to give me the correct command to run with the options I specify in plain language.

Example:

User

Give me the correct rsync command to recursively copy all files in /home/user/Documents that are image files of any type but were created more recently than 1/1/2024. The destination is /home/user/foo

ChatGPT

rsync -avm --include='*/' --include='*.jpg' --include='*.jpeg' --include='*.png' --include='*.gif' --include='*.bmp' --include='*.tiff' --include='*.svg' --exclude='*' --prune-empty-dirs --min-age=$(date -d '2024-01-01' +%s) /home/user/Documents/ /home/user/foo/

User

Break down the command and explain each part of it in dot point format.

ChatGPT

- rsync`: Invokes the rsync program, which is used for efficiently transferring and synchronizing files across systems or within a system.

  • -avm:
    • -a: Archive mode, which preserves permissions, symlinks, modification times, group, and ownership. Implicitly includes recursion.
    • -v: Verbose mode, which provides detailed output of what rsync is doing.
    • -m: Prune empty directory chains from the file-list.
  • --include='*/': Include directories themselves, which is necessary for recursion.
  • --include='*.jpg' --include='*.jpeg' --include='*.png' --include='*.gif' --include='*.bmp' --include='*.tiff' --include='*.svg': Include files that match these image file extensions.
  • --exclude='*': Exclude all other files that do not match the previously stated include patterns.
  • --prune-empty-dirs: Exclude empty directories that result from the inclusion/exclusion pattern.
  • --min-age=$(date -d '2024-01-01' +%s): Exclude files that are older than the timestamp for January 1, 2024. This uses date -d to convert a date string into a timestamp, which rsync uses to filter files.
  • /home/user/Documents/: Source directory from which files are being synchronized.
  • /home/user/foo/: Destination directory to which files are being synchronized.`

It’s also really good for explaining concepts / commands in plain language.

It’s like having a 24 hour on call Linux expert :)

#Things to note:

- Get the subscription. ChatGPT 3.5 is pretty useless. ChatGPT4 is fine, but I’m pretty sure you need the subscription to access it.

- Give it pre-instructions. I have told mine what distro, what shell I’m using and the make and model of my laptop. If you have a subscription you can add these as permanent pre-instructions, so to speak. That way it will be much more likely to give you correct answers.

- It’s not magic In order to get what you want, you have to be able to ask the right questions. It will boost your ability but won’t turn you in to a 1337 haxx0r

-Ask questions As always, don’t run any commands that you don’t understand. Ask it to break down any commands it tells you to run if you don’t understand them.

-Sometimes it goofs For various reasons, sometimes it will ask you to install a package that no longer exists, or will give you a command that doesn’t work. When that happens, I just feed the error message back into ChatGPT and it usually is able to correct itself.

-Ask “Is there a better or easier way to do this?” This is probably the most valuable question I’ve found to ask chatGPT. Sometimes it gets so far in the weeds looking for a solution to a problem that you need to pull back and start fresh.

47 points
*

Chatgpt does not know truth. It does not know if the info it provides is true. It does not know if the code actually works. It just concatenates strings based on probability. You may be lucky or you aren’t. The easier the task, the more likely it’ll succeed. But a low difficulty is no guarantee for success.

It is great for layouts, structure and for the basic concept. “For loop in fish”. But it may struggle to convert a video from x264 to av1 with ffmpeg. It depends on info that’s provided online. If it uses misinformation, then that’s in there as well.

The command you got is just wrong. What about avif, jxl or most other image formats? Use it, but think.

permalink
report
reply
1 point

Note that sometimes Ai models check if code works by executing it. For example gemini can python function and execute it to write down the results

permalink
report
parent
reply
0 points

Nice

permalink
report
parent
reply
-29 points
*

I hear this over and over but none of what you say actually matters.

It’s not luck if it gives accurate and detailed answers for almost every question that actually compiles and works.

I think the difference in opinion comes down to what you use it for. In some areas I imagine it will just hallucinate. But in others, such as coding, it’s often almost 100% correct and a magic tool for learning and saving soooo much time.

permalink
report
parent
reply
-30 points
*

I was wondering how long it would take the gatekeepers to show up. The command works, and is perfectly fine. If I had any uncommon formats, I would tell gpt to include them.

permalink
report
parent
reply
17 points

I’m quite sure it won’t be long until some bad practice spreads like this. Giving clueless “Linux pros” top advice on how to enable a back door.

LLMs can be poisoned and as datasets increase and complexity grows it will be harder to contain.

Cgpt works great for some stuff, but all you know is that someone somewhere wrote something similar. They are no better than Google in predicting what is good material and what’s wrong, and training is statistics.

permalink
report
parent
reply
-14 points

In order to poison a LLM, you’d need access to the training process, which is locked down by openai. Just posting false info on the net isn’t enough. GPT doesn’t simply repeat what’s already been written.

More than that though, you can find plenty of wrong and bad advice posted confidently by legions of Linux gatekeepers on any forum.

Anyone who has ever spent any time on stack overflow will tell you why they’d rather talk to an LLM instead of posting there.

permalink
report
parent
reply
15 points
*

Example that confirms that “Chatgpt does not know truth. It does not know if the info it provides is true.” or more like “It will spell answer that match your inquiry that sound correct even if it’s totally made up.”

https://chat.openai.com/share/206fd8e9-600c-43f8-95be-cb2888ccd259

Summary:

User
in `podman stats` you see BLOCK IO as a summary of hard drive activity.
how to reset the 

ChatGPT
To reset the block I/O statistics displayed by podman stats, you can use the podman stats --reset command.

User
Error: unknown flag: --reset

ChatGPT
Apologies for the confusion. It seems I provided incorrect information. The podman stats command does not have a built-in option to reset the statistics.

So once again, don’t be afraid to use it, but do your own research especially if following LLM could result in something breaking both in tech or in life.

permalink
report
parent
reply
-19 points

You left out the part where it then gave you the correct answer.

permalink
report
parent
reply
8 points

Here are some hallucination examples: https://github.com/giuven95/chatgpt-failures

permalink
report
parent
reply
3 points

Gatekeeping ain’t bad. It keeps the trash out.

permalink
report
parent
reply
-15 points
*

Then why are you here?

permalink
report
parent
reply
33 points

don’t run any commands that you don’t understand. Ask it to break down any commands it tells you to run if you don’t understand them.

You need to pay extra attention to this, as ML models will spit out commands and parameters that doesn’t exists if there was not enough examples in training dataset for that action. Especially with explain as it could just spit out totally wrong but “sounding good” explanation for parameter etc as it not always will tell the magic keywords like “typically” that indicate that it doesn’t have confidence as it’s “based on other similar command/knowledge”.

In your example it spit out:

 -m: Prune empty directory chains from the file-list.
 --prune-empty-dirs: Exclude empty directories that result from the inclusion/exclusion pattern.

which is actually exactly the same parameter with 2 different explanations, you can confirm this with man rsync

 --prune-empty-dirs, -m   prune empty directory chains from file-list

So the more edge case you have the bigger chance it will spill out bad results, but those new models are shockingly good especially for very common use cases.

permalink
report
reply
-8 points
*

Absolutely. And I would also add that the more critical the use case, the more work you should do to double check things. Don’t rely on gpt alone if you’re doing critical backups, for example. But if you just want a python program that sorts MP3s, then go ahead and give it a whirl.

permalink
report
parent
reply
26 points

Interesting post, but made me also think of this one : https://xkcd.com/1168/

permalink
report
reply
6 points

What I’ve always wondered about that one is: why bother forbidding Google but not ‘man tar’? 🤨

permalink
report
parent
reply
9 points

😀 After seeing the comic for the first time I thought that the “UNIX” ™ person simply could have gone for tar --help or tar --version as valid command to show off their “UNIX” skills and save all.

permalink
report
parent
reply
7 points

Also surely a lot of people would know tar -Create Ze Vucking File and/or tar -Xtract Ze Vucking File

permalink
report
parent
reply
3 points

I interpret “use a valid tar command on your first try” as not allowing to run other commands before the tar command.

permalink
report
parent
reply
1 point

Surely the bomb isn’t the only computer in the immediate area.

permalink
report
parent
reply
22 points

I’m not opposed at all to using LLMs for such purposes, however, please consider a solution that aligns with the values of GNU/Linux and the Free Software Movement. If you have sufficient RAM and a somewhat modern CPU, you can do inference on your very own machine, locally, with no connection to any external servers. And at very respectable speed.

permalink
report
reply
5 points

Serious question: Can running locally be as good as ChatGPT-4?

permalink
report
parent
reply
11 points

It’s worth doing anyway to get a sense of how computationally intensive it is. Then consider how many people ask for the daily fart joke and you get a sense of the environmental impact.

permalink
report
parent
reply
4 points
*

in terms of the quality of writing you can get models from 20GB at a similar level to GPT-4 (good for creative writing but much worse if knowledge of something is required)

the model I use (~20GB) would know what rclone is but would most likely not know how to use it

EDIT: now that I think about it is was based off of some benchmark. personally I wouldn’t say it performs at GPT-4 but maybe GPT-3.5

permalink
report
parent
reply
5 points

Which model is that? I tried several ones that were complete trash, then Mixtrail appeared and starting giving answers that are very basic but mostly factually correct. But none of these are even close to ChatGPT that I can rely on with writing scripts.

Don’t get me wrong, I’d rather not give them my data and money if there was an alternative. But for tech stuff we’re not there yet.

permalink
report
parent
reply
1 point
*

I am actually curious about that, would I need a high powered GPU? I’m running a refurbished Dell Optiplex with a very basic video card that I added

permalink
report
parent
reply
21 points
*

User: “ChatGPT, write me a script to clean up my hard disk on Linux”

ChatGPT: sudo rm -rf / 😁

permalink
report
reply
6 points

Squeaky clean 😅

permalink
report
parent
reply

Linux

!linux@lemmy.ml

Create post

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

  • Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.
  • No misinformation
  • No NSFW content
  • No hate speech, bigotry, etc

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

Community stats

  • 9.8K

    Monthly active users

  • 5.8K

    Posts

  • 162K

    Comments