Alvin Alexander | Java, Scala, Unix, Perl, Mac OS X

The Linux cp command lets you copy one or more files or directories. To be clear, the cp command makes a duplicate copy of your information, whereas the mv command moves your information from one location to another.

Let's take a look at some Linux cp command examples.

Simple file copying

Using a Linux or Unix system, to copy a file named "foo" to a new file named "bar" just type:

The Linux grep command is used to search for text. The name "grep" means something like "general regular expression parser", and if you look at the grep man page it says "print lines matching a pattern". I always tell people that if they don't like the name "grep" they can think of it as "search" instead.

In "grep tutorial", we'll share a number of grep example commands. Let's get started.

The Linux cd command is used to navigate around the Linux filesystem. In this post I'll show the most common uses of the cd command.

To move to another directory on the filesystem just use the Linux cd command to move to the desired directory. For instance, this command:

cd /tmp

moves you to the /tmp directory, and this command:

cd /foo/bar

would move you to a directory named /foo/bar, assuming that directory existed.

As I've started to work on designing an HTML editor I'd like for the Mac platform, a little irony has set in: I find that I don't want to write it in Objective C. Given my history with Java, I find that I don't want to be tied to one platform, even Mac OS X. What if I install Ubuntu later this week (as scheduled) and fall madly in love with it? I want my application to work there also.

Just looking through some old code for a Java/Swing editor I started writing years ago, I saw this line of code that I added specifically for the Mac OS X platform:

Here's a brief list of some of the most obvious, and important, team-level best practices I know for software development:

Linux ls command FAQ: Can you share some examples of the Unix/Linux ls command?

The Linux ls command is used to list files and directories. While it has many options, I thought I'd list the most common ls command uses I'm aware of.

The ls command options I use most of the time are -a ("show all") and -l ("long listing"). Put together, like this:

Using command-line expansion

Now, if I'm really cool, I don't actually type out that whole remove command, do I? As a practical matter I usually just type in something like this:

rm de

and then hit the [Tab] key, and if "delete.me" is the only file in the current directory beginning with the characters "de" the Unix system expands my command line to look like this:

rm delete.me

Pretty cool, eh? That part is called "command-line expansion", and it makes life very easy.

Looking at file contents with the "more" and "cat" commands

If I want to be sure that I have the right file I can also look at it with the more command, like this:

Question: How do I set my Java/Swing application to use the native look and feel of the platform it is running on?

Answer: Use the Java UIManager class to set the look and feel properly, like this:

UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());

Note that the setLookAndFeel method can throw an UnsupportedLookAndFeelException exception that you should handle.

 

Mac Java menubar FAQ: I'm creating a "Mac Java" application for (a Java Swing application for Mac OS X) ... how do I put my Java menu bar (JMenuBar) on the Mac menubar?

Answer: In your Java Mac application, set the system property apple.laf.useScreenMenuBar to true, like this:

Here's a simple Ruby program that opens a text file, then uses a series of simple algorithms to look for hidden words in the text. For instance, it looks at only odd words, only even words, then looks at Nth characters, Nth words, and also Fibonacci words and characters.

Logging in to a remote system

To login to that system I'll use a command named ssh, which stands for "secure shell". It's basically an encrypted login session to a remote system. To login to that remote system I'll type this command in my terminal window:

ssh al@foo.bar.com

(Of course everything after the ssh command there is made up. I don't have a login account on any systems named anything like that.)

This article is now part of my new eBook, which is only $2.99 on Amazon.com:

You want me to do what? A Survival Guide for New Consultants

I hope you enjoy my book, and more than that, I hope it helps you have a very profitable and rewarding career.

 

Quick Start: A typical login session

In my previous post I talked about the history of the Unix and Linux operating systems to give you a little background for the rest of this lesson.

Next, I'd like to dig in and show you what a typical Unix login session looks like, and then I'll get into more details after that.

I thought I'd take a little time and write a tutorial on how to get started with the Linux, Unix, and Mac OS X operating systems. As I write this I'm trying to keep in mind a friend of mine who works strictly on Windows, so I'm writing this from that perspective.

Here then is my "Getting Started with Linux and Unix" tutorial.

I just updated my "Software career best practices 101" post from a few years back. It was a little dated, and hopefully now it's a little refreshed.

I just updated an old Postgresql blog entry about how to make a backup of a Postgresql database. The syntax changed quite a bit since that post in 2004.

I thought I'd take a few minutes to look at the philosophical design differences between the Mac OS X user interface and the Microsoft Windows user interface. This topic is probably worthy of a Master's degree thesis, but I'm going to rattle off the big differences I see in about 30 minutes worth of typing.

Ever have one of those days when you wish you hadn't said something publicly? Kevin Miller must certainly be feeling that way these days: