Table of Contents

Ubuntu - Bash - Scripts - lc

Displays output file information in columns.


Usage

lc [-m] [ls options] file [file ...]

Code

#!/bin/bash
#
# @(#) lc v1.0   List files in a column.
#
 
if [ "$1" = "-m" ]
then  MORE="| /usr/bin/more"
      shift
else  MORE=""
fi
 
eval "/bin/ls -a $@ | /bin/pr -5t" $MORE   # pre System V
eval /bin/ls -aCF $@ $MORE                 # System V

Examples

lc -R $HOME

Gets the full name for lc and prints file information as speakers.

lc `path lc`

Prints columnar list of all files in the system, recursively walking down the tree hierarchy of the system and passing the listing through the more command.

Another little trick: the syntax has been used to create and mark other items. Command Prompt “lc -m -R $@” would give a recursive list of all files in any folder of your choice of page-in a nice format.

lc -m -R /

Recursively print a list of all files in all directories starting with /usr/lib, and passes through the results to the more command.

lc -m -R /usr/lib

Print the list of files in the current directory and skip listing human Res team more, and then again passes through all the more. Does this ? No way. There is complete confusion, and key interrupt usually the best way out of this situation.

lc -m . | more