System Health Checker
Part of the Fundamentals section of Coddy's Terminal journey — lesson 82 of 82.
Challenge
EasyCreate a shell script called health.sh that displays a system health report with the following sections:
- Start with the shebang line (
#!/bin/bash) - Print
=== System Health Report === - Print
User:followed by the output ofid -u - Print
Current Directory:followed by the output ofpwd - Print
Running Processes:followed by the count of lines inprocesses.txt(simulating process count) - Print
=== End of Report ===
Use command substitution $(command) to capture command output within your echo statements.
Make the script executable and run it. Your output should be:
=== System Health Report ===
User: root
Current Directory: /home
Running Processes: 10
=== End of Report ===Try it yourself
Terminal
All lessons in Fundamentals
4Directories
Create A DirectoryCopy A DirectoryMove And Rename A DirectoryDelete A DirectoryRecap - Directory Operations7File Content
Head And TailWord CountSort CommandUnique CommandGrep BasicsGrep With FlagsRecap - Text Detective2Navigation
Print Working DirectoryList FilesChange DirectoryAbsolute vs Relative PathsHome And Root DirectoryRecap - Find Your Way8Redirection
Standard OutputOverwrite To A FileAppend To A FileStandard InputStandard ErrorRecap - Log Builder6Wildcards And Patterns
The Star WildcardThe Question Mark WildcardBracket WildcardsCombining WildcardsRecap - Selective Operations9Piping
What Is A PipeChaining Two CommandsChaining Multiple CommandsPipe With GrepRecap - Data Pipeline