Midnight commander linux ��� ������������� ����

Midnight Commander

Midnight Commander is an orthodox (two-pane) file manager, supporting standard file operations, virtual filesystems, panelizing of external commands, and user menus. It also includes an internal viewer, editor, and visual diff tool.

As it is based on versatile text interfaces, such as Ncurses or S-Lang, it works on a regular console, inside an X Window terminal, over SSH connections and all kinds of remote shells.

Contents

Installation

Install the mc package, or mc-git AUR for the development version.

Skins

Midnight Commander comes with multiple skins by default. You can set the skin in Options > Appearance.

Additional third-party skins can be installed separately:

Usage

The below section provides a short overview on usage of Midnight commander.

Interface

In prominent view are two vertical panes. Either can list directory contents, show a plain text preview, file details, or a directory tree (see mc(1) § Directory Tree ). File operations are accessible through the function keys or the mouse. More options are visible in a dynamic user menu ( F2 ) and option menu ( F9 ). Keys above F12 ( F13 up to F20 ) are accessible through Shift . Menu and dialog options have one letter highlighted — pressing this letter (or Alt+Letter inside a text entry) directly activates the respective option.

Below, a command line is visible, connected to a subshell. This shell is generally of the same type mc was launched from, and may be switched to at will ( Ctrl+o ), see mc(1) § The subshell support . On this command line, cd is interpreted by Midnight Commander, and not passed to the shell for execution. As such, special completion (such as from Zsh) is unavailable. Files in the pane interact with the command line; for example, Alt+Enter copies the name of a (selected) file to the command line.

Keybindings are generally similar to GNU Emacs. A more strict emacs keymap can be enabled (see mc(1) § Redefine hotkey bindings ). New users may however use Lynx-like (arrow) keybindings (enabled in Options > Panel options) and mouse clicks for navigation.

Mouse support for Linux virtual consoles can be enabled with General purpose mouse.

Modules

These can be called via the mc interface (with Use internal enabled in Options > Configuration), or separately as symbolic links to the mc binary.

  • mcedit — Text and binary file editor, with regex replace, syntax highlighting, macros and shell piping, see mcedit(1)
  • mcview — Text and hex viewer with goto marks and regex search
  • mcdiff — Compares and edits two files in-place ( Ctrl+x d )

