Piping is one of the core concepts of Linux & Unix based operating systems. Pipes allow you to chain together commands in a very elegant way, passing output from one program to the input of another to get a desired end result. Here’s a simple example of piping: ls -la | sort | less The […]
Linux Internals
Understanding how Linux creates processes
A friend recently read my post on how bash redirection works, but didn’t quite understand my explanation of how bash launches another process and sets stdin/stdout/stderr, so this is a follow up post. Linux creates every process using the fork(2) or clone(2) syscalls. The only way to create a process is to fork your current […]
So what is /proc anyways?
I’ve been using Linux for years, but I’ve never really known was /proc was or why certain commands used it. I’m not sure why I’ve never looked it up in the past, but I recently did and I thought I’d share. /proc isn’t a “real” directory, in the sense that it doesn’t exist on disk. […]
How bash redirection works under the hood
Have you ever wondered how bash redirection works under the hood? Redirection itself is pretty straightforward. Using bash, you can redirect a file to a process’ stdin, or redirect a process’ stdout/stderr to a file or other file descriptor (including things like redirecting stderr to stdout, because both are file descriptors). Redirection looks like this: […]