Using ChatGPT with Linux

z00s@lemmy.world to Linux@lemmy.ml – 51 points –

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.

61

You are viewing a single comment

You can't escape people pumping the AI bubble anywhere. Fuck off. I don't want your subscription and if I want to know how shit works I can read the source code.

I'm guessing for you it's number 3.


The high rate of gatekeeping in the Linux community can be attributed to several factors:

  1. Expertise and Complexity: Linux, with its technical complexity and steep learning curve, can foster environments where expertise is highly valued. This can lead to some individuals using their knowledge as a form of power, controlling access to information and resources.

  2. Cultural Heritage: The origins of Linux in a niche, technically proficient community have perpetuated a culture that prizes deep knowledge and expertise, sometimes at the expense of inclusivity.

  3. Identity and Status: For some, their identity and status within the community are closely tied to their perceived expertise and control over certain aspects of the technology, which can lead to gatekeeping behaviors to protect their standing.

  4. Fear of Dilution: There's often a concern that broadening the community might dilute its values or lower its standards, prompting some members to gatekeep to maintain a perceived purity or quality.

Efforts to address these issues often involve community-led initiatives to foster a more welcoming and inclusive environment, alongside mentorship programs to help newcomers navigate the community more effectively.


I apologise for the language but I am fed up with this shit.

I don't think promoting OpenAI/Microsoft services is very compatible with the open source/free software ethos.

OpenAI pretend to be a non-profit but are controlled by billionaires and Microsoft. I am not going to take up a subscription and have my personal data mined by a company so I can have the arch wiki and man pages developed with millions of hours of volunteer labour served back to me.

I used to attend Linux/free software conferences decades ago and there would always be that one person who thought Facebook or Google were brilliant and that adding everyone's lives and personal data to gmail or facebook was totally fine because the APIs were cool and big companies are totally ethical, "Don't be Evil" etc. I thought they were foolish then and I think time has shown they are even more foolish now.

Every news site and forum I go to, even very non-technical ones, has people appear out of nowhere exclaiming with enthusiasm how OpenAI/copilot solved all their problems in great detail. Whether they are genuine or are just on the hype train created by bots and paid influencers I am at my breaking point with this shit. It is worse than the crypto bros with their NFT monkeys and get rich schemes. It has nothing directly todo with Linux or open source software. I escaped reddit to avoid all the influencers and people peddling shit but it is here as well and people can't see it for what it is.

Lol you certainly earned what they said with this brilliant fucking reply.

1 more...