Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm writing a script that transfers files that are periodically added to a remote server. To do this I'd like to pull ls output from the remote server, then check it against a list of files that have already been downloaded.

I had a difficult time figuring out how to redirect the output from ls to a local file. I cam across this question, and found that ls . localfile works.

I've never come across the . operator for output redirection. How is it related to > and |?

share|improve this question
up vote 4 down vote accepted

It's not. From the ftp(1) man page:

dir [remote-directory] [local-file]

Print a listing of the directory contents in the directory, remote-directory, and, optionally, placing the output in local-file. If interactive prompting is on, ftp will prompt the user to verify that the last argument is indeed the tar‐ get local file for receiving dir output. If no directory is specified, the current working directory on the remote machine is used. If no local file is specified, or local-file is -, output comes to the terminal.

So when using the dir command you can specify a local file to dump the listing to. The . is just referring to the remote directory that you are listing (in the case of . the current directory).

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.