Skip to content

Common Operations

leo-arch edited this page Jun 27, 2022 · 123 revisions
Clone this wiki locally

Common Operations

Table of contents


The expression ELN is crucial for CliFM.1 It stands for Entry List Number and could be used for any operation involving file names in the current directory. For example, given the following list of files:

we see that the ELN corresponding to the Documents directory is 5. So, we can change to this directory either using its file name or its ELN: Documents or just 5. TAB completion is available to automatically expand a given ELN into its corresponding file name (minimizing thus the chances of inadvertently operating on the wrong file(s)).

Entering Documents is thus equivalent to entering just 5: both will cd into the Documents directory.

Of course, any file operation (be it internal or external) could be used instead. For example:


to select the directory


to remove the directory

NOTE: In the case of internal commands, ELN's could be written fused to the command name, as in this case (s5 indeed is equivalent to s 5). However, this does not apply to external commands.

or, using now a shell, external command:

diff 5 6

to compare two files, in this case Documents and Downloads directories.

ELN ranges are also understood:

s1-5 9-12
file 3-7

Since ranges, just as ELN's, could be a bit tricky, TAB completion is available to make sure that this particular range actually includes the desired filenames.

1 As far as I know, the first file manager to implement this notion of ELN (though not called as such), was nffm. The project is sadly no longer maintained.

Completions and suggestions

For file names and ELN's, and ELN ranges TAB completion is available. The procedure is as straightforward as well known:

5 -> TAB -> Documents

Doc -> TAB -> Documents

If the auto-suggestions system is enabled, Documents will be automatically printed (by default in an underlined cyan color) next to the current input string as you type. If the typed string refers to a file name, the suggestion will just complete the input string. When it comes to ELN's (like the 5 above), the file name corresponding to this ELN will be printed as follows:

5_ > Documents

where the underscore represents the current cursor position.

To accept the given suggestion, just press Right or Ctrl-f: the text typed so far will be automatically replaced by the corresponding suggestion.

For more information about the suggestions system, consult the suggestions page.


By default, and unlike the ls(1) shell command, CliFM lists files automatically for each entered directory (a feature know as autols). To disable this function, run CliFM with the -o, --no-autols option or set AutoLs to false in the configuration file (F10).1

Action Command Keybinding
Change directory to DIR DIR / ELN
Change to HOME cd / ~ Alt-e / Home
Change to / / Alt-r
Go back b Shift-Left / Alt-j
Go forward f Shift-Right / Alt-k
Switch workspaces ws[1-8] Alt-[1-4]
Reprint files in current directory rf / . Enter / Ctrl-r
Go to parent directory .. Shift-up / Alt-u
Jump to /some/deep/directory2 j so dir
Go up 2 directories3 ...
Bookmarks2 bm Alt-b
Change to pinned directory5 ,
Change to mountpoint mp Alt-m
Change to first visited directory Ctrl-Alt-j
Change to last visited directory Ctrl-Alt-k
Print directory history bh / fh Alt-h


1 In the last years there have been some projects aimed to implement an autols function on regular shells. See, autols, and auto-ls.
2 Only provided that /some/deep/directory has been already visited and is in the jump database. See the jump section for more information.
3 Fastback function: Each dot (.) after the first two dots means one more directory to go up. Thus, to go up four directories at once enter 5 dots: .....
4 Once in the bookmark screen, just enter the ELN corresponding to the desired file/directory or its shortcut. See the bookmarks section.
5 A directory must be already pinned. See the pin command.

File Operations

NB: Whenever files and/or directories in the current directory are involved, they can be replaced by the corresponding ELN. So, supposing the ELN for myfile is 12, p myfile works the same as p 12 (p12, without space, works as well).
The URI file scheme for local file systems is also supported. For example, file:///etc/hosts amounts to this: /etc/hosts.

