Explain pipes and redirection, including `tee` and here-strings.
BeginnerConceptPackages, Shell & Text Tools
Answer
A pipe | connects stdout of one command to stdin of the next. > overwrites, >> appends, < reads input. tee writes to a file and stdout at once, which is how you write root-owned files with sudo.
journalctl -u api | grep -i timeout | wc -l
echo "vm.swappiness=10" | sudo tee /etc/sysctl.d/99-swap.conf
grep -c x <<< "$text" # here-string
sudo echo x > /etc/file fails because the redirection runs in your unprivileged shell.
More on Packages, Shell & Text Tools
Compare apt and dnf package management.BeginnerWhat is the difference between `apt upgrade` and `apt full-upgrade`?IntermediateHow do you find which package provides a file or command?BeginnerHow do you pin or hold a package version?IntermediateHow are repositories and their GPG keys configured?AdvancedWhat is the difference between a login shell and an interactive non-login shell?Intermediate