DEV Community

Discussion on: What are your UNIX pipeline commands that saved you from lot of coding/time?

Collapse
 
voyeg3r profile image
Sérgio Araújo • Edited

Not exactly pipes but some very useful aliases that sometimes save me a lot of keystrokes

# open the last edited file with neovim
alias lnvim='nvim -c'\'':e#<1'\'
alias pbpaste='xclip -i -selection clipboard -o'
alias pbcopy='xclip -selection clipboard'

zsh global aliases:

alias -g ND='./**/*(/om[1])' # newest directory --> ls -d ND
alias -g NF='./**/*(.om[1])' # newest file

cd ~/music/recordings && audacity NF
# using fasd cd I just type
z recor<Enter> auda<Tab> NF

Also using zsh with:

1 - fasd cd
2 - zsh-autosuggestions
3 - zsh-autopar

But xargs combined with find like:

 find -type f -print0 | xargs -0 cp -t ~/backup

print0 and xargs -0 makes us avoid some erros comming from files with spaces on its names