Difference between revisions of "BASH Useful Tools"

From Indie IT Wiki
imported>Plittlefield
 
 
(2 intermediate revisions by the same user not shown)
Line 19: Line 19:
 
or
 
or
  
  scale=2; echo "11.45 + 7.95" | bc
+
  echo "scale=2; 2/3" | bc
  
 
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'''
 +
 +
echo "1.23456789 1.23456789" | awk '{printf "%s %.0f\n",$1,$2}'
  
 
== Weather ==
 
== Weather ==

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.