How do you run commands as the root user?

Hello

I read other posts concerning the root but still cannot seem to run /etc/ttys as the root user.

I was sure I had logged into the system console as the root, because I was using the .vmdk config file which I think comes only with the root user account at the start. But when I run /etc/ttys to view the all available consoles, the system console returns 'Permission Denied.'

As a workaround, I tried running su root /etc/ttys, then the console returned long 'Command not found' messages made up of the console number followed by each message. Does this mean the permission problem has been cleared but the command is incorrect? If so, could someone please help me get the correct command?

Thank you for your time reading this.
 
Last edited by a moderator:
/etc/ttys is not a command/script you can run. It's a config file (see ttys(5)). If you want to view it run less /etc/ttys (or use your favourite editor).
 
I read other posts concerning the root but still cannot seem to run /etc/ttys as the root user.

I'd be interested in knowing what you read that made you consider doing this. As a general rule, the root account should only be used under particular circumstances. Running random "commands" you don't understand is most definitely not one of them. Also, *.vmdk is a virtual disk file, not a config file.

To satisfy your curiosity about what consoles are available, the answer is 1-7, with 9 reserved for the X server and 8 typically used for a graphical login daemon (see the ttyv* lines in /etc/ttys). You can switch consoles use Alt+<F1-F7>.
 
Back
Top