Skip to main content

Questions tagged [conventions]

Naming conventions and best practice

Filter by
Sorted by
Tagged with
0 votes
1 answer
52 views

Use underscore or hyphen for a CLI utility name?

I'm creating a CLI utility which is aimed at *nix OS:es. Let's call it 'Super CLI Project'. Looking at the latest POSIX Issue 7, 2018 edition - https://pubs.opengroup.org/onlinepubs/9699919799/ - ...
Beamie's user avatar
  • 103
0 votes
2 answers
75 views

Setting Application Defaults in Linux /etc/default

I posted this question over in ServerFault, but it isn't getting any answers. What does the group assembled here think? I've looked in the local Confluence docs and it's been this way for like ten ...
Chris K's user avatar
  • 60
2 votes
1 answer
362 views

Dot file and an adjacent identically named file without dot?

Is it bad practice to have a dot file and an adjacent identically named file without dot? Background: We already create a $HOME/.ourapp directory where we store various configuration files, log files,...
Adám's user avatar
  • 191
0 votes
0 answers
44 views

Linux so convention: is the .so link intended to come from dev packages?

On my Ubuntu jammy Linux PC, after installing the libuv1 package (apt-get install libuv1), I noticed that there was a file, named libuv.so.1.0.0 and a symbolic link to it, named libuv.so.1: $ find /...
StoneThrow's user avatar
  • 1,797
0 votes
0 answers
21 views

/tmp and /var/tmp as tmpfs and volatility [duplicate]

The use of separate file systems for different paths can protect the system from failures resulting from a file system becoming full or failing. Check that a file system/partition has been created for ...
ron's user avatar
  • 7,264
0 votes
0 answers
17 views

trixie/sid/testing:Debian Trixie Variant Displaying as 'trixie/sid': [duplicate]

I currently have Debian Trixie installed on my system. When I run the command lsb_release -a, it returns the output Description: Debian GNU/Linux trixie/sid. However, I was under the impression that &...
111's user avatar
  • 140
2 votes
4 answers
289 views

Function's comment is not printed out when putting it before the function's header

A good and well-established guideline for commenting a shell function is to put it before the function's header. I am trying to follow these guidelines as much as I can, but this convention makes it ...
Rubem Pacelli's user avatar
0 votes
0 answers
65 views

Is there a character convention for representing stderr?

By convention, stdout is -. Is there something similar for stderr?
midrare's user avatar
  • 153
0 votes
1 answer
136 views

Conventions for the PATH variable's value

I am looking for best practices, or at least conventions, for the PATH variable's value. In particular, I would like to know is there any preferred/recommended ordering for the /bin, /usr/bin, and /...
kjo's user avatar
  • 15.6k
0 votes
1 answer
53 views

best practices for adding my own tools and configuration

So, I am currently writing some scripts to gather and bulk report break-in attempts on my server. The scripts itself are working, but I am wondering where I should put my config files and the script ...
siryx's user avatar
  • 95
1 vote
1 answer
2k views

What's the difference between device properties and device attributes in udev?

For udev device entries, what is the technical difference between a "property" and an "attribute"? How are they customarily created (generated?) and used? Which one is the better ...
Bergi's user avatar
  • 115
0 votes
0 answers
50 views

Why Linux uses `blah' to quote strings by convention? [duplicate]

While I was reading the document of some Linux utilities, I found that they always quote strings using ` and '. For example, below is an excerpt from the man page of the find utility. -exec ...
Fajela Tajkiya's user avatar
2 votes
3 answers
820 views

Display a message in color by a conventional color name such as Red, Green, Blue, etc

WSL with Ubuntu 18.04 and GNU bash, version 4.4.20(1)-release (x86_64-pc). I wish to display a message with a conventionally named color via argument such as -red, or -green, or -blue or anything like ...
Lahor's user avatar
  • 123
0 votes
2 answers
1k views

Where should I source /usr/local/etc/profile from? .bash_profile or /etc/profile?

