Difference between revisions of "BASH Useful Tools"

From Indie IT Wiki
 
Line 23: Line 23:
 
Thanks to [http://www.basicallytech.com/blog/index.php?/archives/23-command-line-calculations-using-bc.html Basically Tech].
 
Thanks to [http://www.basicallytech.com/blog/index.php?/archives/23-command-line-calculations-using-bc.html Basically Tech].
  
Rounding Numbers
+
'''Rounding Numbers'''
  
 
  echo "1.23456789 1.23456789" | awk '{printf "%s %.0f\n",$1,$2}'
 
  echo "1.23456789 1.23456789" | awk '{printf "%s %.0f\n",$1,$2}'

Latest revision as of 10:43, 2 February 2023

Pastebin

Pastebin.com and similar websites make it quick and easy to share snippets of code, data, or text.

There is a command line version for Ubuntu. Install it with...

sudo apt install pastebinit

Use it with...

pastebinit file.txt
cat file.txt | pastebinit
/my/program | pastebinit

Calculator

echo $[1+1]

or

echo "scale=2; 2/3" | bc

Thanks to Basically Tech.

Rounding Numbers

echo "1.23456789 1.23456789" | awk '{printf "%s %.0f\n",$1,$2}'

Weather

sudo aptitude install weather-util-data weather-util

Thanks to OMGUbuntu.