Unix How To: Useful Shortcuts for Unix Geeks


Easy and clean.

echo *

The last little trick is just a way to list all the files in a directory in a single line. No tricks with piping the output from ls and removing linefeeds required. If you just type:

$ echo *
echo *
file1 file10 file100 file101 file102 file103 file104 file105 file106 file107 file108 file109 file11 file110 file111 
file12 file13 file14 file15 file16 file17 file18 file19 file2 file20 file21 file22 file23 file24 file25 file26 
file27 file28 file29 file3 file30 file31 file32 file33 file34 file35 file36 file37 file38 file39 file4 file40 
file41 file42 file43 file44 file45 file46 file47 file48 file49 file5 file50 file51 file52 file53 file54 file55 
file56 file57 file58 file59 file6 file60 file61 file62 file63 file64 file65 file66 file67 file68 file69 file7 
file70 file71 file72 file73 file74 file75 file76 file77 file78 file79 file8 file80 file81 file82 file83 file84 
file85 file86 file87 file88 file89 file9 file90 file91 file92 file93 file94 file95 file96 file97 file98 file99

You will get a single line containing all of your file names. This works since the shell expands the asterisk into a list of file names which the echo command is as happy to echo as anything else.

Join us:






Spotlight on ...
Online Training

    Upgrade your skills and earn higher pay

    Readers to share their best tips for maximizing training dollars and getting the most out self-directed learning. Here’s what they said.


    Learn more

Operating SystemsWhite Papers & Webcasts

See more White Papers | Webcasts

Answers - Powered by ITworld

Ask a Question