Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I mean what command will separate the extension from a filename?. I know file gives me tons of information about the file. But is there a program that will just give me the extention?
I guess the point is - extensions don't mean anything in linux, exept to the user maybe... Document files, OOo and such, still use the concept, but mainly for the users benifit...
window managers depend heavily on extensions for file association purposes. Some are smart enough to figure out the file type by the contents, but that is not a reliable method, as with Windows, there is no resource fork (as you have on a Mac), file extension association is possibly the best way for the environment to decide which program should open it.
for i in $(ls); do echo -n "$i: "; echo $i | sed 's/^.*\.\([^.]*\)$/\1/'; done
It does an 'ls' in the current dir '$(ls)' to get some filenames to play with.
For each of those it echos what it is working with and then uses 'sed' to rip off everything after the last '.' and shows that too.
For icon use, maybe, tho konqeror still knows a OOo file without the extension, etc, tho it may give a generic OOo rather than calc icon... Image files etc still preview and so forth. I don't see the extension as much of an issue IME...
Originally posted by amosf For icon use, maybe, tho konqeror still knows a OOo file without the extension, etc, tho it may give a generic OOo rather than calc icon... Image files etc still preview and so forth. I don't see the extension as much of an issue IME...
THat's because the KDE framework remembers which app generate the file. Try taking that file to another Linux box, without the extension, and click on it. Try under various window managers - NOT on the same box which created the file.
It's fantastic that konqueror remembers which app created which document, but it's hardly an ideal setup.
You are probably right. It's not something I worry over and the apps tend to place extensions accordingly... So for data files the extensions are useful, but not necessary with execuatables...
Actually I'm not sure what KDE does, as you can copy and duplicate given files, trasfer across machines, etc, and KDE still seems to have some idea of what they are, tho not always perfectly. Some sort of file preview, I'd say.
Originally posted by KimVette THat's because the KDE framework remembers which app generate the file.
No, it's because Konqueror actually examines the contents of a file in to figure what the heck it is, if there's no file extension. If you're using "Icon View" mode, it will do this just to generate the thumbnail.
Thanks for restating what I already said. However the system isn't perfect - sometimes it cannot figure out the type based on the contents, but can based on the extensions.
Some environments are smart enough to figure it out based on the contents but not all, and of course it will vary depending on which versions of various libraries are installed. Thanks for trying to play semantics though.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.