website/content/blog/launchappsthroughterminal.md

50 lines
1.5 KiB
Markdown
Raw Normal View History

2020-09-26 21:51:39 -04:00
---
title: "Launch Apps through the Terminal"
date: 2020-09-26T21:48:09-04:00
draft: false
2022-11-12 11:22:54 -05:00
tags: ["Linux"]
2023-01-05 14:04:45 -05:00
medium_enabled: true
2020-09-26 21:51:39 -04:00
---
2022-05-10 12:08:39 -04:00
Normally when you launch an application through the terminal, the standard output appears, and closing the terminal closes the application.
## Using `systemd`
[Tem Tem](https://fosstodon.org/@ralismark) recently [tooted](https://fosstodon.org/@ralismark/108266728217245129)
a [blog post](https://www.ralismark.xyz/posts/systemd-run) they wrote on replacing `nohup` with `systemd-run`
To run a graphical application it's as easy as:
```bash
systemd-run --user application
```
If you want to see any of the application terminal output,
then when the service is running you can check the status
like any other systemd service.
```bash
systemd --user status application
```
2022-06-12 19:50:41 -04:00
Note that the current directory information is not known
to `systemd-run`. Therefore, if you'll need to specify
absolute as opposed to relative paths. For example:
```bash
systemd-run --user okular "$PWD/document.pdf"
```
2022-05-10 12:08:39 -04:00
Check out Tem Tem's [blog post](https://www.ralismark.xyz/posts/systemd-run) for more on `systemd-run`!
## Using `nohup` (Legacy)
When the terminal closes, it sends a hangup signal to all of the processes it manages.
The `nohup` command allows applications to run regardless of any hangups sent.
Combine that with making it a background task,
and you have a quick and easy way to launch applications through the terminal.
2020-09-26 21:51:39 -04:00
```bash
nohup application > /dev/null &
```