linux-unix

recent posts related to linux and unix

How to install Java, Scala, and SBT on Linux Mint alvin May 19, 2017 - 7:27pm

Lately I’ve been in the process of “making the switch” from macOS to Linux Mint, and to that end, I just installed the Java 8 JDK/SDK, Scala 2.12, and SBT 0.13 on a new Linux Mint system, and I want to note here how I did that while it’s still fresh in my mind. Here are my notes in a compact form.

Teleport: The Unix/Linux ‘cd’ command, improved

Table of Contents1 - The Teleport command2 - Teleport command help3 - For basic use, tp is just like cd4 - Basic teleporting5 - Listing your teleport history6 - Teleport by number7 - Bash completion with Teleport8 - Teleport aliases9 - Adding/creating a teleport alias10 - Using a teleport alias11 - Listing your teleport aliases12 - Removing an alias13 - Teleport command - summary14 - Teleport command - download

Summary: By keeping a history of the directories you've visited, the Teleport command is an improvement on the Unix/Linux cd command. By having a memory, Teleport lets you jump from one directory to any previously visited directory, easily.

January, 2015 Update: The Teleport command now supports Bash completion. For more details on this, see the Github INSTALL.md file.

Share it!

There’s just one person behind this website; if this article was helpful (or interesting), I’d appreciate it if you’d share it. Thanks, Al.

A Linux shell script to rename files with a counter and copy them alvin May 9, 2017 - 9:39am

As a quick note, I used this shell script to copy many files with the same name into a directory named tmpdir, giving them all new names during the copy process:

count=1
for i in `cat files`
do
  fname=`basename $i`
  cp $i tmpdir/${count}-${fname}
  count=`expr $count + 1`
done

The way this works is that I have a file named files that I created with a find command, and it contains a bunch of entries like this:

foo/bar/baz/filename.jpg
foo/baz/filename.jpg

When the shell script runs, it reads one line at a time from that file, gets the basename (filename) from that line, prepends that name with a counter, then copies the original file to the directory named tmpdir, giving it the new name.

I did this to copy all of the images I have under the Messages cache folder on my Mac. A friend accidentally deleted our text message stream, and I was able to recover 350+ images with this script.

Notes on how to configure HTTPS with Nginx

Table of Contents1 - Summary2 - New Linode Server3 - Update Everything4 - Ubuntu Firewall5 - Add a New User6 - Disabling Root Login7 - Limit Login Attempts8 - Install Nginx9 - Adjust Firewall10 - Nginx Configuration11 - NOT what I used: Let’s Encrypt on Ubuntu 16.0412 - (1) Create a cert (openssl)13 - (2) Create a strong Diffie-Hellman group14 - (3) Configure Nginx to Use SSL15 - Adjust the Nginx Configuration to Use SSL16 - (Alternative Configuration) Allow Both HTTP and HTTPS Traffic17 - Adjust the Firewall18 - Enable the Changes in Nginx19 - Test in Browser20 - Nginx "default_server"21 - Can change to a permanent redirect (301)22 - More Security: Preventing Information Disclosure23 - More Security: Fail2Ban24 - Restricting Access by IP Address25 - See also

Without any introduction or discussion, here are the notes I made while learning how to get HTTPS working with Nginx. These are just for me, but if something helps you, cool.

Share it!

There’s just one person behind this website; if this article was helpful (or interesting), I’d appreciate it if you’d share it. Thanks, Al.

Cerebro, a Spotlight-like launcher for Linux alvin February 21, 2017 - 11:29am

I recently “made the switch” from MacOS to Linux Mint, and was lamenting the fact that I didn’t have Alfred on Mint. But then this morning I learned about Cerebro, which, if it’s not Alfred yet, at least it’s Spotlight for Linux. omgubuntu.co.uk has this good intro article on Cerebro.

Cerebro is written as an Electron app, and as a result it’s available not only for Linux, but Windows and MacOS as well.

Linux Mint (and Ubuntu): Suspend vs Hibernate (meaning) alvin February 16, 2017 - 2:05pm

When I put Linux Mint on a few of my computers recently I quickly encountered the words “suspend” and “hibernate” when attempting to put a laptop to sleep:

LInux Mint, Suspend vs Hibernate

“What the heck is the difference between Suspend and Hibernate,” I wondered. “I’m used to just having a ‘Sleep’ option on my MacBook Pro.”

How to install a ‘deb’ file on Debian Linux (dpkg, apt)

As a quick note, this stackexchange.com page has some good background information on how to install a deb package file from the command line on Debian Linux (which in my case is Ubuntu 16.04). The short answer is that if you have a deb file named google-chrome-stable_current_amd64.deb, you’ll want to run these two commands, one after the other, as shown:

Share it!

There’s just one person behind this website; if this article was helpful (or interesting), I’d appreciate it if you’d share it. Thanks, Al.

Hints for writing Unix tools alvin January 31, 2017 - 1:34pm

Marius Eriksen has a good article titled Hints for writing Unix tools. Some key points: a) consume input from stdin, produce output to stdout; b) output should be free from headers or other decoration; c) output should be simple to parse and compose. There’s much more to it than that, and it’s a good read (or reminder).

An ArchLinux page on Improving Performance alvin January 21, 2017 - 12:25pm

Ubuntu is running great on my old 2008 iMac, but if you’re having Linux performance issues, here’s an ArchLinux page titled “Improving performance.”

Optimizing Linux for slow computers alvin January 20, 2017 - 7:30pm

This is a link to an article titled, “Optimizing Linux for slow computers.” Note that this article links to this more thorough resource on archlinux.org.

Here are a couple of paragraphs from it:

When tuning a server, you'll really want to tweak for performance and high throughput. That's where most Linux configurations really shine over the competition: they come better tuned to get the most out of server configurations.