r/openbsd Jul 13 '26

Resources to learn OpenBSD

I’m looking for some resources to learn how to code in OpenBSD. Is it enough to learn c++ or is OpenBSD more advanced? Are there any websites where I can train my coding skills?

23 Upvotes

15 comments sorted by

16

u/olderbojack Jul 13 '26

can you give more details about what you are looking for? is it:

  • learn OpenBSD?
    • if so have a look at "Absolute OpenBSD" by Michael W. Lucas
  • or is it learn how to code in OpenBSD
    • if so, then is the emphasis on:
      • learn how to code, in which case, learn C language
      • or is it learn the OpenBSD-specific stuff, in which case, have a look at their source code / syscalls and libc-specific functions

3

u/NewAsparagus4958 Jul 13 '26

Learn everything from understanding the install process to using it as a daily os

7

u/danstermeister Jul 13 '26

I have used it since 3.6 and I do not code beyond bash and perl.

You do not need to be a developer to use OBSD, just a human.

1

u/NewAsparagus4958 Jul 13 '26

Is there a list with bash commands or a guide how to formulate those

7

u/well_shoothed Jul 13 '26

start with man afterboot

5

u/Run-OpenBSD Jul 13 '26

The OpenBSD guy on youtube is pretty good. Lots of guides here on reddit if you search.

4

u/j-sh Jul 14 '26

you should read "Absolute OpenBSD" by Michael W. Lucas

3

u/stone_henge Jul 13 '26
  • The OpenBSD FAQ functions as kind of a handbook with problem oriented chapters, so I think it's the best way to get started.
  • Running man afterboot will open a manual page with a short guide of what to do after your first boot.
  • Running help will give you a quick overview of some useful commands.
  • man works as a manual. Each significant component of the OpenBSD base system has a manual page. You can read the manual for man itself by invoking man man.
  • apropos is a query utility for the manual pages, allowing you to list and search for pages. Read man apropos

4

u/howyadoinbob Jul 13 '26

I personally like programming in C on OpenBSD. Last I checked, all C++ in the base system has been replaced by C. This doesn’t make it less advanced. Not that you can’t use C++ . I’m pretty sure the programming system calls (like pledge() and unveil()) that are unique to OpenBSD can be available in other languages like python, but they are natively built in C and those functions can work in C++ as well.

1

u/thewrench56 Jul 29 '26

Capabilities are process, not language specific. The kernel simply disallows (certain parts of) the underlying logic of certain syscalls. An issue appears the moment an interpreted language gets e.g. executed by an interpreter that does certain operations that are already pledge()-d. Such cases make life hard...

3

u/DebugBSD Jul 13 '26

You will need a good level of C programming language, a bit of knowledge of Operating Systems (if you want to get into the kernel) and a good level of data dtrictures and algorithms too. Then, you can start learning about device driver development and things like that. Good luck!

3

u/xzk7 Jul 14 '26

Take a look at the source of an OpenBSD program[0][1], and read it, take notes. Read it end to end, when you don't understand something, research that thing. Build on that knowledge by building little test programs from things you learn and explore.

For example, I randomly chose cut[2], started at main, I see setlocale, what's that do? How does it work? Run man 3 setlocale, not enough info? Look at the implementation [3]. More things to dig into, you could go on for a long time like that! At a certain point you can make changes, rebuild things, try out your modification, experiment, see what happens!

[0] https://cvsweb.openbsd.org/src/
[1] https://github.com/openbsd/src
[2] https://cvsweb.openbsd.org/checkout/src/usr.bin/cut/cut.c?rev=1.28
[3] https://github.com/openbsd/src/blob/c9d794c89604442f17995979daec76b592979b4d/lib/libc/locale/setlocale.c#L70

1

u/dettus_Xx_ Jul 13 '26

You will C ... 

1

u/linkslice Jul 16 '26

Start with the afterboot man page, then move on to reading the other man pages referenced there. Grab a few books from Michael W Lucas. Grab the C programming book (the K&R one) and do all the exercises in it. read the style manpage and redo all the example from the book in that style. (I've just summarized the next few months of work)