Terminal commands
Julia Evans: A list of new(ish) command line tools
Clipboard¶
- pbcopy & pbpaste
https://osxdaily.com/2007/03/05/manipulating-the-clipboard-from-the-command-line/
pbcopy < file.txt
-
ps aux | pbcopy
-
pbpaste > pastetest.txt
pbpaste | grep rcp
xargs
¶
- Run a command using the input data as arguments:
- `arguments_source | xargs command
Secrets¶
direnv¶
- Checks for
.envrc
>.env
- makes them environment variables
Search¶
ripgrep (rg)¶
- better than
grep
- ripgrepall also searches PDFs and other files -
brew install rga
-brew install pandoc poppler tesseract ffmpeg
???? Example use cases
Read logs¶
lnav
has syntax highlighting for logs
Hyperfine CLI Benchmarking Performance¶
Typos¶
- zsh auto recommends a command if you mistype
- for subcommands, use thefuck
Python list to bash¶
space_separated_strings=$(python file.py | tr -d '[],')
# We need the eval because ????
eval "for query_content in $query_content_list; do
echo \$query_content
psql2 $COMMISSIONS_DB -c \$query_content;
done"
You should just do everything in Python Run the shell psql2 from Python
???? What did Viktor do?
su
vs sudo
¶
su
switches userssudo
keeps the current user, runs as if they were sudosu -
creates a new environment with the super user's env var and switches to their home directorysudo su -
Open a man file in Preview (as a PDF)¶
man -t apropos | open -fa Preview
Notify yourself after 10 mins¶
Doesn't work with do not disturb mode on 😞
# can't do sleep 10m on Mac
reminder() {
sleep $((60*$1)) && osascript -e 'display notification "$2"'
}
Last update:
2023-04-24