Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unix file naming convention for effective tab completion?

I feel like I often name files in such a way that my computer constantly beeps while I program because the tab completion is ambiguous. Before doing a lot of Unix programming, I tended to name related files with the same prefix to indicate their relation. Now I must re-think my approach to folder and file structures and names to program more effectively.

What heuristics or rules do you apply when programming to simplify tab completion? Do you use any tools to make tab completion smoother (e.g., emacs icicles)?

EDIT: Wow, thanks for the fantastic insights. I think every possible weakspot of mine was accounted for in the answers. I accepted the one that seems like the best productivity improvement, although they're all worth reading.

like image 854
thebossman Avatar asked Mar 16 '10 18:03

thebossman


People also ask

What is the standard convention being followed when naming files in UNIX?

The name can contain up to 1023 characters including alphanumeric characters (A-Z, a-z, and 0-9), blanks, mathematical symbols (+ - = | ~ ( ) < > { } \), punctuation marks (? , . ! ; : ' " / [ ]), and the following special characters: &, %, $, #, @, ^, *, and _. For example, /etc/ftp.

Which of the following is correct file naming used in Linux?

Only alphanumeric characters, periods, underscores and hyphens and don't use symbols like “%”, “$”, and so forth. Keep the file names short and descriptive.

What aspect of a file do file naming conventions typically describe?

A File Naming Convention (FNC) is a framework for naming your files in a way that describes what they contain and how they relate to other files. Developing an FNC is done through identifying the key elements of the project, the important differences and commonalities between your files.


3 Answers

I've generally worked on projects where related files are all in the same directory, and the file names themselves are specialized to indicate their contents.

Of course, this begs the question, why are you doing tab completion on file names? If you're perusing source code, there are TAGS, CEDET, and a plethora of other utilities that will let you bypass the file name and jump directly the the function/variable you're really after.

It all depends on what you're really trying to do, and finding a particular file is usually the means to a different end.

like image 85
Trey Jackson Avatar answered Oct 13 '22 11:10

Trey Jackson


In general,

setterm -blength 0

will disable the terminal's beep. GNU screen and some graphical terminals have their own beep notification settings.

Specifically for Bash and other Readline-using software, tab completion behavior can be changed using $INPUTRC, /etc/inputrc, and ~/.inputrc configuration files. For example,

bell-style none     # never ring the bell
bell-style visible  # use visual bell, if available

show-all-if-ambiguous on  # list all completions instead of ringing the bell
like image 44
ephemient Avatar answered Oct 13 '22 10:10

ephemient


I must admit that I names my files without regard to tab completion and instead adjust my urge to hit tab until I know that I have typed enough characters to not get tab-silly.

like image 28
Don Avatar answered Oct 13 '22 10:10

Don