Operation Command Keybinding
Create FILE(s) and/or DIR(s) n FILE(s) DIR(s)/ Alt-n
Copy FILE1 to FILE2 c FILE1 FILE22
Copy FILE to a remote location cr FILE2 3
Move FILE1 to FILE2 m FILE1 FILE22
Delete FILE(s) r FILE(s)2
Rename FILE1 into FILE2 m FILE1 FILE2
Symlink FILE2 to FILE1 l FILE1 FILE2
Trash FILE(s) t FILE(s)
List trashed files t
Restore (undelete) trashed files u Ctrl-Alt-u
Empty the trash can t clear
Remove FILE from trash t del
Archive/compress FILE(s) ac FILE(s)
Dearchive/decompress FILE ad FILE
Bulk rename FILE(s) br FILE(s)
Toggle executable bit on FILE(s) te FILE(s)
Export FILE(s) exp FILE(s)
Select FILE(s) s FILE(s)
Select all files in the current directory s * .* Alt-a
Deselect all selected files ds * Alt-d
Copy selected files into current directory c sel Ctrl-Atl-v
Copy selected files into DIR c sel DIR
Move selected files into current directory m sel Ctrl-Alt-n
Move selected files into DIR m sel DIR
Remove selected files r sel Ctrl-Alt-d
Trash selected files t sel Ctrl-Alt-t
Bulk rename selected files br sel Ctrl-Alt-r
Export selected files exp sel Ctrl-Alt-e
Archive selected files ac sel Ctrl-Alt-a
Open/change to last selected file Ctrl-Alt-g
Bookmark last selected file Ctrl-Alt-b

1 Files are opened using the application associated to either the file name or the file's MIME type. Lira, CliFM's built-in resource opener, is responsible for storing file associations and opening files with the appropriated program. For more information about Lira see the Resource opener section.

2 For more information about these commands consult the corresponding description page.

2 cr is the invocation name (action name) of the cprm plugin. Enter cr --help for more information. Remote locations need to be configured first (cr --edit).

Trashing files

CliFM implements a built-in and FreeDesktop compliant trash system.

Only two commands are involved: t (standing for trash) and u (standing for undelete or untrash).

Action Command
Trash FILE(s)1 t FILE(s). Ex: t 1 file2 *.txt sel
List trashed files t
Permanently remove some trashed files2 t del
Restore (undelete) all trashed files Ctrl-Alt-u
Restore (undelete) some trashed files3 u
Empty the trash can t clear or t empty

1 Trashed files are stored in ${XDG_DATA_HOME:-$HOME/.local/share}/Trash
2 The user will be presented with a screen to chose files to be removed from the trash can. TAB completion is also available: t del TAB
3 The user will be presented with a screen to chose files to be restored to their original location. TAB completion is also available: u TAB

NOTE: In order to prevent accidental deletions, the remove command (r) could be instructed to always trash files instead of simply remove them. To achieve this use the --trash-as-rm command line option or the TrashAsRm option in the configuration file.


1. General concepts

Three commands are used to control files selection:

Command Description
s / sel Select files
ds / desel Deselect files. See the deselecting files section below
sb / selbox Print the content of the Selection Box

The syntax of the s command is this:

s, sel ELN/FILE ... n [[!]PATTERN] [-filetype] [:PATH]

If not in light mode,1 once a file is selected, and if the file is in the current working directory, the corresponding file name will be marked with an asterisk (colored according to the value of li in the color scheme file (by default bold green)), at the left of the file name (and at the right of its ELN).

1 Selected files are tracked via device and inode numbers, obtained via a call to stat(3). But since in light mode all calls to this function are avoided for performance reasons, tracking selected files is not possible.

The s command allows you to send one or multiple elements (either files or directories) to the Selection Box. sel accepts individual elements, range of elements, say 1-6, file names and paths, just as wildcards (globbing) and regular expressions. Example:

s 1 4-10 ^r file* filename /path/to/filename

Just as in the search function, it is also possible to further filter the list of matches indicating the desired file type. For instance,

s ^ -d

will select all directories in the current working directory. For available file type filters consult the search section.

By default, the selection function operates on the current working directory. To select files in any other directory use the :PATH expression. For example, to select all regular files with a .conf extension in the /etc directory, the command would be:

s .*\.conf$ -r :/etc

or using wildcards:

s *.conf -r :/etc

