dev notes

software development craftsmanship

#BlackLivesMatter

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?

ubuntu

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

or try

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

gentoo

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

ubuntu

$ dpkg -L coreutils | grep /usr/bin | head
/usr/bin
/usr/bin/[
/usr/bin/arch
/usr/bin/b2sum
/usr/bin/base32
/usr/bin/base64
/usr/bin/basename
/usr/bin/chcon
/usr/bin/cksum
/usr/bin/comm]

gentoo

using the app-portage/gentoolkit

$ equery files coreutils -f cmd | head
/bin/basename
/bin/cat
/bin/chgrp
/bin/chmod
/bin/chown
/bin/chroot
/bin/cp
/bin/cut
/bin/date
/bin/dd