Медленный запуск midnight commander

Доступ в шелл

  • вы можете вводить любую команду — просто начинаете печатать и она появляется внизу в маленьком приглашении ввода вашего шелла. Нажатие на запустит ее на исполнение.
  • не пытайтесь нажать в попытках вызвать автодополнение — вы просто смените текущую панель. Чтобы вызвать автодополнение надо нажать последовательность . Тут все как в обычном шелле — первый раз оно пытается дополнить максимально возможную часть команды, а повторное нажатие последовательности показывает ве возможные варианты (да еще и с выбором как в zsh).
  • а если надо показать большой терминал? На надо выходить из mc — нажимаете и панели файловый менеджер скрывается оставляя вас наедине с консолью. Чтобы его вернуть заново нажимает .
  • — копирует имя текущего выбранного файла в строку терминала (удобно для передачи имени каким-нибудь командам)

6 Command line problems

6.2 How can I access command line history?

Meta-h shows the last commands you executed from the command line. Duplicates are suppressed from the history. Commands executed from
the subshell prompt are not shown.

You can put previous commands to the command line with Meta-p. Meta-n moves you forward in history.

Since version 4.1.15 all the input widgets have permanent history. You can summon the history listbox by pressing M-h.

6.4 I am using ksh. Can I use functions defined in the .kshrc within MC?

Sorry, MC only supports bash, tcsh and zsh functions. Ksh functions are not supported because ksh lacks the necessary hooks needed for
subshell integration.

Switch to bash or zsh. They are both quite compatible with ksh. Your ksh functions should work as such or after minimal changes.

6.5 Is there any way to include additional options or hot keys to MC?

Yes, F2 invokes an user menu, which is fully configurable. You can add any shell commands to the user menu. See the mc(1) man page for
more info.

Another way to add functionality is the external panelize feature. See the mc(1) man page for more info.

And finally, you can code any feature you want yourself. MC source code is free which means you can change it anyway you want. There
are some limitations to make sure MC stays free. See GNU General Public License for details.

6.6 When I use Ctrl-O I don’t get a subshell. How do I fix this?

Only bash, tcsh and zsh can be used as subshell. Use one of those shells as your default shell, and it will be used as subshell in GNU
Midnight Commander.

6.7 Ctrl-O doesn’t work at all. What happens?

Ctrl-O works if either the subshell is used or the terminal can save the output of the commands so it can be restored. If neither is
true, there is absolutely nothing interesting behind the panels!

Only few terminals support screen saving. It’s xterm, rxvt and other xterm-like terminals and virtual terminals on Linux and FreeBSD.

10 Development

10.1 Who has written Midnight Commander?

Midnight Commander was started by ​Miguel de Icaza. Other authors have joined the project

  • Mauricio Plaza (early releases)
  • Janne Kukonlehto (joined Sep 27 1994)
  • Radek Doulik (joined Oct 30 1994)
  • Fred Leeflang (joined Nov 2 1994)
  • Dugan Porter (joined Dec 1 1994)
  • Jakub Jelinek (joined Feb 8 1995)
  • Ching Hui (joined Jun 27 1995)
  • Andrej Borsenkow (joined Jul 1996)
  • Paul Sheer (joined Nov 1 1996)
  • Norbert Warmuth
  • Alex I. Tkachenko

Alessandro Rubini has been specially helpful with debugging and enhancing of the mouse support. John E. Davis has made his S-Lang
library available to us and answered many questions about it.

10.2 Do I dare to use a development version?

Yes, of course. Feel free to test:
As we do our development in git, please do a git checkout of the master branch and build it

But always remember: development versions may have nasty bugs at some points of time. It’s up to you to judge whether the new
features and fixes for the bugs you know outweigh the risk of unknown bugs.

10.3 How can I report a bug/request for a feature?

You might first want to get the newest development version to see if the bug is fixed or the feature is added already.

If this is not the case, feel free to add a ticket in our ticket system, which is located here: ​http://www.midnight-commander.org/NewTicket

Give as much details as possible. A too long message is a lot better than a too short message.

