The command-line phrasebook

Written By
Web Webster
Web Webster
Mar 5, 2009

“The -X flag
Some graphical file managers enable you to sort files and folders
by name, type, when they were last modified and so on. You can also
achieve this on the command line using the ls command and suitable
switches. To sort by type, simply opt to list by file with

“ls -X
This provides the contents of the current directory sorted by
extension starting with any subdirectories and then displaying
files by extension alphanumerically. To sort by time and date,
substitute the switch -t; and to sort by size, use -S instead. You
can use multiple switches at the same time, but remember that some
will undo the work of previous ones. For example, ls -t -a sorts
the contents of the current directory by time, including hidden
files, while ls -S -X results in the contents simply being listed
by type and not by size, followed by type. Where is that file?:
locate & grep

“There are several commands that you can use to search for
files. The first, locate, uses a database of filenames to search
for your file. It returns a list of all files that match the
search, including their full paths.

“locate text

Advertisement

Complete
Story

Web Webster

Web Webster

Web Webster has more than 20 years of writing and editorial experience in the tech sector. He’s written and edited news, demand generation, user-focused, and thought leadership content for business software solutions, consumer tech, and Linux Today, he edits and writes for a portfolio of tech industry news and analysis websites including webopedia.com, and DatabaseJournal.com.

Linux Today Logo

LinuxToday is a trusted, contributor-driven news resource supporting all types of Linux users. Our thriving international community engages with us through social media and frequent content contributions aimed at solving problems ranging from personal computing to enterprise-level IT operations. LinuxToday serves as a home for a community that struggles to find comparable information elsewhere on the web.

Property of TechnologyAdvice. © 2026 TechnologyAdvice. All Rights Reserved

Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.