Run command after open OS Manjaro

How can I execute a command or file.sh on the terminal using Bash language after opening my computer without any intervention from me?

example :

$ echo 'hello' > ~/Desktop/start.txt

Easy:

mkdir -pv ~/.config/plasma-workspace/env/
echo "echo 'hello' > ~/Desktop/start.txt" > ~/.config/plasma-workspace/env/start.sh
1 Like

Create a .desktop file that executes your script in a terminal window, and add this .desktop file to… :arrow_down:

Workspace → Startup and Shutdown → Autostart

… in System Settings.

There are many .desktop files under /usr/share/applications that you can use for inspiration. As an example, you can look at the one for htop, which looks like this… :arrow_down:

[Desktop Entry]
Type=Application
Version=1.0
Name=Htop
GenericName=Process Viewer
GenericName[ca]=Visualitzador de processos
GenericName[da]=Procesfremviser
GenericName[de]=Prozessanzeige
GenericName[en_GB]=Process Viewer
GenericName[es]=Visor de procesos
GenericName[fi]=Prosessikatselin
GenericName[fr]=Visualiseur de processus
GenericName[gl]=Visor de procesos
GenericName[it]=Visore dei processi
GenericName[ko]=프로세스 뷰어GenericName[nb]=Prosessviser
GenericName[nl]=Viewer van processen
GenericName[nn]=Prosessvisar
GenericName[pl]=Przeglądarka procesów
GenericName[pt]=Visualizador de Processos
GenericName[pt_BR]=Visualizador de processos
GenericName[ru]=Монитор процессов
GenericName[sk]=Prehliadač procesov
GenericName[sl]=Pregledovalnik opravil
GenericName[sr@ijekavian]=Приказивач процеса
GenericName[sr@ijekavianlatin]=Prikazivač procesa
GenericName[sr@latin]=Prikazivač procesa
GenericName[sr]=Приказивач процеса
GenericName[sv]=Processvisning
GenericName[tr]=Süreç Görüntüleyici
GenericName[uk]=Перегляд процесів
GenericName[zh_CN]=进程查看器GenericName[zh_TW]=行程檢視器Comment=Show System Processes
Comment[ca]=Visualitzeu els processos del sistema
Comment[da]=Vis systemprocesser
Comment[de]=Systemprozesse anzeigen
Comment[en_GB]=Show System Processes
Comment[es]=Mostrar procesos del sistema
Comment[fi]=Katsele järjestelmän prosesseja
Comment[fr]=Affiche les processus système
Comment[gl]=Mostrar os procesos do sistema.
Comment[it]=Mostra processi di sistema
Comment[ko]=시스템 프로세스 보기Comment[nb]=Vis systemprosesser
Comment[nl]=Systeemprocessen tonen
Comment[nn]=Vis systemprosessar
Comment[pl]=Pokaż procesy systemowe
Comment[pt]=Mostrar os Processos do Sistema
Comment[pt_BR]=Mostra os processos do sistema
Comment[ru]=Просмотр списка процессов в системе
Comment[sk]=Zobraziť systémové procesy
Comment[sl]=Prikaz sistemskih opravil
Comment[sr@ijekavian]=Приказ системских процеса
Comment[sr@ijekavianlatin]=Prikaz sistemskih procesa
Comment[sr@latin]=Prikaz sistemskih procesa
Comment[sr]=Приказ системских процеса
Comment[sv]=Visa systemprocesser
Comment[tr]=Sistem Süreçlerini Göster
Comment[uk]=Перегляд системних процесів
Comment[zh_CN]=显示系统进程Comment[zh_TW]=顯示系統行程Icon=htop
Exec=htop
Terminal=true
Categories=System;Monitor;ConsoleOnly;
Keywords=system;process;task

You don’t have to include all the comments in the different languages. The most important ones to include are… :arrow_down:

[Desktop Entry]
Type=Application
Version=1.0
Name=Htop
GenericName=Process Viewer
Exec=htop
Terminal=true
Categories=System;Monitor;ConsoleOnly;
Keywords=system;process;task
2 Likes

Thanks :white_heart:

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.