Unix and Linux network configuration. Multiple network interfaces. Bridged NICs. High-availability network configurations.


Reviews of latest Unix and Linux software. Helpful tips for application support admins. Automating application support.


Disk partitioning, filesystems, directories, and files. Volume management, logical volumes, HA filesystems. Backups and disaster recovery.


Distributed server monitoring. Server performance and capacity planning. Monitoring applications, network status and user activity.

Commands & Shells

Cool Unix shell commands and options. Command-line tools and application. Things every Unix sysadmin needs to know.

Home » Commands & Shells, Networking

Using FTP with pipes

Submitted by on November 19, 2005 – 10:37 pm 10 Comments

Pipe in Unix is a method of passing information from one command to another. The pipe take the output of the first command and sends it as input for the second command. The a second pipe can be used to grab the output of the second command and send it to the third command and so on. Pipe is a very powerful and useful feature of the Unix shell.

ftp > put "| tar cvf - ." myfile.tar

And to retrieve and untar, use:
ftp > get myfile.tar "| tar xvf -"

Or, to send and compress a tar file onto an ftp site, you can use this:
ftp> put "| tar cvf - . | gzip " myfile.tar.gz<br>

Print Friendly, PDF & Email


  • Siddesh says:

    What does this mean?? Can u explain me??

    app that connects to default ftp client using a pipe on linux, recursively searches for some files (up to some recursion level),

    • Igor says:

      The first command creates a tar ball of the current local directory and uploads it to the FTP server. The second command downloads the tar ball from the FTP server and untars it in the current local directory. The third command does the same as the first command, but also compresses the tar file. These commands can be used to copy and entire directory structure from one computer to another using FTP server as an intermediary.

  • Siddesh says:

    thanx for replying
    But m question is on this —
    ” i want to create app that connects to default ftp client using a pipe on linux, recursively searches for some files (up to some recursion level)”
    I m not getting what is dis?? means how to use pipe

    • Igor says:

      The standard FTP client on Linux does not support any search operations. You can’t use “find” with it. You may want to try ncftp or lftp clients. The only option with the standard FTP client is to do a recursive directory listing with ls -R, dump the output to a file and then use “grep” to search that file. I would suggest trying lftp client.

  • Siddesh says:

    where i ll use pipe in this case

  • Siddesh says:

    ohkk but where i ll b using pipe in ftp

  • Motordom says:

    I have an account with at&t to make my business website.
    Well, I orignally uploaded a file (index.whatever) and it made the page, but it didn’t show up right. Is there anyone out
    here in yahooland that could help me with a premade “something” that I could just upload to it somehow? any tips would be appreciated!

  • Joey 01 says:

    I’m 15 and I set up a ftp server, and I know the basics of html, I’ve also built a computer. I think ubuntu is the best thing since sliced bread. am I technically inclined, or just a nerd?

  • Alun J says:

    can any one give full answer

  • Le Pwner says:

    Hello. I have a function that validates if the url is valid (it should start from http or https or ftp and has dot and no more than several letters and can have a lot of symbols after /). I was sure it’s OK, but I’ve found it’s vulnerable: once user enters ”” – with ” symbol, it cracks the view of the web-page. Probably I need a better checking. Also I don’t know what symbols are allowed in the URL and what symbols can crack the web-page view or make a harmful sql-injection.
    Who can help? Please don’t send me to the proper sites. I spent a lot of time choosing one or another code for validating preg_match. One doesn’t validate, but another validates OK, but you can type ” or and you’ll see bold hi on the next page – not good.
    I’ve found at microsoft web-page about naming files, paths and namespaces that
    * (greater than)
    * : (colon)
    * ” (double quote)
    * / (forward slash)
    * (backslash)
    * | (vertical bar or pipe)
    * ? (question mark)
    * * (asterisk)
    are reserved characters. Unfortunately I suspect some of them can be used for URL. Am I wrong?

    Thank you.

1 Pingbacks »

    Leave a Reply

    %d bloggers like this: