CompTIA
XK0-004 · Question #243
A user wants to alias dir so it always returns the contents of the ls -la command. However, the user has to reset the alias with every login. Which of the following is the BEST action the user can…
The correct answer is C. echo "alias dir=ls -la" >> ~/.profile. When echoing something to a file, >> appends to the file and > overwrites the file.
Scripting, Containers and Automation
Question
A user wants to alias dir so it always returns the contents of the ls -la command. However, the user has to reset the alias with every login. Which of the following is the BEST action the user can take to ensure the command is always available?
Options
- Aecho "alias dir=ls -la" > /etc/profile
- Becho "alias dir=ls -la" >> /etc/skel
- Cecho "alias dir=ls -la" >> ~/.profile
- Decho "alias dir=ls -la" > ~/.bashrc
How the community answered
(43 responses)- A5% (2)
- B2% (1)
- C86% (37)
- D7% (3)
Explanation
When echoing something to a file, >> appends to the file and > overwrites the file.
Topics
#alias#bash profile#shell configuration#login scripts
Community Discussion
No community discussion yet for this question.