?? Mastering Linux Filters, Redirection, and Piping in DevOps! ?? (Linux 4#)
Krishantha Bandara
IT Assistant @phoenix pvt ltd BSc (Hons) Computer Science and Software Engineering Degree (Grade - First Class)
As I continue expanding my skillset in DevOps, I've been deep-diving into Linux commands, filters, and I/O redirection — all critical tools for managing data flows and system outputs efficiently! ???
?? Grep is my go-to for finding text patterns in files. Here are some useful commands:
# Find the line that contains the word "root" from /etc/passwd
grep "root" /etc/passwd
# Ignore case sensitivity (Root ≠ root)
grep -i "root" /etc/passwd
# Display lines that do not contain the word "root"
grep -v "root" /etc/passwd
?? I/O Redirection allows for seamless data handling:
# Create a file with content
echo "Kubernetes is a great tech tool" > devopstools.txt
# Search for "tech" and replace it with "tools", redirecting the output to a new file
sed 's/tech/tools/g' devopstools.txt > newfile.txt
# Append output to the same file
echo "Docker is another powerful tool" >> newfile.txt
# Redirect only errors to a file
command 2>> error_log.txt
# Redirect all output (stdout and stderr) to a file
command &>> output_log.txt
?? Piping (|) lets you chain commands together for efficient workflows:
# Display the first 5 lines of the /etc/passwd file and search for users
head -n 5 /etc/passwd | grep "user"
# Use less to display the contents of a file page-wise
cat newfile.txt | less
Mastering these core skills is key to deploying, troubleshooting, and managing systems in cloud environments like AWS. And yes, it's all part of my journey to mastering DevOps tools like Docker, Kubernetes, Jenkins, and beyond! ???? #Linux #DevOps #CloudComputing #AWS #SystemAdministration #Kubernetes #Docker #Automation #SysAdmin #ContinuousIntegration #DevOpsJourne