dev notes

software development craftsmanship


Linux is an operation system, released on September 17, 1991 by Linus Torvalds. If you want to install linux, you can choose a distribution , which fits your needs. When you are working for a company, it is often the case, that you can't change the operation system. So I will focus on the commands, which are most commonly present on every installation, or which can be easily installed by a package manager. This will lead to a distribution independent environment.

Filesystem Hierarchy Standard

Almost everything on a linux system can be accessed via a file. These files should be placed within certain directories, defined in the Filesystem Hierarchy Standard , which is managed by the linux foundation .

This is a incomplete list of some base folders within a linux system.

directory description
/ filesystem root.
/boot boot loader, kernels, initrd. often as a own partition.
/dev all devices, like hard drives, cpus ect.
/proc virtual file system, amongst other things displaying processes as files.
/tmp temporary files, which may be deleted after system reboot.
/etc system-wide configuration files.
/home user home directory, which has often an own mount point.
/mnt temporary mounted file systems like usb drives.
/opt optional software packages.
/root root home directory.
/sbin . ip or init system binaries like
/bin . mv or ls , cp single user mode commands like
/usr installation target for distribution packages.
/var files, which may change over time like log files.

More or less all distributions out there will use these directories in a proper way. Your development environment will be found in your home folder. Packages like htop will use the information from the /proc folder to show all running processes in a convinient way.

distribution specific

From time to time, you might execute some tasks which are distribution specific. Hopefully, this is will stay a small list. I will take it as small as possible.

command belongs to which package?


$ dpkg -S /usr/bin/head
coreutils: /usr/bin/head

or try

$ command -v head | xargs dpkg -S 
coreutils: /usr/bin/head


using the app-portage/gentoolkit

$ equery belongs /bin/head 
* Searching for /bin/head ... 
sys-apps/coreutils-8.31-r1 (/bin/head)

list all commands for a package


$ dpkg -L coreutils | grep /usr/bin | head


using the app-portage/gentoolkit

$ equery files coreutils -f cmd | head