File system of linux

linux/unix file system manual (online)

Install APP

Package Manager

Windows softwares are downloaded from website, but each linux distribution hosts its own software repositories. These repositories contains software packages specifically for each linux distribution. We could think the “repositories” for linux is like “Apple Store” for iPhone.


Like exe files for windows, Linux has it own types: DEB on Debian and Ubuntu, RPM on Fedora and Red Hat, etc.They are essentially archives contains a list of files. Therefore the installation process just copy the files into the location where the package specifies.

In ubuntu, you would install package via apt-get install package-name, which will lookup package from their own repositories. Ubuntu offers various personal package archives (PPAs) for 3rd application installation as well, but you are responsible for the risk to install them.

SysV vs Systemd vs Upstart

System services, often called daemons in the Linux and UNIX can be implemented in multiple ways for service management.

service managed by systemd:

$ sudo systemctl start service-name
$ sudo systemctl status service-name
$ sudo systemctl stop service-name
$ sudo systemctl enable service-name // enable auto start when startup
$ sudo systemctl disable service-name
$ sudo systemctl show service-name // show all infomation

the script to start service can be located in /usr/lib/systemd/system or /etc/systemd/system to find out where the script is located:

locate name.service // or the 'show command above'

Script Details

Reference Link

root@ubuntu1604# systemctl cat sshd.service

# /lib/systemd/system/ssh.service
Description=OpenBSD Secure Shell server auditd.service

ExecStart=/usr/sbin/sshd -D $SSHD_OPTS
ExecReload=/bin/kill -HUP $MAINPID


Tag meaning:

After/Before: the order of the service should be, after or before a list of services;

Type: can be simple/forking/oneshot/dbus/notify/idle

Restart: can be set in [Service], to indicate how systemd should restart this service,

  no: no restart
  on-success: will restart when exit code is 0, normal exit;
  on-failure: exit code is not 0
  on-abnormal: temSignal or timeout, will restart
  on-abort: ¯\_(ツ)_/¯
  on-watchdog: timeout exiting, will restart
  always: always