Skip to Content.
Sympa Menu

baslinux - [BL] Simplistic File Manager - Manual

baslinux AT lists.ibiblio.org

Subject: Baslinux mailing list

List archive

Chronological Thread  
  • From: Lee Forrest <lforrestster AT gmail.com>
  • To: baslinux AT lists.ibiblio.org
  • Subject: [BL] Simplistic File Manager - Manual
  • Date: Wed, 7 Feb 2007 04:17:29 +0000

sfm-0.1

sfm = simplistic file manager

Description
----------

sfm is a simple tool to facilitate (speed up) browsing the
directory tree, examining and editing files, and performing other
basic file ops.

It is not meant to be substitute for shell knowhow or a permanent
shell interface.

It is meant to be part of a TDE (textmode desktop environment),
the other main part being a menu tree that allows easy execution
of common commands (template available as tdemenu.sh).

The liberal use of aliases is a must for the commandline linux
runner. Here are some example:

alias 'e=nvi' # my editor of choice
alias 'p=less' # pager
alias 'b=links-0.90' # browser

A file devoted to one's aliases is very helpful. Mine is named
/etc/.aliases and it is sourced by my /etc/profile with this
command at the bottom of that file: '. /etc/.aliases'

(More on aliases below.)

Installation & configuration
----------------------------

Copy code to a file named "sfm.sh". Make it executable with
'chmod +rx sfm.sh'. Move to directory in your PATH (I use
/usr/local/bin for most scripts). 'echo $PATH' to see what
directories are available.

Find a single letter that is not being used for an alias or
executable by testing your choice with 'type f'. (f being an
example letter)

Set your choice by putting this in your /etc/profile:

alias f='. sfm.sh'

(The "." causes the script to be "sourced", which means run in
the current shell rather than a subshell, which is necessary for
cd to work as it does from the regular commandline, and for your
aliases to be available.)

Now restart X or do '. /etc/profile' in all open windows

The only thing you may want to change is the default pager,
which can be done near the top of the script. If you don't have
less, then the pager set in the environment variable PAGER
(/etc/profile) will be used.

sfm checks the number of columns (single character) on the
current screen, and chooses how many columns (menu) to display.
There's one less for the submenu because file names tend to
be longer than directory names.

Usage
-----

Starting sfm.sh brings up the main menu:

[1] EXIT [2] COMMAND [3] SAVE
[4] file -L [5] ls -Als [6] /
[7] /bin [8] /dev [9] /etc
[10] /home [11] /lib [12] /proc
[13] /root [14] /sbin [15] /usr
[16] /var [17] STARTDIR [18] LASTDIR
[19] ..
/usr/local/bin:

(that's what it would look like on a narrow screen)

There are no subdirectories in the above directory.

Make your choice by entering a number at the prompt. If it is a directory, you
will cd there and the menu will be rebuilt for that directory.

Ctrl-j (^J) or Ctrl-m (^M) can be used, in most circumstances,
instead of Enter/Return.

[1]-[19] are a part of the main menu regardless of which dir you are
in. Only the subdirs of the current directory are listed. Note
that subdirs in the current directory, if any, begin after ".."
(You can, of course, change the above directories in any way you
wish.)

Hit "Enter/Return" to run ls -aFs on the current directory, then
again to return to the main menu.

"[1] EXIT" Guess! :-)

"[2] COMMAND" opens a submenu and its own prompt. Only non-directory
files are listed, plus the option to return to main menu:

[1] MAIN MENU [2] cz [3] de.sh
[4] jpegtopnm [5] links.sh [6] man2text1.sh
[7] mangrep.sh [8] musetup [9] mutt.gz
[10] pgpewrap [11] pgpring [12] poff
[13] ppmdither [14] ppmtobmp [15] ru
[16] sfm-orig [17] sfm.sh [18] splitscreen.sh
[19] tcpdump.sh [20] time.sh [21] top-mem.sh
[22] trash.sh
Command:

