Nik's wiki

Unix

A family of operating systems that derive from the original AT&T's Unix.

Unix philosophy:

  1. Write programs that do one thing and do it well
  2. Write programs to work together
  3. Write programs to handle text streams, because that is a universal interface

Learn

POSIX

Portable Operating System Interface. A standard for maintaining compatibility between operating systems.

Defines:

See also Single UNIX Specification.

Sockets

A Unix socket is a communication endpoint for exchanging data between processes. The difference between Unix sockets and network sockets is that the latter can exchange data over the network. Unix sockets are faster, which makes them the better option for communication on the same host.

Unix sockets are a part of the POSIX standard.

Standard files

Redirect:

Soft and Hard links

A soft link is another file that contains the path to the original file. If the target is moved or deleted, the link "hangs". The closest analogy is pointers in programming.

💡 Hint
Use readlink to get the path a soft link points to.

A hard link is a direct reference to the actual data on disk (called inode). Every filename is a hard link by design. Hard links allow multiple files to reference the same content without wasting disk space. The actual data won't be deleted until all the hard links pointing to it are deleted.

✏️ Note
mv just changes the hard link without touching the inode.

💡 Hint
Use ls -i to print inode numbers.

Unix links

Filesystem

Directory permissions

For directories, permission bits have different meanings:

Because of the (x) meaning, directories are usually created with 0755 instead of 0644.

XDG Base Directory

Specification

Cron

https://crontab.guru

cron is a general name for the service that runs scheduled jobs. crond is a daemon that runs in the background and reads crontab files. crontab is a tool to edit crontab files.