Q. How do I run a process with modified scheduling priority under Linux? I’d like to change the priority in the kernel’s scheduler while starting a command.
A. Use nice command to run a program with modified scheduling priority / nicenesses. Nicenesses range at least from -20 (resulting in the most favorable scheduling) through 19 (the least favorable). The default behavior is to increase the niceness by 10.
A niceness should not be confused with a scheduling priority, which lets applications determine the order in which threads are scheduled to run. Unlike a priority, a niceness is merely advice to the scheduler, which the scheduler is free to ignore.
nice syntax (/bin/nice command)
/bin/nice -n NUM
Add integer NUM (-20 to 19) to the niceness.
There are multiple versions of the nice command. One built in to the shell, and one in /bin/nice. The syntax may be diffrent on your system. Refer your shell and /bin/nice command man page for details.
Change niceness by 3
Type the command as follows:
$ /bin/nice -n 3 command-name
Only a privileged user may run a process with lower niceness:
$ /bin/nice -n -1 command-name
Shell in build nice command syntax
If you use the csh or tcsh or bash, the syntax is as follows:
nice +n command
I recommend using /bin/nice syntax to avoid confusion and to save time.
Q. Iâ€™d like to create my root account in Linux. How do I do it?
A. Root user is superuser on a Unix / Linux system. Root user has all rights or permissions. . The root user can do many things an ordinary user cannot do on system such as start / stop services, grant / revoke any permissions, open ports (especially < 1024 ports), user management and much more. The root user is the most privileged user on the system and has absolute power over it.
By default almost all Linux distributions and UNIX like operating system creates the root account at the time of installation. You donâ€™t have to create a new root account. Use su or sudo command to run administrative task as the root user.
Creating another root user can be a security risk. Root has a UID of zero in /etc/passwd. This means absolute control over the system for the root user. You can set any user id to 0 (zero) to grant unlimited permissions provided that you login as root.
However some variants of UNIX provides additional account. For example BSD provides a toor ("root" backwards) account in addition to a root account.
It is recommended that you use root only when required and there is no need to create a new root user account.