bash

Command line: Add random emoji to bash prompt

24.05.2020

In your ~/.bashrc file, find the line that sets the PS1 var:

PS1=' ... \$'

Replace the prompt character (in this case \$) with your random emoji:

EMOJIS=(⚡ 💡 🍎 🍿 🍬 🍩);
EMOJI= ${EMOJIS[$RANDOM % ${#EMOJIS[@]}]};
PS1=' ... ${EMOJI}'

Et voilà! You can reload your config with source ~/.bashrc.

Command line: Save pdf as plain text in bash.

22.05.2020

Use the following command to save the text content of document.pdf as document.txt.

less document.pdf > document.txt

Works surprisingly well. less uses pdftotext behind the scenes.