Launching program in linux

Adam the Automator

Linux 101: How to Run a Program in Linux

Michael Franklin

Read more posts by this author.

If you are new to Linux, particularly the command line, and want to learn how to run a program in Linux, you’ve come to the right spot. Running programs in Linux is no different than how it’s done in Windows. Easy to say, right? But no worries, you’ll get to run any program in no time.

In this tutorial, you’ll learn many ways to run programs in Linux, both via GUI and a command-line environment. From a novice Linux user to a power user, you will find knowing these methods to run a program helpful.

Ready? Let’s get started!

Table of Contents

Prerequisites

Ubuntu Desktop 15.04 or later – Ensure you have a Linux host ready to go. This tutorial uses Ubuntu 15.04 (Desktop version) with GNOME installed, but any newer distribution should work similarly.

Launching Programs with the Application (App) Launcher

There are generally multiple ways to run a program within Windows, and Linux is no different. We will start with the most common way to run a program using the Launcher.

The most common method to run programs in Linux is to use the Launcher. The Launcher is a bar similar to the Windows start menu that contains a list of icons you can click on to run programs.

In Ubuntu, the App Launcher is located on the left side of the screen, as you can see below, containing default commonly run applications. To open the program, simply click the icon representing the program.

Launching Programs with the Applications Menu (Unity Dash)

You can also run programs in Ubuntu Linux with Unity Dash. The Applications Menu or Unity Dash is a handy way to search for and run programs in GNOME. To use the Applications Menu, click on the Ubuntu button in the top left corner.

You’ll see below that the menu opens a search bar with any recently run programs.

Type in the correct name of the program you are looking for (i.e Firefox) and it will appear, then select it to launch the program.

In Ubuntu Linux v20.04+, Unity Dash has been replaced with Activities in the upper left of your screen but the process to run a program remains the same.

Using the Run Command to Launch Program

Another way to launch programs in Linux is to use the Run command. The Run command is a handy way to quickly run a program in Linux by typing the program and executing it.

To run programs via the Run command, select the Alt-F2 to open the Run Command box.

You can also hit Alt-F2 as a shortcut to the run command.

Next, type the name of the program you want to run. In this example, you’ll run the Terminal application, type terminal, select the Terminal icon and hit Enter.

You’ll see below that Linux will launch the Terminal application.

Running Programs Using Hot Keys

If you’re more of a keyboard ninja and would rather skip the mouse like we started with in the last example, you can also run programs with hotkeys. In all Linux distros, you can use the Super Key (Windows Key) + A. The Super Key will bring up all applications in alphabetical order and a text box to type in the name of a program, as shown below.

Читайте также:  Как отключить автозагрузку microsoft edge windows 10

You can type the name of the program in the search box to navigate to the program or click on the program with your mouse if it appears immediately.

Setting Up Keyboard Shortcuts to Run Programs in Linux

Now that you have learned the GUI options to run programs, the remainder of this tutorial will focus on using non-GUI-based options to run programs. Let’s first begin with keyboard shortcuts. Using keyboard shortcuts can remove a lot of clicking around.

To set up keyboard shortcuts in Ubuntu:

1. Select the icon in the top left corner again and Keyboard Shortcut. The Keyboard application should show up below. When it does, click on it.

2. In the Keyboard application, click on the Shortcut tab.

In Ubuntu 20.04 and newer, selecting Keyboard Shortcut from the Activities menu brings you directly to the Shortcuts tab.

3. Click on the + icon to create a new keyboard shortcut. Ubuntu will direct you to the Custom Shortcuts section.

4. Next, enter a descriptive Name for the shortcut key and provide the Command (program) to execute and click Apply.

When Ubuntu creates the shortcut, you’ll see that the Name shows up under Custom Shortcuts but it’s disabled.

5. Now, click on the Disabled text as shown above and press the desired keyboard shortcut such as Ctrl+T. Once you type your desired shortcut, it will show up, as shown below.

