Skip to main content
U.S. flag

An official website of the United States government

Official websites use .gov
A .gov website belongs to an official government organization in the United States.

Secure .gov websites use HTTPS
A lock ( ) or https:// means you’ve safely connected to the .gov website. Share sensitive information only on official, secure websites.

The Insider's Guide to Accessing NLM Data

> (greater-than)


As new Insider's Guide classes are no longer being offered, this site is not currently being updated. Please refer to NCBI's E-utilities documentation for more up-to-date information.


The Unix redirection operator “>” can be used to redirect the output of a command to a file. Simply add “>” at the end of the command, followed by the name of the file to which you wish to redirect the output. The file will be saved in your Unix working directory.

Examples

Redirect the output of an efetch command to a file named “abstract.txt”:

efetch -db pubmed -id 26287646 -format abstract > abstract.txt

Redirect the output of an esearch command to a file named “search_results.xml”:

esearch -db pubmed -query "h1n1 asthma" > search_results.xml

Last Reviewed: August 9, 2021