The Chalkboard


DF-SHOW

Last Updated: [2023-10-26 Thu 04:53]

Introduction

DF-SHOW is a file and directory explorer written for Unix-like operating systems. It's based on an old directory explorer originally written for PC-DOS systems in the mid-1980s called DF-EDIT. It's designed to be easy to use by being almost like an interactive version of the ls -l command, with simple to use key bindings which are always on display.

Installing DF-SHOW

DF-SHOW is available for the following Operating Systems:

DF-SHOW Can also be compiled on the following Systems:

See the Installation section in the docs for instructions.

Running DF-SHOW's Directory Browser - show

From the terminal, run show, this will display the current directory. You can also launch show with a directory specified.

show /some/path/to/a/directory

Once show is running, you will see the list of objects in the directory displayed, as well as a . and .. entry. In file system terms, the . is the current directory. Show displays this to provide the user information about who owns the current directory, as well as hard links and directory permissions. The .. entry is the directory above (just like using cd .. to move up a directory). These are always visible even if hidden files are switched off.

Upon launch, the first item will be highlighted in blue, this is the cursor. Using the arrow keys, you are able to change the highlighted item. If you desire to change to a directory within the one you're in, highlight it, and press s. This will load the new directory. Pressing q will return you to the previous directory.

Displaying Files

In a similar fashion, you can also display text files. By default, it will load the file using the included sf application. Show can also be configured to look for an environment variable called PAGER to launch your default paging application using the --no-sf argument at launch. See the section below on setting this up. Upon quitting your pager application, you will be returned to Show.

Copying Files

Pressing c on a highlighted file brings up a prompt at the top of the screen asking where you'd like to copy the file. If the destination already exists, you'll be asked if you want to overwrite.

If you have marked files using the F6 key (or F7 to select all files, or F10 to select a block of files), you can copy multiple files.

Linking files

The l key on a selected file will bring up a prompt asking if you'd like to create a Symbolic link or a Hard link. In most cases, you'll want a Symbolic link, which is like a shortcut in Windows speak:

At the link menu, press s. This will bring up a prompt asking where you want the link to be placed. After writing your destination path, you will then be asked if you want to create the link with a relative path, or an absolute path. In most cases, you'll want the relative path.

Pressing the h key at the link menu will give you a prompt asking where you want the link to be placed. Unlike a Symbolic link, a hard link is done at the filesystem level. The number next to the permissions table will increase by one to indicate that the file is accessible from another location.

Renaming/Moving Files

Using the r key will bring up a prompt, similar to when copying, to rename files. If you rename to a different directory, you are effectively moving the file to another location.

Again, if you have marked files, you can bulk move them.

Deleting Files

The d key, on a highlighted file, will prompt the user if they're sure they want to delete the selected file.

When using this with marked files, show will verify each file unless you respond with "All".

Adjusting Permissions

Pressing m will bring up the Modify menu, here you can select either o for owner changes, or p for permissions. These are similar to the chown and chmod commands respectively.

Since version 0.8.2, Show will assume the group to be the same as the owner unless specified.

As of version 0.10.0, Show will also let you update security contexts on files by selecting c from the Modify menu, this is similar to the chcon command.

This option is only available on systems with SELinux and when --with-selinux is passed at configuration time at compiling. The Enterprise Linux and Fedora builds in COPR have this enabled by default.

Adjusting Timestamps

As of DF-SHOW 0.6.0, you can use the t key on a selected file to update the Modified and/or Access time of a file. The updated time should be presented in one of the following formats: YYYY-MM-DD HH:MM:SS or HH:MM:SS

You can also use the touch command to create blank files, this can be done by going to the global menu (by pressing ESC) and using the t key. This will prompt you for a file name, then will ask if you want to set the time. Saying no will set the new file to the current time.

Creating Directories

Creating directories is done from the global menu, accessible by pressing ESC. From here press the m key. You will be prompted choose a path for the new directory.

If you are trying to move, copy, create files or directories to a path that doesn't exist, show will ask if you want to create the parent directories too.

Passing options on the command line

Before configuration was implemented, I used to run show with the following options passed on the command line:

--color - This colourises the objects based on type, making it easier to spot directories, symlinks, executable files, and files with SUID/SGID/etc. flags set.

--marked=auto - This automatically adds a line to the information section when one or more file is marked displaying information about the marked files. This can be useful to quickly calculate the overall size of a selection of files. This line can be permanently shown by replacing the auto option with always.

--human-readable ( -h ) - This displays file sizes in an easier to read format (the default is to display file sizes in bytes)

There are plenty more options, these can be viewed either by running show --help, or consulting the man pages for show.

OS Specific features

When built on HURD systems, show has full support for displaying the author field. On other systems, --author will duplicate the owner value. This is identical to how the GNU version of ls works.

Since version 0.9.0, the macOS builds support the -@ option and instruct show to display the macOS extended attributes. This feature is absent in the Linux builds.

Systems that are preinstalled with SELinux (Enterprise Linux & Fedora) have support for viewing the security context of files in show 0.9.0 and above. If compiling DF-SHOW from source, be sure to add the --with-selinux option to ./configure as SELinux support needs enabling at build time, failure to do so will result in the Context column being populatated with ? even on systems with SELinux.

Running DF-SHOW's File Viewer - SF

By default, when selecting the Show command on a file within show, sf (Show File) will be used to display it.

Alternatively, from the terminal you can launch the sf command. If no file is specified you will be prompted to supply a file.

Aside from the arrow keys and page up/down keys. The following function keys perform the following actions:

F1 - Page Down

F2 - Page Up

F3 - Top of file

