LINUX CLASSES - FILES
What Are The Rules for Linux File Names?
What's in a File Name? Linux file names can be up to 256 characters long, but you really have to enjoy typing to get to that extreme. You can name a file
panda-corporation-financial-reports.y96 if you wish, but you'll probably find that shorter names (and
intelligent use of directories) will save lots of time and keystrokes in the course of a day.
When naming files, you can use uppercase and lowercase letters, numbers, and certain special characters. It's a really good idea to
stick with letters, numbers, and the dash, dot, and underscore characters to avoid trouble and confusion.
Note: Don't use asterisks, backslashes, or question marks in Linux file names--these
characters have special meaning to the shell and could cause your commands to
do something quite different from what you intended. Also avoid using a dash as
the first character of a file name, since most Linux commands will treat it as a
Files starting with a dot are hidden files. They behave just like any other file, except that the ls (list files) command will not
display them unless you explicitly request it to do so. Your .profile file is an example of a hidden file.
Also remember that Linux file names are case sensitive, which can be difficult to get used to if you have a DOS background. Linux
allows you to have unique files named goodstuff, GOODSTUFF, and GoodStuff in the same directory.
It's best to always use lowercase in Linux unless you can think of a good reason to use uppercase or mixed case. Most Unix
people use lowercase almost exclusively, but aside from this "cultural" point, there's another good reason to use lowercase. If you're
sharing or accessing a DOS file system with Linux, DOS will not be able to see the files that have uppercase or mixed-case file
Unlike under DOS, the dot character (.) has no special meaning. You're not limited to the eight dot three (xxxxxxxx.yyy) style of
naming because Linux treats the dot just like any other character; you can name a file
Some.Yummy.CHEESECAKE.Recipes if you're so inclined.
Along these lines, Linux executables do not need or use a special extension such as .exe or .bat. Linux will happily run a program file
named zippity just as readily as it will run DOODAH.EXE.
And here's another slight difference between Linux and DOS filesystems. Linux uses the forward slash (/) in path names, and DOS
uses the backslash (\). Don't blame this little quirk on Linux though . . . the DOS filesystem was originally modeled after Unix! In
fact, the popular rumor is that Bill Gates and Company implemented the DOS filesystem just differently enough from the Unix
filesystem to avoid being criticized for stealing the idea. The same charge is made about the DOS batch file (.BAT) utility, since it
bears striking similarities to the Unix shell scripting languages, but I digress. . . .
Previous Lesson: The Linux File System
Next Lesson: Linux Directories
[ RETURN TO INDEX ]
Comments - most recent first
(Please feel free to answer questions posted by others!)
(17 Apr 2013, 10:17
i really thank you for letting me konw about Linux.to tell you the truth i
didn't know anything bt now i know almost evrything
(21 Mar 2012, 09:42
I have happy to learn Linux from your advising website how do i access to
online to Linux server to do the used all Linux command's
Please advise me
Thank's & Regard's
(21 Mar 2012, 04:53
all linux servers are only in text mode, and u r using RHEL server 5.
if you want to use GUI then you have to transfer to "RHEL desktop" edition
(07 Feb 2012, 13:18
I have a laptop that I partitioned into three i.e. c, d and e.
I loaded windows 7 onto C drive and would like to put Linux onto D drive.
Would someone remind me on how I could go about this. I did it sometime
back with windows XP and Linux suse 5. It was as easy as 123.
Its proving to be a challenge this time around
(08 Dec 2011, 09:24
I am using RHEL server 5 in hp dv7 3163cl..Only text mode is working and
the GUI mode is not working..Please giv a solution for me..
(16 Nov 2011, 05:56
I installed Linux Mint 11 and now have a dual boot machine. Love Linux! I
still have Windows 7, but use Linux.I worked with Unix many years but
forgot quite a bit. Your site is a great place to relearn.
Thanks for this great site.
(07 Nov 2011, 18:44
i install Nvidia card N8400GS and unable to boot any idea why? The old
video card works fine.
(05 Aug 2011, 04:23
sounds like you really like cheese cakes :)
(31 Oct 2010, 01:41
Thanx a lot boss. Looking for a tutorial like this for a lo ....ng
(26 Aug 2010, 04:39
does any one know the link where i can get
"Programming the world wide web 4th edition by Robert W.Sebesta"
(08 Jun 2010, 06:11
@Graeme - It's an amazing thing... I'm meeting more and more people who can
TYPE, but they cannot READ! :-)
(08 Jun 2010, 03:58
I find it very ignorant that so many people think that they can demand that
you teach them linux on a one to one basis. Is it not enough for them that
you have given them this website? They seem to think you have all the time
in the world to commit to them. They should try and learn it themselves as
everything they need to do so is right here but they are just too lazy to
teach themselves! Thanks for this great piece of work!
(14 May 2010, 06:01
Is the ^M at the end of the filename, or at the end of each line INSIDE the
(12 May 2010, 23:06
I am trying to have this simple script run by cron... It's basically a dump
file of my MySQL database... The problem is, though the output file gets
successfully created, I cannot ftp it to my local directory. Upon
inspection, I notice a ^M character at the end of the filename...
What I did was to use mv command to copy/move the contents of the same file
(but this time, minus the ^M characters at the end) to the same filename...
It works fine... However, I was wondering if say, I include the same mv
command on the script, will it work - or mv will work but it will also
append ^M characters to the end of the new output file??
I welcome your comments. However... I am puzzled by many people
who say "Please send me the Linux tutorial." This website *is* your Linux Tutorial! Read everything here, learn
all you can, ask questions if you like. But don't ask me to send what you already have. :-)
NO SPAM! If you post garbage, it will be deleted, and you will be banned.
by Bob Rankin
All rights reserved - Redistribution is allowed only with permission.