Linux run file from path

How to Execute .bin and .run Files in Ubuntu

Before explaining how to execute .bin and .run files on your Ubuntu, let us first define what exactly these file extensions are:

Bin File: A Binary or BIN file in Ubuntu refers to installation packages that are mostly self-extracting executables for installing software on your system. You can install most software packages through the Ubuntu Software Manager, from .deb packages, and .tar.xz packages. However, there is software that is not available in these formats. These mostly include newer software and newer versions of software, mostly beta, that is not available otherwise. The bin packages are easily executed/run using the Ubuntu command line, the Terminal.

Run File: These are also executable files typically used for Linux program installers. Run Files contain program data and instructions for making the installation; often used for distributing device drivers and software applications. The run packages are easily executed/run using the Ubuntu command line, the Terminal.

In this article, we will explain how to execute/run the file with .run and .bin extensions on Ubuntu Linux.

We have run the commands and procedures mentioned in this article on a Ubuntu 18.04 LTS system. We will be using the Ubuntu command line, the Terminal, in explaining how to run bin and run files. You can open the Terminal application either through the system application launcher search or the Ctrl+Alt+T shortcut.

Note: Please make sure your .run and .bin files come from a reliable source, as executing an insecure file can damage your system and even compromise your system security.

Executing .bin and .run files

The process of running both the run and BIN files is pretty simple and straightforward in Ubuntu.

We are assuming that you have already downloaded your bin/run file in a known location on your Ubuntu.

Open the Terminal application and move to the location where you have saved the executable file.

For example, I would use the following command to move to my Downloads folder:

Now use the following command to make your .bin/.run file executable:

For .bin file: Advertisement

In this example, I will be making a sample .run file named samplefile.run executable.

If your .run/.bin file does not exist in the current location, you can specify the exact file path/location in the above commands.

My file is now marked as executable. The system indicates it by a change in color of the filename when listed through the ls command:

Once your .bin/.run file has become executable, you can use the following command to execute/run it:

You can specify the path of the executable file in the above command if it does not exist in the current folder you are in.

My sample file is pretty much an empty file. In case of a proper installation package, the installation process will begin after you execute the file.

Читайте также:  Как выполнить sfc scannow windows 10

This is the power of the Ubuntu command line. You can install rare software packages available in the .run and .bin formats easily on your system.

Karim Buzdar

About the Author: Karim Buzdar holds a degree in telecommunication engineering and holds several sysadmin certifications. As an IT engineer and technical author, he writes for various web sites. You can reach Karim on LinkedIn

Источник

Переменная PATH в Linux

Когда вы запускаете программу из терминала или скрипта, то обычно пишете только имя файла программы. Однако, ОС Linux спроектирована так, что исполняемые и связанные с ними файлы программ распределяются по различным специализированным каталогам. Например, библиотеки устанавливаются в /lib или /usr/lib, конфигурационные файлы в /etc, а исполняемые файлы в /sbin/, /usr/bin или /bin.

Таких местоположений несколько. Откуда операционная система знает где искать требуемую программу или её компонент? Всё просто — для этого используется переменная PATH. Эта переменная позволяет существенно сократить длину набираемых команд в терминале или в скрипте, освобождая от необходимости каждый раз указывать полные пути к требуемым файлам. В этой статье мы разберёмся зачем нужна переменная PATH Linux, а также как добавить к её значению имена своих пользовательских каталогов.

Переменная PATH в Linux

Для того, чтобы посмотреть содержимое переменной PATH в Linux, выполните в терминале команду:

На экране появится перечень папок, разделённых двоеточием. Алгоритм поиска пути к требуемой программе при её запуске довольно прост. Сначала ОС ищет исполняемый файл с заданным именем в текущей папке. Если находит, запускает на выполнение, если нет, проверяет каталоги, перечисленные в переменной PATH, в установленном там порядке. Таким образом, добавив свои папки к содержимому этой переменной, вы добавляете новые места размещения исполняемых и связанных с ними файлов.

Для того, чтобы добавить новый путь к переменной PATH, можно воспользоваться командой export. Например, давайте добавим к значению переменной PATH папку/opt/local/bin. Для того, чтобы не перезаписать имеющееся значение переменной PATH новым, нужно именно добавить (дописать) это новое значение к уже имеющемуся, не забыв о разделителе-двоеточии:

Теперь мы можем убедиться, что в переменной PATH содержится также и имя этой, добавленной нами, папки:

Вы уже знаете как в Linux добавить имя требуемой папки в переменную PATH, но есть одна проблема — после перезагрузки компьютера или открытия нового сеанса терминала все изменения пропадут, ваша переменная PATH будет иметь то же значение, что и раньше. Для того, чтобы этого не произошло, нужно закрепить новое текущее значение переменной PATH в конфигурационном системном файле.

В ОС Ubuntu значение переменной PATH содержится в файле /etc/environment, в некоторых других дистрибутивах её также можно найти и в файле /etc/profile. Вы можете открыть файл /etc/environment и вручную дописать туда нужное значение:

sudo vi /etc/environment

Можно поступить и иначе. Содержимое файла .bashrc выполняется при каждом запуске оболочки Bash. Если добавить в конец файла команду export, то для каждой загружаемой оболочки будет автоматически выполняться добавление имени требуемой папки в переменную PATH, но только для текущего пользователя:

Выводы

В этой статье мы рассмотрели вопрос о том, зачем нужна переменная окружения PATH в Linux и как добавлять к её значению новые пути поиска исполняемых и связанных с ними файлов. Как видите, всё делается достаточно просто. Таким образом вы можете добавить столько папок для поиска и хранения исполняемых файлов, сколько вам требуется.

Источник

Understanding file paths and how to use them in Linux | Opensource.com

If you’re used to drag-and-drop environments, then file paths may be frustrating. Learn here how they work, and some basic tricks to make using them easier.

Subscribe now

Get the highlights in your inbox every week.

Читайте также:  Open jks file linux

A file path is the human-readable representation of a file or folder’s location on a computer system. You’ve seen file paths, although you may not realize it, on the internet: An internet URL, despite ancient battles fought by proprietary companies like AOL and CompuServe, is actually just a path to a (sometimes dynamically created) file on someone else’s computer. For instance, when you navigate to example.com/index.html, you are actually viewing the HTML file index.html, probably located in the var directory on the example.com server. Files on your computer have file paths, too, and this article explains how to understand them, and why they’re important.

When computers became a household item, they took on increasingly stronger analogies to real-world models. For instance, instead of accounts and directories, personal computers were said to have desktops and folders, and eventually, people developed the latent impression that the computer was a window into a virtual version of the real world. It’s a useful analogy, because everyone is familiar with the concept of desktops and file cabinets, while fewer people understand digital storage and memory addresses.

As it turns out, the creators of UNIX had the same instinct, only they called these units of organization directories or folders. All files on your computer’s drive are in the system’s base (root) directory. Even external drives are brought into this root directory, just as you might place important related items into one container if you were organizing your office space or hobby room.

Files and folders on Linux are given names containing the usual components like the letters, numbers, and other characters on a keyboard. But when a file is inside a folder, or a folder is inside another folder, the / character shows the relationship between them. That’s why you often see files listed in the format /usr/bin/python3 or /etc/os-release. The forward slashes indicate that one item is stored inside of the item preceding it.

Every file and folder on a POSIX system can be expressed as a path. If I have the file penguin.jpg in the Pictures folder within my home directory, and my username is seth, then the file path can be expressed as /home/seth/Pictures/penguin.jpg.

Most users interact primarily with their home directory, so the tilde (

Practice makes perfect

Computers use file paths whether you’re thinking of what that path is or not. There’s not necessarily a reason for you to have to think of files in terms of a path. However, file paths are part of a useful framework for understanding how computers work, and learning to think of files in a path can be useful if you’re looking to become a developer (you need to understand the paths to support libraries), a web designer (file paths ensure you’re pointing your HTML to the appropriate CSS), a system administrator, or just a power user.

When in doubt, drag and drop

If you’re not used to thinking of the structure of your hard drive as a path, then it can be difficult to construct a full path for an arbitrary file. On Linux, most file managers either natively display (or have the option to) the full file path to where you are, which helps reinforce the concept on a daily basis:

Читайте также:  Half life 2 linux ubuntu

dolphin-file-path.jpg

If you’re using a terminal, it might help to know that modern terminals, unlike the teletype machines they emulate, can accept files by way of drag-and-drop. When you copying a file to a server over SSH, for instance, and you’re not certain of how to express the file path, try dragging the file from your GUI file manager into your terminal. The GUI object representing the file gets translated into a text file path in the terminal:

terminal-drag-drop.jpg

Don’t waste time typing in guesses. Just drag and drop.

Tab is your friend

On a system famous for eschewing three-letter commands when two or even one-letter commands will do, rest assured that no seasoned POSIX user ever types out everything. In the Bash shell, the Tab key means autocomplete, and autocomplete never lies. For instance, to type the example penguin.jpg file’s location, you can start with:

and then press the Tab key. As long as there is only one item starting with Pi, the folder Pictures autocompletes for you.

If there are two or more items starting with the letters you attempt to autocomplete, then Bash displays what those items are. You manually type more until you reach a unique string that the shell can safely autocomplete. The best thing about this process isn’t necessarily that it saves you from typing (though that’s definitely a selling point), but that autocomplete is never wrong. No matter how much you fight the computer to autocomplete something that isn’t there, in the end, you’ll find that autocomplete understands paths better than anyone.

Assume that you, in a fit of late-night reorganization, move penguin.jpg from your

/Pictures folder to your

/Spheniscidae directory. You fall asleep and wake up refreshed, but with no memory that you’ve reorganized, so you try to copy

/Pictures/penguin.jpg to your web server, in the terminal, using autocomplete.

No matter how much you pound on the Tab key, Bash refuses to autocomplete. The file you want simply does not exist in the location where you think it exists. That feature can be helpful when you’re trying to point your web page to a font or CSS file you were sure you’d uploaded, or when you’re pointing a compiler to a library you’re 100% positive you already compiled.

This isn’t your grandma’s autocompletion

If you like Bash’s autocompletion, you’ll come to scoff at it once you try the autocomplete in Zsh. The Z shell, along with the Oh My Zsh site, provides a dynamic experience filled with plugins for specific programming languages and environments, visual themes packed with useful feedback, and a vibrant community of passionate shell users:

zsh-simple.jpg

If you’re a visual thinker and find the display of most terminals stagnant and numbing, Zsh may well change the way you interact with your computer.

Practice more

File paths are important on any system. You might be a visual thinker who prefers to think of files as literal documents inside of literal folders, but the computer sees files and folders as named tags in a pool of data. The way it identifies one collection of data from another is by following its designated path. If you understand these paths, you can also come to visualize them, and you can speak the same language as your OS, making file operations much, much faster.

Источник

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