For segmentation faults a stack backtrace is appreciated. You can produce stack backtrace as follows:

  • If segmentation fault produced a core file:
    1. Load the core file by typing «gdb mc core» or «dbx mc core».
    2. Type «where».
    3. Cut and paste the results to your message.
  • If segmentation fault didn’t produce a core file:
    1. Load mc by typing «gdb mc» or «dbx mc».
    2. Start mc by typing «run».
    3. Try to reproduce the segmentation fault by doing whatever you did last time when the segmentation fault occurred.
    4. Type «where».
    5. Cut and paste the results to your message.
    6. For the future you might want to check out what is the command in your shell to allow producing of the core files. Usually it is «limit coredumpsize unlimited» or «ulimit coredumpsize» or «ulimit -c unlimited».

10.4 How can I join the development?

Note that the authors of GNU Midnight Commander have given all their rights on the program to the Free Software Foundation. You will have
to do the same if you contribute non-trivial patches. Otherwise we have to reject your patches in order to avoid copyright problems.

Настройка Midnight Commander

1. Изменение внешнего вида

Нажимаем F9 и открываем меню Options -> Layout:

Здесь можно изменить такие опции:

  • Вид панели (Panel split) — Вертикальный/Горизонтальный;
  • Отображение Меню (Menubar) — включить/выключить вверху;
  • Отображение Командной строки (Command prompt) — внизу;
  • Отображение Быстрых клавиш (Keybar visible);
  • Отображение Подсказок (Hintbar visible);
  • Отображение Заголовка окна терминала (XTerm window title);
  • Отображение свободного дискового пространства (Show free space)

Знак X означает, что опция включена.

С помощью меню Options -> Appearance можно изменить скин файлового менеджера:

Цветовых схем в Midnight Commnader множество, можно выбрать наиболее приятную для своих глаз. Мой любимый скин — nicedark.

В меню Right есть возможность указать, что показывать в правой панели:

Я указал Quick view  — быстрый просмотр файлов. Это значит, что при наведении на текстовый файл — в правой панели покажется его содержимое. Очень удобно. Также тут можно указать вывод любой другой информации — например информация о файле, дерево каталогов, листинг и многое другое на свой вкус.

Еще несколько интересных опций находятся в меню Options -> Panel options.

На вкладке Navigation включаем «Lynx like motion» —  быстрая навигация по папкам с помощью стрелок влево/вправо на клавиатуре.

На вкладке Main options обязательно включаем «Show backup files», «Show hidden files» и «Auto save panels setups» — автосохранение всех изменений в панели.

На вкладке File highlight — включаем «Permissions» (подсветка прав на файлы и папки).

2. Включаем встроенный редактор MCEDIT

По умолчанию, для редактирования файлов в Midnight Commander используется стандартный редактор Linux — nano (или vim). Но у многих новичков могут возникнуть трудности в их освоении, поэтому лучшим вариантом, на мой взгляд, будет использовать простой и понятный встроенный редактор — mcedit.

Для этого переходим в меню Options -> Configuration и ставим X в опции «Use internal edit», после чего нажимаем ОК:

Теперь немного подстроим редактор под себя. Первым делом включаем отображение нумерации строк (ALT + N) и отключаем отображение пробелов в файле конфигурации Midnight Commander — ~/.config/mc.ini:

3. Настройка автосохранения текущей папки в файловом менеджере

Странно, почему в MC до сих пор нет этой важной опции в настройках. Скопируйте скрипт mc-wrapper.sh в папку /etc/profile.d командой:

Скопируйте скрипт mc-wrapper.sh в папку /etc/profile.d командой:

И добавьте в конец файла /etc/bash.bashrc строку:alias mc=’. /etc/profile.d/mc-wrapper.sh’

Перезалогиньтесь — путь к директории теперь будет запоминаться.

Но, этот «фокус» работает только для пользователей, для «рута», к сожалению, не нашел способов. Насколько знаю, тикет по этому багу был открыт.

11 More information

11.1 This document didn’t answer my question. Where else can I look for an answer?

Read messages from the Discussion (mailing list archive), visit our ​Documentation project or read the Manual.

Upgrade to a newer version of Midnight Commander. Many problems are fixed in the new versions.

If you still can’t find an answer, post your question to the Midnight Commander mailing list. Its address is mc@….