Per mc instance, multiple modules can be run concurrently ( Ctrl+` ) (see mc(1) § Screen selector ). External editors may be used instead, and parameters configured accordingly.

Configuration

Most of the Midnight Commander settings can be changed from the menus. However, a small number of settings such as clipboard commands, codeset detection and parameters for external editors can only be changed from

/.config/mc/ini . See mc(1) § Special Settings and following for a complete description of options.

Additionally, the following environment variables are respected: MC_SKIN , MC_KEYMAP , MC_XDG_OPEN , MC_COLOR_TABLE , MC_DATADIR , MC_HOME , KEYBOARD_KEY_TIMEOUT_US , PAGER , EDITOR , VIEWER .

extfs

extfs allows to easily create new virtual filesystems for mc. See /usr/lib/mc/extfs.d/README for details.

Tips and tricks

Start from the menu

Midnight commander can be run from a menu with the correct Desktop entry. For example:

Trash support

Midnight Commander does not support a trash can by default.

Using libtrash

Install the libtrash AUR package, and create an mc alias in the initialization file of your shell (e.g.,

Читайте также:  Canon mf4800 драйвер windows 10

To apply the changes, reopen your shell session or source the shell initialization file.

Default settings are defined in /etc/libtrash.conf.sys . You can overwrite these settings per-user in

/.libtrash , for example:

Now files deleted by Midnight Commander (launched with mc) will be moved to the

Troubleshooting

Exit to the current directory

On exit, the shell returns to the directory Midnight Commander was started from, instead of the last active directory. A wrapper script is included, which can be used by adding this line to your

This will alias mc to the wrapper script.

Another simple workaround is to use the subshell ( Ctrl+o ). This may however interfere with other terminal applications.

Garbled screen

Press Ctrl+l to redraw the display. This only redraws, but does not refresh ( Ctrl+r ) the file list.

Opening files

mc reads the MC_XDG_OPEN environment variable to open files, which defaults to xdg-open when unset. [2]

if mc is blocked until the resulting process ends, or the process exits together with mc, use nohup & :

and set MC_XDG_OPEN accordingly:

Find file shows no results

If the Find file dialog (accessible with Alt+? , or Esc+? , or the MC menu) shows no results, check the current directory for symbolic links. Find file does not follow symbolic links, so use bind mounts (see mount(8) ) instead, or the External panelize command.

Broken shortcuts

With certain terminal definitions such as screen-256color or xterm-termite , shortcuts such as Shift+F6 may not work or act as different combinations. To remedy this, assign the terminal sequences manually with the Learn keys dialog.

Settings will be stored in the

/.config/mc/ini file, for example for screen-256color :

No bold text in urxvt

If started under urxvt with the default TERM setting, text that is usually bold in many other terminals will not appear so. The root of the issue is because xterm couples bright text color with the bold attribute (thus, bright colors will always appear as bold in xterm).

urxvt does not have this limitation, which Slang (the library mc uses for text display by default) honors. Because Slang can decouple the bold attribute from bright colors on urxvt, mc would need to explicitly specify the bold attribute as appropriate (which it does not).

The solution is to configure mc to explicitly use bold colors as desired, e.g. by editing the default skin as follows:

The above will create a copy of the default skin, but with all bright colors having an explicit bold attribute added.

Another common workaround is to set TERM=xterm , however this causes other issues due to mismatching termcap/terminfo, such as certain keys not working.

Источник

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».

Читайте также:  Создание новых пользователей linux

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

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

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

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

Что, если вы хотите использовать другой текстовый редактор, не обнаруженный 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:

Источник

Midnight Commander (Русский)

Перевод этой статьи или раздела не отражает оригинальное содержание.

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

Midnight Commander имеет графический интерфейс, который отображается в текстовом режиме. Он работает в обычной консоли, внутри терминала X и через SSH-соединение на всех видах терминалов.

Contents

Установка

Последняя нестабильная версия доступна в пакете mc-git AUR .

Дополнительные темы

  • mc-solarized-git — Цветовая схема Solarized

https://github.com/nkulikov/mc-solarized-skin || mc-solarized-gitAUR

  • mc-skin-candy — Цветовая схема Candy

https://github.com/izmntuk/archiso/blob/master/configs/alter/root-image/usr/share/mc/skins/candy.ini [устаревшая ссылка 2020-08-04] || not packaged? search in AUR

Usage

The below section provides a short overview on usage of Midnight commander. References to mc(1) and the Help function ( F1 , available in every dialog) are made in this article as Section .

Interface

In prominent view are two vertical panes. Either can list directory contents, show a plain text preview, file details, or a directory tree (see Directory Tree ). File operations are accessible through the function keys or the mouse. More options are visible in a dynamic user menu ( F2 ) and option menu ( F9 ). Keys above F12 ( F13 up to F20 ) are accessible through Shift . Menu and dialog options have one letter highlighted — pressing this letter (or Alt+Letter inside a text entry) directly activates the respective option.

Читайте также:  Файловая система нужна линукса

Below, a command line is visible, connected to a subshell. This shell is generally of the same type mc was launched from, and may be switched to at will ( Ctrl-O ), see The subshell support . On this command line, cd is interpreted by Midnight Commander, and not passed to the shell for execution. As such, special completion (such as from Zsh) is unavailable. Files in the pane interact with the command line; for example, Alt+Enter copies the name of a (selected) file to the command line.

Keybindings are generally similar to GNU Emacs. A more strict emacs keymap can be enabled (see Redefine hotkey bindings ). New users may however use Lynx-like (arrow) keybindings (enabled in F9 > Options > Panel options ) and mouse clicks for navigation.

Modules

These can be called via the mc interface (with Use internal enabled in F9 > Options > Configuration ), or separately as symbolic links to the mc binary.

  • mcedit — Text and binary file editor, with regex replace, syntax highlighting, macros and shell piping, see mcedit(1)
  • mcview — Text and hex viewer with goto marks and regex search
  • mcdiff — Compares and edits two files in-place ( C-x d )

Per mc instance, multiple modules can be run concurrently ( Ctrl-` ) (see Screen selector ). External editors may be used instead, and parameters configured accordingly.

