A simple shellcode that will kill all your processes GNU/Linux x86_64
Now I would like to know, can it be done in some better way? It contains 13 bytes.


From this I conclude that by better you mean shorter.

You can easily bring this down to 11 bytes if you duplicate the method that was used to fill RSI for the setup of RAX.

push 0x3e
pop  rax
dec  rdi
push 0x9
pop  rsi
syscall




The instruction dec rdi depends on the existing value of RDI.
If you know that its lowest 32 bits are non-zero, then you can write dec edi instead, and lose the REX.W prefix. ( -> 10 bytes)

push 0x3e
pop  rax
dec  edi
push 0x9
pop  rsi
syscall




But the most important improvement you can make is of course writing comments.
For now those numbers 0x3E and 0x09 are just magic numbers. What do they mean?
That's what everyone that reads your code is interested in knowing.