Tag Archives: Keyboard

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


 

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


 

Mac Keyboard Shortcuts – Scrolling down with the Spacebar

serveimage
Tech Tip – I was unaware that this shortcut existed until I read “There’s a keyboard shortcut that will transform how you browse the web hiding in plain sight” today. Needless to say, this is a Keyboard Shortcut I will use dozens of time each day from now on!

I just tested this on my Mac with both Safari and Google Chrome. It works as advertised on both, scrolling down the viewed page one screen at a time each time the spacebar is pressed.

This doesn’t sound like much, but if you are reading through multiple web pages each day using this keyboard shortcut can save you time. As I have said before, each time you shave seconds from your daily work process, you make yourself that much more productive.


See my other Mac and Keyboard Shortcut articles


 

Mac Keyboard Shortcuts – Reply in Mail

serveimage
Tech Tip – We almost all use Apple Mail as our email client on the Mac. One keyboard shortcut that will save you time is for replying to your email messages.

This is one of the simpler shortcuts. While reading your email, you can reply to one by simply holding down on the CMD key and pressing “r”. This will then open the reply window and allow you to type in your response. To reply to all simply use SFT + CMD + r instead.

This doesn’t sound like much, but if you are replying to multiple mail messages each day, you will end up saving many seconds per message. As I have said before, each time you shave seconds from your daily work process, you make yourself that much more productive.


See my other Mac and Keyboard Shortcut 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


Mac Keyboard Shortcuts – Creating a Link

serveimage
Tech Tip – I find myself typing in URLs every day. This might be in Notes, Pages, Numbers, Keynote, TextEdit, or Mail. But I don’t just want the URL to be there, I want it to be an active link. To accomplish this I can use the CMD + k key combination.

Screen Shot 2018-09-02 at 12.42.01 PM

To make any text in one of the Apps mentioned above a link, just highlight the text in the document, then type CMD + k on the keyboard. This will open up a dialog box (as seen above) where you can enter the desired link. Type or paste in the full URL, then tap OK or hit return and the link has been created.

I use this on an almost daily basis. It is a fast way to create a link in your documents or Notes. The dialog box varies a little between applications giving more options in some (like Keynote) but the key sequence in all allows you to create a link.

This works for other applications too. For instance, I tried CMD + k while typing this article into the WordPress website editor and it works there too. Try this with your favorite Apps to see just where it works.


See my other Mac and Keyboard Shortcut 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


 

CLI – sed

Screen Shot 2018-08-06 at 7.16.16 PM.png

CLI – Sometimes you have a file that you wish to scan for every instance of a phrase and replace it with another phrase. The sed or stream editor command is just what you are looking for. In the above screen shot I first display a file with the cat command, then use se to replace all appearances of the word ‘Emma’ with the word ‘Bambi’. The sed command syntax for that is:

sed  ‘s/Emma/Bambi/g’ Review_Four\ Dominions\ copy.txt

The ‘s/Emma/Bambi/g’ says to do a global search and replace of Bambi for every instance of Emma. The name of the file being operated on is ‘Review_Four\ Dominions\ copy.txt’.

The description of sed in the macOS man page is:

The sed utility reads the specified files, or the standard input if no files are specified, modifying the input as specified by a list of commands.  The input is then written to the standard output.

A single command may be specified as the first argument to sed.  Multiple commands may be specified by using the -e or -f options.  All commands are applied to the input in the order they are specified regardless of  their origin.

This can be a very powerful and useful command when processing text files. In the SysAdmin world it can be very useful for updating configuration files.

To learn a lot more about how to use sed, take a look at “‘Sed’ Command In Linux: Useful Applications Explained“. Yes, this is a Linux article, but the sed command as implemented on macOS is fundamentally the same.


See my other CLI and macOS articles