Category Archives: Linux

Weather at Your Terminal Command Line

screen shot 2019-01-18 at 6.17.34 pm

Web Tools – There are lots of way of getting the weather on your computer. Most of those will open in your browser with lots of content, animations, and probably advertisements. But wttr.in is different. It is text only. What is wttr.in? From their website:

wttr.in is a console-oriented weather forecast service that supports various information representation methods like terminal-oriented ANSI-sequences for console HTTP clients (curl, httpie, or wget), HTML for web browsers, or PNG for graphical viewers

screen shot 2019-01-18 at 6.11.46 pm

I used curl wttr.in from the terminal command line to get the image shown at the top of this page. This should work on any Linux or macOS system. When I enter http://wttr.in into my Safari browser I get similar output as shown in the image immediately above.

This site provides many options to choose from in their weather report. While it takes your current location as the default, other locations around the world can be specified. Queries from the US appear in USCS units, while most of the rest of the world get values in the Metric System. Optionally you can specify the units.

Reports can be returned in ANSI for the terminal, HTML for the browser, or as a .PNG image. All of the options are explained on their GitHub site.

I like this minimalist weather report and have added the URL to my Safari Favorites.

Advertisements

CLI – dd

serveimage

CLI – If you are wanting to copy a file from one place to another then you may want to look at the dd command. This command is particulary useful when you want to copy the file while making edits to it on the fly.

The command is also useful when copying a disk image to other media. This can be very useful in creating a bootable SD card for a Raspberry Pi. The Wikipedia page on the dd command gives a good overview of how the command can be used.

The description of dd in the macOS man page is:

The dd utility copies the standard input to the standard output.  Input data is read and written in 512-byte blocks.  If input reads are short, input from multiple reads are aggregated to form the output block.  When finished, dd displays the number of complete and partial input and output blocks and truncated input records to the standard error output.

To learn a lot more about how to use dd, take a look at “Linux dd command explained for beginners (8 examples)“. Yes, this is a Linux article, but the dd command as implemented on macOS is fundamentally the same. Check the macOS man page for dd for all of the available options.


See my other CLI and macOS articles


 

CLI – time

serveimage

CLI – Have you ever run a command from the command line and afterwards wondered how long it took to run? If so, the time command will give you that answer.

This command measures the real, user, and system time used by a command during its execution.

The description of time in the macOS man page is:

The time utility executes and times utility. After the utility finishes,
time writes the total time elapsed, the time consumed by system overhead,
and the time used to execute utility to the standard error stream. Times
are reported in seconds..

As an example I ran a three ping against the site capmac.org and timed it.

Screen Shot 2019-01-02 at 9.45.13 AM

To learn a lot more about how to use time, take a look at “Linux time Command Tutorial for Beginners (with Examples)“. Yes, this is a Linux article, but the time command as implemented on macOS is fundamentally the same. Check the macOS man page for time for all of the available options.


See my other CLI and macOS articles


 

SciFi Inspired Desktop UI

Screen Shot 2018-12-13 at 10.44.13 AM

I came across the edexui a few days ago and had to try it. What is it? The edex-ui is:

a science-fiction inspired desktop “heavily inspired by DEX-UI and the TRON Legacy movie effects,” which gives you a terminal and live telemetry from your system

Screen Shot 2018-12-13 at 10.35.09 AM

You can download it from here just click on the link indicated by the arrow in the image above.

There is really no productivity gain with this app, just something fun to try. It does give you a full shell access just like the Terminal App does. It also gives you some data about your system in real time. The site provides some tips for customizing the App further if you scroll down to the FAQ section and click on the “repo’s Wiki” link.

Versions of this App are available for Linux and Windows in addition to macOS.

Official Raspberry Pi Beginner’s Guide

BeginnersGuideLinux – I recently saw that the Raspberry Pi Press has just released its official “Raspberry Pi Beginner’s Guide”. This 244-page book is intended to get the reader started with their Raspberry Pi. As they say:

From setting up your Raspberry Pi on day 1 to taking your first steps into writing coding, digital making, and computing, The Official Raspberry Beginner’s Guide is great for users from age 7 to 107!

You can order a hard copy of the book through the Raspberry Pi Press store (£10.00) with free international delivery. If you are willing to settle for an electronic copy, you can download the PDF for free. I have downloaded the PDF and look forward to reading it on my iPad.

