How to start a Linux application in terminal running mode

Source: Internet
Author: User

How to start a Linux application in terminal running mode

This is a short but useful tutorial that can help you start a Linux application on the terminal and prevent the terminal window from losing the focus.

There are many ways to open a terminal window in Linux, depending on your choice and your desktop environment.

If you are using Ubuntu, you can use CTRL + ALT + T to open the terminal. You can also use the super key (Windows key) to open Dash, search for "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 terminals in the menu. Some environments contain terminal icons on the dock bar or panel.

Generally, you can enter an application name in the terminal to start an application. For example, you can enter "firefox" to start Firefox.

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

For example, you can use the following command to open a Firefox browser window and use the default search engine to search for related information:
Firefox-search "linux.cn"

You may notice that if you start Firefox, after the program is opened, you return to terminal window control, which means you can continue working on the terminal.

Normally, if you start an application on the terminal, the control will switch to the newly started application. Only after the application is closed will the control be switched back to the terminal control. This is because you started this program at the front-end.

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

Like the commands listed below, we can add a (&) symbol to start the application in the background.
Libreoffice &

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

Note: In general, when the terminal is closed, the background program started on the terminal will also be terminated. to disable the terminal, you can use the following commands to keep the background program running:

Nohup command [arg...] &

If the application directory is not installed in the Directory included in the PATH variable, we cannot start the program directly through the Application name. You must enter the entire PATH of the application to start the program.
/Path/to/yourprogram &

If you are not sure 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:
Find/path/to/start/from-name programname

For example, you can enter the following command to find Firefox:
Find/-name firefox

The command running results will generate a large number of outputs. Don't worry, you can also view them by page through less or more.
Find/-name firefox | more
Find/-name firefox | less

When the find Command finds a folder with no access permission, a denial of access error is reported,

You can use the sudo command to prompt for permissions. Of course, if you have not installed sudo, you can only switch to a user with permissions.
Sudo find/-name firefox | more


If you know that the file you want to search for is in your current directory structure, you can use a dot to replace the Slash:
Sudo find.-name firefox | more

You may need sudo to raise the permission, or you do not need it at all. If the file is in your home directory, you do not need to use sudo.

Some applications must be upgraded to run, otherwise you will get a lot of access denial errors, unless you use a user with permissions or use sudo to improve the permissions.

Here is a tip. If you run a program, but it needs to be elevated to operate, enter the following command to try:
Sudo !!

This article permanently updates the link address:

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: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.