My Elementary OS freezes and crashes on coping large files. I try apply a fix I did find on Ubuntu forums: to change content of two files.

sudo sh -c 'echo $((48*1024*1024)) > /proc/sys/vm/dirty_bytes'
sudo sh -c 'echo $((16*1024*1024)) > /proc/sys/vm/dirty_background_bytes'

Sadly after every single reboot, the contents of these two files resets. Which one is the right way to add the above command to the startup?

  • create a startup script or
  • add the below lines to an existing startup script? (which one is that?)

2 Answers 2


Add them to the bottom of the .profile file in your home directory. In the terminal:

io.elementary.code ~/.profile

Append the scripts, save, then reboot and you should be in business.

  • I am a beginner. Could You please be more specific what to do? How to append the scripts? You mean the ~/.profile and which one is the other one? Wont be any problem that I need root privileges for these: sudo sh -c 'echo $((48*1024*1024)) > /proc/sys/vm/dirty_bytes' sudo sh -c 'echo $((16*1024*1024)) > /proc/sys/vm/dirty_background_bytes'
    – nagybal
    Commented Feb 7, 2020 at 7:58
  • I failed to notice that you are running your scripts as sudo. I'll respond back later when I have a few minutes with a solution for this. Commented Feb 7, 2020 at 19:35

Try using gnome-session-properties you can set any command to run after a system startup. Just run it on Terminal and then press "Add", and after that you need to write the script in the given textbox.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.