How To Autostart Programs On Linux

Поделиться
HTML-код
  • Опубликовано: 24 мар 2022
  • How do you "autostart" programs on Linux? While the big desktop environments (like GNOME and Plasma) simplify this, knowing how to setup your autostart programs is especially important for standalone window manager users. While there are a number of ways to do this, I'm going to show you the two ways that I use.
    WANT TO SUPPORT THE CHANNEL?
    💰 Patreon: / distrotube
    💳 Paypal: ruclips.net/user/redirect?even...
    🛍️ Amazon: amzn.to/2RotFFi
    👕 Teespring: teespring.com/stores/distrotube
    DONATE CRYPTO:
    💰 Bitcoin: 1Mp6ebz5bNcjNFW7XWHVht36SkiLoxPKoX
    🐶 Dogecoin: D5fpRD1JRoBFPDXSBocRTp8W9uKzfwLFAu
    📕 LBC: bMfA2c3zmcLxPCpyPcrykLvMhZ7A5mQuhJ
    DT ON THE WEB:
    🕸️ Website: distrotube.com/
    📁 GitLab: gitlab.com/dwt1
    🗨️ Mastodon: fosstodon.org/@distrotube
    👫 Reddit: / distrotube
    📽️ LBRY/Odysee: odysee.com/@DistroTube:2
    FREE AND OPEN SOURCE SOFTWARE THAT I USE:
    🌐 Brave Browser - brave.com/dis872
    📽️ Open Broadcaster Software: obsproject.com/
    🎬 Kdenlive: kdenlive.org
    🎨 GIMP: www.gimp.org/
    💻 VirtualBox: www.virtualbox.org/
    🗒️ Doom Emacs: github.com/hlissner/doom-emacs
    Your support is very much appreciated. Thanks, guys!
  • НаукаНаука

