Why to use sudo to create or run files?

Why should one use sudo to create files or to run them, while the task also can be done without elevated access.?

Hey Suhail, sudo means superuser_do which tell the command line to initiate an action done by us.

It is not necessary to use sudo for every command.
Sudo is a special command used to give supreme access in any situation.
We are told to use sudo just to avoid getting access related errors

Sudo is a command to run a program with the security privileges and it promt for you personal password and confirm your request

Sudo/Root is used whenever you are doing something that a standard user should not have the capability of doing for risk of damaging/changing the system configuration in a way that the Administrator of the system would not normally allow.
For example, if a package/config file could be modified without elevated privileges, then it would be extremely simple for an outside source to simply execute remote code that could break/compromise your system. By forcing those actions to require root access, it forces you as the user to make the decision on whether or not those actions take place.
Sudo is needed only when you are performing admin functions like managing packages, editing config files, installing a program from source etc.It is for security purposes.

The sudo command allows you to run programs with the security privilages of another user.
As you might have noticed it prompts you for personal password and confirms your request to execute a command by checking a file, called sudoers, which the system administrator configures:grinning::grinning:

Some commands do not need superuser privileges, like ls, cd commands.
Certain commands like chmod, apt-get make changes in the filesystem. It could make or break the system. Hence, the sudo is required in these cases. You can check what kind of user you are by using a whoami. Accompany it as sudo whoami and you’d know whether you are a root user or not

Using sudo (or “superuser do”) allows users to execute commands with elevated privileges, typically as the root user or another specified user with administrative rights.It is true that many tasks can be performed without elevated access.