this post was submitted on 31 Aug 2024
210 points (97.3% liked)

Linux

48061 readers
698 users here now

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

founded 5 years ago
MODERATORS
 

As far as I know there are these;

  • Camel case = coolFileName
  • Snake case = cool_file_name
  • Kebab case = cool-file-name
  • Pascal case = CoolFileName
  • Dot notation = cool.file.name
  • Flat case = coolfilename
  • Screaming case = COOLFILENAME

Personally I prefer the kebab/dot conventions simply because they allow for easy "navigation" with (ctrl+arrow keys) between each part. What are your preferences when it comes to this? Did I miss any schemes?

(page 2) 50 comments
sorted by: hot top controversial new old
[–] lnxtx@feddit.nl 6 points 2 months ago

Depends. Java-like languages ofc camel/pascal case.
Bash, Python, etc., snake case, with constants as uppercase.
Filenames: I prefer snake case.

[–] Cris16228 5 points 2 months ago* (last edited 2 months ago)

Both snake and camel case. Sometimes I mix it in the same project and I hate myself for it

[–] ZombiFrancis@sh.itjust.works 5 points 2 months ago

Pascal_Snek_Case

[–] jjjalljs@ttrpg.network 5 points 2 months ago

Snake case, usually. Some perhaps unfounded fear that something will blow up on a dash in a file name kicking around. Or I'll do a weird typo/premature enter and part of the file name will be treated like a -flag of some sort.

[–] fatalicus@lemmy.world 5 points 2 months ago (1 children)

Whatever case I get when my finger reaches the shift key.

load more comments (1 replies)
[–] olafurp@lemmy.world 5 points 2 months ago

I kebab case mine for personal files.

It's mostly because I don't have to use a modifier key and it's doesn't need url encoding and all in the same lowercase. Dot notation looks nice but I feel like dots are for extensions only. Flat case is horrible to read, screaming case even worse, camel/pascal case to many times ends up as coolFileNAme on first time typing.

I've done a couple of different styles because of programming in different languages but now if I have to do anything that's not kebab case I make a small frown.

[–] whoisearth@lemmy.ca 4 points 2 months ago

Snake if writing in python

Camel if writing in PowerShell

I tend to stick with what the language wants me to use.

[–] thedeadwalking4242@lemmy.world 4 points 2 months ago

Camel case for short names snake case if it starts getting hard to read

[–] navi@lemmy.tespia.org 4 points 2 months ago (2 children)

I don't like it but I am used to reading old C codebase (windows: https://learn.microsoft.com/en-us/windows/win32/stg/coding-style-conventions) with Hungarian notation.

pszMyString 😥

load more comments (2 replies)
[–] Uncle_Abbie 4 points 2 months ago

For files, date+Snake: 20240831Letter_to_Rodney.odt For variables, Screaming

[–] possiblylinux127@lemmy.zip 4 points 2 months ago
[–] Jessica@discuss.tchncs.de 4 points 2 months ago (1 children)

I've got one more to add to your list, and I hate it, but it's worth mentioning: https://en.m.wikipedia.org/wiki/Hungarian_notation

It's when the data type is in the name of the variable.

load more comments (1 replies)
[–] GissaMittJobb@lemmy.ml 4 points 2 months ago

General purpose: Kebab case

But really, follow the conventions of what you're working on. For example, I'd use pascal case when working on a Java/Kotlin project, and snake case when working on a Python project.

[–] featured@lemmygrad.ml 4 points 2 months ago

If it’s something that will be mostly interacted with over CLI then kebab case. If GUI then spaces

[–] kyub@discuss.tchncs.de 4 points 2 months ago

code: camel or snake, depending on language

files/dirs: snake + kebab + dot mixture (trying to avoid caps and special chars here)

[–] Tovervlag@feddit.nl 4 points 2 months ago

I generally end up using snake case.

[–] thingsiplay@beehaw.org 3 points 2 months ago (1 children)

I don't have a consistent style for everything and it depends on the circumstances. snake_case is often used, especially to avoid spaces. Sometimes I just do flatcase instead, and in rare cases also kebab-case or combined_snake-and-kebab-case. The combined_case is often useful to group parts of the name, like a dates and version numbers together and to indicate what part is constant; example-name_2024-08. Sometimes I also do the "Title Case", which is basically PascalCase, but with spaces. Or even even more weird, "Python_Case", which is PascalCase, but with snake_case, when I want to avoid spaces.

I often avoid dots in regular filenames, unless they indicate a file extension or format, such as ".svg" and ".inkscape.svg" to indicate its a specific version of the SVG format. Or ".xiso.iso", as a specific compressed version of the regular ISO file (for use with Xemu emulator). Basically the same logic and tradition as ".tar.gz" (but in reverse order).

[–] Rhaedas@fedia.io 3 points 2 months ago

I don't like extra dots simply because pattern matching might get weird down the road. Keep dots for extension type and use Pascal to make it easier to read multiple words. Flatcase only if it's short or I'm lazy for a temp file.

[–] saigot@lemmy.ca 3 points 2 months ago* (last edited 2 months ago)

FileName_IMPORTANTCATEGORIZATION.yyyy.ext

With all bits being optional (not every file needs the date it refers to)

So eg (slight modifications for anonymity):

SunLifeInsureance_SIGNED.2024.Q1.pdf

SpotDoesTrickAndFalls_ORIG.mp4

JSmithPassport_CANADA.2015_2025.pdf (I am a dual citizen)

JSmithCOVIDPass_DOSE1.2021.pdf

[–] Gobbel2000@programming.dev 3 points 2 months ago

Snake case and kebab case mixed arbitrarily.

[–] flashgnash@lemm.ee 3 points 2 months ago* (last edited 2 months ago)

Have been defaulting to kebab case for variable and function names in all languages recently because of cargo yelling at me

Pascal case for class names cause c#, snake case for python files because it doesn't like kebab

Screaming case for env files because that's what everybody else does

[–] harsh3466@lemmy.ml 3 points 2 months ago

Depending on the file it’s either dot notation or flat case.

[–] BaumGeist@lemmy.ml 3 points 2 months ago

1337 case = k3wlf1l3n4m3

[–] GustavoM@lemmy.world 3 points 2 months ago

I go with the "quotation case", "Cool file name".

[–] uzay@infosec.pub 3 points 2 months ago (1 children)

Snake case or kebab case I guess. But why is it called kebab case?

[–] elfahor@lemmy.blahaj.zone 3 points 2 months ago (1 children)

Because it looks like the words are on a rod, like kebab meat

[–] uzay@infosec.pub 4 points 2 months ago (2 children)

Huh thanks,, I guess it's based on a misunderstanding of the word kebab then. Correctly it would have to be called şiş/shish case then, but that certainly has less of a ring to it.

load more comments (2 replies)
[–] Lettuceeatlettuce@lemmy.ml 3 points 2 months ago

I try to make everything Pascal case. It's easy to read in a terminal and pretty easy to type.

[–] Charadon@lemmy.sdf.org 3 points 2 months ago

PascalCaseForTheWin

[–] ricdeh@lemmy.world 3 points 2 months ago

Snake case for all kinds of file names and camel case for programming

[–] model_tar_gz@lemmy.world 3 points 2 months ago (2 children)

stOcHaStIC-l33t-CasE FTW yizzo.

load more comments (2 replies)
load more comments
view more: ‹ prev next ›