6. Finally, launch the application by pressing the keyboard shortcut!

Running a Program within the Terminal

Although if you’re a newcomer to Linux, chances are you’ll be running programs with the GUI but if you need to use the command line for any reason, the Terminal makes it easy to do so. The Terminal is a command-line application that allows you to manage all facets of Linux with the keyboard.

To run programs in the Terminal, open the App Launcher (or Activities) in the upper left corner and run the Terminal application as shown below.

When the Terminal opens, as shown below, simply type the name of the program and press Enter.

Running programs in the Terminal will not work for all programs. Some programs may not be in the PATH.

Conclusion

In this tutorial, you’ve learned many different methods to run programs in Linux. Using both GUI-based and command-line-based methods, you should now know how to launch programs wherever you are within Linux.

Try installing programs in Linux such as the tutorial to install a common program such as Docker for practice and then run it using a shortcut, command line, or GUI Interface. Which way will you use most often to run your favorite programs?

More from Adam The Automator & Friends

With an ever-increasing visitor base searching for solutions to their problems, we can help you connect with and reach the right kind of audience and generate targeted sales leads.

We’ve put together a list of the resources we, at ATA, can wholeheartedly recommend!

Why not write on a platform with an existing audience and share your knowledge with the world?

Источник

How to automatically run program on Linux startup

There are a few stages of Linux startup, and you can set your own autostart script or program at any of the stages where it could be a single command, a chain of commands, or an executable shell script. There could be, however, some differences in startup procedure between different Linux distributions and versions.

Modern Linux will first boot into systemd while older versions of Linux uses System V init. Both methods will run cron and rc.local before the desktop environment such as GNOME or KDE is loaded. On the other hand, server-based Linux distributions will run the default shell such as Bash after the user logged in at the console instead of loading the desktop environment.

Читайте также:  Как выделить несколько файлов windows 10

Methods to automatically run program on Linux startup:

Automatically run program on Linux startup via systemd

systemd is the standard system and service manager in modern Linux. It is responsible for executing and managing programs during Linux startup, among many other things. Compatible programs will provide service unit files used by systemd to manage the program’s execution.

You can configure systemd to run programs automatically during Linux startup following these steps:

You’ll have to create your own service unit if it’s a custom program or if your program doesn’t come with one during installation
Related: Creating and modifying systemd unit files

enabled service unit is executed during boot

Automatically run program on Linux startup via cron

cron is a daemon to execute scheduled commands. The commands are stored in the cron job table or crontab and are unique for each user in the system. It’s started during system boot either by systemd or System V init, and you can schedule your job or program to be executed right during the system boot itself by following these steps:

You’re required to select an editor for the crontab if this is the first time the user uses the command.

A crontab will be created for the user running the command and will be executed using the privileges of the user. If you need your program to run as the root user, run crontab -e as the root user itself.

@reboot defines the job to be executed during system boot.

Use full path for your programs when possible and write your commands in a single line.

The file is saved in /var/spool/crontab/

Automatically run program on Linux startup via rc.local

rc.local is a legacy from the System V init system. It is the last script to be executed before proceeding to a login screen for the desktop environment or a login prompt at the terminal. It’s usually a Bash shell script, and you can run anything from the script.

You can configure your rc.local script following these steps:

It must start with interpreter (/bin/bash) and ends with an exit code (0 is for success)

The file will be executed as the root user during system boot

Automatically run program on GNOME startup

GNOME is the default desktop environment for Linux distributions such as Ubuntu and Red Hat. GNOME can be configured to run programs when a user logs in and can be configured by following the below article:

Automatically run program on KDE startup

KDE is another popular desktop environment for Linux and is the default in Kubuntu and openSUSE. It can easily be configured to run programs when a user logs in as detailed in the following article:

Automatically run program on new Bash session