Just in case you have been living in a cave somewhere, the Raspberry Pi is:

a small, clever, British-built computer that’s packed with potential. Made using the same technology you find in a smartphone, the Raspberry Pi is designed to help you learn to code, discover how computers work, and build your own amazing things.

One of the great things about the Raspberry Pi is that they are very inexpensive. If you search Amazon, you will find various kits and versions of the Raspberry Pi starting from $27. They are also available in Fry’s Electronic Stores if you are lucky enough to have one of those close by.

The book and the hardware would be a great Christmas present for the clever kid (of any age) in your family.

CLI – file

serveimage

CLI – If you encounter a file and are not sure what type of file it is (often because the extension is missing), the the file command is what you are looking for.

This command allows you to lets you see the type of file you’re dealing with. The description of file in the macOS man page is:

file tests each argument in an attempt to classify it.  There are three sets of tests, performed in this order: filesystem tests, magic tests, and language tests.  The first test that succeeds causes the file type to be printed.

The type printed will usually contain one of the words text (the file contains only printing characters and a few common control characters and is probably safe to read on an ASCII terminal), executable (the file contains the result of compiling a program), or data meaning anything else (data is usually “binary” or non-printable).  

To learn a lot more about how to use file, take a look at “Linux file Command Tutorial for Beginners (5 Examples)“. Yes, this is a Linux article, but the file command as implemented on macOS is fundamentally the same. Check the macOS man page for file for all of the available options.


See my other CLI and macOS articles


 

CLI – whatis

serveimage

CLI – As mentioned before, every command line command has a descriptive man page entry that you can access. That is often a very long and detailed description of the command and all of the possible options available to it.

Sometimes you just want a quick explanation as to what a command does. This is where the whatis command is useful. It will return a one line description of the command being referenced.

The description of whatis in the macOS man page is:

whatis searches a set of database files containing short descriptions of system commands for keywords and displays the result on the standard output.  Only complete word matches are displayed.

To learn a lot more about how to use whatis, take a look at “Linux whatis Command Tutorial for Beginners (5 Examples)“. Yes, this is a Linux article, but the whatis command as implemented on macOS is fundamentally the same. Check the macOS man page for whatis for all of the available options.


See my other CLI and macOS articles


 

CLI – tcpdump

serveimage

CLI – If you are having network connectivity issues tcpdump is a utility that you may want to try. It is also handy when you want to examine unusual network traffic.

This command allows you to capture and analyze network traffic. Using this command is probably going to require you to put on your ‘propeller hat’ and drop further down ‘into the weeds’ of tech than you are typically used to. It is good to know that the ability is there if you need it.

The description of tcpdump in the macOS man page is:

Tcpdump prints out a description of the contents of packets on a network interface that match the boolean expression; the description is preceded by a time stamp, printed, by default, as hours, minutes,  seconds, and fractions of a second since midnight.  It can also be run with the -w flag, which causes it to save the packet data to a file for later analysis, and/or with the -r flag, which causes it to read from a saved packet file rather than to read packets from a network interface. It can also be run with the -V flag, which causes it to read a list of saved packet files. In all cases, only packets that match expression will be processed by tcpdump.

To learn a lot more about how to use tcpdump, take a look at “An introduction to using tcpdump at the Linux command line“. Yes, this is a Linux article, but the tcpdump command as implemented on macOS is fundamentally the same. Check the macOS man page for tcpdump for all of the available options.


See my other CLI and macOS articles


CLI – bzip2

CLI – If you have a file you want to compress, you have options as to how you will do it. The bzip2 command is one of the options that is open to you on a macOS system. Likewise, if you come across a previously compressed file with the .bz2 extension, you will want to use bzip2 to decompress it.

The description of bzip2 in the macOS man page is:

bzip2  compresses  files  using  the Burrows-Wheeler block sorting text compression algorithm, and Huffman coding. Compression is generally considerably better than   that achieved by more conventional LZ77/LZ78-based compressors, and approaches the performance of the PPM family of statistical compressors.

To learn a lot more about how to use bzip2, take a look at “Linux bzip2 Command Tutorial for Beginners (6 Examples)“. Yes, this is a Linux article, but the bzip2 command as implemented on macOS is fundamentally the same. Check the macOS man page for bzip2 for all of the available options.


See my other CLI and macOS articles