Menu

Category Archives: Linux

Linux on Mac

By Gene Wilburn

My Macbook Air is now a dual-boot MacOS/Linux laptop. I’ve always wanted to run Linux on really nice hardware so I decided to try installing the Ubuntu 18.04 LTS release after setting aside half my SSD, using Mac’s Disk Utility program to format it as MS-DOS. (Linux reformats this to native Linux Ext4.)

I chose Ubuntu because of its excellent hardware support and, to my surprise, it installed trouble free, though it didn’t initially recognize the built-in wifi hardware of the Mac. To fix this I booted with a USB wifi adapter inserted and Ubuntu downloaded the Broadcom device driver I needed for the Mac. One reboot and I had a live, fully functioning system.

The installation didn’t ask me to try to put Grub into any kind of pre-boot partition, like MBR. To change from one OS to another, I simply hold the Option key down while booting and choose which OS to boot. In MacOS you can set the boot default and mine is set to default to Linux.

I’ve been a Linux user since 1993, starting out with Slackware on an old 386 PC, in character mode only. I’ve used many distributions since then, and I find things to like most of them, but I prefer the Debian-based distributions because of the robust .DEB packaging system. Ubuntu has been rock solid for me so it’s the one I put on the Mac.

There was one oddity. Neither Gnome3 (Ubuntu’s version), nor Cinnamon would recognize any kind of right-click emulation from the Mac’s trackpad. Mate worked just fine, but I’ve grown fond of Cinnamon and by setting its trackpad settings to “mouse emulation” the trackpad had left and right clicks located in the bottom-left and bottom-right corners, just the way I set them up in MacOS. The Mac trackpad worked almost as smoothly as it does under MacOS. I’ve never had much luck with Windows hardware trackpads and Linux so this was a nice surprise.

The greatest moment of acceptance came for me when I synchronized my Linux Dropbox client and it downloaded my photo files. I opened some of them with Gimp, which I already knew how to use, and Gimp looked really good on the Mac’s Retina display. This was a key finding. As a photographer who has used Photoshop for years, I found myself falling behind Adobe because I was sticking with my Photoshop CS6 package. Adobe’s ACR raw editor no longer supports the cameras I use and I’m just not even remotely tempted to buy in to Adobe’s rent-Photoshop-every-month-for-the-rest-of-your-life option. Photoshop is excellent, but so is Gimp, which costs nothing and stays up to date.

The main part of the Adobe package I’ll miss is Adobe Bridge because it could easily review and batch rename files with my custom naming convention. But last year I solved that too, by writing a Bash script to use Exiftool to extract the shot date and turn the result into my file naming convention.

So, hello Linux on Mac has meant goodbye Adobe. And anyway, I can do fine tuning of photos in Snapseed on my iPad.

The final adjustment I needed was a way to easily enter occasional French accented characters from the keyboard. When you live in Canada, it’s common to want to write something like Trois Rivières in accented fashion, to respect the French spelling. MacOS handles this brilliantly but I couldn’t find any Linux keystrokes that worked like a language Compose key.

I found an app called “Characters” that is simply a character map for different languages. It was awkward to use so I did some Googling and discovered that there’s a deeply-buried option in the keyboard settings that allows you to assign a Compose key. I took the default Right-Alt key, better known as Right-Option on the Mac.