A new shell program will be spawned when you start your terminal session. Bash is the default shell for most Linuxdistributions, and when started, it will look for the following files in the particular order and executes them.

These files contains commands and logics to set up proper environment variables and run required programs in Bash language. It’s also configured to normally execute other files such as /etc/bashrc, /etc/bash.bashrc and

You can edit any of these files to run your program when a Bash session is started. Below is a part of a typical

Comment anonymously. Login not required.

Источник

6 Ways to Open a Ubuntu Application

Open your apps the most convenient way for you

In this guide, you will discover a number of different ways to open an application using Ubuntu. Some of them will be obvious and some of them less so.

Not all applications appear in the launcher, and not all of them appear in the Dash. Even if they do appear in the Dash, you might find it easier to open them in other ways.

You might want to make sure Ubuntu is updated so you don’t have any issues opening applications.

Читайте также:  Презентацию сравнение операционных систем windows

Use the Ubuntu Launcher to Open Applications

The Ubuntu Launcher is on the left side of the screen and contains icons for the most commonly used applications.

  • You can open one of these applications simply by selecting it.
  • Right-clicking​ on an icon often provides other options such as opening a new browser window or opening a new spreadsheet.

Search the Activities to Find an Application

If the application doesn’t appear in the launcher the second quickest way to find an application is to use the GNOME Activities menu.

  1. Select Activities in the upper left corner of your screen.
  2. Your screen will darken to display the Activities Overview. Here, you’ll see any applications that you have minimized, the other available workspaces, and a search.
  3. Type the name of the application you want into the search. GNOME will show you both the apps installed on your system and the ones available for download.

For a more advanced approach of finding a program, or if you can’t find your application in the Activities search, check out our breakdown of how to use the ‘which’ command to find a program.

Browse the Applications Menu to Find an Application

If you just want to see which applications are on your computer or you know the type of application but not its name you can simply browse the GNOME applications menu.

  1. To browse, select the Show Applications icon on the launcher or press the Super Key + A.
  2. The GNOME applications menu will open up, displaying all the apps you have in your system in alphabetical order. At the bottom, you’ll find the option to toggle between All applications and your Frequent ones.
  3. Select an app icon to launch it.

Use the Run Command to Open an Application

If you know the name of the application you can open it quite quickly in the following way:

  1. Press Alt+F2 to bring up the run command window.
  2. Enter the name of the application. If you enter the name of a correct application then an icon will appear.
  3. You can run the application either by clicking on the icon or by pressing Return on the keyboard.

Use the Terminal to Run an Application

You can open an application by using the Linux terminal.

To open a terminal press Ctrl+Alt+T or follow this guide for more suggestions. If you know the program’s name you can simply type it into the terminal window. For example:

Of course, some applications aren’t graphical in nature. One example of this is apt-get, which is a command-line package manager.

When you get used to using apt-get you won’t want to use the graphical software manager anymore.

Use Keyboard Shortcuts to Open Applications

You can set up keyboard shortcuts to open applications with Ubuntu.

  1. To do so, open the applications menu, and search for Settings.
  2. Open the Settings app.
  3. When the window opens, locate and press Devices in the left side menu.
  4. Now, the menu will change to show device related options. Choose Keyboard Shortcuts.
  5. The main body of the window will display a huge list of current keyboard shortcuts.
  6. Scroll to the very bottom of the list, and select the Plus Sign (+) icon.
  7. Another smaller window will pop up. Enter a Name for your shortcut. For the Command, you can usually use the name of the app. Sometimes, that’s different. You can search for the path to it with which . For example: which firefox
  8. If you don’t know the name of the command at all, you can try:
    ls -lah /usr/bin | grep -i
  9. Then, press Set Shortcut to input the key combination. Press the combination of keys that you want to assign the shortcut to on your keyboard. Then, press Add in the upper right of the window to create your shortcut

When the launcher has been created you can set the keyboard shortcut in the same way as the other launchers.

Источник

Оцените статью