How can I set default settings for htop?











up vote
35
down vote

favorite
4












Occasionally, I need to check resources on several machines throughout our data-centers for consolidation recommendations and the like. I prefer htop, mostly because of the interactive feel and the display.



Is there a way to default some settings to my setup for htop? For example, one thing I'd like to always have shown is the average CPU load.



important note: Setting this on specific boxes isn't something feasible - I'm looking for maybe a way to set this dynamically every time I ssh into the box.



Is this possible at all?










share|improve this question


















  • 1




    Isn't that what the numbers for Load averages at the top show? This answer explains what they mean.
    – Anko
    Aug 1 '14 at 16:19















up vote
35
down vote

favorite
4












Occasionally, I need to check resources on several machines throughout our data-centers for consolidation recommendations and the like. I prefer htop, mostly because of the interactive feel and the display.



Is there a way to default some settings to my setup for htop? For example, one thing I'd like to always have shown is the average CPU load.



important note: Setting this on specific boxes isn't something feasible - I'm looking for maybe a way to set this dynamically every time I ssh into the box.



Is this possible at all?










share|improve this question


















  • 1




    Isn't that what the numbers for Load averages at the top show? This answer explains what they mean.
    – Anko
    Aug 1 '14 at 16:19













up vote
35
down vote

favorite
4









up vote
35
down vote

favorite
4






4





Occasionally, I need to check resources on several machines throughout our data-centers for consolidation recommendations and the like. I prefer htop, mostly because of the interactive feel and the display.



Is there a way to default some settings to my setup for htop? For example, one thing I'd like to always have shown is the average CPU load.



important note: Setting this on specific boxes isn't something feasible - I'm looking for maybe a way to set this dynamically every time I ssh into the box.



Is this possible at all?










share|improve this question













Occasionally, I need to check resources on several machines throughout our data-centers for consolidation recommendations and the like. I prefer htop, mostly because of the interactive feel and the display.



Is there a way to default some settings to my setup for htop? For example, one thing I'd like to always have shown is the average CPU load.



important note: Setting this on specific boxes isn't something feasible - I'm looking for maybe a way to set this dynamically every time I ssh into the box.



Is this possible at all?







ssh display-settings htop






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Aug 1 '14 at 16:12









MrDuk

5451516




5451516








  • 1




    Isn't that what the numbers for Load averages at the top show? This answer explains what they mean.
    – Anko
    Aug 1 '14 at 16:19














  • 1




    Isn't that what the numbers for Load averages at the top show? This answer explains what they mean.
    – Anko
    Aug 1 '14 at 16:19








1




1




Isn't that what the numbers for Load averages at the top show? This answer explains what they mean.
– Anko
Aug 1 '14 at 16:19




Isn't that what the numbers for Load averages at the top show? This answer explains what they mean.
– Anko
Aug 1 '14 at 16:19










7 Answers
7






active

oldest

votes

















up vote
33
down vote



accepted










htop has a setup screen, accessed via F2, that allows you to customize the top part of the display, including adding or removing a "Load average" field and setting it's style (text, bar, etc.).



These seem to be auto saved in $HOME/.config/htop/htoprc, which warns:



# Beware! This file is rewritten by htop when settings are changed in the interface.
# The parser is also very primitive, and not human-friendly.


I.e., edit that at your own risk. However, you should be able to transfer it from one system to another (version differences might occasionally cause a bit of an issue).



You could also set up a configuration, quit, and then copy the file, so that you could maintain a set of different configurations by swapping/symlinking whichever one with htoprc.






share|improve this answer





















  • Thanks. I just blindly copied htop config from a good looking server to ugly looking server. It made the ugly looking server look great!
    – Thamme Gowda
    Oct 11 '17 at 15:42










  • Also, note that if you lose permission to your htoprc, such as by accidentally touching it as root/sudo, htop will be unable to update this file and silently fail to save your changes.
    – Cerin
    Dec 19 '17 at 0:50


















up vote
18
down vote













The easiest way is to use the setup in the program and then save and exit the program with F10, not with CTRL-C. Next time you can close the program the way you like.






