130
submitted 5 months ago by harsh3466@lemmy.world to c/linux@lemmy.ml

I didn’t get to spend as much time tinkering and learning this week, but I still learned some new things!

  1. Wireguard is great! I had been using OpenVPN because when I initially set up my machine, my VPN had a bug with Wireguard. I was setting up a raspberry pi today for some more tinkering, and I decided to try Wireguard to see if the bug was fixed. Not only is it fixed, but Wireguard is much easier to work with. Not hating on OpenVPN, but I’ll definitely be preferring Wireguard going forward.
  2. Proper use of find, particularly with regex. This is ongoing. I’ve been using find for awhile, but not with full understanding of it’s options and syntax. I’m starting to get a better understanding of how to use it to find and manipulate the files I’m looking for. One of the biggest things that’s tripping me up with find and regex is designating the path.
  3. How to set up a new user. This was interesting. I already knew the basics, adduser -m username, sudo passwd username, but what I didn’t know anything about was --skel for copying over the skeleton shell config files. I didn’t even know the skeleton config files existed.
  4. The shell prompt can be customized. This was interesting. I was setting up a non root user on a vps that I have, and after creating the user, all I had was the $ prompt. No user@host, and no working directory. After some reading I found that adding PS1='$(whoami)@$(hostname):$(pwd)$ ' to ~/.profile will show a more traditional user@host:working/directory$ prompt. I’m sure this is not the only way to do this, and may not be the best way to do it, but based on my limited knowledge, it is the way that I’m currently doing it on my vps.
top 33 comments
sorted by: hot top controversial new old
[-] Corr@lemm.ee 23 points 5 months ago

As someone also starting to get into Linux I appreciate these posts

[-] harsh3466@lemmy.world 5 points 5 months ago

I’m glad they’re useful for you!

[-] om1k@sopuli.xyz 16 points 5 months ago

check fd-find, "A simple, fast and user-friendly alternative to 'find'". Really good trust me

[-] harsh3466@lemmy.world 2 points 5 months ago

I will look into that. Thank you!

[-] stanka@lemmy.ml 14 points 5 months ago

If you code adding the current branch to your shell prompt will change your world.

Also, if you are getting good use out of find, you should learn to pipe the output to GNU parallel. Put those cores to work!

[-] neo@lemmy.comfysnug.space 2 points 5 months ago* (last edited 5 months ago)

Depending on your distribution it may also just be called fd in the package manager

[-] just_another_person@lemmy.world 14 points 5 months ago

Check out using something like oh-my-zsh if you want a deeply configurable shell experience that isn't super far off the stock bash path.

[-] pineapplelover@lemm.ee 16 points 5 months ago* (last edited 5 months ago)

I kinda like fish tbh. The dracula theme is much better and more features than stock zsh

[-] Jesus_666@feddit.de 8 points 5 months ago

There's also oh-my-fish.

[-] zarkanian@sh.itjust.works 7 points 5 months ago

Fish + starship is a killer combo.

[-] PumpkinEscobar@lemmy.world 6 points 5 months ago

There's also oh-my-posh, which was originally a powershell prompt, but it was rewritten as a go application that works on (I think all) mainstream shells.

[-] harsh3466@lemmy.world 1 points 5 months ago

I’ve heard of oh-my-zsh, but I haven’t wanted to deviate off of bash until I have a good grasp on bash first.

[-] just_another_person@lemmy.world 1 points 5 months ago

The project aims to make Bash vs Zsh as similar as possible. There is little difference except for customization. Switching to Fish or Spaceship will jump that barrier.

[-] harsh3466@lemmy.world 1 points 5 months ago

Interesting. I’ll give it a look.

[-] PlexSheep@feddit.de 13 points 5 months ago

My advice: make your home directory a git directory. You can ignore everything in a gitignore, then make exceptions, like your vim configs, shell configay and so on. You have version control and on a new host you can just git clone and bam, you have your usual setup.

[-] ransomwarelettuce@lemmy.world 16 points 5 months ago

Or simply create a dotfiles repo and symlink configs.

[-] cadekat@pawb.social 5 points 5 months ago

Yes, this. Don't put your whole home directory in git.

[-] harsh3466@lemmy.world 1 points 5 months ago

I’ve never used git to publish/make myself a repo before. That’s something I’ve been meaning to learn but haven’t quite gotten there yet. However, with the amount of tinkering, and breaking I’ve been doing, I think I’ll move it up on my priority list.

I’ve also got shell scripts I’ve been writing and tinkering with and having proper version control (versus script, script.copy, script.copy.bak…) would also be nice.

[-] PlexSheep@feddit.de 2 points 5 months ago

It's not actually hard if you know some high level basics. I recommend to use a git GUI or tui, makes things even easier. I personally use lazygit.

[-] harsh3466@lemmy.world 1 points 5 months ago

I’m diving in. I set up gitea on my server. Now I need to learn how to use git with gitea.

[-] PlexSheep@feddit.de 2 points 4 months ago

Amazing. I've switched to forgejo, thr gitea projects are amazing and I'm awaiting federation.

[-] backhdlp@iusearchlinux.fyi 12 points 5 months ago

You might be interested in the ArchWiki page on prompt customization: https://wiki.archlinux.org/title/Bash/Prompt_customization

[-] harsh3466@lemmy.world 2 points 5 months ago

Ohhh. Thank you. I will give that a read through!

[-] inspxtr@lemmy.world 5 points 5 months ago

re 1: out of curiosity, do you encounter dnsleaks when using wireguard?

re 4: you can also check out https://starship.rs/, which helps configure shell prompt very intuitively with a toml file.

[-] harsh3466@lemmy.world 1 points 5 months ago

I didn’t k ow there were dms leak issues. I will investigate. If I’m finding that I’ll likely switch back to openvpn

[-] bizdelnick@lemmy.ml 1 points 5 months ago

DNS leaks don't depend on what VPN protocol you use. They only depend on how you configure your DNS resolver and routing.

[-] bizdelnick@lemmy.ml 4 points 5 months ago

Regex is not the most oftenly used feature of find. Have you already learned how to use -exec, -delete, -print0 together with xargs?

[-] harsh3466@lemmy.world 1 points 5 months ago

That’s what I’m finding. I’m not certain I need regex for what I want to accomplish with find. I’m reorganizing my media libraries, and I have a mix of mp4 and mkv files. I want to be able to find all mkv and mp4 files and move them using regex like '.+\.(mp4|mkv)'

I have learned how to use find with -exec and -delete, but I haven’t gotten to -print0 or xargs yet.

[-] bizdelnick@lemmy.ml 2 points 5 months ago

You don't need a regex for that, you can write \( -name '*.mp4' -o -name '*.mkv' \).

[-] harsh3466@lemmy.world 1 points 5 months ago

Thank you! That worked perfectly. I had to do some digging through the man page to find that -o flag!

[-] Pantherina@feddit.de 2 points 5 months ago

I really need to learn find.

How is the rust replacement?

[-] drndramrndra@lemmygrad.ml 3 points 5 months ago

How is the rust replacement?

fd > find. It's a lot faster, and I find the syntax to be better.

[-] harsh3466@lemmy.world 1 points 5 months ago

I’m not familiar with the rust replacement

this post was submitted on 01 Feb 2024
130 points (95.8% liked)

Linux

45457 readers
1296 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