Powered by OPF
OPF WIKI STATIC ARCHIVE
2,681 pages · 153 spaces · 776 tags · 4,025 history records · 96.2% of the original wiki recovered
Archived copy. This page was recovered from the Internet Archive snapshot of /pages/viewpage.action?pageId=22249550 taken on 2022-09-30. The original wiki at wiki.opf-labs.org is being decommissioned.

Command Line Trickery

Created by Maurice de Rooij on Feb 04, 2013 · last edited by Maurice de Rooij · on Feb 04, 2013 (view history) · 3 versions

Introduction

This page is meant to show you some command line trickery to make your daily Digital Preservation tasks and life in general a lot easier. Please note that most of this tips apply to Linux environment, unless stated otherwise.

Redirection

Redirect STDOUT to file, creating the file if it does not exist, or overwrite when the file already exists.
command > output.txt

Redirect STDOUT to file, appending data, if the file already exists.
command >> output.txt

Redirect STDOUT to file, creating the file if it does not exist, or overwrite when the file already exists;
Redirect STDERR to another file, creating the file if it does not exist or overwrite when the file already exists.
command > output.txt 2> error.txt

Redirect STDOUT to file, creating the file if it does not exist, or overwrite when the file already exists;
Redirect STDERR to another file, appending data, if the file already exists.
command > output.txt 2>> error.txt

Redirect STDOUT to file, creating the file if it does not exist, or overwrite when the file already exists;
Redirect STDERR to another file, appending data, if the file already exists.
command >> output.txt 2>> error.txt