this post was submitted on 03 Oct 2023
27 points (96.6% liked)

Linux

48157 readers
614 users here now

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

Related Communities

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

founded 5 years ago
MODERATORS
 

Question 1:

I want to copy a file to clipboard, how can I do this using cli? I have this file "home/$USER/example.svg" and I want to copy it to clipboard without manually doing it. I tried to ask ChatGPT to help me with it, it didn't :(

I am pretty sure there is a copy to clipboard option in Thunar and Nemo file managers but I don't know how to use it. My google searches have been so far fruitless. Please help me copy it?

Use Case: I want to copy it and paste it to Obsidian.md file. Obsidian is a text manager which supports Mathjax but not Latex, so in order to get a semblance of greater Latex support, I want to convert tex to svg and copy it from the folder to clipboard (without opening the folder) and then paste it.


Question 2: Do you have a anonymous file sharing service you use to share videos and images? If so, what is it? imgur helps with images and videos lower than 1 mins, but above that, it won't accept uploads.

Also, bashify.io and emalm.com seems to be ok ok in this regard. The problem is, I don't know enough about them to trust them. mehh....

Use case: If I have a problem with my system, I want to share the video of the problem I am facing to Linux forums and I want it to be instantly accessible


Question 3: Is it ok to move random file script you find on the internet into a root folder which is included in your $PATH variable?

https://github.com/tremby/imgur.sh

I was trying to use this script and it is my understanding that if you have a script in a folder included in your path variable, then you don't have to actually specify the path to run it. You can just give it's name and press enter to execute it.

am I right so far and should I move that script into my path variable folder? What are the risks?

top 16 comments
sorted by: hot top controversial new old
[–] [email protected] 8 points 1 year ago* (last edited 1 year ago) (2 children)
  1. I think file managers just put a file name into the clipboard, not the actual file. It's also worth noting that the clipboard is a concept of X11/Wayland. There may be CLI tooling, but it will only work as long as there's a graphical environment running. I any case, have you tried putting a file reference, i.e. ![](/path/to/file.svg), into your .md file? I don't think you can put an SVG directly into Markdown anyway (I may be wrong on that).

  2. People seem to use https://catbox.moe/

  3. I'd edit PATH rather than moving a random script to root. The convention is to put a directory ~/bin into your home and add that to PATH.

[–] [email protected] 6 points 1 year ago (2 children)

The convention is to put a directory ~/bin into your home and add that to PATH

Wasn't it ~/.local/bin?

[–] [email protected] 1 points 1 year ago (1 children)

/.local/bin already exists. I am pretty sure it was created by some other application. So, that's it, I can add it there and give it execution privileges (isn't that what Stalin had ;)

[–] [email protected] 2 points 1 year ago

I am pretty sure it was created by some other application.

That's why I think that's the convention lol

[–] [email protected] 1 points 1 year ago* (last edited 1 year ago)

This is the first time I am hearing of it, so far I was only aware of .local/share. Conventions being what they are, there may be multiple. :) However, I find it impractical to use a hidden directory for the purpose.

[–] [email protected] 5 points 1 year ago

I any case, have you tried putting a file reference, i.e. , into your .md file? I don’t think you can put an SVG directly into Markdown anyway (I may be wrong on that).

Thank you very much! this is what I did and it works.

[–] [email protected] 3 points 1 year ago (1 children)

FYI there are Obsidian community plugins that support LaTeX

[–] [email protected] 2 points 1 year ago (1 children)
[–] [email protected] 2 points 1 year ago* (last edited 1 year ago) (1 children)

Just go into settings > community plugins and search for LaTeX. I can't make specific recommendations since I don't use LaTeX, but I saw there were a few.

[–] [email protected] 3 points 1 year ago

I installed some plugins right now, let's see how they work, but for now, svg works like magic for me. I didn't know you could do this using community plugins so thank you for letting me know.

[–] [email protected] 2 points 1 year ago* (last edited 1 year ago) (1 children)

For question 1: idk how to convert tex to svg, but maybe there's a program called tex2svg . Often programs are named like that. However, if you want the contents of a file (which is basically markup text) in the clipboard from CLI you would use on Xorg X11 xclip or xclipboard like so:

xclip -selection clipboard -in < myfile.txt

... or on Wayland wl-copy from wl-clipboard like so:

wl-copy < myfile.txt

For question 3: after you have reviewed the potentially dangerous script, you would move it to a directory for non distribution files, eg. /usr/local/bin/ if it is for all users on your system. You would add that path to the PATH environment variable for all users who need it, but maybe better not for root. I mean you can, but make sure the permissions don't allow non-root users to write or replace the file/dir so nobody can use it to escalate their privileges.

[–] [email protected] 1 points 1 year ago

hmm, thank you!

[–] [email protected] 2 points 1 year ago

Regarding 2: I don't think I've ever seen this, in what situation would you rather share a video then a description of the problem + your log files?

Regarding 3: Should be fine as along as the script itself isn't harmful. Which you can really only answer by reading the script. (And funnily enough, you'd find an answer to your first question inside this specific script...).

[–] [email protected] 1 points 1 year ago

Regarding 1 there are solutions for a terminal emulator, but are you really are what you really want is the clipboard? You can directly push whatever you have into whatever file, outside of extreme circumstances.

[–] [email protected] -1 points 1 year ago (1 children)

Have you tried Bing Chat? It uses GPT 4 and has access to the internet. I ran your question through and it gave me this.

[–] [email protected] 2 points 1 year ago* (last edited 1 year ago)

and why were you downvoted :')

can't people just explain what they disagree with instead of downvoting?

edit: You could use Bing ChatGPT on firefox? I didn't know that. it didn't give me the desired result, but Thank you