this post was submitted on 15 Jan 2025
36 points (97.4% liked)

Linux

49393 readers
2029 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
 

We all know this. We need to do a specific task and with the help of the internet we find a specific tool alongside command line parameters to do the job right from the shell.

What is a good way of collecting/documenting these snippets on your own for future reference and use? Just a text file in the home folder?

all 26 comments
sorted by: hot top controversial new old
[–] kionite231@lemmy.ca 16 points 2 weeks ago

There is a command called tldr. it's works similar to what you have described.

[–] Deckweiss@lemmy.world 10 points 2 weeks ago (1 children)
[–] Localhorst86@feddit.org 3 points 2 weeks ago

Thanks, this looks like the tool I was looking for. Being able to store the snippets alongside a description sounds perfect

[–] CrabAndBroom@lemmy.ml 8 points 2 weeks ago* (last edited 2 weeks ago) (2 children)

I do mine in Obsidian, I just have a folder for 'computer notes' and whenever I figure out a new thing I drop it in there.

Some stuff I use often I set up as an alias too. So for example I have alias yt='yt-dlp -f "bestvideo[ext=mp4]+bestaudio[ext=m4a]/mp4"' for my most commonly used yt-dlp settings, so now I can just do yt [URL of video] to quickly download something from YouTube. Or alias rs="sudo rsync --ignore-existing -rav" for my rsync settings for a specific backup folder I copy a lot.

[–] Dragonish@lemmy.dbzer0.com 2 points 2 weeks ago

In my obsidian i use the daily note feature heavily and if i come across a useful snippet or info i will add a tag and content like below. I found tagging to be helpful because i do not have to spend effort up front putting the file in the "right" folder. I have cleaned some of these up by removing them from my daily notes and into dedicated notes, but only after i have collected quite a few for a specific language or tech and there is a need for me to put more structure around the information.

#codesnippet/ Write a description to help me remember what this is for

[–] Cris16228@lemmy.today 1 points 2 weeks ago* (last edited 2 weeks ago) (1 children)

I prefer my -f "bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]/best" --concurrent-fragments 12 --throttled-rate 100K -o "%(uploader)s/%(playlist_title|)s/%(playlist_index&{} - |)s%(title)s.%(ext)s"

Since it saves it based on the channel and if is a playlist, it makes a folder based in that

  • Channel
    • Playlist (if is a playlist, otherwise save inside channel)
      • - title.extension (if not a playlist, it doesn't add the -

Not sure if --concurrent-fragments 12 --throttled-rate 100K does actually something.

I'm interested in the rsync part for backups, do you have a good guide or video for that? Thanks

[–] CrabAndBroom@lemmy.ml 2 points 2 weeks ago* (last edited 2 weeks ago) (1 children)

I’m interested in the rsync part for backups, do you have a good guide or video for that? Thanks

I don't really have a guide or anything for it to hand, but essentially what that alias is doing is:

  • rsync = running rsync
  • --ignore-existing = as you might have guessed, this tells rsync not to copy a file if it already exists at the destination.
  • -rav = additional arguments. r = recursive, IE also copy subfolders. a = archive mode, preserves things like symlinks etc. and v = verbose, just tells you extra info about what's going on.

So with that alias, I can just type rs [target folder] [destination folder] and it'll copy it across exactly as it is, ignore anything that's already there and tell me precisely what it's doing.

[–] Cris16228@lemmy.today 1 points 2 weeks ago (1 children)

What if I added my own local server in dolphin? Can I use it's path to sync a local (Linux) folder to the server?

[–] CrabAndBroom@lemmy.ml 1 points 2 weeks ago

Hmm, I have no idea to be honest! I just back up to an external drive. It does look like you can rsync to anything you have SSH access to, but I've never tried it personally.

[–] superkret@feddit.org 5 points 2 weeks ago
[–] johannes@lemmy.jhjacobs.nl 2 points 2 weeks ago

I'd try a wiki of some sorts. Personally we collect a lot of stuff in our bookstack instance. Recently we're looking into tools that can save a page for offline usage.

[–] HubertManne@moist.catsweat.com 2 points 2 weeks ago

just alias them.

[–] myrmidex@slrpnk.net 2 points 2 weeks ago

If you're into self hosting, Bytestash is very nice!

[–] wewbull@feddit.uk 2 points 2 weeks ago

Just learn the basic POSIX commands (there's probably 20-25) and understand pipes. Then you can do pretty much anything you're likely to need from the command line. Sure, there will be more modern flashy friendly tools that come along. Some you'll integrate into what you do. Some won't have enough staying power to remember.

No notes. No googling or LLM. Just don't skip to the end.

[–] danekrae@lemmy.world 2 points 2 weeks ago

I use a text file and have an alias to access it quickly.

[–] harsh3466@lemmy.ml 2 points 2 weeks ago

I take notes in Joplin with the command and a breakdown of any flags, parameters, etc, and what they everything means/does.

[–] redxef@feddit.org 2 points 2 weeks ago

I just keep my history file around and have set it up to never truncate. Then grep or ^R.

[–] corvus@lemmy.ml 2 points 2 weeks ago* (last edited 2 weeks ago)

commands.txt every command with a one line description and a separator.

[–] PseudoSpock@lemmy.dbzer0.com 2 points 2 weeks ago

I push them up to my self hosted gitlab server.

[–] nycki@lemmy.world 2 points 2 weeks ago

i use a joplin notebook. its like a private wiki, and it works on android too.

[–] lime@feddit.nu 1 points 2 weeks ago* (last edited 2 weeks ago)

i usually get to where i'm going using man pages rather than copying wholesale from the web, but when i find something worth saving i usually put the snippet in its own script in ~/.local/bin, which is in my PATH. with some modifications to make it generic, of course.

[–] Sonotsugipaa@lemmy.dbzer0.com 1 points 2 weeks ago

I just use Zsh's command history, coupled with a bunch of functions and aliases to set up different HISTFILE values for different workflows.

I keep HISTFILEs clean by prepending a whitespace before commands that I don't want to remember, which unfortunately gave me the habit of doing that on Bash when Zsh isn't available (which is ineffective at best, and actively annoying at worst).

[–] eru@mouse.chitanda.moe 1 points 2 weeks ago* (last edited 2 weeks ago)

spend more time in the shell. you will naturally learn the most commonly used commands and useful flags for them. soon you will be surprised by how much you know. having good typing speed helps reduce the friction a lot. i have not found need to specifically "memorize" anything consciously.

for obscure things, write a script and put it in a scripts folder, have a comment at the top explaining what it does for reference later.

[–] Strit@lemmy.linuxuserspace.show 1 points 2 weeks ago* (last edited 2 weeks ago)

I have a folder in my nextcloud, where I save scripts I find and/or use regularly.

[–] torgeir@lemmy.ml 1 points 1 week ago

I put mine as zsh autoloads. This way feels almost as light as creating aliases once set ut, and also allows for the scripts to have slow initializing code and still be readily available, without having to load everything immediately when zshrc loads and wait for it all the time, even when you might not need it.