this post was submitted on 15 Jun 2023
2 points (100.0% liked)

commandline

1859 readers
7 users here now

founded 2 years ago
MODERATORS
 

Any extra tips or tricks are welcome!

Yesterday I learned that set -x enables trace for a bash, sh, or zsh script and prints the trace to the terminal.

top 8 comments
sorted by: hot top controversial new old
[–] [email protected] 1 points 2 years ago (1 children)

In Bash, I like to use cdargs

sudo apt-get install cdargs

It allows you to set up shortcuts on the fly,

cv sdbackup

rather than cd /media/user/Backup Plus/ MyFiles/current/sdbackup

cv with no argument will give you a list to select from current shortcuts

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

Of those mentioned, this one intrigues me most. Thanks!

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

My answers (mostly running in powershell - not that it makes much of a difference!)

Rust-based utilities I couldn't live without:

  • fd (fd-find) for finding my files
  • rg (ripgrep) for string searches
  • sd (sed) for search and replace
  • dust (dust) for information about my directories
  • lsd (aliased to ls or l) for replacing Dir
  • bat (better cat) - for when the help pages are too long

Other stuff I love:

  • htop - I just learned you can run this in WSL to see all your system cores. It's pretty!
  • nvim - obviously. The best vim. Even works in VSCode
[–] [email protected] 1 points 2 years ago* (last edited 2 years ago)

pv, which is like cat, simply copying files or stdin to stdout, but prints statistics to the terminal.

A related tip: dd isn't special in the way most people use it. This works too, if you're root: pv my-fav-distro.iso > /dev/sdc

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

I really like jless. You can pipe the JSON output of a cURL command into it and it displays it in a really nice, easy to read way with collapsible arrays and objects.

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

Always partial to yq and jq. No easier way to interact with kubernetes outputs on the fly.

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

Don't forget about fq!

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

How I have never heard of yq, I'm unsure, but thank you as I'm sure it will make life easier