AWS re/Start Lab · Linux

Working with Commands

Learn to manipulate data streams using powerful shell utilities. Use tee for simultaneous output, sort for ordering records, cut for isolating columns, and the pipe operator to chain sequences together.

Lab Summary

Connected via PuTTY (as described in Lab 225). Began by piping the system hostname into the tee command for dual output. Constructed raw CSV lists via cat to test the capabilities of sort and cut against delimiter-separated values, ultimately chained together with robust piping architecture to discover string patterns using grep.

Piping Output

Executed overlapping routines simultaneously using the pipe character linking outputs dynamically.

Data Formatting

Employed sort techniques against CSV data to normalize and arrange records alphanumerically.

Field Extraction

Spliced specific text columns using the cut toolkit mapping exact delimiter targets.

Step-by-Step Walkthrough

Detailed record of each task performed during the lab manipulation suite.

01

SSH Connection

  • Connected to the EC2 instance via PuTTY following the process described in Lab 225.
02

Use the tee Command

  • Navigated to the user home folder.
  • Executed hostname | tee file1.txt which queried the server name and, via a pipe, handed it to tee.
  • Confirmed that tee relayed the hostname (e.g., ip-xx.region.compute.internal) both up to the console screen and down into the new file file1.txt.
  • Verified file creation with the ls utility.
03

Use the sort Command and Pipe Operator

  • Generated a new flatfile by initiating cat > test.csv.
  • Populated 5 rows containing non-sequential business data regarding Factories and Stores.
  • Closed the input stream using CTRL+D.
  • Organized the dataset executing sort test.csv, allowing the daemon to sequence the records alphabetically by title block, then numerically.
  • Implemented the pipe structure combining find and string matching: find | grep Paris test.csv ensuring nested operations search for specific locales efficiently.
04

Use the cut Command

  • Built a second registry via cat > cities.csv, saving US cities and states.
  • Initiated the cut mechanic: cut -d ',' -f 1 cities.csv.
  • Observed that the -d ',' delimiter switch mapped against every comma, and the -f 1 switch retained merely the leading column (the city name), severing formatting.
  • Understood how the sed (stream editor) application can manipulate text identically via sed 's/old/new/' filename format algorithms.

Command Reference

Primary utilities executed within the data modeling operations.

cmd

tee

Reads from standard input and writes strictly forward to standard output and simultaneously into specified files.

cmd

sort

Prints the lines of its input or concatenation of multiple files arranged in specified sequence orders.

cmd

cut

Removes sections from each line of a file.

  • -d : Declares the custom delimiter to target beyond whitespace
  • -f : Indicates which column field number to select or display

Key Learnings

What Was Learned

Routing processing streams into the tee service bridging log capture and console confirmation.
Sorting structural database arrays algorithmically with minimal options using the sort baseline behavior.
Isolating core data metrics leveraging the cut tool's precise delimiter scoping logic (e.g., isolating commas).
Chaining multi-phase jobs through the | feature extending the capabilities of individual binaries.

Technical Conclusion

Understanding standard input, output, and redirection is important when architecting robust data-pipelines. By exploiting the | pipe mechanics, sequential tasks that normally require discrete intermediary text files can occur instantly in RAM.

Text-parsing appliances (sort, cut, sed) unlock profound search mechanisms that guarantee sysadmins can triage dense log infrastructures efficiently compared to traditional graphical editors.