alvin's blog

Linux ls command examples

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:

Linux tutorial, part 5

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.

Linux tutorial, part 4

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:

Java look and feel - how to use the native system look and feel

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.

 

Java JMenuBar Mac example - put the JMenuBar on the Mac OS X menubar

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:

A Ruby script to find hidden messages in text

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.

Linux tutorial, part 3 (ssh, cd, ls, cp, mv)

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.)

The karma of a pessimist

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.

 

Linux tutorial, part 2

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.

Syndicate content