UNIX basics: Difference between revisions

From XPUB & Lens-Based wiki
(Created page with " ==Tools:== === Input reading: === * cat * wget - network downloader * sed - to read specific file lines: sed -n LINENUMBERp e.g sed -n 4p sed -n 5,10p * wc - word/line/char...")
 
No edit summary
 
(2 intermediate revisions by the same user not shown)
Line 2: Line 2:
==Tools:==
==Tools:==
=== Input reading: ===
=== Input reading: ===
* cat
* echo - echo what text is in front of the command
* cat - concatonate (aka) print the content of a file
* wget - network downloader
* wget - network downloader
* sed  - to read specific file lines: sed -n LINENUMBERp e.g sed -n 4p sed -n 5,10p  
* sed  - to read specific file lines: sed -n LINENUMBERp e.g sed -n 4p sed -n 5,10p  
* wc - word/line/character counter  
* wc - word/line/character counter  
* dadadodo - markov-chain based text generator
** <code>cat myfile.txt | dadadodo - </code>
===ascii art===
===ascii art===
* figlet
* figlet
Line 14: Line 18:
** jpg image  
** jpg image  
** do the conversion  
** do the conversion  
===audio===
* text-to-speech: espeak


=== social tools ===
=== social tools ===
* write username  - chat with the users
* write username  - chat with the users
* wall  - message to all users
* wall  - message to all users
===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 32: Line 42:
  sort --random-sort userlist.txt | head -n 1  
  sort --random-sort userlist.txt | head -n 1  


* dadadodo - markov-chain based text generator
* text-to-speech: espeak
  cat silvio.txt | dadadodo -c 1 - | espeak
  cat silvio.txt | dadadodo -c 1 - | espeak
[[Category:Cookbook]]

Latest revision as of 17: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