[Linux Internals]: What happens when you type ‘ls -l’ command in the terminal?

  • Terminal is nothing but a wrapper that runs shell (bash or ksh etc) and allows us to enter commands
  • Shell breaks down the commands entered by parsing
  • It checks for shell expansion ( ex: ls * ) [ Resource: https://www.gnu.org/software/bash/manual/html_node/Shell-Parameter-Expansion.html ]
  • It checks for aliases for that command
  • Tries to find the location of the command by searching under $PATH
  • If it finds, it executes it!
  • During the execution, libraries required by the program are loaded into the memory at the run time; If you run “ltrace or strace” on the command you can see library calls like mmap() [strace for system calls / ltrace for library calls]. Loading of libraries can happen through dynamic loading or static loading. Shell will use system calls to load these libraries while running the command.

Interesting resources:



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store

Passionate about problem solving; #VoraciousReader #MBTIEnthusiast #LovePsychology