F4 - Bottom of file

Searching a file

Using the f key, you are presented with the option of either searching case sensitive or case insensitive. The search dialogue will then be presented which will let you do regex style searches. If a result is found, you will be taken to that line.

Going to a specific line

Using the p command will allow you to go to a specific line number, or a line number relative to the one you're currently on (by using + or -)

Text wrapping

By default, lines do not wrap, and the left and right keys must be used to view text that rolls off the screen. Using the w command toggles wrapping on or off.

Customising DF-SHOW

To make use of DF-SHOW’s ability to launch a text editor on a selected file, environment variables for VISUAL (or EDITOR) may be set. Optionally, the PAGER value can be set if you don't want to view files using sf by default. Here's an example from my .bashrc file:

export VISUAL=$(command -v vim)
export PAGER=$(command -v less)

alias s=show

Here I've set my default editor to vim, and less as my pager, however, personally I use the sf application for viewing files, setting a pager will allow you to use the --no-sf flag on Show.

I also have set an alias for the single letter s to launch show. This is purely personal preference and is more a demonstration of Unix-like aliases rather than DF-SHOW, but I've included it here for anyone wanting to take advantage of it.

As of DF-SHOW 0.9.2 it is no longer nessessary to set environment variables and show will fall back on dfshow.conf, and failing that a suitable default (which should be discovered at build time).

Colours and Themes

Within the Show application, it's possible to customise and build themes. From the global menu, use the o command to bring up the theme editor. Here you can change the colours of each element used within the applications. You can quit without saving to see how it looks in show. When saving, ensure you save in your personal ~/.dfshow directory to allow you to use the theme at program launch and between the applications. Pressing u will set the theme as default (providing the theme has been saved).

Persistent Customisations

As of version 0.7.0, you are able to adjust the settings of all DF-SHOW applications within the applications themselves by invoking the settings menu. In show, this is located in the global menu (ESC → C) and in sf pressing C will take you to its settings menu.

Whilst in the menu, you can revert settings by pressing the r key. To preview any settings (for the session only) press q to return to the application. To save the settings (persistent changes) press s before quitting.

Manually editing the config file

DF-SHOW settings are changed by using a config file (version 0.5.0 and above). Until version 0.7.0, this configuration file needed to be created manually. Below is a copy of the default config file. You can pick out settings you want to change and put them in the ~/.dfshow/dfshow.conf file and the applications will read it on launch, the global config is set in /etc/dfshow.conf - I may get around to writing a puppet module at some point to automate this, however using the config file in your own .dfshow directory gives you the ability to tune DF-SHOW to your liking.

# DF-SHOW Config

common:
{
  # Default theme (default: default)
  theme = "default";
  # Enable SIGINT - quit on Ctrl-C (default: 0)
  sigint = 0;
};

show:
{
  # Colored files and directories (default: 0)
  color = 0;
  # Show Marked file info (default: never)
  marked = "never";
  # Sorting mode [name; date; size] (default: name)
  sortmode = "name";
  # Reverse order (default: 0)
  reverse = 0;
  # Time style [full-iso; long-iso; iso; locale] (default: locale)
  timestyle = "locale";
  # Show hidden files (default: 0)
  hidden = 0;
  # Ignore backups (default: 0)
  ignore-backups = 0;
  # Don't view files in SF (default: 0)
  no-sf = 0;
  # Ignore danger lines when running as root (default: 0)
  no-danger = 0;
  # Use SI units (default: 0)
  si = 0;
  # Show sizes in human readable form (default: 0)
  human-readable = 0;
  # Repurpose Enter key as Show command (default: 0)
  show-on-enter = 0;
  # Configure owner column (default: owner 1; group 1; author 0)
  owner:
   {
     owner = 1;
     group = 1;
     author = 0;
   };
  # Show security context of objects (default: 0)
  context = 0;
  # Skip naviation items if at the top of list (default: 0)
  skip-to-first = 0;
  # Show only directories (default: 0)
  only-dirs = 0;
  # Show sizes in blocks (default: 0)
  sizeblocks = 0;
  # Override default file editor (default: 0)
  defined-editor = 0;
  # Defined file editor (default: "vi")
  # visualPath = "vi"
  # Override default pager (default: 0);
  defined-pager = 0;
  # Defined pager (default: "more")
  # pagerPath = "more";
};

Running on Windows

DF-SHOW is currently supported on Windows when compiled via Cygwin.

When installing Cygwin, ensure you have the following components installed:

You will also need to install libconfig manually (as it's not available in the Cygwin repositories):

Grab the latest release from here: https://github.com/hyperrealm/libconfig/releases/latest

Once extracted, run the following:

autoreconf --install
automake --add-missing
./configure --prefix=/usr
make
make install

After the installation has been completed, you can go ahead and download the latest version of DF-SHOW: https://github.com/roberthawdon/dfshow/releases/latest

Once extracted, run the following:

./bootstrap
./configure --prefix=/usr
make
make install

Once the installation is complete, you can run show and sf from the Cygwin terminal.

Further references

The project is open source, licensed under the GPLv3, and hosted on GitHub: https://github.com/roberthawdon/dfshow

For a brief history of the project, see: https://dfshow.org/

Documentation for DF-SHOW is both available in the form of man pages (man show and man sf) as well as online: https://dfshow.readthedocs.io/en/latest/


DISCLAIMER: The information provided on this website is generated from my own notes and is provided "as is" and without warranties. Robert Ian Hawdon can not be held responsible for damages caused by following a guide published on this site. This website contains links to other third-party websites. Such links are provided as convienice of the reader. I do not endorce the contents of these third party sites.