It works just as expected. If you hold down Compose and type a backtick(` ) then a vowel, you get à, è, ì, ò, ù. Same for the other accents. Perfect for when the need is occasional. If I were typing a lot of French I’d switch over to a French keyboard layout, but my use is casual.

As mentioned, I use Dropbox to coordinate my files between Linux, MacOS, and iOS machines. It’s also my most immediate backup.

The rest is pretty standard. I use Firefox as my browser, just as I do under MacOS, and I use the browser version of Gmail so I don’t have to fiddle with email client programs. Besides, I’ve never liked Thunderbird.

For writing, the activity I do the most, I use Gedit, a basic text editor that comes with most Linux distros. It has useful plugins, like one for Markdown support. All my writing files are in plain text, marked up with bits of Markdown when I need italics, bold, or some minor formatting like indented passages. I use Pandoc to convert my Markdown files into HTML files when needed.

I tried using Emacs to write with, but as much as I admire it, I don’t care for it as a writing tool. Besides, its line oriented text files don’t mesh well with my Mac editors, which are paragraph oriented. Gedit works perfectly for my needs, including inline spell checking.

Occasionally I do some programming and lately I’ve been studying a little C++. I could do this on MacOS too, but open-source languages feel more at home in Linux, more complete and up to date. Apple keeps its own development tools up to date, but lags behind on open-source releases like the gcc compiler, Perl, Python, and the rest.

I originally thought I’d pop into MacOS more often — don’t get me wrong, MacOS is an elegant and very modern operating system (far superior to Windows in my opinion) — but now that I’ve eliminated Adobe from my life, there’s not much that’s available for the Mac that I don’t already have an equivalent for in Linux. As a result, the only time I find myself booting into MacOS is when I want to update it, to keep it current.

Linux on Mac is one of the nicest surprises I’ve had this year. While nothing is perfect, this is as close to perfection as I’ve yet experienced.

Linux on Mac — an elegant way to run Linux for the technically inclined.

Why Use Linux?

By Gene Wilburn

I’m astonished at how seldom anyone asks me “Why use Linux?” It’s as if, outside the realm of computer techies, Linux is unknown or feared. So let me start with an introduction.

Think of your computing device operating system as a vehicle of transit, say a car that takes you to where you want to go. Now think Smart Car. Now think driverless Smart Car where you simply sit inside and tell Siri, or James, or Hobnob where to take you. This is the model of modern operating systems, especially those for tablets, such as iOS from Apple and Android from everyone else except Microsoft. They are attempts to make your trip devoid of challenges or problems and both Windows 10 and MacOS try to do this, not entirely successfully. The design goal of user friendliness and ease of use is good, but it’s only one way of looking at operating systems. The problem with this model is that some of us like to do our own driving, and we like a standard gear shift so we can control the ride ourselves. If you’re like this, then there some things about Linux that might appeal to you.

The standard way to introduce Linux is to say something like “Linux, or GNU/Linux as it’s sometimes known, is a multiuser, multitasking operating system that runs on a broad variety of Intel and AMD processors.” That’s a mouthful and it doesn’t do much to tell you what Linux is. So, think DOS, or if you back go far enough, CP/M. You got around and did work by typing commands directly into your computer. Before Windows (and Mac and OS/2) that’s how you communicated with your computer and launched programs. Like driving a stick shift.

Now, lest I misrepresent it, Linux too has a graphical, windowed interface — several of them to choose from actually — and they’re very nice and modern and you can set up a Linux computer for a non-techie and they can work it just fine that way. I use it that way myself most of the time. But the real draw of Linux lies under the hood, or behind the command line prompt, which is usually a plain, little dollar sign: $. From here you can do just about anything, including driving yourself into a brick wall at high speed, if you’re not careful. But then, you’re a careful driver, right? And behind that dollar sign lies a computer techie’s dream.

So what’s so special about Linux, then? Two things: it’s based on Unix, and it’s free.

Unix

Linux derives, ultimately, from Unix, an operating system that emerged from the Bell Labs in New Jersey and launched on January 1, 19701. Unix pioneered many of the modern operating system concepts, like hierarchical directories, utilities that did one thing, and one thing well, and a way to string the utilities together using pipes and redirection. You may remember DOS commands such as mkdir for “make a directory” (today most people call them “folders”) and cd for “change directory.” These commands were “borrowed” from Unix but were a pale imitation of the real deal.

Furthermore, Unix was the proving ground for the mouse, the graphical interface (before the Macintosh), and before that, and more importantly, the Internet. Email was invented and standardized in Unix, as was the TCP/IP network protocol that the Internet runs on. The Web was invented on Unix too. To put it mildly, Unix has been a foundational technology in the history of computing. The problem with Unix was that it only ran on mainframes and minicomputers, as shared multiuser systems. The techie’s dream was to have a personal Unix that could run on an inexpensive Intel and AMD PCs. But Unix required expensive licensing and was not built for the Intel architecture.

FSF, GNU, and BSD

There were three or four projects that were begun in the hopes of creating a free Unix workalike, free from licensing fees, and free from corporate rule. An influential programmer, Richard Stallman, set up a project to recreate all the Unix utilities with no reference to the original source code so it could be used and legally distributed for free. He called it the Free Software Foundation (FSF) and later, GNU (GNU’s not Unix — a recursive acronym). GNU was delaying building a kernel (or auto engine) for the last piece of work.

Meanwhile another group was striving to release a BSD (Berkeley Systems Division) Unix derivative using both the GNU and the Berkeley utilities to create a Unix-like OS for the Intel 386 processor. They actually did a smashing job at this, but ran into a licensing dispute with the University of California, Berkeley, about free distribution. FreeBSD, as it came to be called, was, and still is, an excellent Unix-like OS and if they hadn’t been forced to hold back until the dispute was settled, I might now be advocating FreeBSD instead of Linux. Unfortunately, it missed its prime window of opportunity. Nonetheless, there are a lot of web sites today running on FreeBSD which is admired for its dependability and stability.

Linux

But fate intervened, and a young computer science student in Helsinki, Finland — Linus Torvalds — took another project called MINIX (an experimental Unix-like OS for the Intel 286) and started rewriting the kernel to work on the 386, the first genuinely 32-bit CPU from Intel. To say the least, he succeeded, then he and his colleagues around the world added the GNU Unix utilities and his friends dubbed the package “Linux” in his honour. Linus is still the head of Linux kernel development, though he now does it from sunny Silicon Valley.

The early days of Linux were typified mostly by character-based consoles, like logging in to a PDP-11 Unix computer except right on your own PC. There were several “Linux distributions” (flavours) like Slackware (still available), Debian (still available and the progenitor of all the Ubuntu distributions), Red Hat (before it went commercial), Caldera (no longer with us), and SUSE (still popular in Europe). In addition the “little Linuxes” began to appear—distributions like Damned Small Linux that ran on minimal or even embedded systems.

As Intel processors became faster and more powerful, Linux added windowing interfaces based on another free project, the X Window Consortium. From this sprang most of the modern Linux graphical interfaces that have names like Gnome3, Mate, Cinnamon, KDE, IceWM — there are literally a few dozen graphical interfaces to choose from, some of which are designed to run on minimal (e.g., old) hardware.

Because it was developed for the PC, Linux quickly acquired device drivers for most of the peripherals of the day: network cards, printers, faxes, external hard disks, scanners, mice, trackpads, speakers, and, more recently, Bluetooth and WiFi adapters. In other words Linux had all the joy of Unix plus all the practicality of a personal computer. A personal Unix. What is most notable about all of this is that it is the result of programmers who cared enough to devote their free time to working on Linux drivers and other free software projects. This was the birth of what is now called the Open Source model.

ASCII (Text) Files

I think it’s fair to say that no other operating system uses ASCII2, or text, files to the extent that Linux/Unix does. Perhaps you remember the early days of DOS and Windows when you might have an autoexec.bat and a config.sys file in your boot directory to customize your system for your use when you started your PC. And when Windows programs frequently had a corresponding .ini text initialization file to create a profile for how a Windows program should start and run.

This is the Unix style, and Linux is set up with all manner of text files that instruct the system how to boot and what to run when it does. And many programs, such as the vi or emacs editors have startup files that are “hidden” files with names like .vimrc or .emacs. The dot at the beginning of the file name makes them invisible unless you invoke a list command that displays them, e.g. ls -a.

The beauty of ASCII files is that they are easily readable, easily edited, and, perhaps as importantly, easily searched. Linux/Unix has excellent, time-honoured facilities for searching text files either for file name or contents. Linux editors abound, from the traditional vi and emacs editors to simple editors like nano or writing-oriented editors like Focus Writer. There’s an editor for any style or personality. Many are oriented to programming, with syntax colouring and parenthesis, brace, and bracket matching to assist programmers, but there are authors who use these editors for writing articles and books. The SF author Neal Stephenson, for instance, mentioned in an interview that he uses Emacs on Linux for all his writing and I believe I’ve heard that Cory Doctorow uses Emacs as well.

Linux currently sports a sophisticated office suite called Libre Office (also available for Windows and Mac), but the true heart of Linux lies in its text files. For things like advanced formatting of print material, PDFs, or ebooks, the traditional Unix approach has been to put instructions on what to do right inside the text file, totally visible with nothing hidden. Think permanent Reveal Codes if you recall WordPerfect 5 for DOS. This is called a markup scheme, and is used for traditional typesetting programs such as troff or LaTeX. This has also led to the development of a simple writer’s markup scheme called Markdown and is the scheme I use for all my writing, including this essay3.

When your files are text files, some things become much easy to do in Linux. For instance, to keep my essay writing in some semblance of order, I internally title my essays as Essay001.md,Essay002.md,Essay003.md, etc. (.md for Markdown) and to see what they’re about I know that each essay has a title line as its first line. To get a snapshot of my work I can use the Linux utility head that shows only the first x lines of a file, 10 by default. (There is a corresponding tail command.) I only need one line, so my command in my Essay directory is:

Slick, no? It’s a trivial example of what you can do from the command line, but it illustrates the principle of Linux tool use. It starts out with, hey, I’ve got a problem to solve. How do I see the first line of all my essay files? Then I think about what tools are available. Well, head should be able to do that and a quick check on the manual (man) page tells me how to limit the display to one line. This is a form of computing, using the tools for something you want to solve.

There’s much more I could do with my essay files from the command line. Using sed (stream editor) I could make global changes to all the files with one command, say substituting the word real for actual, for example, or removing the spaces around em-dashes. If I were a novelist, I could change a character’s name globally if I decided to rename a character after several chapters into the work. There is nearly always a solution, often more than one, to solve a problem. Of course you need to know what the tools can do before you will think of using them, but that comes with the territory of learning the environment, and if you’re technically inclined, it’ a fun study.

Development Tools

Linux is also the home of server applications, such as Postfix for an email server, Apache or Nginx for a web server, not to mention database servers, repository servers, FTP servers, firewalls, and the like. You can create a test website on a Linux box then test it from other PCs and tablets on your home network before committing your work to a live, external web server. Want to work with a content server like WordPress? You can set this up to work in your Apache web server and get to know it and its plugins and do your testing locally rather than risk fiddling with a live website. Linux is a web developer’s friend.

But the jewels in the crown are the programming environments Linux provides, from the amazingly able Bash shell and interpreted scripting languages such as Perl and Python all of which are normally a part of every distribution. To that you can easily add C,C++,Java,LISP,Haskell, and any of a few dozen specialty languages. Naturally this might not appeal to a casual user, but think kids. The more exposure to Linux and its programming environments they get, the more prepared they will be to pursue technical training and study.

Scalable Knowledge

One of the side benefits to learning Linux is that you can log into just about any Unix or Unix-like computer on the planet and feel at home with the environment. This includes machines as tiny as a Raspberry Pi that might be used in a robotic installation, or a supercomputer cluster at a research centre. A survey in 2017 indicated that the top 15 supercomputers in the world were all Linux clusters. Most of the Cloud is based on Linux as well. You can switch easily between your personal Linux PC and a remote console for a Linux system located in Amazon Web Services (AWS) or another cloud provider.

And if you should end up working in the financial sector, as I did for a few years, you’re already right at home in IBM AIX, HP/UX, and Solaris systems that might be operating as Oracle servers. In other words, Linux knowledge is extensible and scalable — you only need to learn the basics once and you’re set for life. Command-line knowledge is stable and enduring.

Rescuing Old PCs

Most of us enjoy using the latest and fastest computers we can acquire and, in an age of graphical programs and the increased demand they make on resources, fast and powerful is good. However, in a text oriented environment, say writing, you don’t really need all that speed and power. The world is full of abandoned PCs and laptops that have quite a bit of life in them if turned into Linux machines.

For instance, I rescued a Dell Mini system with an Atom processor this year. It only has 1GB of memory and a slow HD, but it’s a nice little portable unit for a writer, and a great system for a kid to learn Python on. While most of the major distributions of Linux run best on fast gear, there are distributions created specifically for machines with fewer resources. On the Dell Mini I installed Xubuntu, a stripped-down, lightweight version of the popular Ubuntu Linux distribution. The Mini runs surprisingly well on it. Another friend had a low-resource laptop that was totally swamped by Windows 10, so I installed Lubuntu on it, an even lighter version of Ubuntu and it fuctions well as a browser for the Internet and it runs Libre Office well enough for occasional use.

Even if you’re not a writer, you can use a rescue PC to serve as a music and multimedia server for the house. Or, of course, a development web server. Or just as a machine for learning about computing, from the command line up.

Modern Applications

What I’ve sketched out here in very brief detail is the use of Linux as a traditional Unix box, with command-line richness and tools galore. For a tech-savvy person, this aspect of Linux is like owning a filled treasure chest. But there are also many modern, graphical open-source programs, or applications, available, from sound recording to animation to photo editing. They’re often not quite as slick as the commercial programs available for Mac or Windows, but they’re free of cost and you’re free (that is, it’s legal) to share them with others. These applications tend to be very good, with constant updates and improvements. Above all, Linux gives you choices. If you don’t want to pay Adobe $10US a month to use the current versions of Photoshop and Lightroom, you can use the free Gimp or Darktable apps that provide at least 80% of the same functionality, if not more.

Here’s maybe a surprise. If you’re not an Apple or Windows camp follower, you may already be using Linux without even realizing it. The Android operating system for smartphones and tablets is a Linux variant. If you have a Roku or similar device, it’s probably running Linux under the hood. The same goes for your router. Embedded Linux is widely used in commercial products. Linux may be used in your fridge, your car, or your TV set.

So let me conclude by saying that there are many reasons for wanting to use Linux, though I’ll be the first to admit it’s a best fit for people with a technical bent. If you’re so inclined, you’ll find it puts the computing back into computing. And I’m just geeky enough to think that it’s way more fun than Windows or even MacOS4. And did I mention? It’s free.

uppercase UNIX is a trademark name. The computer industry usually uses the spelling Unix to include both UNIX and all UNIX-workalike operating systems such as HP/UX, Solaris, AIX, FreeBSD, Linux, etc.↩

ASCII is short for American Standard Code for Information Interchange. Today it’s more accurate to say UTF8 as part of Unicode encoding but it doesn’t come as trippingly on the tongue.↩

If you’d like to know more about using Markdown, I have written a free small e-monograph on the subject called Markdown for Writers.↩

Technically, MacOS is a BSD Unix derivative OS but has been modified in untraditional ways by Apple. It’s still a Unix system at the command prompt, but is never as up to date on utilities as Linux or FreeBSD.↩