[X-Unix] What's the command?

Scott Buntin scott-xlists at scotist.com
Fri Apr 16 21:58:14 PDT 2010


On Apr 16, 2010, at 10:10 AM, Dave Higgins wrote:

> I was reading through some forum threads and stumbled on a pair of command-line tools that I thought would be handy for something that I'm working on, and I thought I kept it in some notes, but for the life of me I can't find it or remember the commands.
> 
> They're quite simple. One trims the filename off of a full path, and the other trims the path off of the filename. So, given
> 
> /path/to/file/on/the/drive.txt
> 
> one returns "drive.txt"
> other returns "/path/to/file/on/the"
> 
> Anyone know offhand what these are?

Steve already answered this, but it brought to mind another almost-forgotten command line goodie: apropos ("which commands might have something to do with …"). Similarly, man -k works too.

~ scott$ apropos filename
BIO_s_file(3ssl), BIO_new_file(3ssl), BIO_new_fp(3ssl), BIO_set_fp(3ssl), BIO_get_fp(3ssl), BIO_read_filename(3ssl), BIO_write_filename(3ssl), BIO_append_filename(3ssl), BIO_rw_filename(3ssl) - FILE bio
File::Basename(3pm)      - Parse file paths into directory, filename and suffix
Tcl_TranslateFileName(3tcl) - convert file name to native form and replace tilde with home directory
basename(1), dirname(1)  - return filename or directory portion of pathname
filename(ntcl)           - File name conventions supported by Tcl commands
fnmatch(3)               - test whether a filename or pathname matches a shell-style pattern


and there's your basename and dirname.




More information about the X-Unix mailing list