Hour 3

1: What are invisible files? How can they be listed with ls?
A1: Invisible files are files with names that start with the . character. You can list them by specifying the -a option to ls.
2: Is there any difference in the output of the following commands?
  1. $ ls -a1

  2. $ ls -1 -a

  3. $ ls -1a

A2: No. Each of these commands will produce the same results.
3: Which options should be specified to wc to count just the number of lines and characters in a file?
A3: On Solaris, HPUX and BSD (including MacOS X), use the command
$ wc -lm

On Linux use the command

$ wc -lc
4: Given that hw1, hw2, ch1, and ch2 are files and book and homework are directories, which of the following commands generates an error message?
  1. $ cp hw1 ch2 homework

  2. $ cp hw1 homework hw2 book ...

Get Sams Teach Yourself Shell Programming in 24 Hours, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.