I just confused to create file with sudo command. As i know, sudo command is commonly used for root privilege(by default) and when i created files using command below:
sudo cat > root.txt
And i saw the user, it still regular username not root. How that can be happen? and how to create files owned by root without changing user to root?
root.txt
, then runscat
withsudo
. See related How to solve “permission denied” when using sudo with redirection in Bash? – steeldriver Sep 29 '20 at 12:49