Useful Tips

How to run terminal in Ubuntu

Pin
Send
Share
Send
Send


To open the terminal emulator in Ubuntu, select "Applications-> Accessories-> Terminal" in the panel. The terminal emulator - Gnome terminal will start.

You can also launch the Gnome terminal emulator in Ubuntu from the application launch window. To do this, press Alt + F2 and enter the name of the program in the window that opens - “gnome-terminal”.

To access the real text console, you can use the keyboard shortcuts Ctrl + Alt + F1 ... Ctrl + Alt + F6. Ctrl + Alt + F7 - switch back to graphical mode.

Ubuntu command line

First you need to clarify what a terminal is and why it is needed. It is a text medium through which the user interacts with the OS. The principle of the command line in Ubuntu is simple: "set the command - get the result."

The terminal has three advantages that incite the user to use it:

  • acceleration of work with files and folders due to simple programming,
  • launching other programs inside the terminal and organizing their interaction,
  • work with servers that allow processing large amounts of data much faster than a personal computer.

How to call a terminal in Ubuntu

The console in Ubuntu can be called in several ways:

  • using hotkeys,
  • in the Dash menu,
  • through the sidebar of Launcher Unity,
  • using the Run window.

As a rule, the choice depends not only on convenience, but also on the ability to open the console in a particular situation.

Ubuntu terminal launch hotkeys

Calling a terminal by pressing hot keys sets Ubuntu apart from other Linux distributions. From anywhere in the graphical interface, opening the terminal will allow simultaneous pressing of the keys Ctrl + Alt + T.

You can change the key combination in the keyboard settings located in the "Devices" section of the system settings. There is an item “Open terminal”. He is allowed to assign any combination of three keys.

Dash Panel

You can open the command line in Ubuntu through the Dash menu, which is called by clicking on the Ubuntu logo in the upper left corner of the window, or by pressing the Win key on the keyboard. A launch line appears at the top, in which you need to enter the name of the program - “Terminal”.

Launcher Unity Panel

Launcher Unity is a kind of quick launch bar located on the left side of the workspace. To start the terminal through it, you need to drag the program shortcut to the panel. To do this, you can use the Dash menu and the above steps, after which, without releasing the mouse, drag the terminal icon to Launcher Unity.

Run command

In all versions of Ubuntu there is a pop-up window "Run", caused by the simultaneous pressing of Alt + F2. An input line will appear over all windows through which you can run both the terminal and any other program.

In the latter case, there is no way to see the output of the command, so it is better to launch the console. Terminal invocation commands are different in different Ubuntu environments. For example, in Gnome it is gnome-terminal, and in KDE it is console.

How to open a file through an Ubuntu terminal

To open a file of any extension in its intended program, the Ubuntu command line provides the xdg-open command. It allows you to open not only a file, but also a web page or folder in the system. To do this, specify the path to the desired resource:

If you want to open a text file, while still looking at its contents, other commands are provided:

  • More - opens a file for paging directly in the terminal. You can specify additional options. For example, if you want to read only the first 5 lines, the parameter “–5” is set, and to start reading from the 5th line - “+5”.
  • Less is an advanced version of more with a read up function. In addition, it does not save text in the terminal. Implemented content search. To do this, type “/” and the text itself for the search. Use the “n” key to go to the next found fragment.
  • head displays only the beginning of the document. By default, the first 10 lines are displayed, but the value can be changed:

head -13 text.log - view 13 lines of a document.

How to run a program through an Ubuntu terminal

The principle of running programs through the Ubuntu terminal is quite simple, but has its own catch. The template command entry is as follows:

Often the path to the program is not fully indicated. This is explained by the fact that all the main programs are stored in certain directories, for example: / bin, / usr / sbin and others. Therefore, to automate the process, the PATH variable was introduced, which stores all of these paths. The full list of directories can be found out by doing:

When the program name is written to the console, the system scans all folders from PATH for its presence. If the search fails, a message appears - command not found. For example, entering ls will launch a utility that displays the contents of the folder.

If the location of the program is different, you must write the full path. Even if a folder with this program is open, it is not enough just to write its name. To specify that you want to open the utility from this directory, you can use "./":

Sometimes there is a need to define a utility that will be used to open certain files by default. In this case, the EDITOR variable is used:

Conclusion

Knowledge of how to open a terminal in Ubuntu, as well as the main list of its features, is desirable for users of this OS. Despite the convenience of using the graphical shell, the console provides wider functionality, and sometimes it is the only way to solve the problem. Over time, the text interface becomes familiar, which greatly speeds up the work.

Pin
Send
Share
Send
Send