How to start a program in a Linux terminal using the background running mode

Source: Internet
Author: User
Tags switches

We have a lot of ways to open a terminal window in a Linux system, depending on your choice and your desktop environment.

If you are using Ubuntu, you can use the CTRL+ALT+T key combination to open the terminal. Of course you can also use the Super key (Windows key) to open the dash, search "TERM", and then click the "TERM" icon to open the terminal window.

For other desktop environments, such as Xfce, KDE, lxde, cinnamon, and mate, you can find a terminal in the menu. Some environments include a terminal icon on a docking bar or panel.

Typically, you can start an application by entering the application name directly in the terminal. For example, you can start Firefox by typing "Firefox".

The advantage of starting an application at a terminal is that you can include some additional parameters.

For example, you can use the following commands to open a Firefox browse window and then search for relevant information using the default search engine:

The code is as follows:

Firefox-search ""

You may notice that if you start Firefox, the program opens and returns to the Terminal window control, which means you can continue working at the terminal.

Typically, if you start the application at the terminal, the control switches to the newly launched application and switches to terminal control only after the program is shut down. This is because you started the program at the front desk.

If you want to open the application at the Linux terminal and return to terminal control, you need to start the application as a background process.

As with the commands listed below, we can start the application in the background by adding a (&) symbol.

The code is as follows:

LibreOffice &

Translator Note: If you need to add parameters, remember to put the & symbol at the end.

In general, when the terminal is closed, the background program that is started in this terminal will also be terminated, so that after the terminal is closed, the background program remains executed. You can use the following command

The code is as follows:

nohup command [arg ...] &

If the application directory is not installed in the directory contained in the path variable, there is no way to start the program directly through the application name, and you must enter the entire path of the application to start it.

The code is as follows:

/path/to/yourprogram &

If you are unsure which Linux directory structure the program enters, you can use the Find or Location command to locate it.

You can enter the following symbols to find a file:

The code is as follows:

Find/path/to/start/from-name ProgramName

For example, you can enter the following command to find Firefox:

The code is as follows:

Find/-name Firefox

The results of the command run will be a lot of output, don't worry, you can also through less or more to Page view.

The code is as follows:

Find/-name Firefox | More

Find/-name Firefox | Less

When the Find command finds a folder that does not have access, a deny access error is reported.

You can use the sudo command to prompt permission. Of course, if you don't have sudo installed, you can only switch to a user with permissions.

The code is as follows:

sudo find/-name Firefox | More

If you know that the file you are looking for is in your current directory structure, you can use dots instead of slashes:

The code is as follows:

sudo find. -name Firefox | More

You may need sudo to elevate permissions, or you may not need it at all, and if the file is in your home directory, you don't need to use sudo.

Some applications must elevate permissions to run, otherwise you will get a lot of access denied errors unless you use a user with permission or use sudo to elevate permissions.

Here's a little trick. If you run a program, but it needs to be elevated to operate, enter the following command to try:

The code is as follows:


Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.