# Linux Commands Part 9 - 10

Tags: linux-com-book

* User accounts are defined in the `/etc/passwd` file
* groups are defined in the `/etc/group` file

![file types](/files/kucT186DiPoDjMuijCcq)

![permission attributes](/files/fOkCYssSWSTZ3IeqEhTS)

![chmod permission symbolic notation](/files/0g9O73WmCWhPOQycy3TR)

![chmod notation example](/files/AR4tzpGnXfLa3wRQl2fk)

![file permission in octal](/files/ZHUxizpCuXYvw2XDFPOS)

### chown and chgrp

* `chown` : to change the file ownership&#x20;
* `chgrp` : to change the group

`d|rwx|rwx|rwx`

* d : directory
* 1st block for user
* 2nd block for group (of user)
* 3rd block for other

```
chmod u=rwx test.sh
chmod g=rwx test.sh
chmod o=rwx test.sh
chmod go-wx test.sh
chmod 744 test.sh
```

numbering system : read = 4 write = 2 exec = 1

## Processes

* When a system starts up, the kernel initiates a few of its own activities as processes and launches a program called init
* init, in turn, runs a series of shell scripts (located in /etc) called init scripts
* The fact that a program can launch other programs is expressed in the process scheme as a parent process producing a child process

```bash
# to look at process 
ps 

# to show all process regardless of terminal
ps x

# output 
PID TTY      STAT   TIME COMMAND
   1876 ?        Ss     0:02 /usr/lib/systemd/systemd --user
   1881 ?        S      0:00 (sd-pam)
   1895 ?        Ss     0:12 /usr/bin/appimagelauncherd
   1902 ?        Sl     0:00 /usr/bin/gnome-keyring-daemon --daemon
   1915 tty2     Ssl+   0:00 /usr/libexec/gdm-wayland-session /usr/
   1917 ?        Ss     0:00 /usr/bin/dbus-broker-launch --scope us
   1920 ?        S      0:02 dbus-broker --log 4 --controller 9 --m
   1923 tty2     Sl+    0:00 /usr/libexec/gnome-session-binary
   1982 ?        Ssl    0:00 /usr/libexec/gnome-session-ctl --monit
   1983 ?        Ssl    0:00 /usr/libexec/uresourced --user
   1986 ?        Ssl    0:00 /usr/libexec/gnome-session-binary --sy
   1990 ?        Ssl    0:00 /usr/libexec/gvfsd

# for a detailed look
ps aux

# output
USER         PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root           1  0.0  0.2 173328 17748 ?        Ss   16:29   0:01 /usr/lib/systemd/systemd
root           2  0.0  0.0      0     0 ?        S    16:29   0:00 [kthreadd]
root           3  0.0  0.0      0     0 ?        I<   16:29   0:00 [rcu_gp]
root           4  0.0  0.0      0     0 ?        I<   16:29   0:00 [rcu_par_gp]
root           5  0.0  0.0      0     0 ?        I<   16:29   0:00 [netns]
root           7  0.0  0.0      0     0 ?        I<   16:29   0:00 [kworker/0:0H-events_highpri]
root           9  0.0  0.0      0     0 ?        I<   16:29   0:00 [kworker/0:1H-events_highpri]
root          10  0.0  0.0      0     0 ?        I<   16:29   0:00 [mm_percpu_wq]
root          11  0.0  0.0      0     0 ?        I    16:29   0:06 [kworker/u32:1-blkcg_punt_bio]
root          12  0.0  0.0      0     0 ?        I    16:29   0:00 [rcu_tasks_kthread]
root          13  0.0  0.0      0     0 ?        I    16:29   0:00 [rcu_tasks_rude_kthread]
root          14  0.0  0.0      0     0 ?        I    16:29   0:00 [rcu_tasks_trace_kthread]
root          15  0.0  0.0      0     0 ?        S    16:29   0:00 [ksoftirqd/0]
```

![process state diagram](/files/hU7KS2NhOQvJGkAwOVym)

**Information shown by top**

![top field information](/files/lbdJGJp9AAzSNvAV1aDK)

![top field information](/files/A2VACHzeRFUFQNVq9dZC)

* to kill a process : `kill -signal [PID]`

![process signals](/files/R84cIKURNkznY1GSDj72)

![process signals part 2](/files/vtkO0HEQFv6mEJHbOl2Y)

![process signals part 3](/files/5LQ1M10GPgJp8iuLEZA1)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://dev117uday.gitbook.io/notes-md/linux/linux-commands-part-9-10.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
