What is the purpose of the printf command in Linux?
It formats and controls the presentation of text and numbers in output.
What does the %s specifier do in printf?
It acts as a placeholder for string values.
What does \n do in printf?
It creates a new line in the output.
Example: What does the command ‘printf “User: %s\nHome Directory: %s\nShell: %s\n” “$USER” “$HOME” “$SHELL”’ do?
It displays user information in a structured format using variables.
What is the bc command used for?
It performs precise arithmetic operations, including floating‑point calculations.
What does ‘scale=2’ do in bc?
It sets the output precision to two decimal places.
Example: What does ‘echo “scale=2; (2.45 + 3.67 + 4.89) / 3” | bc’ calculate?
The average of the three numbers with two decimal precision (3.67).