11.2 What mailing lists are there for Midnight Commander?

Following mailing lists discuss about Midnight Commander:

mc@…
General discussion of GNU Midnight Commander. To subscribe visit ​http://mail.gnome.org/mailman/listinfo/mc/
mc-devel@…
Technical development discussion. To subscribe visit ​http://mail.gnome.org/mailman/listinfo/mc-devel/
mc-commits@…
Mailing list only for applyed commits into master/stable branches. To subscribe visit ​http://groups.google.com/group/mc-commits/subscribe
mc-bugs@…
Mailing list only for tickets and comments (use it as RSS :) ). To subscribe visit ​http://groups.google.com/group/mc-bugs/subscribe

7 Virtual file systems

7.1 How can I see the contents of a tar archive?

If you use keyboard just move the selection bar on the tar file and press enter. If you use mouse just double-click on the tar file.

The recognized suffixes for tar archives are .tar, .tar.gz and .tgz. You can also enter a tar archive by typing «cd filename/​utar://» where
filename is the name of the archive. In this case, the suffix is not important.

7.2 How do I get out of a tar archive?

Just press enter on the toplevel «..» file or change to a non-tar directory. Just typing «cd» with no parameters is enough (it will
take you to your home directory).

7.3 How do I do anonymous ftp with MC?

Just type «cd ​ftp://hostname» where hostname is the name of the host you want to connect. Alternatively, select FTP link from the Left or
Right menu and type the name of the host you want to connect.

7.4 How do I do non-anonymous ftp with MC?

Non-anonymous ftp works just like the anonymous ftp but you give the login name with the host name. For example, type «cd
​ftp://username@hostname».

7.5 How do I close an ftp connection?

Just change to a non-ftp directory. Simply typing «cd» with no parameters is enough (it will take you to your home directory).

GNU Midnight Commander closes ftp connection automatically after a timeout or on exit. It’s possible to force disconnect by selecting
«Command» -> «Active VFS List» in the menu and using the «Free VFSs Now» button.

7.6 Why aren’t the contents of ftp panel updated?

Update is skipped because there would be a serious performance penalty. Constantly updating directory panels through a ftp
connection would take too much time.

You can use C-r to force an update.

7.7 What kind of proxy server works with Midnight Commander?

There are two kinds of ftp proxies: proxies for ftp clients and proxies for web browsers.

Midnight Commander only supports ftp proxies which are meant for ftp clients. Common WWW proxies (like Squid) are not supported. A rule
of thumb is that if a ftp proxy requires a web browser, it won’t work with Midnight Commander.

Операции над файлами

Shift+F4 — Создает новый файл

shift-f6 — переименовать файл

Ctrl+x,i — Быстрый просмотр информации о текущем объекте на второй панели

Ctrl+x,q — Быстрый просмотр содержимого файла на второй панели

alt-. — показать скрытые файлы

ctrl-x, c — права на файл

ctrl-x, o — владелец файла

Shift-F3 — просмотр файла (raw/ без учета расширения)

Ctrl-X+L — создать ссылку на файл

Ctrl-X+S — создать символическую ссылку на файл

Ctrl + x v — создать относительную символическую ссылку  

trl+x,Ctrl+s — Редактировать символическую ссылку

F12 — Save as

ctrl-t — отметить файл либо снять отметку

+ — выбрать (отметить) группу файлов по регулярному выражению

\ — снять отметку с группы файлов

ctrl-x, ctrl-d — сравнить файлы

ctrl-t или Insert — Выделение текущего объекта

Полезные советы

Переход на уровень выше может быть затруднительным, потому что требуется пролистать все содержимое до пункта /.. Нажмите F9, выберите меню Настройки (Options) и нажмите ENTER. Выберите Panel options (настройки панелей), где можно выбрать Навигация в стиле Lynx (Lynx-like motion). Выберите этот пункт и нажмите пробел, либо кликните на нем мышкой. Теперь можно переходить на уровень выше стрелкой влево, а заходить в директорию стрелкой вправо.

