Defindit Docs and Howto Home

This page last modified: Aug 17 2004
# ls dot files
ls -d `ls -A | grep "^\."`

# ls dot files, method 2
# File starts with a dot, but second char is not a dot which eliminates ..
# Implies a file name longer than one character which eliminates .
ls -ld ./.[^\.]*

# ls the file with the very irritating name "--"
# -- ends option processing, so that hyphens stop having special meaning.
ls -l -- -- 

# Also try using a full or relative path.
# This seems to work.
ls -l ./--
rm -i ./--

# bash has the ability to have extended globs,
# however, globs are apparently expanded into a file list before the command is executed
# therefore ?(\-\-) still must follow a -- to stop parameter parsing.
# In other words, bash uses command line globbing to build a list of files
# it substitutes for the glob on the original command line. Bash builds a new command line
# based on the command the user entered. The new command is the one executed. 
# Verify this with echo (which also shows that echo can be used to list files).
echo ??
shopt -s extglob
echo ?(??)
ls -l ?(tt)

# disable file name globbing e.g. noglob on
set -o noglob

# enable globbing e.b. noglob off
set +o noglob