Just as in the case of the search function, inverse matching is supported for patterns, either wildcards or regular expressions. To invert or reverse the meaning and action of a pattern, just prepend an exclamation mark (!). E.g., to select all non-hidden regular files in the Documents directory, issue this command:

s !^\. -r :Documents

or, to select all directories in /etc, except those ending with ".d":

s !*.d -d :/etc

Glob and regular expressions could be used together. For example:

s ^[r|R].*d$ /etc/*.conf

will select all files starting with either 'r' or 'R' and ending with 'd' in the current working directory, plus all .conf files in the /etc directory. However, this use is discouraged if both patterns refer to the same directory, since the second one will probably override the result of the first one.

It is important to note that glob expressions are evaluated before regular expressions, in such a way that any pattern that could be understood by both kinds of pattern matching mechanisms will be evaluated first according to the former, that is, as a glob expression. For example, .*, as regular expression, should match all files. However, since glob expressions are evaluated first, it will only match hidden files. To select all files using a glob expression, try .* *, or, with a regular expression: ^ or (.*?). The keyboard shortcut Alt-a is also available to perform the same operation.

The Selection Box is accessible to different instances of the program, provided they use the same profile (see the profiles section). By default, indeed, each profile keeps a private Selection Box, being thus not accessible to other profiles. You can nonetheless modify this behavior via the ShareSelbox option in the configuration file. If the ShareSelbox option is enabled, selected files are stored in /tmp/clifm/username/.selbox.cfm. Otherwise, /tmp/clifm/username/.selbox_profilename.cfm is used (this is the default).

Use the sb command (or Alt-s) to show the entries currently contained in the Selection Box.

2. Operating on selected files

In order to operate on selected files the sel keyword is used: indeed, sel amounts to all selected files. In this way, you can use the sel keyword with any command, be it internal or external. For example:

r sel

to remove all selected files


ls -l sel

to print the properties of all selected files

2.1 Operating on specific selected files

If using the FZF mode for TAB completion, you can operate only on some selected files as follows:

CMD sel<TAB>

The list of selected files will be displayed. Choose one or more of them (use TAB to mark entries) to operate only on those specific files. For example, to print the file properties of some specific selected files: p sel<TAB>, select the files you want via TAB, press Enter or Right (marked files will be inserted into the command line), and the press Enter to run the command, as usual.

The fzfsel plugin (invoked via the * action name) can be used as well:

* ls -l

The user will be prompted to mark some selected files (you need to install FZF first), which then will be passed as parameters to the corresponding command, in this case ls -l.

If you need to specify a specific position for marked selected files in your command, use the %f placeholder as follows:

* cp %f /misc/docs

Marked selected files will be inserted in the place of %f. If %f is not specified, marked files will be inserted at the end of your command.

2.2 Deselecting files

There are several ways of deselecting files, all of them involving the ds command:

a. Just enter ds: you'll be prompted to select files to be deselected. To deselect all selected files at once, enter ds * or press Alt-d.

b. Type ds, and then press TAB: if using FZF for TAB completion, you'll see the list of currently selected files. Mark (using the TAB key) those files to be deselected and then press Enter.

c. Via the fzfdesel plugin, bound by default to the ** action. To invoke this plugin, just enter **. Here you can fuzzy search/filter selected files and easily mark those you want for deselection. You can mark individual files, all of them, just as invert the current selection. Once done, just press Enter.

NOTE: Given the flexibility of the fzfdesel, you might want to replace the ds command by this plugin. To do so, just edit the configuration file (F10 or edit) and create the corresponding alias:


Tagging files

Etiqueta is CliFM's built-in files tagging system

1. How Etiqueta works?

File tags are created via symbolic links using an specific directory under the user's profile: ${XDG_CONFIG_DIR:-/home/USER/.config}/clifm/profiles/USER/tags.

Every time a new tag is created, a new directory named as the tag itself is created in the tags directory. Tagged files are just symbolic links (named as the full path of the target file and replacing slashes by colons) to the actual files created in the appropriate directory. For example, if you tag ~/myfile.txt as work, a symbolic link to ~/myfile.txt, named home:USER:myfile.txt will be created in tags/work.

NOTE: Etiqueta itself takes care of expanding these symlinks, so that you, as a user, should not worry at all about this colons notation.

2. Handling file tags

tag is the main Etiqueta command and is used to handle file tags. Its syntax is as follows:

tag [ls, list] [new] [rm, remove] [mv, rename] [untag] [merge] [FILE(s)] [[:]TAG]

NOTE: the :TAG notation is used for commands taking both file and tag names: tag FILES(s) :TAG ..., to tag files, and tag untag :TAG file1 file2, to untag files. Otherwise, TAG is used (without the leading colon). For example: tag new docs, to create a new tag named docs, or tag remove png, to delete the tag named png.

The following command shortcuts are available:

Command Description
ta Tag files
td Delete tag(s)
tl List tags or tagged files
tm Rename (mv) tag
tn Create new tag(s)
tu Untag file(s)
ty Merge two tags

3. Usage examples

List available tags:


Tag all .PNG files in the current directory as both images and png:

ta *.png :images :png

NOTE: Tags are created if they do not exist

Tag all selected files as special:

ta sel :special

List all files tagged as work and all files tagged as documents:

tl work documents

Rename the tag documents as docs:

tm documents docs

Merge the tag png into images:

ty png images

NOTE: All files tagged as png will be now tagged as images, and the png tag will be removed.

Remove the tag images (untag all files tagged as images and remove this tag):

td images

Untag a few files from the work tag:

tu :work file1 image.png dir2

NOTE: TAB completion is available to complete tagged files. If using the FZF mode, multi-selection is available via the TAB key.

4. Operating on tagged files

Tag expressions, that is, the t:TAG construct, are used to operate on tagged files via any command, be it internal or external. A few examples:

Print the file properties of all files tagged as docs:

p t:docs

Remove all files tagged as images:

r t:images

Run stat(1) over all files tagged as work and all files tagged as docs:

stat t:work t:docs

NOTE: When using tag expressions (i.e. the t:TAG construct), TAB completion is available to expand the expression into one or more of the files tagged as the current tag. If using the FZF mode, multi-selection is available via the TAB key.

4.1 Operating on specific tagged files

NOTE: This feature, as always when multi-selection is involved, is only available when TAB completion mode is set to FZF. See the TAB completion page.

You might not want to operate on all files tagged as some specific tag, say work, but rather on some files tagged as work. TAB completion is used to achieve this aim.

Let's suppose you have a tag named work which contains ten tagged files, but you need to operate (say, print the file properties) only on two of them, say, work1.odt and work2.odt:

p t:work<TAB>

The list of files tagged as work will be displayed via FZF. Now just mark the two files you need using TAB, press Enter or Right, and the full path of both files will be inserted into the command line. So, p t:work will be replaced by p /path/to/work1.odt /path/to/work2.odt.


Files searching is performed in CliFM using the slash character (/). The general usage of the search function is as follows:

/PATTERN [-filetype] [-x] [DIR]

Just type / followed by a glob or regular (or extended regular) expression, and CliFM will list all matches in the current working directory. For example, both




will list all PDF files in the current working directory, the former using wildcards, and the second a regular expression.

Bear in mind that search patterns (if containing metacharacters) are evaluated first as glob expressions, and then, if no matches are found, as regular expressions.

Expressions containing no pattern metacharacter are automatically transformed into a regular expression: /.*EXP.*. For example, /test becomes /.*test.*. By default, regular expressions (and thereby expressions containing no metacharacter) are case insensitive (glob expressions, by contrast, are always case sensitive). However, you can enable case sensitive search via the CaseSensitiveSearch option in the configuration file.

To search for files in any directory other than the current one, specify the directory name as a further argument. This argument (DIR) could be an absolute path, a relative path, or an ELN. For example,

/^A 7

will search for all files starting with 'A' in the directory corresponding to the ELN 7, while

/*.conf /etc

will list all .conf files in the directory /etc.

The result of the search could be further filtered by specifying a filter type:

Filter Meaning
-d directory
-r regular file
-l symlink
-s socket
-f FIFO/pipe
-b block device
-c character device

For example:

/[.-].*d$ -d Documents/

will list all directories containing a dot or a dash and ending with 'd' in the directory named Documents.

The quick search function also supports invert search: prepend the exclamation mark (!) to negate a given search pattern. For example:

/!.*s$ -d /etc

will match all directories in /etc NOT ending with 's', just as /!D* will match all files in the current directory NOT starting with 'D'.

To perform a recursive search use the -x parameter, and, optionally, a search path (DIR). The search will be performed using find(1) as follows: find DIR -name PATTERN. If no search path is provided, the search is executed starting in the current directory. Otherwise, the search starts in DIR.

Search history

Search entries (stored in the general history file) can be accessed via the TAB key. Just type / an then press TAB to get the list of already used search patterns.

File details

By default, CliFM only lists file names. To toggle to detail or long view mode press Alt-l. The output is quite similar to output of the ls -l shell command, though it does not depends on ls(1) at all.

To get more detailed information about one or more files properties, use the p command (short for prop). For example:

p5 10

to get information about those files whose ELN's are 5 and 10. The output format is based on the output of the stat(1) shell command, but, again, it is completely independent from it.

In the case of directories, you can use the pp command to include the total directory size as well. Example:



bm (short for bookmarks) is the command used to administer user bookmarks. The general syntax for this command is this:

bm, bookmarks [a, add PATH] [d, del] [edit] [SHORTCUT, NAME]

With no argument, bm opens the bookmarks menu (Alt-b is also available). Here you can cd into the desired bookmark by entering either its ELN, its shortcut or its name.

If we consider the first line of this image, 1 is the ELN, h the shortcut, and home the name of this bookmark.

In this screen you can also add, remove or edit your bookmarks by simply typing 'e' to edit the bookmarks file (F11 is available as well), which is simply a list of lines with this format:


For example:


To delete a bookmark, just remove the corresponding line from the bookmarks file ($XDG_CONFIG_HOME/clifm/profiles/NAME/bookmarks.cfm).

If you want to add or remove a bookmark directly from the command line, use the a and d arguments respectively. Example:

bm a /media/misc


bm d

You can also open a bookmark by typing bm SHORTCUT or bm NAME (in which latter case TAB completion and auto-suggestions are available).

A handy use for the bookmarks function, provided the expand-bookmarks option is enabled, is to create bookmarks using short names, which will be later easily accessible via TAB completion and the suggestions system.

NOTE: If you are a Ranger or a Midnight Commander user, you can import bookmarks using the plugin, bound by default to the bmi action. Just run bmi BOOKMARKS_FILE (usually ~/.local/share/ranger/bookmarks for Ranger and ~/.config/mc/hotlist for Midnight Commander).

Basic usage examples

If looking for information about some specific command, take a look at the complete list of commands.
Help for all internal commands can be accessed via the -h or --help options.
You can also make use of help topics: just type help and then hit TAB to get a list of topics.

Two important tips before starting:

1) Always try TAB: TAB completion is available for many things.

2) Pay attention to CliFM's suggestions: whenever a possible completion/expansion is available, Gemini, the auto-suggestions system, will print it next to the current cursor position: if that is what you want, just press Right or Ctrl-f to accept the suggestion: the text typed so far will be automatically replaced by the given suggestion. Otherwise, the suggestion will be ignored. You can disable suggestions via the --no-suggestions command line option or setting Suggestions to falsein the configuration file.

Command Full description Brief description
/etc Change directory Change the current directory to /etc. The cd command could be used as well: cd /etc
5 Change directory Change to the directory whose ELN1 is 5. TIP: Press TAB (or just pay attention to the auto-suggestion) to make sure 5 is the directory you want
myfile.txt Open files Open myfile.txt. The default associated application will be used to open the file. See the resource opener section and the mm command to manage default opening applications. The open command could be used as well: o myfile.txt
12 Open files Open the file whose ELN is 12. TIP: Press TAB (or just pay attention to the auto-suggestion) to make sure 12 is the file you want. Use the ampersand character to open the file in the background. Example: 12&
n myfile Create files Create a new file named myfile. Since CliFM is integrated into the system shell, you can also use any of the commands you usually use to create new files. For example: touch myfile
n mydir/ / md mydir Create files Create a new directory named mydir (note the ending slash). You can also use mkdir(1)
n mydir/ && mydir Create a directory named mydir and cd into it at once (provided the first operation was successful). If the second command does not depend on the success of the first, use the semicolon instead: cmd1; cmd2
j xproj Kangaroo The j command allows you to fuzzy jump to already visited directories. In this example, jump to ~/media/data/docs/work/mike/xproject, provided this directory has been already visited (that is, it is in the jump database). For more accuracy you can try j mike xproj. Suggestions are available for this command to make the search easier
b / Shift-left / Alt-j Back / Forth Go back in the directory history list (the previously visited directory). NOTE: Enter f, or press Shift-right or Alt-k to go forth in the directory history list
Alt-l Toggle detail/long view mode on/off
p4 Files properties Print the properties of the file whose ELN is 4. To include directories size as well, use the pp command: pp4
chmod 644 4 Change permissions of the file whose ELN is 4 to 644. To just change the executable bit of a file, you can use the te command: te4. Any shell command can make use of ELN's. Ex: diff 1 2
rf / . / Enter Reprint the list of files in the current directory
/*.png / /.*png$ Files search Search for files ending with .png in the current directory. To just search for files containing query in their names, issue /query
s *.c :my_project/ Files selection Select all C files in the directory my_project/
s 1-4 8 19-26 Files selection Select multiple files in the current directory by ELN
sb / Alt-s Files selection List currently selected files
ds Files selection Deselect a few files. Use ds * or Alt-d to deselect all files at once
c sel Copy files Copy selected files into the current directory
ta *.pdf :mypdfs Tagging files Tag all PDF files in the current directory as mypdfs
p t:mypdfs Tagging files Print the file properties of all files tagged as mypdfs
c 34 file_copy Copy files Create a copy (named file_copy) of the file whose ELN is 34. You can also use the d command to duplicate a file
m 45 3 Move/rename files Move the file whose ELN is 45 to the directory whose ELN is 3. To rename the file just issue m 45: a secondary prompt will be displayed to edit the file name inline. m 45 NEW_NAME is also allowed
r sel mydir 27 Remove files Remove all selected files, plus the directory named mydir and the file whose ELN is 27. To remove files in bulk via a text editor use the rr command.
t 12-18 Trashing files Send the files whose ELN's are 12 through 18 to the trash can
t del Trashing files Select trashed files and remove them permanently. You can also use TAB to get the complete list of trashed files, select a few, and then remove all of them from the trash can
t empty Trashing files Empty the trash can
u Trashing files Undelete trashed files (restore them to their original location). Hit TAB to get the list of trashed files
bm / Alt-b Bookmarks Open the bookmarks screen. Here you can select the desired bookmark by just entering the corresponding ELN or shortcut.2 You can also specify the desired bookmark in the command line as follows: bm NAME, where NAME is a bookmark name (TAB completion is available)
bm a mydir Bookmarks Bookmark the directory named mydir/. Regular files can also be bookmarked. To delete a bookmark run bm d and the press TAB to select the bookmark name to be deleted2
ws2 / Alt-2 Workspaces Switch to the second workspace. To go back to the first workspace, just enter ws1 or press Alt-1
edit / F10 Configuration file View and/or edit the configuration file
pf set test Profiles Change to the profile named test. If the profile does not exist, it will be created
hf on / Alt-. Show hidden files. Press Alt-. to hide these files again
st size rev Sort files Sort the current list of files by size in reverse order. You can use Alt-z and Alt-x to quickly switch sorting methods
actions Plugins List available actions/plugins
- Files preview Navigate the file system via fzf, including files preview3
icons on Icons Enable icons3
q Quit I'm tired, quit

1 ELN amounts to Entry List Number, that is, the number at the left of each listed file name. Consult the ELN and the interface sections for more details.
2 You can also enter bm edit or press F11 to open the bookmarks file and manually add/remove/edit the desired bookmark.
3 Both files preview and icons depend on third-party software. See the corresponding links in the Full description column.

Note: If you experience any problem with the default keybindings, consult the Keybindings issues section.

For more advanced use cases see the Common operations and the Advanced tricks pages.