Linux - Desktop This forum is for the discussion of all Linux Software used in a desktop context. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
08-09-2023, 03:07 PM
|
#1
|
LQ Newbie
Registered: Aug 2023
Posts: 2
Rep:
|
when i use nice with a long command it isn't working
Hi,
sudo nice -n -18 $(okular Documents/x/x.pdf 2> log.file &)
when i use this command it doesnt asks me for a sudo password, as it is not opening the pdf, then when i try to close terminal, it shows that password input but closes rapidly. so it failes. i couldn't figure out why.
my os is ubuntu 22.04
|
|
|
08-10-2023, 08:38 AM
|
#2
|
LQ Guru
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,748
|
Welcome.
It's because of the ampersand's placement in the sequence, as well as the command substution, but rather than address that, there is a clarifying question to be answered: What are you trying to do? There is 100% a different way to do it, since Okular should not be run as root.
|
|
|
08-11-2023, 05:59 PM
|
#3
|
LQ Newbie
Registered: Aug 2023
Posts: 2
Original Poster
Rep:
|
Quote:
Originally Posted by Turbocapitalist
Welcome.
It's because of the ampersand's placement in the sequence, as well as the command substution, but rather than address that, there is a clarifying question to be answered: What are you trying to do? There is 100% a different way to do it, since Okular should not be run as root.
|
I want to read X.pdf with okular, while the code and process is on background -so it doesn't distract my terminal-, and with a faster way-i think its becoming faster as the nice is lower- .
|
|
|
08-11-2023, 07:20 PM
|
#4
|
LQ Guru
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,748
|
Then sudo is not needed as you wish to lower the priority not raise it.
Code:
nice -n 18 okular Documents/x/x.pdf 2> log.file &
Reread "man nice" and "man 2 nice". The higher the number, the lower the priority.
|
|
|
08-12-2023, 02:44 AM
|
#5
|
LQ Addict
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 24,250
|
yes, see man page of nice. You do not need to use sudo if you want to lower the priority, but actually you tried to increase it, which requires root user.
Anyway using nice is completely useless in your case, it won't make your terminal any faster.
Running okular in the background (using &) will detach it from the terminal (and operate independently).
Additionally your original syntax is just wrong, you must not use $( ), that's why it's acting so weird.
|
|
|
08-12-2023, 12:46 PM
|
#6
|
Member
Registered: Nov 2008
Location: US
Distribution: slackware
Posts: 872
|
Quote:
Originally Posted by gonencing
Hi,
sudo nice -n -18 $(okular Documents/x/x.pdf 2> log.file &)
|
I am curious which "nice" would be used in this case. I expect you are using the bash builtin nice. Can you try "/bin/nice" instead of just "nice" ?
|
|
|
All times are GMT -5. The time now is 02:57 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|