You are not logged in.
Pages: 1
Long time lurker, first time poster here.
I'm curious about how everyone here handles filenames in Linux. I've read a few articles online discussing proper filenaming conventions in Linux (such as this one and this one).
Currently I have some files/directories with spaces, parentheses and brackets in their filenames. Is it best practice to use underscores instead of spaces, and avoid use of parentheses and brackets? It's also suggested to make all filenames and directory names lowercase.
How do you guys handle this subject?
Offline
Spaces, brackets etc. are all just fine. They can be a bit inconvenient to refer to on the command line, but that's not an issue if you've gotten into the habit of quoting everything anyway.
Offline
Spaces, brackets etc. are all just fine. They can be a bit inconvenient to refer to on the command line, but that's not an issue if you've gotten into the habit of quoting everything anyway.
Offline
I hate underscores in filenames. If you treat space just like any other sign, you will quickly learn how to use it in scripts, terminals etc. And with tab-completion you will seldom notice it in cli. That said, if you use a graphical filemanager you will never notice it, but you will notice if all your filenames have underscores in them.
Offline
If your system works for you, then there is no point changing it.
Offline
Alright, thanks for the advice guys.
Offline
i never use spaces or brackets, because they always funk up bash scripts (or i'm too stupid to write proper scripts )
☃ Snowman ☃
Offline
i never use spaces or brackets, because they always funk up bash scripts (or i'm too stupid to write proper scripts )
There is a simple way around that:
cd "/home/blah/Funky Dire(tory Name/"
I tend to use all lower-case filenames, and have a very strict directory structure and organisational method.
Last edited by Barrucadu (2008-05-29 08:41:07)
Offline
robmaloy wrote:i never use spaces or brackets, because they always funk up bash scripts (or i'm too stupid to write proper scripts )
There is a simple way around that:
cd "/home/blah/Funky Dire(tory Name/"
I tend to use all lower-case filenames, and have a very strict directory structure and organisational method.
Or just escape those types of characters properly
cd /some\ directory\ with\ spaces/
Same thing for brackets and other special characters in filenames.
As for naming convention, use whatever you like on your system .
Offline
And as for Bash scripting:
$ cat ~/bin/test.sh
#!/bin/bash
ls "$1"
for str in "$@" ; do
echo "$str"
done
$ test.sh "~/Strange Directory" "Foo Bar" "Baz Bin"
<contents of ~/Strange Directory>
Foo Bar
Baz Bin
Last edited by skymt (2008-05-29 19:30:42)
Offline
The only times I tend to put spaces in my directory names is when they're titles, otherwise I tend to keep the names short and with as few words as possible, hence negating the need for spaces.
However, I find them cumbersome, because I use the cmdline quite a bit, and when I do 'ls', the output is hard to read because of the spaces. heh
Offline
There are no rules
On servers, I stick with all lower case, or camel-case in some instances. No spaces.
phillips@bundaberg:/home/phillips$ ls
bash-3.2.tar.gz c dead.letter fs.xfs horror.part3 id_dsa.pub linux-0.01.tar.gz mnt.ext3 scripts
black_and_white.ps clock.sh fs.ext3 horror.part1 horror.part4 iSearch linux1.0 mnt.jfs version-check.sh
burn-cache colour.ps fs.jfs horror.part2 iBrigade linux0.01 linux-1.0.tar.gz mnt.xfs wikipedia_replication
(Go the Linux 0.01!!)
On my desktop, I use "Windows" style with spaces and whatever else I feel like using because Linux will let me use more characters than Windows! This only causes problems when trying to work with Windows, which my desktop doesn't so it's all good
fukawi2@phil-desktop:~$ ls
Activ Rally Sport Download Media TXT's
Downloads Music Templates Firefox_wallpaper.png
Total Annihilation.tar.bz2 Archive Games Network
Videos Audio51 Gnome Customization Visual Basic
nohup.out Pictures Desktop Images
Production Scripts Documents Installers Public
scripts
Are you familiar with our Forum Rules, and How To Ask Questions The Smart Way?
BlueHackers // fscanary // resticctl
Offline
TOTAL ANNIHILATION! That was one sweet game... I sure miss Boneyards haha
@lucke: I see you what you did there....
Arch on a Thinkpad T400s
Offline
TOTAL ANNIHILATION! That was one sweet game... I sure miss Boneyards haha
Oh yeah
Blows that Cavedog went bust
Are you familiar with our Forum Rules, and How To Ask Questions The Smart Way?
BlueHackers // fscanary // resticctl
Offline
I find it's more of a challenge to avoid alphanumeric characters. Using filenames like &(@(@@><$, :-[ or ...... just plain looks cooler.
Last edited by iphitus (2008-06-02 06:49:22)
Offline
You goose
Are you familiar with our Forum Rules, and How To Ask Questions The Smart Way?
BlueHackers // fscanary // resticctl
Offline
IAlwaysCamelCaseMyFilesAndFolders
Be yourself, because you are all that you can be
Offline
I do not like spaces. They are ok on Linux but if you have to share them with other, less modern unix like OS's you can get in trouble. I like underscores.
Offline
Pages: 1