Score:6

Having apps stay open when the computer starts

ws flag

Hello Running Ubuntu Mate. Is their a way to have command line applications open automatically at startup.

Right now every time I restart the computer I have to open the programs manually.

Score:6
cn flag

In any desktop environment, you can autostart programs after login. Do this if you want a few specific programs to be always available.

In many desktop environments, you can save "sessions". This causes the system to "remember" all applications that were still open at the time you shut down the system. You can also "hibernate" or "suspend" the system rather than shutting it down to have a similar effect, but it does not work reliably on any hardware.

In the MATE desktop environment you can autostart programs after login or restore previously opened in the MATE Control Center.

  • Add "autostart" programs using the "Startup programs" tab. You can specify both graphical and command line applications (image source). You can simply specify the name of the executable if it is in your search PATH, else specify the full path name.

    enter image description here

  • Use the tab "Options" to enable saving your session:

    MATE Startup Applications

    and check Automatically remember running applications when logging out here.

N0rbert avatar
zw flag
Added MATE specifics to your answer with screenshot. Hope it now solves the OP problem better :)
vanadium avatar
cn flag
@N0rbert Thanks, could not check that myself ;)
Score:1
cn flag

To enable Hibernation in 20.04:

With hibernation your RAM is saved to a swapfile. Rebooting restores everything that was in use before exiting.

Increase swapfile size to match RAM size up to 8GB.

  • Check the swap that is in use:

    sudo swapon -s
    
  • If swap partition(s) are found:

    sudo swapoff -a
    sudo nano -Bw /etc/fstab
    
  • Add # before the UUID of the swap partition(s):

    # UUID=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX   none   swap    sw     0       0
    
  • Add a line for the swapfile, if one does not exist:

    /swapfile   none    swap     sw      0       0
    
  • Create the swapfile:

    sudo fallocate -l XG /swapfile*
    

    where X is swapfile's size in GB:

    sudo mkswap /swapfile
    sudo chmod 0600 /swapfile
    sudo swapon /swapfile
    
  • Reboot:

    sudo reboot
    

Add resume location and offset to grub.cfg:

  • Edit /etc/default/grub:

    GRUB_CMDLINE_LINUX_DEFAULT="quiet splash resume=UUID=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX resume_offset=XXXXX"
    
  • Use UUID from root.

  • Use offset from:

    sudo filefrag -v /swapfile |grep " 0:"| awk '{print $4}'
    
  • Update GRUB:

    sudo update-grub
    
  • Test hibernation:

    sudo systemctl hibernate
    

A hibernate button can be added using GNOME extensions.

Note that there is a slight possibility of getting holes in a swapfile when creating it with fallocate. /var/log/syslog can be searched for the phrase swapon: swapfile has holes to ensure there will be no data loss.

A swap file can alternatively be created using dd:

sudo dd if=/dev/zero of=/swapfile bs=1G count=8

An error when using dd may overwrite your HDD.

ar flag
See [this answer](https://askubuntu.com/questions/145443/how-do-i-use-pm-suspend-hybrid-by-default-instead-of-pm-suspend/781957#781957) for some other nuanced options.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.