1

I know, you have to know C programming language and have deeper insight of how operating systems work, but what if you are just someone with a basic understanding of programming languages, shell scripting and command line, is there some knowledge about the Kernel worth knowing to benefit from it even with lesser abilities?

closed as primarily opinion-based by Jeff Schaller, phk, dr01, Stephen Kitt, Kusalananda May 18 '17 at 18:22

Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise. If this question can be reworded to fit the rules in the help center, please edit the question.

2

Being in that linux user category, I had been asking myself this question too.

The first thing that springs to mind is strace (man page).

Knowing parts of the kernel can give you insight in figuring out how to explain strace's output and debug your code even further from just its regular logs.

For example, this is the ouput of strace cat text.txt, where text.txt contains the sentence my name is test.

execve("/usr/bin/cat", ["cat", "test.txt"], [/* 76 vars */]) = 0
brk(0)                                  = 0x1e4f000
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f1b8ecd4000
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=138212, ...}) = 0
mmap(NULL, 138212, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f1b8ecb2000
close(3)                                = 0
open("/lib64/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0@\34\2\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=2118128, ...}) = 0
mmap(NULL, 3932672, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f1b8e6f5000
mprotect(0x7f1b8e8ab000, 2097152, PROT_NONE) = 0
mmap(0x7f1b8eaab000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1b6000) = 0x7f1b8eaab000
mmap(0x7f1b8eab1000, 16896, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f1b8eab1000
close(3)                                = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f1b8ecb1000
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f1b8ecaf000
arch_prctl(ARCH_SET_FS, 0x7f1b8ecaf740) = 0
mprotect(0x7f1b8eaab000, 16384, PROT_READ) = 0
mprotect(0x60b000, 4096, PROT_READ)     = 0
mprotect(0x7f1b8ecd5000, 4096, PROT_READ) = 0
munmap(0x7f1b8ecb2000, 138212)          = 0
brk(0)                                  = 0x1e4f000
brk(0x1e70000)                          = 0x1e70000
brk(0)                                  = 0x1e70000
open("/usr/lib/locale/locale-archive", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=106070960, ...}) = 0
mmap(NULL, 106070960, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f1b881cc000
close(3)                                = 0
fstat(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 0), ...}) = 0
open("test.txt", O_RDONLY)              = 3
fstat(3, {st_mode=S_IFREG|0664, st_size=16, ...}) = 0
fadvise64(3, 0, 0, POSIX_FADV_SEQUENTIAL) = 0
read(3, "my name is test\n", 65536)     = 16
write(1, "my name is test\n", 16my name is test
)       = 16
read(3, "", 65536)                      = 0
close(3)                                = 0
close(1)                                = 0
close(2)                                = 0
exit_group(0)                           = ?
+++ exited with 0 +++

All system calls are visible above, so, if you have some knowledge of the kernel, you have more clues in debugging your code.

1

This gives you a view, and in some cases it's good to know the kernel type, architecture, modules, ... and their compatibility or ...

Not the answer you're looking for? Browse other questions tagged or ask your own question.