I know that, by default, bash will source /etc/profile and ~/.bash_profile. Now, suppose I also have machine-specific profile commands in /usr/local/etc/profile (involving stuff that's in /usr/local, ...
einpoklum's user avatar
  • 9,653
2 votes
1 answer
44 views

Is it good practice to add the manpage section number to POSIX tools when referring to them? [closed]

I sometimes see people referring to tools, like ls append the manpage section number in parens, like the manpages themselves do (in ls's case ls(1)) in prose/text like answers and comments here on ...
Andreas's user avatar
  • 21
0 votes
2 answers
239 views

How to sort filename list (txt-file) by sub-strings of the filename/path with multiple levels. Special challenge: Two types of filename conventions

I'd like to sort the following list of filenames / pathes. L1_Data/level1/192027/LC08_L1TP_192027_20201126_20210316_01_T1 DONE L1_Data/level1/192028/LC08_L1TP_192028_20201126_20210316_01_T1 DONE ...
jaysigg's user avatar
  • 111
0 votes
0 answers
203 views

What does (or did) the name "feh" represent?

To me, the name of the feh image viewer is not memorable enough for me to recall it when I need it. I feel that if I had some context, I'd be able to remember it better. What, if anything, does the ...
Steve V.'s user avatar
  • 965
-1 votes
1 answer
69 views

Is there a convention for naming and placing the manual page file for a command in source tree?

I think the name could be in format <command_name>.<section_number> where the numbers are shown in the description chapter of man man. I use doc directory for the file in a repository.
jarno's user avatar
  • 630
2 votes
1 answer
304 views

When desiginng a CLI is there a preference/rule of thumb for using an option or a subcommand? [closed]

For example, to install a package with pacman one would use: pacman -S <package> While somebody using dnf would type: dnf install <package> While pacman uses the -S option, dnf uses the ...
AlpGlide3's user avatar
2 votes
2 answers
566 views

How to choose an appropriate error prefix? [closed]

How can I figure out appropriate error prefixes to use when reporting various kinds of errors? Is there are guideline or overview of how these should be? I see patterns in many commands, but find it ...
Olav Fosse's user avatar
0 votes
2 answers
614 views

Is it a good practice to use aliases? [closed]

I have a colleague who likes to use aliases instead of writing scripts, but I don't want to do this. First, you need to set the same alias on each computer. They behave differently on different ...
daohu527's user avatar
  • 111
0 votes
1 answer
2k views

command-line argument conventions for stdin, stdout

I'm writing a command-line tool that takes a file and modifies its contents. I would like the user interface to be as canonical as possible. So far, I have $ foobar -h usage: foobar [-h] [--version] [...
Nico Schlömer's user avatar
4 votes
1 answer
2k views

How to organize /opt?

I'd like to place a handmade script in its conventional place and folder structure. It's currently located in /opt/chkobm/chkobm, but it seems like a bad practice since it requires $PATH to include ...
Sumak's user avatar
  • 263
0 votes
1 answer
381 views

Can I add arbitrary directory to icon search dirs?

Linux desktop environments such as GNOME, KDE, XFCE etc search icon themes in some standard paths such as /usr/share/icons, ~/.icons, ~/.local/share/icons etc. I wonder if I can add any directory to ...
Anwar's user avatar
  • 123
0 votes
1 answer
821 views

why aliases found in root users ~/.bashrc file are not used for standard users by default?

Is there any reason why aliases like alias rm='rm -i' found in the ~/.bashrc file of user root are not used by default for any other users?
user211245's user avatar
1 vote
2 answers
2k views

Naming convention of worker threads

I started reading about worker threads. Old Legacy worker threads is replaced with worker pools. $ ps -ef | grep 'kworker' root 6 2 0 04:41 ? 00:00:00 [kworker/0:0H-kb] root ...
md.jamal's user avatar
  • 291
-2 votes
2 answers
1k views

Debian packages naming, documentation is self-contradicting

Debian policy manual (released on 2019-10-03) clearly states that "Package names (both source and binary, see Package) must consist only of lower case letters (a-z), digits (0-9), plus (+) and minus (-...
Александр Чайка's user avatar
-1 votes
2 answers
798 views

Use of a specific character for commenting, like e.g. #, in config files depends on...? [closed]

I need help settling a discussion about comments in configuration files. This is about the question "what dictates which character/string is used for commenting in any given program?" Theory A) ...
Bennypr0fane's user avatar
31 votes
10 answers
9k views

one-liner vs script

I've noticed a lot of questions and answers and comments expressing disdain for (and sometimes even fear of) writing scripts instead of one-liners. So, I'd like to know: When and why should I write a ...
cas's user avatar
  • 79.2k
1 vote
3 answers
1k views

What are the conventional meanings for symbols used to show commands' syntax?

I am looking for some sort of "syntax key" for command line tools on GNU/Linux, something like this document that Microsoft has: https://docs.microsoft.com/en-us/windows-server/administration/windows-...
bitseeker's user avatar
0 votes
1 answer
2k views

Why doesn't CTRL + C exit vim? [duplicate]

I'm aware that if I press esc followed by typing :q!, I can exit the vim editor, due to this question. However, the standard convention is for programs to exit when ctrl + c is pressed, which sends a ...
starbeamrainbowlabs's user avatar
2 votes
1 answer
100 views

How to differentiate an executable sh file, and a source sh file?

I have sh files that are executable, and others that are only meant to be sourced by executable ones. On the executable ones I use no extension at all, and have the first line as #! /bin/sh. On the ...
alx - recommends codidact's user avatar
3 votes
1 answer
1k views

When did user accounts using UIDs above 1000 become normal? And why?

We have a really old NIS domain which is mapping some user accounts to UIDs less than 1000. I'm wondering when did using UIDs greater than or equal to 1000 for human users become 'standard', why did ...
Samuel Harmer's user avatar
-1 votes
3 answers
285 views

Why is it uncommon for stdin inputs to have option-like inputs, while common for command line arguments?

POSIX and GNU have their syntax styles for options. For all the commands that I have seen, they accept option-like inputs as command line arguments. Is it uncommon for a program to accept option-...
Tim's user avatar
  • 103k
7 votes
3 answers
4k views

Will it be bad that a function or script name contains dash `-` instead of underline `_`?

If I name a function or script with dash - instead of underline _ between words, would that be bad? For example, function duplicate-me() or duplicate-me.sh. In bash, a variable name can contains ...
Tim's user avatar
  • 103k
3 votes
1 answer
444 views

GRUB Partion Naming Conventions

In the GNU GRUB info pages in the Ubuntu 16.04 LTS distro, the naming convention for partitions seemed straight forward with the following definition: (hd0,msdos2)   Here, 'hd' means ...
Chezzwizz's user avatar
  • 133
3 votes
1 answer
3k views

What is the numbering convention in .conf files(inside a conf.d)?

Inside the xorg.conf.d/ for example, we have three files: 00-keyboard.conf 10-monitor.conf 30-touchpad.conf I know that the 2-digit number determine the precedence that each file is read so 00-...
Gabriel Manoel's user avatar
4 votes
1 answer
1k views

why are the folders under /home/$USER/ typically uppercased when all other folders are lowercased

Other than a short dalliance with Arch, my linux experience has been with Debian/Ubuntu based distros, so maybe that answers my question... I know I can rename /home/$USER/Download to anything I want,...
kevcoder's user avatar
  • 485
2 votes
2 answers
3k views

What do you call the calling convention behind `int 0x80`?

I know there is a syscall convention but what do you call the calling convention that precedes it that you see when you call to int 80 rather than syscall, like this. mov rax,4 ; system call ...
Evan Carroll's user avatar
  • 31.8k
5 votes
1 answer
3k views

FreeBSD vs Linux: performance of kernel calling conventions

From int80h.org, the FreeBSD Assembly Language Tutorial [The Linux Calling] convention has a great disadvantage over the Unix way, at least as far as assembly language programming is concerned: ...
Evan Carroll's user avatar
  • 31.8k
2 votes
1 answer
429 views

awk : best practice for loop variable naming [closed]

The following code results in an infinite loop because awk doesn't support local variable in { … } scope. #! /usr/bin/gawk -f function myfunction() { for (i = 5; i < 8; i++){ print "...
Firmin Martin's user avatar
2 votes
1 answer
462 views

What is the usual single letter flag denoting an IP address in a commandline option? [closed]

I noticed in most programs that I use that read in IP addresses, they either use no option flag to denote IP address and it is just part of the default input (like ssh, scp, ifconfig, etc...) or it is ...
Peter Turner's user avatar
  • 1,694
13 votes
2 answers
3k views

When to use standard error stream in command-line application?

Is there a guideline when to use the error when writing a command-line application? To my surprise, I didn't find anything when googling it. In particular, the question I'm concerned with right now ...
UTF-8's user avatar
  • 3,287
21 votes
2 answers
5k views

An official standard / convention for a file extension for shell scripts to source

I was wondering if there is a convention for file type extensions for shell scripts you want to source instead of run. For example: If I want to run this script in a subshell. ./script.sh If I ...
Mateusz Piotrowski's user avatar
1 vote
2 answers
398 views

Mount point for system-wide USB disk

I have a USB disk connected to a server computer which is mounted when the computer starts. I'm thinking that it's not ideal to mount it under the /media directory since it could potentially lead to a ...
August Karlstrom's user avatar
66 votes
8 answers
15k views

Why does Bash's source not need the execution bit?

With Bash's source it is possible to execute a script without an execution bit set. This is documented and expected behaviour, but isn't this against the use of an execution bit? I know, that source ...
Motte001's user avatar
  • 1,220
2 votes
0 answers
37 views

epstopdf loose greek symbole

I'm generating a pdf using gnuplot this way: set term postscript color eps enhanced 15 set out '| epstopdf --filter --outfile=SD.pdf' replot set out Whereas the eps file generated contains the ...
Éric's user avatar
  • 121
3 votes
1 answer
157 views

How to determine program success when running a sequence of similar tasks?

I am writing a series of CLI tools that share the same parent command, similar to programs like git. program verb OPTIONS One of the action verbs, install, is designed to git clone as many ...
j--'s user avatar
  • 437
6 votes
2 answers
3k views

How are log files named?

Or what can we infer from the names of log files? For example, when I want to check the Xorg logs, I find three files: Xorg.0.log Xorg.0.log.old Xorg.1.log You can also find many such log ...
daltonfury42's user avatar
13 votes
2 answers
6k views

Convention/standard on using curly braces around options

The man page for tar in Arch Linux SYNOPSIS section starts with: tar {A|c|d|r|t|u|x}[GnSkUWOmpsMBiajJzZhPlRvwo] [ARG...] I perfectly understand that in this situation it means that exactly one of the ...
umbasa's user avatar
  • 139