Altering a process priority is indispensable when you wish to change the behaviour of a running program on the system. Most of the times, when one wants a program to complete its processing faster, tuning its priority holds the key.
Under Linux, this can be accomplished by two ways – GUI & CLI. For this article, we will look at changing a process priority the GUI way. The CLI warrants a separate article.
Once you have the process running, simply open the “System Monitor”. Do note, I am under KDE for this demonstration. So the system monitor options may vary as per your desktop environment. However, the corresponding options should be self explanatory.
Once in System Monitor, click on the “Process Table” tab for a summary of running processes on the system. Here identify your program. In my case, I wished to increase the priority of the Openshot process so it may process my video faster. So upon highlighting the Openshot Video Editor’s process in the table, I hit F8.You should now notice a similar window like one shown above. Here drag the sliders to the right for faster processing. You will be prompted for the root password as you do so. That’s all, the process should now conclude faster.
Regular users do not have permissions to alter files, however the super user can do any changes to the critical system files. For most of the times, one must avoid logging as a root user but at times one needs to login as a root user itself. Here, a small mistake could potential cause irreversible damage to the system. Take an example you are deleting a file & enter the following;
# rm -rf / etc/sysconfig/network-scripts/ifcfg-eth0:0
Noticed the space after ‘/’? That’s not intentional & it got mistyped in haste. Now, if the root user hits enter without correcting his mistake, it will lead to deletion of the entire root directory. You wouldn’t want that. However there is a simple command which prevents root user from deleting files or directories. You can set it on files or directories which you perceive to be important.
The command sets a certain attribute onto a file. These are special attributes over the regular file permissions. The attribute can be only set & unset by a root user.
# chattr +a filename
Now try doing,
# rm -rf filename
You will get,
rm: cannot remove ‘filename’ : Operation not permitted
You can do same on directories.
# chattr +a directory
This will also have an effect on the subsequent sub-directories in the specified directory. However, with the append(a) option, the file can still be altered using the append command. So to avoid that, use the immutable(i) switch instead of (a).
# chattr +i filename
The file can be now deleted nor written to(cannot be appended too).
To unset any of these attributes, simply use minus(-) along with the attribute you specified & file name/directory name.
# chattr -i filename
# chattr -a /directory/
Set this attribute on critical files & directories and you may avoid a potential doom’s day.