December 31, 2013 · debian ftp hacks learnshell linux newbie productivity shell ssh tricks

Midnight Commander - Console Based File Manager for Linux

When you work with a lot of files within console environment, you may find that your job is being quite tedious. You may be familiar with GUI environment File Managers, such as Nautilus, Thunar, or if you're Windows user - File Explorer, Total Commander. Using a file manager on command line will speed up your work . You don't have to remember syntax/commands associated with file operations. Luckily, Linux has a text based file manager that works on console environment. Midnight Commander, or mc (also the command to run midnight commander) for short, is the tool you want to use.

Installation | Features | File Operations | Internal Viewer |

File Permissions | (S)FTP | Exit mc

Here comes Midnight Commander!

According to mcwebsite,

"GNU Midnight Commander is a visual file manager, licensed under GNU General Public License and therefore qualifies as Free Software. It's a feature rich full-screen text mode application that allows you to copy, move and delete files and whole directory trees, search for files and run commands in the subshell. Internal viewer and editor are included"

By default, Midnight Commander is not installed on a Linux machine (while it should be!). So you need to install it first. On Debian based distros you do it with:

sudo apt-get install mc

On RedHat, CentOS and Fedora-like distros:

yum install mc

And on ArchLinux:

sudo pacman -S mc

After the installation, run Midnight Commander with


command. If you ever worked on DOS, you might be familiar with the Midnight Commander looks:


Midnight Commander Features

mc has many features which are useful for a user or Linux Administrator. Here are some basic features that may be useful for daily basis usage.

Copy, Delete, Rename / Move, Create Directory

Midnight Commander is divided into two columns - **left **and right column. Those columns (or windows) are independent from each other. Each window represents an active directory. You can switch between windows using [Tab] on your keyboard. At the bottom, you will see prefixed labels. Those numbers represent F1 - F10 buttons.

To copy file(s) from one directory to another, simply highlight the file and press F5. If you want to copy multiple files, you need to press [Insert] key for each file you want to copy, or + to highlight all or specified files.


MC will ask for confirmation about destination folder (To), Follow links, Preserving attributes, etc. Generally, you focus only on the To parameter. Just hit [Enter] to confirm or click [] with mouse, to commit copy process. To move around fields, use [Tab] key.

Deleting file(s) is easier - simply highlight the file(s) you want to get rid of and press F8 to confirm deletion. Moving file(s) is done with F6 key.

Renaming files is different. When you press F6 key, you need to make sure that you add a new filename for the specified file in To parameter:


To create a directory, press F7. MC will create a new directory within the current directory.

Internal Viewer

In console mode, there are many text editors such as vijoe, and nano. Midnight Commander has its own internal viewer. If you want to view the contents of a file, you can do so with F3. You also can edit a file  using F4 key. When you run the text editor for the first time, Midnight Commander will ask you to choose the default text editor. Here's a sample output:

bubbl@Bubbl ~ % 

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

Now, when you press F4 to edit a file, MC will use the text editor you have specified.

File Permissions

Files and directories have permissions. Permissions will manage who can read, write and execute files and directories. The command to manage those is chmod. With MC, you can select a file and

F9 > File > Chmod

or press [Ctrl-X] and C. MC will output the current permissions of the selected file and show to you more parameters that can be set:


File Ownership

Files and directories also have owner and group owner. To manage ownership, you'd use chown command.

Within Midnight Commander, you'd  select a file and

F9 > File > Chown

or use key combination [Ctrl-X] and O (that's a letter O, not zero). Now you can set owner and group from the list:


MC provides as well an Advanced Chown. It's a combination of chmod and chown. You can get two birds with one stone with:

F9 > File > Advanced Chown



By default, MC will show you 2 column interface. Those columns are not only used for local directories. You can make one of them (or both) connected to a remote machine using FTP, or a more secure SFTP. MC will act as an (S)FTP Client. To connect to (S)FTP service, you need to

F9 > Left/Right > FTP link... # for FTP connection 
F9 > Left/Right > Shell link... # for SFTP connection

MC will ask for credentials for the (S)FTP server. The credentials format is:

user[:pass]@machine[:port][remote-dir] # for FTP 
user@machine[:port]/[remote-dir] # for SFTP 

On connection, the desired window will show directories on the remote machine:


To disconnect your (S)FTP link:

F9 > Command > Active VFS List

In the Active VFS directories list, you will see your (S)FTP link. Choose the link and select [ Free VFSs now ]. If you only want to switch to local folder without disconnecting the current link, choose [] instead:


Leaving Midnight Commander

To leave Midnight Commander, press

F9 > File > Exit

or just press F10, or type


and hit [Return].

There is fare more features inside Midnight Commander.

For more details, head to Midnight Commander FAQ at

  • LinkedIn
  • Tumblr
  • Reddit
  • Google+
  • Pinterest
  • Pocket