UNIX basics: Difference between revisions

From XPUB & Lens-Based wiki
No edit summary
 
(One intermediate revision by the same user not shown)
Line 19: Line 19:
** do the conversion  
** do the conversion  


===audio==
===audio===
* text-to-speech: espeak
* text-to-speech: espeak


Line 27: Line 27:




===chaining programs aka piping ==
===chaining programs aka piping ===


  echo HI WORLD | figlet -f /home/pi/figlet-fonts/ticksslant.flf > /dev/ttyUSB0
  echo HI WORLD | figlet -f /home/pi/figlet-fonts/ticksslant.flf > /dev/ttyUSB0
Line 43: Line 43:


  cat silvio.txt | dadadodo -c 1 - | espeak
  cat silvio.txt | dadadodo -c 1 - | espeak
[[Category:Cookbook]]

Latest revision as of 18:32, 14 September 2019

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