Useful bash

For info on ImageMagick, refer to the ImageMagick page.

Convert all wav in dir to mp3

for i in *.wav; do lame -b 320 "$i"; done

Get IP on macos

ipconfig getifaddr en0

Convert copied md to html

You can use docx also
pbpaste | pandoc -f markdown -t html | pbcopy
You can also use it as an alias in your bash profile like so:
alias md="pbpaste | pandoc -f markdown -t html | pbcopy; echo 'Conversion done.'"
Now, just type md to swap the Markdown in your clipboard for HTML.

Update all formulas

brew upgrade

Move all file inside directory to upper dir

from this stack exchange
mv * .[^.]* ..
Explanation: the mv command moves files and directories. The last argument to mv is the target (in this case the directory one step "up" in the tree, ..). The arguments before that are the source files and directories. The asterisk (*) is a wildcard which matches all files which do not start with a dot. Files that start with a dot (dotfiles) are "hidden". They are matched using the pattern .[^.]*(see edit below)

Why .[^.]* instead of .* ?
The pattern .* also matches . and ... Since you don't want to (and cannot) move those, it's better to use a pattern which matches any filename starting with a dot except those two. The pattern .[^.]* does just that: it matches any filename (1) starting with a dot (2) followed by a character which is not a dot (3) followed by zero or more arbitrary characters.

Hide File in MacOS

chflags hidden [file_name] #use nohidden to revert

Compress Gif

gifsicle -O3 --colors 256 -i in.gif -o out.gif
convert -loop 0 input ouptput

Fuzzy search

Using the fzf plugin use ** + tab in a command to open a search bar.

Create symbolic link

ln -s source destination

- home -