Skip to content

Instantly share code, notes, and snippets.

@boydjc
Last active April 23, 2022 23:46
Show Gist options
  • Save boydjc/d5b8c297624ddf4d299a9f07a8889f8f to your computer and use it in GitHub Desktop.
Save boydjc/d5b8c297624ddf4d299a9f07a8889f8f to your computer and use it in GitHub Desktop.
Minecraft priority change in Linux

This snipit of code is used to change the priority of Minecraft so that I can squeeze out a bit more performance.

renice -n -20 $(ps -aux | grep minecraft | awk '{print $2}' | tail -2 | head -1)

A break down of the command:

  • renice -n -20

used to set the max priority of a process. The renice command needs a process id to operate on

  • ps -aux | grep minecraft | awk '{print $2}' | tail -2 | head -1

the ps command gets a list of processes. It returns many things such as who is running the process and the process id the grep command takes the output piped from ps and searched for any output that contains 'minecraft' we use the awk command to select specific columns. In this case we use it select the 2nd column which contains the process id tail and head are used to narrow down the results to one id

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment