Command Line Interface

I have become enamored with the idea of minimalist computing. The primary reason is that I like substituting intellectual capital for financial capital or to put it another way, using cheap computers more effectively. My secondary reason is that I have reached a point in my work where the electrical usage and heat production from my research needs to be considered both in terms of monetary costs and environmental impact.

The bottom line is that minimal computing allows for the same productivity with older or cheaper machines. When you need cutting edge computation that is expensive and sucks power, either rent from a cloud provider where they can manage the hardware and operate at a more efficient scale than your home or keep your own servers at the most efficient power provider like the office. At a minimum, you can avoid both paying for power and the marginal increase in cooling costs. Second hand servers can be found/purchased/built cheap but are still expensive to operate. Keeping operating costs as low as possible helps you get the biggest bang for your buck.

For those interested in moving away from the GUI world, I suggest a gradual shift while continuing to work on the operating system of your choice. If you are on Windows 10, Ubuntu and other Linux distributions are available on the app store via the Windows Subsystem for Linux (WSL). Mac users can install MacPorts to get the standard versions of some command line programs. Eventually you will want to transition to a free open source operating system like Ubuntu Linux but baby steps for now.

Install

Windows - find the Ubuntu Linux distribution in the App store and install it using the Windows Subsystem for Linux (WSL) available starting with Windows 10.

Windows - Cygwin: select the packages during the Cygwin install. If you need to add something, just run the installer again.

Mac OS X - MacPorts: the syntax here to install gawk is

sudo port install gawk

Where Do I Begin?

I suggest learning the following tools in this order:

File Operations: ls (list), cp (copy), mv (move), rm (remove) Type cp –help for syntax and options

Administration: sudo (execute command as administrator), chmod (change permissions), apt (package manager for Ubuntu Linux and other Debian distributions)

Secure Shell: use the command line of another computer over the network Be sure to install openssh on WSL or Linux. OS X comes with it. Syntax is: ssh user@serverURL Use “ssh-keygen -t rsa” once to generate a key and “ssh-copy-id user@serverURL” to put the public key on the server. This will allow logins without typing your password every time. Secure Shell requires TCP port 22 by default. Some network environments may block incoming traffic to this port.

nano: simple text editor Use Ctrl as the meta key so Ctrl-x exits the program.

tmux: use multiple command line sessions in a single terminal I love monitors but they suck power and take up too much space. Using a terminal multiplexer like tmux allows you to cram more info into a smaller amount of real estate. Use Ctrl-b to issue commands. Add resurrect and continuum through the plug-in manager to make your tmux session more robust.

mosh: make your sessions robust to network disruptions Do you like closing your laptop for a while and then resuming exactly where you left off? Mosh does this for secure shell sessions so you don’t need to reestablish your connections manually. Mosh requires that UDP ports 60000-60100 as well as the secure shell port is open. Some network environments may block traffic to these ports. One of the great tools that “just works” in most network environments.

rsync: quickly copy large amounts of files wget: fetch files from the Internet curl: more advanced Internet functionality gawk: manipulate text files sed: manipulate text output irssi: text based IRC client

Previous
Next