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 /display/PT/Command Line Trickery taken on 2017-05-11. 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 Aug 01, 2013 (view history) · 3 versions
Work in progress

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

Redirection to file

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

Redirection to process

Piping

Named Pipes