Nic Acton
  • My Gitbook
  • My Favorite Things
    • Podcasts
    • Newsletters
  • Monthly Summaries
    • May 2019
    • June 2019
  • Cloud Computing
    • Cloud Concepts
    • AWS
      • Certified Solutions Architect
      • Well Architected Framework
        • Operational Excellence
        • Reliability
        • Performance Efficiency
        • Cost Optimization
        • Security
      • Analytics
        • Elasticsearch Service
        • Kinesis
        • Elastic MapReduce (EMR)
      • Compute Services
        • Elastic Beanstalk
        • Elastic Container Service (ECS)
      • Deployment
        • CloudFormation
      • Application Services
        • Key Management Service (KMS)
        • Simple Queue Service (SQS)
        • API Gateway
        • Simple Work Flow (SWF)
        • Amazon MQ
        • Simple Notification Service (SNS)
      • Simple Storage Service (S3)
        • Macie
      • Databases
        • RDS
        • DynamoDB
        • ElastiCache
        • Neptune
        • Redshift
      • Cloudfront
      • IAM
      • Monitoring
        • Trusted Advisor
        • Amazon Inspector
        • AWS Config
        • AWS Shield
        • CloudWatch
          • VPC Flow Logs
        • CloudTrail
        • Guard Duty
      • Route53
      • Serverless Architectures
        • Lambda
      • VPC
        • Highly Available & Fault Tolerant VPCs
        • Hybrid Environments
          • VPC Peering
          • Direct Connect
        • Cloud HSM
    • GCP
    • Azure
    • HashiCorp
    • Red Hat
      • RHEL
        • Basics
        • Grep & Regex
        • SSH
      • Ansible
    • Tutorials/Guides
      • Linux
        • Admin
  • Software Engineering
    • Machine Learning
      • Deep Learning
        • Tensorflow
      • Training and Loss
    • Programming
      • APIs
    • Security
    • Web Development
      • OSI 7 Layer Model
    • Tutorials/Guides
      • Apache Server
    • Virtualization
      • Virtual Machines
      • Containers
      • Serverless
  • Fitness
    • Nutrition
      • Diets
      • Macronutrients
      • Supplements
      • Miscellaneous
    • Strength Training
    • BodyBuilding
  • Miscellaneous
    • Technology Ethics
      • Education
    • Interesting Concepts
      • Libertarian Paternalism
Powered by GitBook
On this page
  • Input/Output Redirection
  • Output Redirection
  • Input Redirection
  • Pipes
  • Error Redirection

Was this helpful?

  1. Cloud Computing
  2. Red Hat
  3. RHEL

Basics

Input/Output Redirection

Three things to remember:

  • stdin device is the keyboard

  • stdout device is the screen

  • stderr is reserved for error output

Output Redirection

$ ls -al > listing will store output of ls -al in a file called listing

>> performs the same function but appends data instead of rewriting a file

Input Redirection

$ sort < listing will push the listing file to the sort command

Pipes

Pipes take the output of one command and feed it into another. You can give any command scrolling output by piping it through less like $ ls -l | less

Error Redirection

When an application has an error, this goes to stderr which can be pushed to a file using 2> so if myscript.sh were to push an error, then $ myscript.sh 2> errors would push only the errors to a file called error. The 2 in the redirect specifies to redirect stderr, with normal output showing on the screen. You can write all output and errors to the same file using something like $ myscript.sh > allout.txt 2>&1

PreviousRHELNextGrep & Regex

Last updated 5 years ago

Was this helpful?