(that's what it would look like on a narrow screen)

[1] takes you back to the main menu.

Here you enter a normal commandline, but you use numbers instead

of filenames.

(And/or the string "ZZ". See below.)

"[3] SAVE" gives you a menu with just the non-directory files
in the current directory, because you are returned to the main
menu after running it once. And its own prompt.

[1] cz [2] de.sh [3] jpegtopnm
[4] links.sh [5] man2text1.sh [6] mangrep.sh
[7] musetup [8] mutt.gz [9] pgpewrap
[10] pgpring [11] poff [12] ppmdither
[13] ppmtobmp [14] ru [15] sfm-orig
[16] sfm.sh [17] splitscreen.sh [18] tcpdump.sh
[19] time.sh [20] top-mem.sh [21] trash.sh
Save:

If you enter a list of numbers at the prompt, the file names they
represent, with full path, will be saved to a tempfile and you'll
return to the main menu.

The contents of this tempfile can be included on the "Command: "
commandline by using the string "ZZ".

You can now navigate to another directory and, for example, copy
the files in the tempfile to that directory by entering:

Command: cp ZZ .

You can only use the tempfile once. If you don't use it at all,
it will be deleted when you exit sfm. If you call SAVE again,
the tempfile will be deleted before the new save begins. Just
going to the SAVE submenu and hitting Enter/Return will delete
the tempfile.

But it's a good way to see just the non-dir files.

Note that "." causes " $PWD " to be printed on the sfm
commandline, which is _not_ as flexible as a regular commandline,
although you can do a lot.

Command: e 45

would open the file represented by the number 45 in your favorite
editor (if you have "e" aliased to your favorite editor).

SAVE and COMMAND do not display error messages. If you use
invalid command names, options, or args, or don't include any
numbers representing files in the current directory, you will
find yourself returned to the main menu with SAVE, and with a new
COMMAND menu and prompt with COMMAND. If you enter one or more
numbers that don't represent valid files, but otherwise the line
is sound, the mistakes will be ignored.

The screen doesn't clear after a command is executed at the
"Command: " prompt so that you can see the output of apps that
output to stdout.

If the output of such an app is more than a screenful, use
Shift-PageUp/PageDown to access the missing part. Hit Space
to return to the prompt.

(For dirs with a _lot_ of files, piping to a pager is mandatory.)

If you want to keep the screen neat when executing more than one
command, there are three ways:

1. Execute 'clear' at the "Command: " prompt.

2. Pipe the output to a pager.

3. Return to the main menu and start again.

If a command hangs, use Ctrl-c (^C) to get out of it. (This has
only happenned with 'cat' with no files on the commandline.)

"[4] file -L" runs file -L (dereference symbolic links) on the current
directory and displays the results in your pager of choice.

"[5] ls - Als" runs ls -Als on the current directory and displays the
results in your pager of choice. (Here is where you can see the
symbolic links.)

Quiting the pager in either case returns you to the main menu.

"[17] STARTDIR" takes you back to the directory you started sfm
in.

"[18] LASTDIR" to the last directory you were in.

"[19] .." to the parent directory of your current directory.

If you have basic typing skills (and anyone aspiring to master
the computer _must_ be a decent touch typist) using sfm is much
faster for navigating the directory tree, in most cases, than
typing all the cd's and paths and ls's.

Takes a little getting used to, but once you have the numbers memorized...

Most of the time you can get to a directory with a fraction of
the keystrokes doing it manually would take. The numbers are easy
keystrokes.

If sfm is getting in the way, just kill it.

Typing hint: Put your left index finger on "f" and the right
index finger on "j" (standard basic typing position). Move your
entire hands diagonally to the upper left. Your index fingers are now on
"r" and "u", respectively. Do it again. They are now on "1" and
"7". Practice moving back and forth with your eyes closed and
typing abcdefgh...then 123456...Keep your thumbs touching the
Space bar and your shoulders relaxed.

You can run as many concurrent instances of sfm as you like. They
won't step on each other.

Please read through the script. It is well-commented.

------------------------------------------------------------------------------

Simplistic File Manager

Copywrong Lee Forrest lforrestster AT gmail.com Wed Feb 7 2007

Thanks to Steven, creator of BasicLinux, for his help with formatting.

http://www.basiclinux.com.ru

/quote

If anyone wants to try it and suggest changes, I'd be grateful.
I've been using it for a while, and it looks like I got the bugs
out, but....

Lee

--
BasicLinux: Small is Beautiful
http://www.basiclinux.com.ru




  • [BL] Simplistic File Manager - Manual, Lee Forrest, 02/07/2007

Archive powered by MHonArc 2.6.24.

Top of Page