UNIX basics

From XPUB & Lens-Based wiki
Revision as of 17:27, 14 September 2019 by Andre Castro (talk | contribs) (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...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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/character counter

ascii art

  • figlet
  • toilet
  • cowsay
  • jp2a
    • install it: sudo apt-get install jp2a
    • jpg image
    • do the conversion

social tools

  • write username - chat with the users
  • wall - message to all users
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 
  • dadadodo - markov-chain based text generator
  • text-to-speech: espeak
cat silvio.txt | dadadodo -c 1 - | espeak