UNIX basics
Revision as of 17:32, 14 September 2019 by Andre Castro (talk | contribs)
Tools:
Input reading:
- echo - echo what text is in front of the command
- cat - concatonate (aka) print the content of a file
- wget - network downloader
- sed - to read specific file lines: sed -n LINENUMBERp e.g sed -n 4p sed -n 5,10p
- wc - word/line/character counter
- dadadodo - markov-chain based text generator
cat myfile.txt | dadadodo -
ascii art
- figlet
- toilet
- cowsay
- jp2a
- install it: sudo apt-get install jp2a
- jpg image
- do the conversion
audio
- text-to-speech: espeak
social tools
- write username - chat with the users
- wall - message to all users
chaining programs aka piping
echo HI WORLD | figlet -f /home/pi/figlet-fonts/ticksslant.flf > /dev/ttyUSB0 echo "yolo" | figlet -f /home/pi/figlet-fonts/weird.flf > /dev/ttyUSB0 echo "yolo" | figlet -f /home/pi/figlet-fonts/madrid.flf
Text Processing:
- sed - stream editor for replacing terms/character. e.g. where e is replaced by 3: sed 's/e/3/g'
cat mona.txt | sed 's/0/?/g' cat mona.txt | sed 's/e/3/g'| sed 's/o/0/g'| sed 's/a/4/g'
- sort - sort (alphabetically) lines of text files
sort --random-sort userlist.txt | head -n 1
cat silvio.txt | dadadodo -c 1 - | espeak