Find the distance of a light-year and other units with the Linux command line.

This command will show how many kilometers there are in a light year.

jason$ units -t '1 light year/kilometers'
9.4605284e+12

If I travelled 800m in 9.58 seconds how many miles per hour is this?

jason$ units -t '800m/9.58s' 'miles/hour'
186.80053

Using it this way, I can work out that 12 miles equals 19.3 kilometers.

jason$ units
Currency exchange rates from www.timegenie.com on 2015-10-14 
2919 units, 109 prefixes, 88 nonlinear units
 
You have: 12 miles
You want: kilometers
	* 19.312128
	/ 0.051780933

Changing 2 liters into gallons.

jason$ units
Currency exchange rates from www.timegenie.com on 2015-10-14 
2919 units, 109 prefixes, 88 nonlinear units
 
You have: 2 liters
You want: gallons
	* 0.5283441
	/ 1.8927059
You have: ^C

Converting 12 inches into centimeters.

jason$ units '12 inches' 'centimeters'
	* 30.48
	/ 0.032808399

How many yards in 1 kilometer?

jason$ units '1 kilometer' 'yards'
	* 1093.6133
	/ 0.0009144

The units command is very useful for find out what units of measurement equal in other units. A very useful Linux command indeed.

No comments have been made. Use this form to start the conversation :)

Leave a Reply