Еще один полезный инструмент для экономии времени – пользовательское меню. Вернитесь в директорию , где вы создали девять файлов. Вызовите меню пользователя клавишей F2. Выберите пункт Compress the current subdirectory (tar.gz) – сжатие текущей поддиректории. Когда вы выберете имя архива, он будет создан в директории /tmp (на уровень выше сжимаемой. Если выбрать файл .tar.gz и нажать Enter, он откроется как обычная директория. Это позволяет просматривать архивы и извлекать файлы простым копированием (F5) в рабочую директорию противоположной панели.

Для определения размера директории (то есть суммарного размера всех файлов в ней), выделите директорию и нажмите Ctrl+пробел.

Редактор

F4 (в редакторе) — поиск с заменой

F6 (в редакторе) — поиск с помощью регулярного выражения

Shift-Del (в редакторе) — удалить блок (и положить его в clipboard)

Shift-Ins (в редакторе) — вставить блок из буфера (работает даже в другой консоли!!!) Можно редактировать два и более файлов на разных консолях и гонять блоки между ними.

Shift+F3 — Начать выделение блока текста. Повторное нажатие F3 закончит выделение

Shift+F5 — Вставка текста из внутреннего буфера обмена mc (прочитать внешний файл)

Meta+i — Переключение режима «Автовыравнивание возвратом каретки», удобно при вставке отформатированного текста из буфера обмена

Meta+l — Переход к строке по её номеру

Meta+q — Вставка литерала (непечатного символа).См. таблицу ниже

Meta+t — Сортировка строк выделенного текста

Meta+u — Выполнить внешнюю команду и вставить в позицию под курсором её вывод

Ctrl+f — Занести выделенный фрагмент во внутренний буфер обмена mc (записать во внешний файл)

Ctrl+k — Удалить часть строки до конца строки

Ctrl+n — Создать новый файл

Ctrl+s — Включить или выключить подсветку синтаксиса

Ctrl+t — Выбрать кодировку текста

Ctrl+u — Отменить действия

Ctrl+x — Перейти в конец следующего

Ctrl+y — Удалить строку

Ctrl+z — Перейти на начало предыдущего слова

Meta+Enter — Диалог перехода к определению функции

Meta+- — Возврат после перехода к определению функции

Meta++ — Переход вперед к определению функции

Meta+n — Включение/отключение отображения номеров строк

tab Отодвигает вправо выделенный текст, если выключена опция «Постоянные блоки»

Meta-tab Отодвигает влево выделенный текст, если выключена опция «Постоянные блоки»

Shift+Стрелки Выделение текста

Meta+Стрелки Выделение вертикального блока

Meta+Shift+- Переключение режима отображения табуляций и пробелов

Meta+Shift++ Переключение режима «Автовыравнивание возвратом каретки»

Теги: bash,linux,mc

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

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

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

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

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

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

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

pungki@mint15 ~ $ 

Select an editor.  To change later, run 'select-editor'.
  1. /bin/ed
  2. /bin/nano

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

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

# Generated by /usr/bin/select-editor
SELECTED_EDITOR="/usr/bin/vi"

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

Файлы и директории имеют права доступа, которые указывают, кто может читать, записывать и исполнять файлы и директории. Команда для управления правами доступа — 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 запросит данные для подключения в следующем формате:

user:password@machine_or_ip_address

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

Для отключения 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:

Остаемся в текущей папке при выходе из mc.

Вы замечали, что при выходе из mc вы всегда возвращаетесь в ту папку, в которой были до его запуска. Одним это нравится, а другим нет.

В любом случае такое поведение можно поменять. А служит для этого опция -P, которой передается имя файла, в котором сейчас находится mc.

Зная имя файла по завершению процесса можно всегда вернуться в нужный катало. Для этого есть скрипт mc-wrapper.sh. Прописываем у себя в .bashrc.

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

Getting started

1.1 What is Midnight Commander?

GNU Midnight Commander is a user-friendly yet powerful file manager and visual shell, useful to novice and guru alike. It provides a
clear, user-friendly, and somewhat protected interface to a Unix system while making many frequent file operations more efficient and
preserving the full power of the command prompt. After some practice, you will wonder how you could ever live without it.

1.2 Does it run on my machine?

GNU Midnight Commander runs on POSIX (Unix-like) operating systems, such as GNU/Linux, FreeBSD, Mac OS X, Solaris, HP-UX and others. It
can also be compiled under Cygwin on Windows.

GNU Midnight Commander uses GNU Autoconf which should automatically configure it for every Unix clone. Following configurations have
been tested in the past (this list is very old):

  • i386-*-linux1.x, 2.x
  • alpha-linux-linux2
  • sparc-linux-linux2.x
  • sparc64-linux-linux2.1
  • mips-sgi-irix5.x, 6.x
  • sparc-sun-sunos4.1
  • sparc-sun-solaris2.3, 2.4, 2.5
  • sparc-sun-netbsd1.0
  • hppa-hp-hpux9
  • hppa-hp-hpux7
  • m68k-apple-aux
  • unixware
  • mc88110-aviion-dgux5.4R2.01
  • i386-*-sco3.2v4.2
  • i386-*-sco3.2v5

1.3 Does it work with my terminal?

Yes, it does.

Because GNU Midnight Commander is a full screen program it doesn’t run on dummy terminals but anything more advanced will do (like
vt100). If your terminal works with vi, emacs, elm or pine it will work with GNU Midnight Commander.

1.4 What else do I need to run MC?

You need a POSIX (Unix compatible) operating system. If you are running Windows, use Cygwin.

To compile any edition you need to have glib >= 2.30 installed. It’s available at ​https://download.gnome.org/sources/glib/.

If you want to use mouse on the Linux console you need the gpm daemon from ​https://www.nico.schottelius.org/software/gpm/. You need nothing extra to
use mouse on xterm.

If you do not want to use the S-Lang library you could try using ncurses version 4.1 and above.

1.5 Is GNU Midnight Commander Public Domain? Copyrighted?

Midnight Commander is under GNU Public License which basically means that you may freely copy, change and distribute it, but that you may
not impose any restrictions on further distribution, and that you must make the source code available. This is not the same as Public
Domain. For details, the GNU license is included in GNU Midnight Commander source distribution (the COPYING file).

Midnight Commander is now officially a part of the GNU project. All the authors of GNU Midnight Commander have given all their rights
on the program to the Free Software Foundation.

1.7 I cannot compile MC. What should I do?

Make sure you have read the INSTALL file in the sources. Report the error messages exactly as they appear, mention the versions of your
OS, your compiler and whatever else software you think is relevant. If you have compile problems in the VFS code, try disabling it by
using «—disable-vfs» option.

9 Other common problems

9.1 Is there any way to ‘bookmark’ favorite ftp-fs links?

Use the directory hotlist. Just press control-backslash. If your national keyboard layout doesn’t have backslash key, just press the
control key with the key which is the backslash key in the English keyboard layout.

9.2 When I start Midnight Commander, nothing happens!

When MC is compiled with Samba support, have a look at the «interfaces = …» line in your smb.conf file. MC uses pretty old
Samba code that only expects IP addresses and host names there, but not network interface names (like eth0). MC interprets these
names as host names and tries to resolve them using a DNS server. To fix this, ask your system administrator to change the interface
names to their assigned IP addresses, or (untried) add the interface names and their IP addresses to the /etc/hosts file.

First, invoke MC without subshell support: «mc -u». If this helps check the shell you are using. Subshell support works best with
bash, although tcsh and zsh are also supported. You might want to upgrade your shell to a newer version. If you use something else
than bash, tcsh or zsh, subshell support is disabled automatically.

Another reason is problems with gpm. Try using «—nomouse» option to see if it makes any difference. Restarting gpm can help. Sometimes
it’s enough to move the mouse.

Also, if you have the DISPLAY environment variable set, but the X server is unreachable (e.g. it’s firewalled), this can also cause a
delay at startup. Unset DISPLAY to see if that’s the case.

Рейтинг
( Пока оценок нет )
Понравилась статья? Поделиться с друзьями:
Техноарена
Добавить комментарий

;-) :| :x :twisted: :smile: :shock: :sad: :roll: :razz: :oops: :o :mrgreen: :lol: :idea: :grin: :evil: :cry: :cool: :arrow: :???: :?: :!: