Command Line Trickery

Skip to end of metadata
Go to start of metadata
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

Labels:
None
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.