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

commandline

1760 readers
1 users here now

founded 1 year 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.

you are viewing a single comment's thread
view the rest of the comments
[–] cd_slash_rmrf 3 points 1 year ago (1 children)

if you spend a lot of time in the shell, i like using the following for easier directory traversal:

  • fzf and its shell bindings for fuzzy-matching arguments
  • z for jumping to "frecent" directories
  • zsh-z (a native zsh port of z)
  • bd for going back directories

and some zsh settings which make cd silently act like pushd/popd:

# autopushd         : make cd act like pushd (alias doesn't work properly)
# pushdminus        : use -1 instead of +1
# pushdsilent       : prevents printing stack on each cd
# pushdtohome       : `pushd` to ~/
# pushdignoredups   : dont add duplicates to stack
[–] gamma 2 points 1 year ago (1 children)

I want to add setopt autocd, and hash -d name=/some/long/path/to/name to create your own ~name shortcuts.

[–] cd_slash_rmrf 2 points 1 year ago

woa, i didn't even know about hash -d name=/path, neat!