Configuration

Most of the Midnight Commander settings can be changed from the menus. However, a small number of settings such as clipboard commands, codeset detection and parameters for external editors can only be changed from

/.config/mc/ini . See Special Settings and following for a complete description of options.

Additionally, the following environment variables are respected: MC_SKIN , MC_KEYMAP , MC_XDG_OPEN , MC_COLOR_TABLE , MC_DATADIR , MC_HOME , KEYBOARD_KEY_TIMEOUT_US , PAGER , EDITOR , VIEWER .

extfs

extfs allows to easily create new virtual filesystems for mc. See /usr/lib/mc/extfs.d/README for details.

Советы и рекомендации

Переназначение сочетаний клавиш

Создайте копию стандартных комбинаций клавиш для текущего пользователя:

и отредактируйте файл под свои нужды. Вы можете использовать также другие файлы .keymap. Например, можно установить /etc/mc/mc.emacs.keymap при помощи переменной окружения MC_KEYMAP :

Смотрите также mc(1) для получения более подробной информации.

Чтобы иметь возможность навигации по каталогам с помощью клавиш со стрелками как в Lynx, перейдите в меню Options ( F9 , o ) > Panel Options ( p ) и установите флажок Lynx-like motion в группе Navigation ( y ), затем нажмите OK ( o ).

Запуск из меню

Midnight Commander можно запускать из меню, создав файл desktop entry. Пример:

Поддержка корзины

Midnight Commander не поддерживает функцию корзины.

Использование libtrash

Библиотека libtrash перехватывает вызовы функций удаления файлов и вместо удаления выполняет перемещение файлов в корзину.

Установите libtrash AUR из AUR и создайте псевдоним для mc в файле инициализации вашей командной оболочки (например,

Чтобы изменения вступили в силу, переоткройте сеанс терминала или просто выполните скрипт инициализации командой source.

Стандартные настройки библиотеки находятся в файле /etc/libtrash.conf.sys . Вы можете переопределить их для текущего пользователя, создав пользовательский файл настроек

Теперь, после запуска mc, удаляемые файлы будут попадать в каталог корзины

Решение проблем

Выход в текущий каталог

При выходе, командная оболочка вернет вас с тот каталог, в котором вы запустили Midnight Commander. Если вы хотите, чтобы оставался текущий каталог, выбранный в Midnight Commander, простым решением будет просто скрывать интерфейс, не прерывая сеанс программы, нажатием Ctrl+O .

Искаженное изображение

Нажмите Ctrl+L для перерисовки интерфейса. Эта команда перерисует изображение, но не обновит список файлов в каталогах. Для обновления списка файлов на панелях используйте Ctrl+R .

Opening files

mc uses xdg-open to open files by default, as shown in /usr/lib/mc/ext.d/ . While stderr is redirected, stdout is not, which may result in a garbled screen.

Create a script to wrap xdg-open:

If mc is blocked until xdg-open ends, detach the process:

and make mc aware of it by setting the MC_XDG_OPEN environment variable:

Find file shows no results

If the Find file dialog (accessible with Alt+? ) shows no results, check the current directory for symbolic links. Find file does not follow symbolic links, so use bind mounts (see mount(2) ) instead, or the External panelize command.

Источник

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