Linux commands storage

Date Published: Sat Sep 03 2022
vagrantvirtual-boxarm-64

Linux commands file system

Everything in Linux is file based. all the commands that we use in terminal is file based and are actually stored in a folder.

In Linux based file system / is the starting folder and all the necessary information is stored in this folder only.

commands are stored in the /bin/ & /sbin/ folder.

To verify if every commands is stored in file run this command in terminal.

which ls
ls -la /usr/bin/ls
<img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1662301139209/ywBuLQhKk.png" alt="ls command" width="90%"/>

You can even create your own commands.

sudo cp /usr/bin/ls /usr/bin/ls_new
new_ls
which new_ls
<img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1662301147379/2K_E7_ert.png" alt="commands" width="90%" />

Difference between bin and sbin

  1. In bin folder user specific command are stored.
  2. In sbin folder root user commands are stored which can accessed by root user or by using sudo

see examples.

<img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1662213774393/1uJySUtJ7.png" width="90%" alt="commands demo" />