2019-05-01_Linux_Format

(singke) #1

http://www.techradar.com/pro/linux May 2019 LXF249 61


File manager TuTorials


Of course, if you’d like to define your own keyboard,
you can do that as well by editing the script to your
satisfaction. Unfortunately, we don’t have enough space
to provide a complete list of the default key bindings,
butherearesomethatyouwillusefrequently:


Key Function
J scroll down
K scroll up
H go to parent dir
L go to child dir
Enter go to child dir
Backspace go to parent dir


  • go to previous directory
    ! open shell in current directory
    F new file
    N new dir
    R rename


In addition to J, K, H and L, you can also use the
respective arrow keys for the same purpose, as these
are configured by default in FFF. That is, you can press
the right and left keys to respectively enter a directory,
or return to the parent directory. The up and down keys
can similarly be used to select a file or directory.
Most file managers help you do more than just
provide easy access to a directory’s content; they also
help you rename, copy, move, search for or delete files.
Like its graphical counterparts, FFF too supports all
these functions, and they’re all at your disposal with a
single keystroke.
You can press / followed by a string and FFF will
immediately print all files/directories which match the
entered string. Unlike other command-line utilities,
which retain a case-sensitive approach, the search
feature on FFF is not case-sensitive. For instance, if
your home directory contains several directories and
files which feature the letters M and m – whether at the
start, middle or the end – as soon as you start typing
/m , FFF will automatically limit the contents to all
matching files/directories which feature these letters.
This means that the search results will include the
directory Music as well as the file beard-grooming-
tips.txt, and all other matches. The results will keep
getting narrowed down as you type.
If you also want to view hidden files/directories, you
can press the. key to toggle hidden files. Once on, the
option remains enabled, until you toggle it again. You
can similarly use the X key to determine the attributes
such as total size, permissions, time of the last access,
modification and so on of the selected file and directory.
Most graphical file managers let you type in the
directory you wish to access. If your present working
directory is ~/Documents and you want to navigate to
/Downloads/projects/calcurse/calcurse-4.3.0/
scripts, that’s a whole lot of key presses. Thankfully,
FFF also lets you type in the directory path you want to
access. First press : and then type the directory path.


Being a Bash script, FFF also supports tab-completion,
so you don’t have to manually type the complete path.
You can copy, move, or delete single files with FFF
by selecting the file/directory and then respectively
pressing the Y, M or D key. You can also select all files
in the current working directory using the same keys
plus Shift. That is, press Shift+Y to mark all files for
copying, or Shift+M or Shift+D to move or delete all
files. When you choose a file operation such as copy,
move or delete, the selected file is highlighted in red,
and the bottom of the interface will show in red the
operation you’re about to perform. For instance, if you
mark a file/directory for deletion, you’ll see:
(12/12) [1] selected (trash) [p] ->/home/linuxlala/
Desktop
Here, the path at the end of the line describes the
location of the file, the number in square brackets
describes the number of files, and the keyword in
brackets describes the intended operation. The (12/12)
at the beginning of the line describes the position of the
selected file in the directory list. All the contents are
arranged alphabetically, and FFF automatically
computes the total number of files/directories in the
current working directory. So if your current directory
has four files, named Alpha, Curses, beard and java,
they would be assigned numbers 1, 3, 2, 4 respectively.
This is because FFF isn’t case sensitive.
Similarly, for a move operation, the line at the
bottom of FFF would read:
(3/4) [2] selected (mv -i) [p]->/home/linuxlala/
Downloads/projects/
Here, the [2] means we’ve selected two files for the
move operation (mv -i). Once you’ve chosen the file
operation to perform, navigate to the directory where
you want to move or copy the selected files/directories
and then press P. FFF then pastes the chosen files into
this new working directory. Unfortunately, there’s no
way for you to specify the path where you want to move
or copy files: you have to manually navigate there and
then press P for the file operation to take effect.
In summary, FFF features many of commonly used
features, has no real learning curve to speak of, and is
indeed, er, quite fast.

enhanCe yourterminal-Fu Subscribe now at http://bit.ly/LinuxFormat


youcanuse
thekeys1 to
9 tocreate
bookmarks
tocommonly
accessedfiles
ordirectories.
opentheFFF
scriptinyour
favouriteeditor,
navigatetothe
‘#Directory
favourites’
sectionanduse
thetemplate
‘export
FFF_FaV1=/
path/to/file-
or-directory’
.youcannow
usethekeys 1
to9 toswitchto
a bookmarked
directory,
oropena
bookmarked
file,irrespective
ofyourcurrent
working
directory.

The FFF script is neatly split into different sections. Although not thoroughly commented, it can
teach you a lot about Bash scripting.
Free download pdf