Комментарии • 117

  • @Abdo70t
    @Abdo70t 2 года назад +4

    like your tutorials alot, simple and to the point thanks

  • @Jeff_Seely
    @Jeff_Seely 10 месяцев назад +2

    This is really great information thank you Derek. I want to start the proper screen resolution for each window manager and this clearly explained it.

  • @Muneeb100
    @Muneeb100 2 года назад +3

    I really needed this one. Thanks

  • @philzeo
    @philzeo 2 года назад +1

    KDE user here. I love how simple the autostart program is 😁 autostart my dock, my Konsole, my Backup application. Nothing more, nothing less. No kruft, all easy.
    Thanks for showing us some more ways to make it work on other desktops!

  • @systemuser9636
    @systemuser9636 2 года назад

    Thanks for the morning video DT!

  • @jackkeifer
    @jackkeifer 2 года назад +8

    Great explanation for auto-starting! I have to admit, I'm one of those users that never did it this way. 👍👍

  • @somedude7624
    @somedude7624 2 года назад +2

    Hey Thanks,
    You uploaded it just when I neeed it.

    • @vaisakhkm783
      @vaisakhkm783 2 года назад

      Yes.. i just search it yeaterday and gone nuts as things put in xinitrc not starting....
      🙃i just wanted compton and wal to start but not from WM config file... that is not working sometimes

  • @KeebHoard
    @KeebHoard 4 месяца назад

    Great video. Thanks for the really good, in depth explanation of how these things are really meant to work. It's nice to get some light shed upon the situation.

  • @blasm1713
    @blasm1713 2 года назад +1

    This is what i needed. Thank you so much!!

  • @user-ff9rx7kq2g
    @user-ff9rx7kq2g Месяц назад

    Thank you for making this video.

  • @kychemclass5850
    @kychemclass5850 2 года назад

    Been using Linux (Thank you God!!) for year now and I know how to "startup" auto-start. Tq DT.

  • @donpeer4477
    @donpeer4477 2 года назад +1

    What a great topic! I've been wondering if removing an app got everything out and, thanks to your video, I found that there are actually leftover .desktop files laying around on my system. Well, no longer! Kudos, Derek ;)

  • @rinzieronzie
    @rinzieronzie 2 года назад

    Awesome new upload!

  • @phonewithoutquestion80
    @phonewithoutquestion80 2 года назад +17

    I use xinitrc and have ever since I ditched the display manager. You can even automate the "startx" command to trigger every time you log into the tty, making it behave more like somewhat of a DM.

    • @groos3449
      @groos3449 2 года назад

      Same, it's much better this way. However I place my apps on my .xprofile to keep my .xinitrc more organized

    • @lucasrodrigues9766
      @lucasrodrigues9766 2 года назад

      Is there a way of using xinitrc with a display manager? I wanted some script to run after I select the dwm window manager through a xfce login, but I do not know how I can do that

    • @lucasrodrigues9766
      @lucasrodrigues9766 2 года назад

      I have tried using a script in the dwm.desktop file, yet it could not find the file, sometimes it simply returned to the xfce login screen instead of opening the dwm window

    • @Tjk918
      @Tjk918 2 года назад +1

      @@lucasrodrigues9766 Try using a .xprofile file. They are supported by most DMs

    • @lucasrodrigues9766
      @lucasrodrigues9766 2 года назад

      @@Tjk918 thanks

  • @send2gl
    @send2gl 2 года назад

    Useful advice.

  • @YannMetalhead
    @YannMetalhead 2 года назад

    Thank you!

  • @YannMetalhead
    @YannMetalhead 2 года назад +1

    Good video.

  • @ayush-that
    @ayush-that 2 года назад

    thank you so much

  • @ruandiablo
    @ruandiablo 7 месяцев назад

    Thank you, my friend! It is equal in Windows, just Win+R shell:startup to acess the folder

  • @OctaviusPelagius
    @OctaviusPelagius 2 года назад

    Hey @DistroTube for starting the Emacs daemon I'd consider a systemd unit since you'd have a lot of control over it to restart the daemon in cases like major updates to the Doom plugins for instance.

  • @QuotePilgrim
    @QuotePilgrim 2 года назад +1

    Well, .desktop files have an option to run commands in the terminal so, yes, you can put the Htop desktop file in your autostart folder and it will work.
    If you're using a GUI desktop file editor it should be a checkbox saying "run in terminal", if editing it manually with a text editor, it's a line saying "Terminal=true" (or "false").

  • @SirStevenGilroy
    @SirStevenGilroy 2 года назад +3

    What about `/etc/init.d` or the `/etc/rc*` scripts and directories? How do you decide between using these, or the autostart files you mentioned in this video?

  • @k1lluachan
    @k1lluachan Год назад

    that's exactly what i need how do i auto-start a terminal program in Linux inside mi desktop environment

  • @thomasa.anderson2238
    @thomasa.anderson2238 2 года назад

    There actually many other way to auto strart things. The two main solution are the systemd service management (if you have systemd of course) and the crontab for task scheduling. In fact crontab is more powerful than that. You can schedule script execution per week month day or per hour minutes and seconds. And also schedule task on reboot shutdown and things like that.

  • @Nikolai508
    @Nikolai508 2 года назад

    Awesome, I've found that the on screen keyboard starts up as a background process on login for me, never use it so will see if I can stop it.

  • @barrenaedu
    @barrenaedu 2 года назад

    DT, how are you? A been using linux for 10 years or more, another way not discussed very much among users and maybe you can talk about it is creating auto run scripts using systemd and init.d as it is very easy and insane powerfull. I used them a lot as they run in sudo mode you can do lot of things during linux initialization. Good vibes, i see some of your videos some times, good contribution to the linux comunity from your side Regards!

  • @wyattstorms9711
    @wyattstorms9711 Год назад

    How do you get new programs to run? Do you have to make them executable first, and what is the right way to do that?

  • @amos660
    @amos660 2 года назад

    Hey DT, what’s your take on ed the Unix line editor?

  • @Torvating
    @Torvating 2 года назад

    Hey DT how do you handle with programs/software not made for Tiling Window Manager. Like: MegaSync, Steam, Flameshot, etc ?

  • @nolan412
    @nolan412 2 года назад

    Here to hear if it's init scripts, systemd services, XDG autostart, xinitrc, dot profile, or what am I missing?

  • @agneaybnair9519
    @agneaybnair9519 2 года назад +1

    Hey DT, I feel that astro vim beats doom emacs

  • @heroe1486
    @heroe1486 2 года назад +1

    Even on tiling wm we rely on premade solution like exec_always on i3

  • @Zakaros1000
    @Zakaros1000 2 года назад

    When I installed CoreControl I was following a youtube tutorial in which it was supposed to configured to autostart, that problem was that I didn't get to autostart the program whichout asking me for the user password. That was hella annoying because I have to enter the password to log in and then enter the password again because CoreControl was asking for it when was autostarted. It's sad that I didn't get an answer in this video for those types of programs that ask for user password whenever they are started.

  • @TheCannonFather
    @TheCannonFather 2 года назад

    Semi Newbie with a question. Curious if there is way to dictate which workspaces a program opens up in. I would like to group certain apps to certain desktops. I realise that it's probably different per WM but I wanted to know if its doable at all.

  • @theodorealenas3171
    @theodorealenas3171 2 года назад +1

    I'm confused. Can't you write a bash script and make that autostart somehow?

  • @waraiotoko374
    @waraiotoko374 2 года назад +1

    Does anyone know how to open a program in qtile but in the selected workspace?

  • @lguedes768
    @lguedes768 2 года назад

    I'm welling to try dtos on a vanilla arch install maybe

  • @HzYDuB
    @HzYDuB 2 года назад

    surprised that systemd wasn't mentioned

  • @nehajain2974
    @nehajain2974 Год назад

    How to autostart programs if we are using a raspberrypi lite?? Kindly guide

  • @edwardzdankiewicz9068
    @edwardzdankiewicz9068 2 года назад

    This topic needs a mention of start on power on vs start on log-in.

  • @s8x.
    @s8x. 9 месяцев назад

    Is there a way to do this with Hyprland?

  • @oalfodr
    @oalfodr 2 года назад +3

    What is wrong with using .xprofile? When using .xprofile, I do not need to make desktop files for all my scripts and programs that do not have desktop files (a lot of programs I use do not have desktop files)

    • @ivailogeimara
      @ivailogeimara 2 года назад

      Unlike .xprofile and older methods (like .profile), xdg-autostart works with Wayland too. Some people use Wayland instead of XOrg.

  • @gokulrajr6195
    @gokulrajr6195 2 года назад +1

    "Pro-tip: Have mpv play an autostart sound when you login" 🔥 -DT

  • @platpig7749
    @platpig7749 Год назад

    can i do this with steam big picture moad

  • @oldbeardedtech993
    @oldbeardedtech993 2 года назад +3

    Any way to add a 10 second delay to an autostarted app? Like if you need internet connection before the application starts?

    • @scheimong
      @scheimong 2 года назад +3

      If you use systemd (which is likely), you can create a custom service (a "unit file") that launches your application, and set it to run only after the system reaches a particular "checkpoint" (technically known as a "target"). One of those built-in checkpoints is `network-online.target`, which pretty much means what it says.

    • @scheimong
      @scheimong 2 года назад +4

      That's the clean way to do it IMO. There's also the quick and dirty way, which is to edit the `.desktop` file, and simply insert `sleep 10s && ` after `Exec=`...

  • @billeriksson1057
    @billeriksson1057 2 года назад +5

    In order to connect hardware and software in the correct order, it is important to be able to schedule the start-up of the components. Linux Mint has made it easy for the user by specifying a delay when specifying the startup programs! How do you do in other Distros that lack this?

    • @glidersuzuki5572
      @glidersuzuki5572 2 года назад

      Which software specifically? I had no issue without any auto starting programs except systemd services.

    • @billeriksson1057
      @billeriksson1057 2 года назад +1

      @@glidersuzuki5572 Hello,
      Sometimes it is important that the start-up takes place in a predictable way and not randomly. Same every time. Simple example: That the network works and the server is up and running. Then the synchronization software in the computer can be started. The alternative without a specific starting order, I get error messages and problems! Guaranteed! The computer I am currently running has four servers and three clouds connected. The mutual starting order is essential. You do not want some system programs in the early start-up. For example, "Update Manager", "System Reports Manager" and "Panel Program for Print Queue". These are delayed by default in Linux Mint. Anyway, it's so easy to work with the boot order in Linux Mint so you can treat yourself to that luxury! (More complicated cases exist of course) 🙄

    • @rizkyadiyanto7922
      @rizkyadiyanto7922 2 года назад

      systemd is made to solve that problem. though probably a bit complicated and need some time to read the manual for new users.

    • @idjtoal
      @idjtoal 2 года назад +1

      @@rizkyadiyanto7922 Or you could just have a directory of init scripts, with names that started with 01, 02, 03, and so on. Not complicated, no need to read a manual, things running in a specific order every time.

    • @paulg3336
      @paulg3336 2 года назад

      @@rizkyadiyanto7922 On my mythtv system I have an overide file: mythtv_backend_override.conf that tells systemd not to start mythbackend until the hardware tuners have initialised

  • @emacsking4310
    @emacsking4310 2 года назад +2

    I will make EKOS - Emacs King OS, here the features.
    Muli ISO - KDE, XMonad, BSPWM, i3WM, EXWM
    Super Easy - It will have a keybinding sheet that can be pulled with one key or button on the bar, all programs will be documented on the wiki too.
    Just works - It will be Fedora based prob, stable, up to date packages also.
    No proprietary software - Free operating system.
    Software:
    Fish shell
    Emacs (optional)
    Ungoogled Chromium
    Neomutt
    SCIM
    Dmenu/Rofi
    Etc..Etc..
    Combo DTOS LARBS.

  • @therealchonk
    @therealchonk 2 года назад +2

    I thought systemd (systemctl --user) would be part of this video.

  • @NerdTouchingGrass
    @NerdTouchingGrass Год назад +1

    the problem with linux is ive been looking for 45min on how to start synergy on boot up and its 1 check box in windows.

  • @Jennifer_Prentice
    @Jennifer_Prentice 2 года назад

    Hi DT . I have a Corsair keyboard and I use CKB-NEXT and I use the terminal command for systemctl enable . I think this just creates an auto start file into the same directory.. Is there anything I should know about using this command instead of just dragging and dropping the files into the directory?

    • @wikingagresor
      @wikingagresor 2 года назад

      It is just using systemd to do it for you.

    • @ivailogeimara
      @ivailogeimara 2 года назад

      * `systemctl --user start/enable` - starts a systemd service / makes a systemd service start on user login. User specific systemd services are located in `.config/systemd/user`
      * xdg-autostart i.e. the thing that reads `.config/autostart` and starts the programs in there is another way to autostart apps. Every modern DE is programmed to scan that dir for .desktop files and start them when the DE is started.
      These are 2 ways to autostart a program on login as non-root user. Systemd services are more advanced though and can do more that just start programs on login. You can specify start order, dependencies and more.

  • @nabhasan
    @nabhasan 2 года назад

    I want application to auto start without need to login in the system.

  • @synen
    @synen 2 года назад

    Does DT OS include this very same setup DT uses? Thanks.

  • @user-xg7hi5mh3g
    @user-xg7hi5mh3g 2 месяца назад

    How to autostart an application on torizon OS

  • @pelletized
    @pelletized 2 года назад +1

    How would i autostart a shell script? i don't suppose dropping the sh file into the autostart folder would work?

    • @DistroTube
      @DistroTube  2 года назад +2

      You could probably just add a .desktop file for you shell script. Make sure that the 'exec' line within the .deskop file points to your shell script.

    • @ivailogeimara
      @ivailogeimara 2 года назад +2

      As DistroTube said you need to create a .desktop file to start your script. This is an example desktop file:
      ```
      [Desktop Entry]
      Type=Application
      Name=CustomScript
      Exec=/bin/sh /home/user/.config/autostart/script.sh
      StartupNotify=false
      Terminal=false
      ```
      `Name` can be anything.
      `Exec` specifies the command that should be executed. `script.sh` is a "sh"(Bourne Shell) script so I'm using `/bin/sh` to run it. If it's a "bash" script I'd use `/bin/bash /home/user/.config/autostart/script.sh`
      `Terminal` if set to `true` will open the default terminal emulator app and launch the script in there. In most cases you don't want that so it should be set to `false`

  • @tralphstreet
    @tralphstreet 2 года назад

    I have an autostart script that gets executed by qtile on startup with a method I got in the docs. There's a problem tho. Things started with that scripts do not get killed when the session ends, so logging out and logging back in results in duplicate applications/scripts running in the background. Do you know how I can fix this? Maybe making desktop files for the programs instead of running them with a script, and then using dex to launch those would work?

    • @idjtoal
      @idjtoal 2 года назад

      Just have the script check to see if the thing is running? " if ps -ef | grep -v grep | grep firefox; then echo 'firefox is running'; else echo 'firefox not started yet'; fi " kind of thing?

    • @rizkyadiyanto7922
      @rizkyadiyanto7922 2 года назад

      systemd

  • @dcprom0396
    @dcprom0396 2 года назад

    Could you add this wallpaper to your wallpapers GitLab repo please?

  • @tsa4983
    @tsa4983 Год назад

    No details of what's in the .desktop file.

  • @anujv2909
    @anujv2909 2 года назад

    I really like that shirt, can you give the link ?

  • @cqwickedwake7651
    @cqwickedwake7651 2 года назад

    I just use systemd because its the best!

  • @soanvig
    @soanvig 2 года назад

    Why the heck WM have autostart capability. While i somewhat understand they provide shortcuts, the autostart though? How is it related to "managing windows"...

  • @MerkDolf
    @MerkDolf 2 года назад +1

    Auto start sound "Welcome you have mail"

  • @fictitiousnightmares
    @fictitiousnightmares Год назад

    I still after watching all these videos on how to do it can't get terminal to open up and run bpytop on startup on Linux Mint. Seems simple, but yeaaahh. I created a .desktop file for it and put in:
    [Desktop Entry]
    Type=Application
    Name=bpytop
    Exec=bpytop
    StartupNotify=false
    Terminal=true
    and put it in the .config/autostart directly. It shows up in the gui when turning on and off autostart items, but it doesn't seem to run. Even after making it executable. Shrug.

  • @Quicken2k
    @Quicken2k 2 года назад

    Hi. What file manager is that?.

    • @donpeer4477
      @donpeer4477 2 года назад +1

      Slow down the video and you'll see that Derek is using pcman

    • @Quicken2k
      @Quicken2k 2 года назад

      @@donpeer4477 Thanks. Looks Nice is why I asked.

    • @emacsking4310
      @emacsking4310 2 года назад +3

      I think emacs

  • @VINNUSAURUS
    @VINNUSAURUS Год назад

    Create a desktop shortcut for the app from the menu and copy it 🤪

  • @Larimuss
    @Larimuss Год назад

    G. Nome sound so wrong 😂 I don’t know official name but I just assumed it was like the English word gnome with silent G

  • @help2day
    @help2day 2 года назад

    It is to avoid those apps

  • @livingcodex9878
    @livingcodex9878 2 года назад

    おはようございます

  • @kolegakolegi
    @kolegakolegi 2 года назад

    Well I'm guilty of using Cron inwtead

  • @IvanAlexHC86
    @IvanAlexHC86 2 года назад +1

    first

  • @dakotavega6313
    @dakotavega6313 Месяц назад

    "GAnome"

  • @Walker956
    @Walker956 2 года назад +1

    Yeah, working for other people sucks.

  • @greendsnow
    @greendsnow 5 месяцев назад +5

    Too much talk.

  • @mkedzier123
    @mkedzier123 2 года назад

    As usual - simple thing that is made needlessly complicated on Linux.

    • @lunaticmode638
      @lunaticmode638 2 года назад

      agreed

    • @user-he4ef9br7z
      @user-he4ef9br7z 2 года назад +3

      How so?

    • @emacsking4310
      @emacsking4310 2 года назад

      Lol. How is it complicated? If you want it easier use KDE or some. Yet another idiot filtered by change, when there is a million ways to do it and way easier than Windows.

  • @mozzy09
    @mozzy09 Год назад +1

    youve wasted my time

  • @bahathir_
    @bahathir_ 2 года назад +1

    I am using the old skool method, the .xinitrc. It can be as simples as a single line in the .xinitr rc ..
    emacs -fs
    Xorg will run GNU Emacs in full-screen, when start the X11 Window session with 'startx' from text console. Yes, I am still using the old skool 'startx' method. Anyway, my basic .xinitrc just like this.
    # Set resolution
    xrandr --output HDMI-1 --mode 1920x1080
    # Set the beautiful full black wallpaper for 'root window'
    xsetroot -solid black
    # Enable auto blank and monitor's energy saving mode
    xset +dpms
    # Start st terminal emulator with GNU Screen
    st -g 90x25+0+0 -e screen -Rd&
    # Finally start my favorite minimalist window manager.
    evilwm -snap 5

  • @kadensharpin2156
    @kadensharpin2156 2 года назад

    Create a "oneshot" .service file. /etc/systemd/system/.service
    systemctl enable .service

  • @sotecluxan4221
    @sotecluxan4221 2 года назад

  • @dimitrioskoulartsas6184
    @dimitrioskoulartsas6184 2 года назад +1

    AwesomeWM users probably need to put their autostart entries in the rc.lua, as AwesomeWM does not respect ~/.config/autostart and /etc/xdg/autostart

    • @dimitrioskoulartsas6184
      @dimitrioskoulartsas6184 2 года назад

      @Spada I am an AwesomeWM user and I always had this issue

    • @dimitrioskoulartsas6184
      @dimitrioskoulartsas6184 2 года назад

      @Spada Awesome is the only tiling manager that I have tried. So, I am not sure how it compares to other managers.

  • @glowiak3430
    @glowiak3430 2 года назад +2

    This is bloat. I just insert "program &" to my ~/.xinitrc

  • @nuligebla1173
    @nuligebla1173 2 года назад +1

    Does it have to be .desktop files, or can it be soft links? Because these desktop files already exist, no? I know they're small, but they get updated when you update, and copying them around always seems to cause problems, like icon file names being changed, etc.