CMD Shift Dot

If you’re using Finder on a Mac OS, the quickest way to display and hide hidden files is by using the Command + Shift + . (or the period) key combination. This key combination will toggle on and off the hidden files inside the Finder. By the way, this is only applicable if you have the Mac Sierra OS and above. I like the clean look better (without the hidden files), but the Command + Shift + . is pretty handy if you need to quickly look at hidden files.

Finder: Command + Shift + .

The Return of the Linux Desktop

I’m thinking about using the Linux desktop again after 4 years of inactivity. The MacOS was the desktop of choice. I’ve been happy with the switch. I don’t anticipate abandoning it any time soon. Lately I thought about sharpening up my Linux skills after having been dormant for years. I need a Linux platform that I can work with. Ubuntu is my default, but there are other distros equally interesting. Mint, Debian and Fedora come to mind. Instead of having multiple boot partitions, I might install Ubuntu as the base distro and install Virtualbox. Other distros can be fired up as virtual machines. In that way, it’s simple to manage. I just need a heftier machine that can handle several VMs running at the same time. That’s the plan for the next several weeks.

Keep Your SSH Sessions Alive

If you work on servers via Terminal using SSH (secure shell), one of the more annoying things that happens quite regularly are timeouts. If there’s no activity between your SSH client and the server, your terminal is closed because your session has timed out. You’ll need to login again. If you do this at least 6 times a day, then you can see how taxing this whole exercise can be.

To avoid Terminal timeouts, you can set the SSH client, your terminal, to keep the connection alive by sending a null signal to the server every few seconds. I’ve set mine to 2 minutes. Since I’m on Mac OS, I’ll need to configure my SSH client. The configuration file is located in your home directory under .ssh/config. If the file doesn’t exist, just create one.

cd
nano .ssh/config

Now add the following lines to it.

Host *
ServerAliveInterval 120

I’ve set mine to 120 seconds or 2 minutes. This value works for me while connected to an Ubuntu Server. You may have to play around with this value on other Linux systems. I think this is a better approach as opposed to configuring the SSH server on every server you are connected to. You may not have root access to some servers. Changing the settings on your SSH client is the better approach.

Open With Application Duplicate

If you’re a Mac user, you can open up a file by right-clicking on it, and choosing “Open With,” and selecting an application. If you see duplicates, you can remove multiple entries by running the following script. The script restarts the Launch Register called lsregister and removes the duplicates.

/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user

Right click the file again. The duplicates should be gone.

Mac OS Hosts File

Adding host entries in your desktop can be beneficial if you run several servers or hosts on your internal network. Instead of typing and remembering long IP addresses, you simply type the name of each host to make things easier for you. Let’s say you have several servers named “one”, “two” and “three” in your internal network. Each hosts will have their own assigned static IP address. By editing your hosts file and adding host entries to it, you can then use the hostnames instead of IP addresses.

In the end, you can ping each hostname like this:

$ ping one
$ ping two
$ ping three

In addition, you can also use the hosts “one”, “two” or “three” on your browser URL if your host has a web interface. If there are no host entries, the ping command, as well as you browser will simply timeout. To make this all possible in your Mac OS, you’ll need to edit the /private/etc/hosts file, by opening the Terminal and typing:

$ sudo nano /private/etc/hosts

You need to add each host to the file in this format: ip_address hostname. See below:

192.168.1.22 one
192.168.5.56 two
192.168.1.33 three

Save file and exit. Ctrl-o and Ctrl-x.

Flush the DNS by typing:

$ dscacheutil -flushcache

You can now ping and use the hostname anyway you want.

The only limitation with this approach is, you’ll have to edit the hosts file for each desktop or laptop that is on your network. You can avoid this by take the next step, by running your own internal DNS server.