share|improve this answer



















  • 3




    TL;DR: Exit with F10, not CTRL-C.
    – camomileCase
    Aug 15 '16 at 19:14










  • At least on linux, quitting with 'Q' also does NOT save your changes... ;(
    – ljwobker
    Dec 29 '17 at 0:06


















up vote
2
down vote













For any Mac users, the htop config file may be located in either of two places:




  1. under a config subdirectory in home: $HOME/.config/htop/htoprc

  2. right at the home directory: $HOME/.htoprc,


The first option (under .config/htop/ is preferred -- as mentioned in
htop's manpage as well as my own experiments.



On a 2014 MacBook Pro, the second location was used, while on a 2017 MacBook Pro the first location is used, though in both cases Homebrew was used to install htop, and both laptops are (as of 10/29/17) running macOS 10.12.6. (thanks to @iconoclast for pointing out the discrepancy)



In either case, the same config file format can be used, and in both cases, it's recommended you change any settings via htop's own setup instead of directly editing the config file, as it's automatically generated.






share|improve this answer























  • on my Mac it's at $HOME/.config/htop/htoprc
    – iconoclast
    Jun 13 '16 at 0:52










  • Yeah, the same is true for my own newer MBP. Not sure why the difference exists, but I updated the answer to reflect it. Thanks for the note!
    – TCAllen07
    Oct 30 '17 at 1:23


















up vote
0
down vote













Just had the same problem, but quitting htop with F10 didn't help save the settings. It appeared that this user's ~/.config belonged to root.



To check this:



$user@host:~$ ls -hal ~ |grep config

drwx------ 4 root root 4.0K Mar 25 2015 .config


If it lists any user other than you, you should chown the directory to make your htop able to write in it:



sudo chown user:mygroup ~/.config


(replace "user" and "mygroup" with your username and group)



There is a "softer" way when you just give yourself permission to write but do not change the owner. But I cannot imagine why one should not own their ~/.config. Please tell me if I'm wrong.






share|improve this answer























  • Also encountered this. I know I have run sudo htop at some point, which likely wound up saving the config file with root's user and group.
    – user86616
    Feb 27 '17 at 16:53


















up vote
0
down vote













Okay, though this post may be old, I had the same issue.



Use the setup htop provides, which the asker had already done, but the settings were not being saved upon SSH, which is likely because there is no htoprc. Upon creating one, htop will then use it to save and load settings, rather than defaulting to its stock setup.



After reading @goldilocks and @TCAllen07 response, I sought to check if I even had a htoprc to begin with. It was not present. So, even though I owned my config directory from install, if I changed the setup, the settings would be lost.
To solve it, I simply created the htoprc file in it's directory using touch .config/htop/htoprc, then I edited the settings from within htop interface and used cat .config/htop/htoprc to see that the changes were saved.



OS: Fedora 25
LK: 4.9.9-200.fc25.x86_64






share|improve this answer























  • @Fox the answer is in fact provided. It's too use the setup htop provides, which the asked had already done, but the settings were not being saved upon SSH, which is likely because there is no htoprc. Upon creating one, htop will then use it to save and load settings, rather than defaulting to its stock setup.
    – Th'Ink-King
    Feb 15 '17 at 12:19


















up vote
0
down vote













You could also use a folder, shared among all your machines. Let's say that /media/shared is mounted equally on all machines. You can set it as your $HOME for htop, then it will save and load its configuration there.



HOME=/media/shared htop


This will start htop with a clean configuragion. Setup and close htop with F10 (or q). You could also copy your current configuration:



cp ~/.config/htop/htoprc /media/shared/.config/htop/htoprc


Now launch htop on your other machine(s):



HOME=/media/shared htop


It should be configured as you did on your previous machine. :)






share|improve this answer

















  • 1




    Don't be "smart" and set $HOME globally in your shell session by doing export HOME=/media/shared. This may cause headaches. :-)
    – hzpc-joostk
    Aug 1 '17 at 16:07


















up vote
0
down vote













Reset the settings in the config file



This are the default settings for htop on a Ubuntu 18.04 system. Replace the content of the file $HOME/.config/htop/htoprc and you should be fine. Make a backup first.



# Beware! This file is rewritten by htop when settings are changed in the interface.
# # The parser is also very primitive, and not human-friendly.
fields=0 48 17 18 38 39 40 2 46 47 49 1
sort_key=1
sort_direction=1
hide_threads=0
hide_kernel_threads=1
hide_userland_threads=0
shadow_other_users=0
show_thread_names=0
show_program_path=1
highlight_base_name=0
highlight_megabytes=1
highlight_threads=1
tree_view=0
header_margin=1
detailed_cpu_time=0
cpu_count_from_zero=0
update_process_names=0
account_guest_in_cpu_meter=0
color_scheme=0
delay=15
left_meters=LeftCPUs Memory Swap
left_meter_modes=1 1 1
right_meters=RightCPUs Tasks LoadAverage Uptime
right_meter_modes=1 2 2 2





share|improve this answer





















    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "106"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














     

    draft saved


    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f147885%2fhow-can-i-set-default-settings-for-htop%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    7 Answers
    7






    active

    oldest

    votes








    7 Answers
    7






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    33
    down vote



    accepted










    htop has a setup screen, accessed via F2, that allows you to customize the top part of the display, including adding or removing a "Load average" field and setting it's style (text, bar, etc.).



    These seem to be auto saved in $HOME/.config/htop/htoprc, which warns:



    # Beware! This file is rewritten by htop when settings are changed in the interface.
    # The parser is also very primitive, and not human-friendly.


    I.e., edit that at your own risk. However, you should be able to transfer it from one system to another (version differences might occasionally cause a bit of an issue).



    You could also set up a configuration, quit, and then copy the file, so that you could maintain a set of different configurations by swapping/symlinking whichever one with htoprc.






    share|improve this answer





















    • Thanks. I just blindly copied htop config from a good looking server to ugly looking server. It made the ugly looking server look great!
      – Thamme Gowda
      Oct 11 '17 at 15:42










    • Also, note that if you lose permission to your htoprc, such as by accidentally touching it as root/sudo, htop will be unable to update this file and silently fail to save your changes.
      – Cerin
      Dec 19 '17 at 0:50















    up vote
    33
    down vote



    accepted










    htop has a setup screen, accessed via F2, that allows you to customize the top part of the display, including adding or removing a "Load average" field and setting it's style (text, bar, etc.).



    These seem to be auto saved in $HOME/.config/htop/htoprc, which warns:



    # Beware! This file is rewritten by htop when settings are changed in the interface.
    # The parser is also very primitive, and not human-friendly.


    I.e., edit that at your own risk. However, you should be able to transfer it from one system to another (version differences might occasionally cause a bit of an issue).



    You could also set up a configuration, quit, and then copy the file, so that you could maintain a set of different configurations by swapping/symlinking whichever one with htoprc.






    share|improve this answer





















    • Thanks. I just blindly copied htop config from a good looking server to ugly looking server. It made the ugly looking server look great!
      – Thamme Gowda
      Oct 11 '17 at 15:42










    • Also, note that if you lose permission to your htoprc, such as by accidentally touching it as root/sudo, htop will be unable to update this file and silently fail to save your changes.
      – Cerin
      Dec 19 '17 at 0:50













    up vote
    33
    down vote



    accepted







    up vote
    33
    down vote



    accepted






    htop has a setup screen, accessed via F2, that allows you to customize the top part of the display, including adding or removing a "Load average" field and setting it's style (text, bar, etc.).



    These seem to be auto saved in $HOME/.config/htop/htoprc, which warns:



    # Beware! This file is rewritten by htop when settings are changed in the interface.
    # The parser is also very primitive, and not human-friendly.


    I.e., edit that at your own risk. However, you should be able to transfer it from one system to another (version differences might occasionally cause a bit of an issue).



    You could also set up a configuration, quit, and then copy the file, so that you could maintain a set of different configurations by swapping/symlinking whichever one with htoprc.






    share|improve this answer












    htop has a setup screen, accessed via F2, that allows you to customize the top part of the display, including adding or removing a "Load average" field and setting it's style (text, bar, etc.).



    These seem to be auto saved in $HOME/.config/htop/htoprc, which warns:



    # Beware! This file is rewritten by htop when settings are changed in the interface.
    # The parser is also very primitive, and not human-friendly.


    I.e., edit that at your own risk. However, you should be able to transfer it from one system to another (version differences might occasionally cause a bit of an issue).



    You could also set up a configuration, quit, and then copy the file, so that you could maintain a set of different configurations by swapping/symlinking whichever one with htoprc.







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Aug 1 '14 at 17:39









    goldilocks

    60.9k13148203




    60.9k13148203












    • Thanks. I just blindly copied htop config from a good looking server to ugly looking server. It made the ugly looking server look great!
      – Thamme Gowda
      Oct 11 '17 at 15:42










    • Also, note that if you lose permission to your htoprc, such as by accidentally touching it as root/sudo, htop will be unable to update this file and silently fail to save your changes.
      – Cerin
      Dec 19 '17 at 0:50


















    • Thanks. I just blindly copied htop config from a good looking server to ugly looking server. It made the ugly looking server look great!
      – Thamme Gowda
      Oct 11 '17 at 15:42










    • Also, note that if you lose permission to your htoprc, such as by accidentally touching it as root/sudo, htop will be unable to update this file and silently fail to save your changes.
      – Cerin
      Dec 19 '17 at 0:50
















    Thanks. I just blindly copied htop config from a good looking server to ugly looking server. It made the ugly looking server look great!
    – Thamme Gowda
    Oct 11 '17 at 15:42




    Thanks. I just blindly copied htop config from a good looking server to ugly looking server. It made the ugly looking server look great!
    – Thamme Gowda
    Oct 11 '17 at 15:42












    Also, note that if you lose permission to your htoprc, such as by accidentally touching it as root/sudo, htop will be unable to update this file and silently fail to save your changes.
    – Cerin
    Dec 19 '17 at 0:50




    Also, note that if you lose permission to your htoprc, such as by accidentally touching it as root/sudo, htop will be unable to update this file and silently fail to save your changes.
    – Cerin
    Dec 19 '17 at 0:50












    up vote
    18
    down vote













    The easiest way is to use the setup in the program and then save and exit the program with F10, not with CTRL-C. Next time you can close the program the way you like.






    share|improve this answer



















    • 3




      TL;DR: Exit with F10, not CTRL-C.
      – camomileCase
      Aug 15 '16 at 19:14










    • At least on linux, quitting with 'Q' also does NOT save your changes... ;(
      – ljwobker
      Dec 29 '17 at 0:06















    up vote
    18
    down vote













    The easiest way is to use the setup in the program and then save and exit the program with F10, not with CTRL-C. Next time you can close the program the way you like.






    share|improve this answer



















    • 3




      TL;DR: Exit with F10, not CTRL-C.
      – camomileCase
      Aug 15 '16 at 19:14










    • At least on linux, quitting with 'Q' also does NOT save your changes... ;(
      – ljwobker
      Dec 29 '17 at 0:06













    up vote
    18
    down vote










    up vote
    18
    down vote









    The easiest way is to use the setup in the program and then save and exit the program with F10, not with CTRL-C. Next time you can close the program the way you like.






    share|improve this answer














    The easiest way is to use the setup in the program and then save and exit the program with F10, not with CTRL-C. Next time you can close the program the way you like.







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Apr 22 '15 at 15:46









    Community

    1




    1










    answered Jan 27 '15 at 16:05









    keiner

    18112




    18112








    • 3




      TL;DR: Exit with F10, not CTRL-C.
      – camomileCase
      Aug 15 '16 at 19:14










    • At least on linux, quitting with 'Q' also does NOT save your changes... ;(
      – ljwobker
      Dec 29 '17 at 0:06














    • 3




      TL;DR: Exit with F10, not CTRL-C.
      – camomileCase
      Aug 15 '16 at 19:14










    • At least on linux, quitting with 'Q' also does NOT save your changes... ;(
      – ljwobker
      Dec 29 '17 at 0:06








    3




    3




    TL;DR: Exit with F10, not CTRL-C.
    – camomileCase
    Aug 15 '16 at 19:14




    TL;DR: Exit with F10, not CTRL-C.
    – camomileCase
    Aug 15 '16 at 19:14












    At least on linux, quitting with 'Q' also does NOT save your changes... ;(
    – ljwobker
    Dec 29 '17 at 0:06




    At least on linux, quitting with 'Q' also does NOT save your changes... ;(
    – ljwobker
    Dec 29 '17 at 0:06










    up vote
    2
    down vote













    For any Mac users, the htop config file may be located in either of two places:




    1. under a config subdirectory in home: $HOME/.config/htop/htoprc

    2. right at the home directory: $HOME/.htoprc,


    The first option (under .config/htop/ is preferred -- as mentioned in
    htop's manpage as well as my own experiments.



    On a 2014 MacBook Pro, the second location was used, while on a 2017 MacBook Pro the first location is used, though in both cases Homebrew was used to install htop, and both laptops are (as of 10/29/17) running macOS 10.12.6. (thanks to @iconoclast for pointing out the discrepancy)



    In either case, the same config file format can be used, and in both cases, it's recommended you change any settings via htop's own setup instead of directly editing the config file, as it's automatically generated.






    share|improve this answer























    • on my Mac it's at $HOME/.config/htop/htoprc
      – iconoclast
      Jun 13 '16 at 0:52










    • Yeah, the same is true for my own newer MBP. Not sure why the difference exists, but I updated the answer to reflect it. Thanks for the note!
      – TCAllen07
      Oct 30 '17 at 1:23















    up vote
    2
    down vote













    For any Mac users, the htop config file may be located in either of two places:




    1. under a config subdirectory in home: $HOME/.config/htop/htoprc

    2. right at the home directory: $HOME/.htoprc,


    The first option (under .config/htop/ is preferred -- as mentioned in
    htop's manpage as well as my own experiments.



    On a 2014 MacBook Pro, the second location was used, while on a 2017 MacBook Pro the first location is used, though in both cases Homebrew was used to install htop, and both laptops are (as of 10/29/17) running macOS 10.12.6. (thanks to @iconoclast for pointing out the discrepancy)



    In either case, the same config file format can be used, and in both cases, it's recommended you change any settings via htop's own setup instead of directly editing the config file, as it's automatically generated.






    share|improve this answer























    • on my Mac it's at $HOME/.config/htop/htoprc
      – iconoclast
      Jun 13 '16 at 0:52










    • Yeah, the same is true for my own newer MBP. Not sure why the difference exists, but I updated the answer to reflect it. Thanks for the note!
      – TCAllen07
      Oct 30 '17 at 1:23













    up vote
    2
    down vote










    up vote
    2
    down vote









    For any Mac users, the htop config file may be located in either of two places:




    1. under a config subdirectory in home: $HOME/.config/htop/htoprc

    2. right at the home directory: $HOME/.htoprc,


    The first option (under .config/htop/ is preferred -- as mentioned in
    htop's manpage as well as my own experiments.



    On a 2014 MacBook Pro, the second location was used, while on a 2017 MacBook Pro the first location is used, though in both cases Homebrew was used to install htop, and both laptops are (as of 10/29/17) running macOS 10.12.6. (thanks to @iconoclast for pointing out the discrepancy)



    In either case, the same config file format can be used, and in both cases, it's recommended you change any settings via htop's own setup instead of directly editing the config file, as it's automatically generated.






    share|improve this answer














    For any Mac users, the htop config file may be located in either of two places:




    1. under a config subdirectory in home: $HOME/.config/htop/htoprc

    2. right at the home directory: $HOME/.htoprc,


    The first option (under .config/htop/ is preferred -- as mentioned in
    htop's manpage as well as my own experiments.



    On a 2014 MacBook Pro, the second location was used, while on a 2017 MacBook Pro the first location is used, though in both cases Homebrew was used to install htop, and both laptops are (as of 10/29/17) running macOS 10.12.6. (thanks to @iconoclast for pointing out the discrepancy)



    In either case, the same config file format can be used, and in both cases, it's recommended you change any settings via htop's own setup instead of directly editing the config file, as it's automatically generated.







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Oct 30 '17 at 1:22

























    answered Feb 22 '15 at 2:49









    TCAllen07

    1214




    1214












    • on my Mac it's at $HOME/.config/htop/htoprc
      – iconoclast
      Jun 13 '16 at 0:52










    • Yeah, the same is true for my own newer MBP. Not sure why the difference exists, but I updated the answer to reflect it. Thanks for the note!
      – TCAllen07
      Oct 30 '17 at 1:23


















    • on my Mac it's at $HOME/.config/htop/htoprc
      – iconoclast
      Jun 13 '16 at 0:52










    • Yeah, the same is true for my own newer MBP. Not sure why the difference exists, but I updated the answer to reflect it. Thanks for the note!
      – TCAllen07
      Oct 30 '17 at 1:23
















    on my Mac it's at $HOME/.config/htop/htoprc
    – iconoclast
    Jun 13 '16 at 0:52




    on my Mac it's at $HOME/.config/htop/htoprc
    – iconoclast
    Jun 13 '16 at 0:52












    Yeah, the same is true for my own newer MBP. Not sure why the difference exists, but I updated the answer to reflect it. Thanks for the note!
    – TCAllen07
    Oct 30 '17 at 1:23




    Yeah, the same is true for my own newer MBP. Not sure why the difference exists, but I updated the answer to reflect it. Thanks for the note!
    – TCAllen07
    Oct 30 '17 at 1:23










    up vote
    0
    down vote













    Just had the same problem, but quitting htop with F10 didn't help save the settings. It appeared that this user's ~/.config belonged to root.



    To check this:



    $user@host:~$ ls -hal ~ |grep config

    drwx------ 4 root root 4.0K Mar 25 2015 .config


    If it lists any user other than you, you should chown the directory to make your htop able to write in it:



    sudo chown user:mygroup ~/.config


    (replace "user" and "mygroup" with your username and group)



    There is a "softer" way when you just give yourself permission to write but do not change the owner. But I cannot imagine why one should not own their ~/.config. Please tell me if I'm wrong.






    share|improve this answer























    • Also encountered this. I know I have run sudo htop at some point, which likely wound up saving the config file with root's user and group.
      – user86616
      Feb 27 '17 at 16:53















    up vote
    0
    down vote













    Just had the same problem, but quitting htop with F10 didn't help save the settings. It appeared that this user's ~/.config belonged to root.



    To check this:



    $user@host:~$ ls -hal ~ |grep config

    drwx------ 4 root root 4.0K Mar 25 2015 .config


    If it lists any user other than you, you should chown the directory to make your htop able to write in it:



    sudo chown user:mygroup ~/.config


    (replace "user" and "mygroup" with your username and group)



    There is a "softer" way when you just give yourself permission to write but do not change the owner. But I cannot imagine why one should not own their ~/.config. Please tell me if I'm wrong.






    share|improve this answer























    • Also encountered this. I know I have run sudo htop at some point, which likely wound up saving the config file with root's user and group.
      – user86616
      Feb 27 '17 at 16:53













    up vote
    0
    down vote










    up vote
    0
    down vote









    Just had the same problem, but quitting htop with F10 didn't help save the settings. It appeared that this user's ~/.config belonged to root.



    To check this:



    $user@host:~$ ls -hal ~ |grep config

    drwx------ 4 root root 4.0K Mar 25 2015 .config


    If it lists any user other than you, you should chown the directory to make your htop able to write in it:



    sudo chown user:mygroup ~/.config


    (replace "user" and "mygroup" with your username and group)



    There is a "softer" way when you just give yourself permission to write but do not change the owner. But I cannot imagine why one should not own their ~/.config. Please tell me if I'm wrong.






    share|improve this answer














    Just had the same problem, but quitting htop with F10 didn't help save the settings. It appeared that this user's ~/.config belonged to root.



    To check this:



    $user@host:~$ ls -hal ~ |grep config

    drwx------ 4 root root 4.0K Mar 25 2015 .config


    If it lists any user other than you, you should chown the directory to make your htop able to write in it:



    sudo chown user:mygroup ~/.config


    (replace "user" and "mygroup" with your username and group)



    There is a "softer" way when you just give yourself permission to write but do not change the owner. But I cannot imagine why one should not own their ~/.config. Please tell me if I'm wrong.







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Nov 27 '15 at 6:16

























    answered Nov 16 '15 at 13:11









    Nick Volynkin

    20227




    20227












    • Also encountered this. I know I have run sudo htop at some point, which likely wound up saving the config file with root's user and group.
      – user86616
      Feb 27 '17 at 16:53


















    • Also encountered this. I know I have run sudo htop at some point, which likely wound up saving the config file with root's user and group.
      – user86616
      Feb 27 '17 at 16:53
















    Also encountered this. I know I have run sudo htop at some point, which likely wound up saving the config file with root's user and group.
    – user86616
    Feb 27 '17 at 16:53




    Also encountered this. I know I have run sudo htop at some point, which likely wound up saving the config file with root's user and group.
    – user86616
    Feb 27 '17 at 16:53










    up vote
    0
    down vote













    Okay, though this post may be old, I had the same issue.



    Use the setup htop provides, which the asker had already done, but the settings were not being saved upon SSH, which is likely because there is no htoprc. Upon creating one, htop will then use it to save and load settings, rather than defaulting to its stock setup.



    After reading @goldilocks and @TCAllen07 response, I sought to check if I even had a htoprc to begin with. It was not present. So, even though I owned my config directory from install, if I changed the setup, the settings would be lost.
    To solve it, I simply created the htoprc file in it's directory using touch .config/htop/htoprc, then I edited the settings from within htop interface and used cat .config/htop/htoprc to see that the changes were saved.



    OS: Fedora 25
    LK: 4.9.9-200.fc25.x86_64






    share|improve this answer























    • @Fox the answer is in fact provided. It's too use the setup htop provides, which the asked had already done, but the settings were not being saved upon SSH, which is likely because there is no htoprc. Upon creating one, htop will then use it to save and load settings, rather than defaulting to its stock setup.
      – Th'Ink-King
      Feb 15 '17 at 12:19















    up vote
    0
    down vote













    Okay, though this post may be old, I had the same issue.



    Use the setup htop provides, which the asker had already done, but the settings were not being saved upon SSH, which is likely because there is no htoprc. Upon creating one, htop will then use it to save and load settings, rather than defaulting to its stock setup.



    After reading @goldilocks and @TCAllen07 response, I sought to check if I even had a htoprc to begin with. It was not present. So, even though I owned my config directory from install, if I changed the setup, the settings would be lost.
    To solve it, I simply created the htoprc file in it's directory using touch .config/htop/htoprc, then I edited the settings from within htop interface and used cat .config/htop/htoprc to see that the changes were saved.



    OS: Fedora 25
    LK: 4.9.9-200.fc25.x86_64






    share|improve this answer























    • @Fox the answer is in fact provided. It's too use the setup htop provides, which the asked had already done, but the settings were not being saved upon SSH, which is likely because there is no htoprc. Upon creating one, htop will then use it to save and load settings, rather than defaulting to its stock setup.
      – Th'Ink-King
      Feb 15 '17 at 12:19













    up vote
    0
    down vote










    up vote
    0
    down vote









    Okay, though this post may be old, I had the same issue.



    Use the setup htop provides, which the asker had already done, but the settings were not being saved upon SSH, which is likely because there is no htoprc. Upon creating one, htop will then use it to save and load settings, rather than defaulting to its stock setup.



    After reading @goldilocks and @TCAllen07 response, I sought to check if I even had a htoprc to begin with. It was not present. So, even though I owned my config directory from install, if I changed the setup, the settings would be lost.
    To solve it, I simply created the htoprc file in it's directory using touch .config/htop/htoprc, then I edited the settings from within htop interface and used cat .config/htop/htoprc to see that the changes were saved.



    OS: Fedora 25
    LK: 4.9.9-200.fc25.x86_64






    share|improve this answer














    Okay, though this post may be old, I had the same issue.



    Use the setup htop provides, which the asker had already done, but the settings were not being saved upon SSH, which is likely because there is no htoprc. Upon creating one, htop will then use it to save and load settings, rather than defaulting to its stock setup.



    After reading @goldilocks and @TCAllen07 response, I sought to check if I even had a htoprc to begin with. It was not present. So, even though I owned my config directory from install, if I changed the setup, the settings would be lost.
    To solve it, I simply created the htoprc file in it's directory using touch .config/htop/htoprc, then I edited the settings from within htop interface and used cat .config/htop/htoprc to see that the changes were saved.



    OS: Fedora 25
    LK: 4.9.9-200.fc25.x86_64







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Feb 15 '17 at 13:45

























    answered Feb 15 '17 at 12:08









    Th'Ink-King

    11




    11












    • @Fox the answer is in fact provided. It's too use the setup htop provides, which the asked had already done, but the settings were not being saved upon SSH, which is likely because there is no htoprc. Upon creating one, htop will then use it to save and load settings, rather than defaulting to its stock setup.
      – Th'Ink-King
      Feb 15 '17 at 12:19


















    • @Fox the answer is in fact provided. It's too use the setup htop provides, which the asked had already done, but the settings were not being saved upon SSH, which is likely because there is no htoprc. Upon creating one, htop will then use it to save and load settings, rather than defaulting to its stock setup.
      – Th'Ink-King
      Feb 15 '17 at 12:19
















    @Fox the answer is in fact provided. It's too use the setup htop provides, which the asked had already done, but the settings were not being saved upon SSH, which is likely because there is no htoprc. Upon creating one, htop will then use it to save and load settings, rather than defaulting to its stock setup.
    – Th'Ink-King
    Feb 15 '17 at 12:19




    @Fox the answer is in fact provided. It's too use the setup htop provides, which the asked had already done, but the settings were not being saved upon SSH, which is likely because there is no htoprc. Upon creating one, htop will then use it to save and load settings, rather than defaulting to its stock setup.
    – Th'Ink-King
    Feb 15 '17 at 12:19










    up vote
    0
    down vote













    You could also use a folder, shared among all your machines. Let's say that /media/shared is mounted equally on all machines. You can set it as your $HOME for htop, then it will save and load its configuration there.



    HOME=/media/shared htop


    This will start htop with a clean configuragion. Setup and close htop with F10 (or q). You could also copy your current configuration:



    cp ~/.config/htop/htoprc /media/shared/.config/htop/htoprc


    Now launch htop on your other machine(s):



    HOME=/media/shared htop


    It should be configured as you did on your previous machine. :)






    share|improve this answer

















    • 1




      Don't be "smart" and set $HOME globally in your shell session by doing export HOME=/media/shared. This may cause headaches. :-)
      – hzpc-joostk
      Aug 1 '17 at 16:07















    up vote
    0
    down vote













    You could also use a folder, shared among all your machines. Let's say that /media/shared is mounted equally on all machines. You can set it as your $HOME for htop, then it will save and load its configuration there.



    HOME=/media/shared htop


    This will start htop with a clean configuragion. Setup and close htop with F10 (or q). You could also copy your current configuration:



    cp ~/.config/htop/htoprc /media/shared/.config/htop/htoprc


    Now launch htop on your other machine(s):



    HOME=/media/shared htop


    It should be configured as you did on your previous machine. :)






    share|improve this answer

















    • 1




      Don't be "smart" and set $HOME globally in your shell session by doing export HOME=/media/shared. This may cause headaches. :-)
      – hzpc-joostk
      Aug 1 '17 at 16:07













    up vote
    0
    down vote










    up vote
    0
    down vote









    You could also use a folder, shared among all your machines. Let's say that /media/shared is mounted equally on all machines. You can set it as your $HOME for htop, then it will save and load its configuration there.



    HOME=/media/shared htop


    This will start htop with a clean configuragion. Setup and close htop with F10 (or q). You could also copy your current configuration:



    cp ~/.config/htop/htoprc /media/shared/.config/htop/htoprc


    Now launch htop on your other machine(s):



    HOME=/media/shared htop


    It should be configured as you did on your previous machine. :)






    share|improve this answer












    You could also use a folder, shared among all your machines. Let's say that /media/shared is mounted equally on all machines. You can set it as your $HOME for htop, then it will save and load its configuration there.



    HOME=/media/shared htop


    This will start htop with a clean configuragion. Setup and close htop with F10 (or q). You could also copy your current configuration:



    cp ~/.config/htop/htoprc /media/shared/.config/htop/htoprc


    Now launch htop on your other machine(s):



    HOME=/media/shared htop


    It should be configured as you did on your previous machine. :)







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Aug 1 '17 at 16:05









    hzpc-joostk

    1




    1








    • 1




      Don't be "smart" and set $HOME globally in your shell session by doing export HOME=/media/shared. This may cause headaches. :-)
      – hzpc-joostk
      Aug 1 '17 at 16:07














    • 1




      Don't be "smart" and set $HOME globally in your shell session by doing export HOME=/media/shared. This may cause headaches. :-)
      – hzpc-joostk
      Aug 1 '17 at 16:07








    1




    1




    Don't be "smart" and set $HOME globally in your shell session by doing export HOME=/media/shared. This may cause headaches. :-)
    – hzpc-joostk
    Aug 1 '17 at 16:07




    Don't be "smart" and set $HOME globally in your shell session by doing export HOME=/media/shared. This may cause headaches. :-)
    – hzpc-joostk
    Aug 1 '17 at 16:07










    up vote
    0
    down vote













    Reset the settings in the config file



    This are the default settings for htop on a Ubuntu 18.04 system. Replace the content of the file $HOME/.config/htop/htoprc and you should be fine. Make a backup first.



    # Beware! This file is rewritten by htop when settings are changed in the interface.
    # # The parser is also very primitive, and not human-friendly.
    fields=0 48 17 18 38 39 40 2 46 47 49 1
    sort_key=1
    sort_direction=1
    hide_threads=0
    hide_kernel_threads=1
    hide_userland_threads=0
    shadow_other_users=0
    show_thread_names=0
    show_program_path=1
    highlight_base_name=0
    highlight_megabytes=1
    highlight_threads=1
    tree_view=0
    header_margin=1
    detailed_cpu_time=0
    cpu_count_from_zero=0
    update_process_names=0
    account_guest_in_cpu_meter=0
    color_scheme=0
    delay=15
    left_meters=LeftCPUs Memory Swap
    left_meter_modes=1 1 1
    right_meters=RightCPUs Tasks LoadAverage Uptime
    right_meter_modes=1 2 2 2





    share|improve this answer

























      up vote
      0
      down vote













      Reset the settings in the config file



      This are the default settings for htop on a Ubuntu 18.04 system. Replace the content of the file $HOME/.config/htop/htoprc and you should be fine. Make a backup first.



      # Beware! This file is rewritten by htop when settings are changed in the interface.
      # # The parser is also very primitive, and not human-friendly.
      fields=0 48 17 18 38 39 40 2 46 47 49 1
      sort_key=1
      sort_direction=1
      hide_threads=0
      hide_kernel_threads=1
      hide_userland_threads=0
      shadow_other_users=0
      show_thread_names=0
      show_program_path=1
      highlight_base_name=0
      highlight_megabytes=1
      highlight_threads=1
      tree_view=0
      header_margin=1
      detailed_cpu_time=0
      cpu_count_from_zero=0
      update_process_names=0
      account_guest_in_cpu_meter=0
      color_scheme=0
      delay=15
      left_meters=LeftCPUs Memory Swap
      left_meter_modes=1 1 1
      right_meters=RightCPUs Tasks LoadAverage Uptime
      right_meter_modes=1 2 2 2





      share|improve this answer























        up vote
        0
        down vote










        up vote
        0
        down vote









        Reset the settings in the config file



        This are the default settings for htop on a Ubuntu 18.04 system. Replace the content of the file $HOME/.config/htop/htoprc and you should be fine. Make a backup first.



        # Beware! This file is rewritten by htop when settings are changed in the interface.
        # # The parser is also very primitive, and not human-friendly.
        fields=0 48 17 18 38 39 40 2 46 47 49 1
        sort_key=1
        sort_direction=1
        hide_threads=0
        hide_kernel_threads=1
        hide_userland_threads=0
        shadow_other_users=0
        show_thread_names=0
        show_program_path=1
        highlight_base_name=0
        highlight_megabytes=1
        highlight_threads=1
        tree_view=0
        header_margin=1
        detailed_cpu_time=0
        cpu_count_from_zero=0
        update_process_names=0
        account_guest_in_cpu_meter=0
        color_scheme=0
        delay=15
        left_meters=LeftCPUs Memory Swap
        left_meter_modes=1 1 1
        right_meters=RightCPUs Tasks LoadAverage Uptime
        right_meter_modes=1 2 2 2





        share|improve this answer












        Reset the settings in the config file



        This are the default settings for htop on a Ubuntu 18.04 system. Replace the content of the file $HOME/.config/htop/htoprc and you should be fine. Make a backup first.



        # Beware! This file is rewritten by htop when settings are changed in the interface.
        # # The parser is also very primitive, and not human-friendly.
        fields=0 48 17 18 38 39 40 2 46 47 49 1
        sort_key=1
        sort_direction=1
        hide_threads=0
        hide_kernel_threads=1
        hide_userland_threads=0
        shadow_other_users=0
        show_thread_names=0
        show_program_path=1
        highlight_base_name=0
        highlight_megabytes=1
        highlight_threads=1
        tree_view=0
        header_margin=1
        detailed_cpu_time=0
        cpu_count_from_zero=0
        update_process_names=0
        account_guest_in_cpu_meter=0
        color_scheme=0
        delay=15
        left_meters=LeftCPUs Memory Swap
        left_meter_modes=1 1 1
        right_meters=RightCPUs Tasks LoadAverage Uptime
        right_meter_modes=1 2 2 2






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 14 at 10:16









        Stefan

        60126




        60126






























             

            draft saved


            draft discarded



















































             


            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f147885%2fhow-can-i-set-default-settings-for-htop%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Morgemoulin

            Scott Moir

            Souastre