Linux Today: Linux News On Internet Time.
Search Linux Today
Linux News Sections:  Developer -  High Performance -  Infrastructure -  IT Management -  Security -  Storage -
Linux Today Navigation
LT Home
Contribute
Contribute
Link to Us
Linux Jobs


More on LinuxToday


The command-line phrasebook

Mar 05, 2009, 19:33 (1 Talkback[s])

"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

Complete Story

Related Stories: