Midnight commander linux ��� ���

Midnight Commander — консольный файловый менеджер для Linux

Если вам приходится работать с большим количеством файлов в консольном окружении, то вы можете найти такую работу достаточно утомительной. В графическом окружении имеются файловые менеджеры, которые помогают повысить скорость работы с файлами. Вам не нужно помнить название и синтаксис каждой команды, связанной с файлами.

В консольном окружении для работы с файлами вы должны знать основные команды и их синтаксис. К счастью, в Linux также имеется текстовый файловый менеджер, работающий в консольном окружении. Он называется Midnight Commander (далее мы будем называть его просто MC).

Заголовки разделов

Сайт Midnight Commander говорит:
«GNU Midnight Commander — это визуальный файловый менеджер, распространяемый под лицензией GPL, и поэтому он квалифицируется как Free Software. Это мощная текстовая полнофункциональная программа, которая позволяет вам копировать, перемещать и удалять файлы и директории, производить поиск файлов и запускать на выполнение команды оболочки. Также включены встроенные редактор и программа для просмотра файлов».

Как установить Midnight Commander в Linux

По умолчанию MC, как правило, не устанавливается. В Debian, Ubuntu и Linux Mint вы можете установить его с помощью команды apt-get:

В RHEL, CentOS и Fedora вы можете использовать команду:

После завершения инсталляции просто введите «mc» (без кавычек) в консоли для его запуска.

Возможности Midnight Commander

MC имеет много полезных как для пользователей, так и для администраторов, функций.

Копирование, удаление, переименование/перемещение, создание директорий

Интерфейс MC разделен на две колонки, независимые друг от друга. Каждая колонка представляет активную директорию. Вы можете переключаться между ними с помощью клавиши Tab. В нижней части экрана вы можете видеть кнопки с номерами, которые относятся к функциональным клавишам F1 — F10.
Для копирования файла из одной директории в другую просто выделите его и нажмите «F5». Для копирования нескольких файлов сразу необходимо сначала выделить их с помощью клавиши «Insert».

MC запросит у вас подтверждения. Для начала копирования просто нажмите «OK».
Удаление файлов еще проще. Просто выделите файлы и нажмите «F8». Перемещение файлов выполняется с помощью клавишы «F6».
Однако переименование файлов немного отличается. Нажав клавишу «F6», вам необходимо ввести новое имя файла. Пример, как это делается, приведен ниже на скриншоте.

Для создания директории вы можете нажать «F7». MC создаст новую директорию в текущей. Чтобы узнать, что еще MC может делать с файлами, нажмите «F9» > File.

Встроенная утилита для просмотра файлов

Затем, когда вы нажмете клавишу «F4», MC будет использовать выбранный вами текстовый редактор. Если вы хотите изменить редактор по умолчанию, просто нажмите «F2», вы берите «@» и введите «select-editor» (без кавычек).

Читайте также:  Ноутбук зависает намертво через несколько минут работы windows

Что, если вы хотите использовать другой текстовый редактор, не обнаруженный MC? Допустим, вы хотите работать с Vi. Это можно сделать по другому. Найдите в своей домашней директории файл «.selected_editor». Это скрытый файл, поэтому он начинается с точки. Отредактируйте его следующим образом:

Права доступа к файлам

Файлы и директории имеют права доступа, которые указывают, кто может читать, записывать и исполнять файлы и директории. Команда для управления правами доступа — chmod. Чтобы узнать, как нею пользоваться, наберите в терминале «man chmod».
В MC вам нужно только выделить файл, затем нажать «F9» > File > Chmod или «Ctrl-x» и «c». МС покажет вам текущие права доступа выделенного файла и параметры, которые можно изменить.

Владелец файла

Файлы и директории имеют своего владельца, а также группу владельца. Привилегии владельца управляются с помощью описанной выше команды chmod. Управление владельцами осуществляется с помощью команды chown.
Как обычно, чтобы узнать, как нею пользоваться, наберите в терминале «man chmod». В MC вам нужно просто выделить файл, затем нажать «F9» > File > Chown, или «Ctrl-x» и «o». Теперь вы можете задать владельца и группу владельца из списка доступных пользователей и групп.

У MC также есть функция «Advanced Chown», которая представляет собой комбинацию chmod и chown, позволяющая выполнять две описанные выше задачи в одном месте. Нажмите «F9» > File > Advanced Chown.

Подключение по FTP

По умолчанию MC имеет двухпанельный интерфейс. Эти панели предназначены не только для локальных директорий. Вы можете подключить их к удаленному компьютеру по FTP.
В этом случае MC выступает в качестве FTP-клиента. Для подключения вам необходимо нажать «F9» > FTP Link. MC запросит данные для подключения в следующем формате:

Если введенные данные верны, в одной из панелей вы увидите список директорий удаленного компьютера.

Для отключения FTP-соединения вы можете нажать «F9» > Command > Active VPS Link. В списке директорий Active VFS вы увидите свое FTP-соединение. Выберите его и нажмите «Free VFSs». Если вы хотите просто переключиться на локальную директорию без разрыва FTP-соединения, выберите «Change to».

Если в вашей сети используется прокси-сервер, вы можете настроить MC на работу с прокси. Нажмите «F9» > Options > Virtual FS > Always use ftp proxy.

Выход из Midnight Commander

Чтобы выйти из Midnight Command, нажмите «F9» > File > Exit или «F10».

Для более детального ознакомления с возможностями MC, постетите Midnight Commander FAQ:

Источник

How to Use Midnight Commander, a Visual File Manager

Introduction

For beginners, managing files on their Linux servers from the command line can be intimidating, time-consuming, and sometimes even risky. More experienced users might want to switch to better suited tools for dealing with files and directories in many different locations. One tool that can help both Linux newbies and veterans is Midnight Commander, a Text User Interface (TUI) file manager.

Читайте также:  Виджеты для рабочего стола windows 10 котировки

A TUI facilitates interaction between users and their systems in a visually oriented way instead of typing commands. While lacking in visual components compared to a graphical user interface (GUI), a TUI offers windows, panels, menus, and mouse support.

Before You Begin

The methods in this tutorial have been tested on Debian 9. There is no special requirement to install Midnight Commander, and it works on all Linux distributions. While this file manager should work in almost identically on all Linux distributions, a particular distro may not package the exact same Midnight Commander version (4.8.18, in this case). This may result in small behavioral differences on other operating systems.

Install Midnight Commander

First, install the utility:

On Debian or Ubuntu run:

On CentOS, the command is:

Launch Midnight Commander

To start Midnight Commander with the command prompt:

Keep in mind that running as root is not a good idea unless you need to modify or delete files/directories owned by this user. In most cases, reading or copying objects owned by root doesn’t require special privileges, so try to run mc as a regular user.

By default, Midnight Commander uses a blue background color and highlights important menu items. To turn off color:

Interact With Screen Elements

The file manager is vertically split into two panels. The logic behind this is that copy and move operations are done from one place to another. At the bottom, you will see ten labeled rectangles:

Help, Menu, View, (+ 7 more)

The numbers preceding each label represent the function key you need to press to perform those actions. For example pressing F10 will quit the program and return to your shell.

Above those ten buttons, you’ll see [email protected]_hostname:

$ . This allows you to type commands in your current working directory. Try it now, type:

After you press ENTER, you’ll see a new file appear in your active panel. Now, delete it without typing any commands. Use the arrow keys, pressing UP or DOWN until the file named test is highlighted. Now press F8. A dialog box pops up and asks for confirmation. Press ENTER. If you press F8 by mistake this gives you chance to cancel the action.

At the top of the screen, you can see a colored bar with text: Left, File, Command, Options, Right.

These are drop-down menus that can be accessed by pressing F9 and then navigating with your arrow keys. Press F9 and then the DOWN arrow key multiple times until Tree is highlighted. Press ENTER. The panel has now changed to tree view.

Once you hit the F9 key, some letters get highlighted, e.g., C in Command. These are keys that you can press to navigate the menus faster. Let’s return to your previous view: press F9 then l (L) and then g to get back to File listing. When an input field is selected, hold ALT down before pressing on the highlighted letter.

Читайте также:  Файлы служба сервера windows

Shortcut keys are a combination of keys pressed together that allow you to quickly access specific actions. For example, try pressing CTRL+O. This lets you focus on the command line or see previous command output while Midnight Commander runs in the background. You can quickly return to its interface by hitting the same key combination.

You can also use your mouse pointer to click on interface elements.

Use the Two Panels to Work with Files and Directories

Switch between the left and the right vertical panels by pressing TAB.

Close Midnight Commander by pressing F10. Open a temporary working directory in both panels:

This is a directory containing temporary files that will be deleted at next boot, so we can experiment freely here.

Create a directory by pressing F7. Name this test .

Using your arrow keys, navigate to test and press ENTER (after creating a directory, this should already be highlighted).

Create nine empty files:

Say you want to copy three files from /tmp/test to /tmp . Use the arrow keys to navigate to file1 . Once it’s highlighted press INSERT three times. Pressing F5 and then ENTER will copy all three files to the working directory opened in the opposite panel.

Alternate ways to make selections are: holding down SHIFT and then pressing UP or DOWN arrow key.

  • * to inverse the selection
  • — to deselect all objects that match a pattern (e.g., typing f* will deselect every file or directory whose names start with “f”)
  • + to select by pattern

In these patterns, * stands for zero or more characters while ? stands for one character. So “f*e” would match “fe”, “file”, “fiiiile” or anything else starting with “f” and ending with “e”. “a?c” would match “abc”, “adc”, “azc” but will not match “ac”. There needs to be exactly one character between “a” and “c.”

If you prefer to use the mouse, then right clicking will make individual selections. Holding down the right click and dragging will select multiple entries.

Pressing F4 will open a file in the default editor. On Debian you will get this output if you never used an editor before:

It’s recommended you choose 2 here since mcedit integrates with Midnight Commander and is easier to use than nano . A large amount of functions can be accessed by pressing F9 to activate the editor’s menu. Press F10 to exit the utility or ESC two times.

Источник

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