Sorting ‘ls’ command output by filesize alvin July 14, 2017 - 11:15am

I just noticed that some of the MySQL files on this website had grown very large, so I wanted to be able to list all of the files in the MySQL data directory and sort them by filesize, with the largest files shown at the end of the listing. This ls command did the trick, resulting in the output shown in the image:

ls -Slhr

The -S option is the key, telling the ls command to sort the file listing by size. The -h option tells ls to make the output human readable, and -r tells it to reverse the output, so in this case the largest files are shown at the end of the output.

How to create a symbolic link in Linux

Linux FAQ: How do I create a symbolic link in Linux?

Answer: To create a symbolic link in Linux, just use the Linux ln command, like this:

ln -s OriginalFile NewSymbolicFile

As you can see from my filenames, when using the Linux ln command, you specify the name of the file you're linking to first, and then supply the name of the link second.

How to sort Linux ls command file output alvin October 24, 2009 - 10:13am

A couple of days ago I was asked how to sort the output from the Unix and Linux ls command. Off the top of my head I knew how to sort the ls output by file modification time, and also knew how to sort ls with the Linux sort command, but I didn't realize there were other cool file sorting options available until I looked them up.

In this short tutorial I'll demonstrate the Unix/Linux ls command file sorting options I just learned.

Linux ‘sort’ command examples

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

As its name implies, the Unix/Linux sort command lets you sort text information. This article shares several examples of the Linux sort command.

Sorting ls command output

You can use the Linux sort command to sort all kinds of output from other commands. For instance, here's an example where I sort the output of the ls -al command:

Linux ls man page (Unix and Linux ls command help)

The contents of this page come from the CentOS Linux ls man page, i.e., the man page for the Linux ls command (also known as the help page for the ls command).

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 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:


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

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.