Friday, October 21, 2016

Using a previous version of Maven in Ubuntu

There are some issues in the current version of Maven (v3.3.9) that were giving me some problems with a plugin that is in use. I needed to revert to v3.3.3 under Ubuntu. Instead of uninstalling maven and manually installing the previous version, I can take advantage of Debian's update-alternatives infrastructure which is included with Ubuntu. This lets me install both versions that I need and switch between them via a simple command. The instructions for installing the different version of maven are well laid out here.

After following those instructions, a simple "sudo update-alternatives --config mvn" allows me to pick the version which will be used with the "mvn" command and avoid my version-based troubles.

Tuesday, August 30, 2016

Grep for a particular file type

Grep is great for searching recursively through a directory of source code, but it annoyingly wastes time looking at binary files and other file types that I am not interested in. When I am looking through some Java code for a reference to something like writeTextToLog(), I would ordinarily go to my top level directory and use

grep -r "writeTextToLog(" .

But this returns lots of binary target file results like this that clutter the screen and sit there chewing up time:

Grep for a particular file type

Grep is great for searching recursively through a directory of source code, but it annoyingly wastes time looking at binary files and other file types that I am not interested in. When I am looking through some Java code for a reference to something like writeTextToLog(), I would ordinarily go to my top level directory and use

grep -r "writeTextToLog(" .

But this returns lots of results like this that clutter the screen and sit there chewing up time:

Wednesday, June 15, 2016

Some data tools

There are some good command line data tools in this blog post for working with data. Specifically, csvkit is pretty useful.

Wednesday, May 11, 2016

Figuring out which internet connection is being used

Now that fiber connections are more widely available (including in my house) sometimes I will plug my laptop in to a wired connection so that I can take advantage of the higher speeds. For general browsing and listening to music it doesn't make much difference whether I am on wifi or wired in, but when transferring large amounts of data, it can make a big difference. But when I plug in the wired connection, do I need to disconnect my wifi to ensure I am using the connection? How do I tell which connection is being used? The answer is found with the Linux tools route and traceroute.

Monday, April 4, 2016

Viewing login attempts

Open an ssh port to the internet and in a short time you will see all kinds of login attempts. There will be repeated attempts to access your system using usernames such as "admin" and "root" and others that are presumably left unguarded on systems somewhere. There are all kinds of simple steps to take to ensure that these attempts are not successful and that they don't overwhelm your system (such as using fail2ban). The log files auth.log and syslog (found in /var/log) will be full of attempts, but how do you look to see if anyone has successfully logged in?

Wednesday, February 24, 2016

Running Python pip on a specific python installation

Python versions are a bit confused on my Ubuntu install right now. If I type "python" at the command line I get Python 2.7. If I type python3 then I get Python 3.4. And python3.5 gives me Python 3.5. Not usually a problem because I put the correct entry in the shebang of the script I am running, but it is sometimes difficult to get pip to install in the right place (or, I should say, to figure out where pip installed and determine if it is where I want it, because who knows what the "right" place is?).