Skip to content

Instantly share code, notes, and snippets.

@mbodo
Last active October 15, 2018 21:26
Show Gist options
  • Save mbodo/19f36dc93287a98d37d99de79eed6908 to your computer and use it in GitHub Desktop.
Save mbodo/19f36dc93287a98d37d99de79eed6908 to your computer and use it in GitHub Desktop.

Revisions

  1. mbodo revised this gist Feb 10, 2018. 1 changed file with 3 additions and 2 deletions.
    5 changes: 3 additions & 2 deletions lpi.md
    Original file line number Diff line number Diff line change
    @@ -462,8 +462,9 @@
    ps -ef - like previous plus, UID, PPID, C, STIME
    ps -efl - like previous plus, F, S, PRI, ADDR, NI, SZ, WCHAN(if running than - )
    ```
    [inspect-manage-processes-ps](https://fedoramagazine.org/inspect-manage-processes-ps/)
    > Links:
    - [inspect-manage-processes-ps](https://fedoramagazine.org/inspect-manage-processes-ps/)
    - free
    ```
    free -mt
  2. mbodo revised this gist Feb 10, 2018. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions lpi.md
    Original file line number Diff line number Diff line change
    @@ -462,6 +462,8 @@
    ps -ef - like previous plus, UID, PPID, C, STIME
    ps -efl - like previous plus, F, S, PRI, ADDR, NI, SZ, WCHAN(if running than - )
    ```
    [inspect-manage-processes-ps](https://fedoramagazine.org/inspect-manage-processes-ps/)
    - free
    ```
    free -mt
  3. mbodo revised this gist Dec 15, 2017. 1 changed file with 3 additions and 2 deletions.
    5 changes: 3 additions & 2 deletions lpi.md
    Original file line number Diff line number Diff line change
    @@ -965,5 +965,6 @@
    - ssh client: /etc/ssh/ssh_config file or the ~/.ssh/ssh_config file.
    * TODO ssh tunneling
    [ssh-tunnel-local-and-remote-port-forwarding-explained-with-examples](https://blog.trackets.com/2014/05/17/ssh-tunnel-local-and-remote-port-forwarding-explained-with-examples.html)
    [whats-ssh-port-forwarding-and-whats-the-difference-between-ssh-local-and-remote](https://unix.stackexchange.com/questions/115897/whats-ssh-port-forwarding-and-whats-the-difference-between-ssh-local-and-remot)
    - [ssh-tunnel-local-and-remote-port-forwarding-explained-with-examples](https://blog.trackets.com/2014/05/17/ssh-tunnel-local-and-remote-port-forwarding-explained-with-examples.html)
    - [whats-ssh-port-forwarding-and-whats-the-difference-between-ssh-local-and-remote](https://unix.stackexchange.com/questions/115897/whats-ssh-port-forwarding-and-whats-the-difference-between-ssh-local-and-remot)
  4. mbodo revised this gist Dec 15, 2017. 1 changed file with 5 additions and 1 deletion.
    6 changes: 5 additions & 1 deletion lpi.md
    Original file line number Diff line number Diff line change
    @@ -962,4 +962,8 @@
    * Configuring OpenSSH
    - sshd daemon: /etc/ssh/sshd_config
    - ssh client: /etc/ssh/ssh_config file or the ~/.ssh/ssh_config file.
    - ssh client: /etc/ssh/ssh_config file or the ~/.ssh/ssh_config file.
    * TODO ssh tunneling
    [ssh-tunnel-local-and-remote-port-forwarding-explained-with-examples](https://blog.trackets.com/2014/05/17/ssh-tunnel-local-and-remote-port-forwarding-explained-with-examples.html)
    [whats-ssh-port-forwarding-and-whats-the-difference-between-ssh-local-and-remote](https://unix.stackexchange.com/questions/115897/whats-ssh-port-forwarding-and-whats-the-difference-between-ssh-local-and-remot)
  5. mbodo revised this gist Sep 25, 2017. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions lpi.md
    Original file line number Diff line number Diff line change
    @@ -440,7 +440,7 @@
    ```
    Display memory in different memory units b/kb/mb/gb/tb .etc at top window summary
    Shift + e
    <Shift + e>
    Now it's in MB
    @@ -449,7 +449,7 @@
    Display memory in different memory units b/kb/mb/gb/tb .etc at top process view window
    e
    <e>
    804 someone+ 20 0 1147.5m 166.8m 45.3m S 9.0 0.5 0:13.78 chrome
    4546 someone+ 20 0 1259.1m 280.6m 55.8m S 5.6 0.9 23:02.07 chrome
  6. mbodo revised this gist Sep 25, 2017. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions lpi.md
    Original file line number Diff line number Diff line change
    @@ -440,7 +440,7 @@
    ```
    Display memory in different memory units b/kb/mb/gb/tb .etc at top window summary
    Ctrl + Shift + e
    Shift + e
    Now it's in MB
    @@ -449,7 +449,7 @@
    Display memory in different memory units b/kb/mb/gb/tb .etc at top process view window
    Ctrl + e
    e
    804 someone+ 20 0 1147.5m 166.8m 45.3m S 9.0 0.5 0:13.78 chrome
    4546 someone+ 20 0 1259.1m 280.6m 55.8m S 5.6 0.9 23:02.07 chrome
  7. mbodo revised this gist Sep 25, 2017. 1 changed file with 2 additions and 3 deletions.
    5 changes: 2 additions & 3 deletions lpi.md
    Original file line number Diff line number Diff line change
    @@ -441,11 +441,10 @@
    Display memory in different memory units b/kb/mb/gb/tb .etc at top window summary
    Ctrl + Shift + e
    ```
    Now it's in MB
    ```
    **MiB** Mem : 31794.33+total, 20088.98+free, 6975.496 used, 4729.855 buff/cache
    MiB Mem : 31794.33+total, 20088.98+free, 6975.496 used, 4729.855 buff/cache
    MiB Swap: 31803.99+total, 31803.99+free, 0.000 used. 23910.77+avail Mem
    Display memory in different memory units b/kb/mb/gb/tb .etc at top process view window
  8. mbodo revised this gist Sep 25, 2017. 1 changed file with 4 additions and 4 deletions.
    8 changes: 4 additions & 4 deletions lpi.md
    Original file line number Diff line number Diff line change
    @@ -441,19 +441,19 @@
    Display memory in different memory units b/kb/mb/gb/tb .etc at top window summary
    Ctrl + Shift + e
    ```
    Now it's in MB
    ```
    **MiB** Mem : 31794.33+total, 20088.98+free, 6975.496 used, 4729.855 buff/cache
    MiB Swap: 31803.99+total, 31803.99+free, 0.000 used. 23910.77+avail Mem
    Display memory in different memory units b/kb/mb/gb/tb .etc at top process view window
    Ctrl + e
    804 someone+ 20 0 1147.5m 166.8m 45.3m S 9.0 0.5 0:13.78 chrome
    4546 someone+ 20 0 1259.1m 280.6m 55.8m S 5.6 0.9 23:02.07 chrome
    804 someone+ 20 0 1147.5m 166.8m 45.3m S 9.0 0.5 0:13.78 chrome
    4546 someone+ 20 0 1259.1m 280.6m 55.8m S 5.6 0.9 23:02.07 chrome
    ```
    - ps
  9. mbodo revised this gist Sep 25, 2017. 1 changed file with 18 additions and 0 deletions.
    18 changes: 18 additions & 0 deletions lpi.md
    Original file line number Diff line number Diff line change
    @@ -437,6 +437,24 @@
    ```
    > Links:
    - [view-threads-process-linux](http://ask.xmodulo.com/view-threads-process-linux.html)
    ```
    Display memory in different memory units b/kb/mb/gb/tb .etc at top window summary
    Ctrl + Shift + e
    Now it's in MB
    **MiB** Mem : 31794.33+total, 20088.98+free, 6975.496 used, 4729.855 buff/cache
    MiB Swap: 31803.99+total, 31803.99+free, 0.000 used. 23910.77+avail Mem
    Display memory in different memory units b/kb/mb/gb/tb .etc at top process view window
    Ctrl + e
    804 someone+ 20 0 1147.5m 166.8m 45.3m S 9.0 0.5 0:13.78 chrome
    4546 someone+ 20 0 1259.1m 280.6m 55.8m S 5.6 0.9 23:02.07 chrome
    ```
    - ps
    ```
  10. mbodo revised this gist Aug 25, 2017. 1 changed file with 16 additions and 0 deletions.
    16 changes: 16 additions & 0 deletions lpi.md
    Original file line number Diff line number Diff line change
    @@ -430,6 +430,13 @@
    ```
    > Links:
    - [linux.die.net - top](https://linux.die.net/man/1/top)
    ```
    Run top with threads displayed within the process of PID and with unwrapping command column
    top -H -p PID -c
    ```
    > Links:
    - [view-threads-process-linux](http://ask.xmodulo.com/view-threads-process-linux.html)
    - ps
    ```
    @@ -444,6 +451,15 @@
    -m megabytes
    -t total
    ```
    ```
    Update 'free' periodically in seconds
    free -mt -s 10
    -m megabytes
    -t total
    -s update every [s]
    ```
    * Prioritizing Processes
    - priority (PR) - higher number -> lower priority of process, default is 80
    - nice (-20 +19) - lower number -> higher priority of process, default is 0
  11. mbodo revised this gist Jun 30, 2017. 1 changed file with 15 additions and 1 deletion.
    16 changes: 15 additions & 1 deletion lpi.md
    Original file line number Diff line number Diff line change
    @@ -515,7 +515,8 @@
    exit 0
    :wq
    ```
    ```
    $ ./mysript.sh
    ...
    @@ -532,6 +533,19 @@
    fg 1
    $ ./mysript.sh
    put to background again
    Ctrl + Z
    $jobs -l
    [1]+ 3908 Stopped ./myscript.sh
    job is stopped right now, to put into running state again
    $bg 1
    [1]+ 3908 Running ./myscript.sh
    ```
    * Ending a Running Process
  12. mbodo revised this gist Jun 30, 2017. 1 changed file with 8 additions and 0 deletions.
    8 changes: 8 additions & 0 deletions lpi.md
    Original file line number Diff line number Diff line change
    @@ -423,6 +423,14 @@
    ```
    * Viewing Running Processes
    - top - see h for help to manipulate top format output
    ```
    Run top for user foo and with unwrapping command column
    top -u foo -c
    ```
    > Links:
    - [linux.die.net - top](https://linux.die.net/man/1/top)
    - ps
    ```
    ps - display processes only belogs to current shell
  13. mbodo revised this gist Jun 30, 2017. 1 changed file with 11 additions and 6 deletions.
    17 changes: 11 additions & 6 deletions lpi.md
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,12 @@
    #<a id="lpi"></a>LPI Essentials Notices
    # <a id="lpi"></a>LPI Essentials Notices
    * [Managing Users and Groups](#8)
    * [Managing File Ownership and Permissions](#9)
    * [Archiving Files](#10)
    * [Managing Linux Processes and Log Files](#11)
    * [Connecting Linux to a Network](#13)

    ##<a id="8"></a> 8 Managing Users and Groups

    ## <a id="8"></a> 8 Managing Users and Groups

    * How Linux User Accounts Work
    - Authentication - provide who you are to system, username, password
    @@ -158,7 +163,7 @@
    - w - who is logged a what is he doing right now
    ## 9 Managing File Ownership and Permissions
    ## <a id="9"></a> 9 Managing File Ownership and Permissions
    * Permisions:
    @@ -284,7 +289,7 @@
    - [Setuid](https://en.wikipedia.org/wiki/Setuid)
    - [Sticky bit](http://www.thegeekstuff.com/2013/02/sticky-bit/?utm_source=feedburner)
    ## 10 Archiving Files
    ## <a id="10"></a> 10 Archiving Files
    - Backup types:
    - Full - all files are backup (slow)
    @@ -393,7 +398,7 @@
    count - how many
    ```
    ## 11 Managing Linux Processes and Log Files
    ## <a id="11"></a> 11 Managing Linux Processes and Log Files
    * Understanding Linux Processes
    - Binary executables
    @@ -568,7 +573,7 @@
    > Links:
    - [howto-linux-unix-write-to-syslog](https://www.cyberciti.biz/tips/howto-linux-unix-write-to-syslog.html)
    ## 13 Connecting Linux to a Network
    ## <a id="13"></a> 13 Connecting Linux to a Network
    * What is protocol
  14. mbodo revised this gist Jun 30, 2017. 1 changed file with 3 additions and 2 deletions.
    5 changes: 3 additions & 2 deletions lpi.md
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,7 @@
    # LPI Essentials Notices
    #<a id="lpi"></a>LPI Essentials Notices
    * [Managing Users and Groups](#8)

    ## 8 Managing Users and Groups
    ##<a id="8"></a> 8 Managing Users and Groups

    * How Linux User Accounts Work
    - Authentication - provide who you are to system, username, password
  15. mbodo revised this gist Jun 29, 2017. 1 changed file with 31 additions and 0 deletions.
    31 changes: 31 additions & 0 deletions lpi.md
    Original file line number Diff line number Diff line change
    @@ -126,6 +126,37 @@
    - groupmod
    - groupdel
    * Using su
    - su
    ```
    with:
    - load user variables
    c switch to user and issue cmd
    m switch user but preserve variables
    ```
    * Using sudo
    - /etc/sudoers
    - visudo
    ```
    e.g

    User_Alias POWRUSR = someone1,someone2
    Cmnd_Alias KILLPROCS = kill, killall
    Host_Alias MYHOST = myhost1

    User_Alias Host_Alias = (user) Cmnd_Alias
    POWRUSR MYHOST = (root) KILLPROCS
    ```
    * Using Log Files to view authentication attempts
    - /var/log/wtmp - binary, succesfully authentication attempts, command to view last
    - /var/log/faillog - binary, failed authentication attempts, command to view faillog
    ```
    faillog -u user_name
    ```
    - who - show who is logged
    - w - who is logged a what is he doing right now
    ## 9 Managing File Ownership and Permissions
    * Permisions:
  16. mbodo revised this gist Jun 28, 2017. 1 changed file with 9 additions and 9 deletions.
    18 changes: 9 additions & 9 deletions lpi.md
    Original file line number Diff line number Diff line change
    @@ -104,16 +104,16 @@
    someone:x:54323:54330:Someone Fullname:/home/someone:/bin/bash
    ```
    - userdel:
    ```
    1, delete user account without deleting users home
    - userdel:
    ```
    1, delete user account without deleting users home
    userdel someone
    userdel someone
    2, delete with users home
    2, delete with users home
    userdel -r someone
    ```
    userdel -r someone
    ```
    * Managing Linux Group Accounts
    - /etc/group
    @@ -123,8 +123,8 @@
    grep -i --color mygroup /etc/group
    ```
    - groupmod
    - groupdel
    - groupmod
    - groupdel
    ## 9 Managing File Ownership and Permissions
  17. mbodo revised this gist Jun 28, 2017. 1 changed file with 76 additions and 0 deletions.
    76 changes: 76 additions & 0 deletions lpi.md
    Original file line number Diff line number Diff line change
    @@ -49,6 +49,82 @@
    someone:$6$m:17301:0:99999:7:::
    username:encrypted_password:last_modified:min_days(0):max_days(99999):days_warn(7):disabled_days:expire(null = infinite passw never expire)
    ```
    - pwck - utility to check validity and synchronization of /etc/passwd and /etc/shadow files
    - pwconv - synchronize missing accouts in /etc/passwd and /etc/shadow
    * Creating and Managing User Accounts from the Command Line
    - useradd:
    ```
    1, default file in /etc/default/useradd
    # useradd defaults file
    GROUP=100
    HOME=/home
    INACTIVE=-1
    EXPIRE=
    SHELL=/bin/bash
    SKEL=/etc/skel
    CREATE_MAIL_SPOOL=yes
    2, for login default is /etc/login.defs
    controls password expiration, UID, GID, HOME creation etc.
    3, /etc/skel - contains skeleton files will be copied to new user home
    useradd someone
    ```
    - passwd
    ```
    1, to report account status
    passwd -S someone
    someone LK 2017-06-27 0 99999 7 -1 (Password locked.)
    2, to set password for user
    passwd someone
    New password:
    Retype new password:
    3, to report account status after password was set
    passwd -S someone
    someone PS 2017-06-27 0 99999 7 -1 (Password set, SHA512 crypt.)
    ```
    - usermod:
    ```
    usermod options username
    e.g
    usermod -c "Someone Fullname" someone
    someone:x:54323:54330:Someone Fullname:/home/someone:/bin/bash
    ```
    - userdel:
    ```
    1, delete user account without deleting users home

    userdel someone

    2, delete with users home

    userdel -r someone
    ```
    * Managing Linux Group Accounts
    - /etc/group
    - groupadd
    ```
    groupadd -g 8001 mygroup
    grep -i --color mygroup /etc/group
    ```
    - groupmod
    - groupdel
    ## 9 Managing File Ownership and Permissions
  18. mbodo revised this gist Jun 28, 2017. 1 changed file with 7 additions and 1 deletion.
    8 changes: 7 additions & 1 deletion lpi.md
    Original file line number Diff line number Diff line change
    @@ -18,6 +18,8 @@
    ```
    - id - show UID, GID, groups
    ```
    id someone
    uid=1000(someone) gid=1000(somegrp1) groups=1000(somegrp1),10(somegrp2),54321(somegrp3)
    ```
    * Where Linux User Accounts Are Stored
    @@ -42,7 +44,11 @@
    sshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologin
    ```
    - /etc/shadow
    ```
    someone:$6$m:17301:0:99999:7:::
    username:encrypted_password:last_modified:min_days(0):max_days(99999):days_warn(7):disabled_days:expire(null = infinite passw never expire)
    ```
    ## 9 Managing File Ownership and Permissions
  19. mbodo revised this gist Jun 28, 2017. 1 changed file with 44 additions and 0 deletions.
    44 changes: 44 additions & 0 deletions lpi.md
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,49 @@
    # LPI Essentials Notices

    ## 8 Managing Users and Groups

    * How Linux User Accounts Work
    - Authentication - provide who you are to system, username, password
    - PAM
    - root has also /home dir, it's /root
    - finger - show info about the user
    ```
    finger someone
    Directory: /home/someone Shell: /bin/bash
    On since Wed Jun 28 05:08 (EDT) on pts/0 from gateway
    1 minute 24 seconds idle
    No mail.
    No Plan.
    ```
    - id - show UID, GID, groups
    ```
    uid=1000(someone) gid=1000(somegrp1) groups=1000(somegrp1),10(somegrp2),54321(somegrp3)
    ```
    * Where Linux User Accounts Are Stored
    - local /etc/passwd
    - LDAP
    - NIS
    - Windows domain
    - Local files:
    ```
    /etc/passwd - user info
    /etc/shadow - user passwords
    /etc/group - group info
    ```
    - /etc/passwd
    ```
    normal user
    someone:x:1000:1000:somone fullname:/home/someone:/bin/bash
    user_name:legacy_password_only_x:UID:GID:full_name:home_dir:shell
    system user UID (from 0, to 999)
    sshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologin
    ```
    ## 9 Managing File Ownership and Permissions
    * Permisions:
  20. mbodo revised this gist Jun 28, 2017. 1 changed file with 2 additions and 3 deletions.
    5 changes: 2 additions & 3 deletions lpi.md
    Original file line number Diff line number Diff line change
    @@ -158,7 +158,7 @@
    myfile.txt
    mytxt.txt
    :wq
    :wq
    tar -cvf my.tar -X excl ./*
    @@ -191,8 +191,7 @@
    bzip2 -d myfile.txt.gz
    ```
    - Using cpio
    ```
    ```
    e.g will only backup files
    compress:
  21. mbodo revised this gist Jun 28, 2017. 1 changed file with 93 additions and 0 deletions.
    93 changes: 93 additions & 0 deletions lpi.md
    Original file line number Diff line number Diff line change
    @@ -125,6 +125,7 @@
    > Links:
    - [Setuid](https://en.wikipedia.org/wiki/Setuid)
    - [Sticky bit](http://www.thegeekstuff.com/2013/02/sticky-bit/?utm_source=feedburner)
    ## 10 Archiving Files
    - Backup types:
    @@ -142,6 +143,98 @@
    - /srv
    - Using Linux Backup Utilities
    - tar,cpio,dd
    - Using tar
    - gzip uses Lempel-Ziv
    - bzip uses Burrows-Wheeler
    ```
    e.g of tar backup insted of file to SCSI tape, which is /dev/st0
    tar –cvf /dev/st0 /home
    e.g. excludes (suppose myfile.txt and mytxt.txt exist in curren dir)
    vi excl
    myfile.txt
    mytxt.txt
    :wq
    tar -cvf my.tar -X excl ./*
    will tar without myfile.txt, mytxt.txt
    ```
    - gzip
    ```
    e.g compress
    gzip myfile.txt
    ls myfile.txt.*
    myfile.txt.gz
    e.g decompress
    gunzip myfile.txt.gz
    gzip -d myfile.txt.gz
    ```
    - bzip2
    ```
    e.g compress
    bzip2 myfile.txt
    ls myfile.txt.*
    myfile.txt.bz2
    e.g decompress
    bunzip2 myfile.txt.bz2
    bzip2 -d myfile.txt.gz
    ```
    - Using cpio
    ```
    e.g will only backup files
    compress:
    ls | cpio –ov > ./backup.cpio
    decompress:
    cpio –iv > ./backup.cpio
    e.g backup files with dirs
    compress:
    find . -depth -print | cpio -ov > /home/someone/backup2.cpio
    decompress:
    cpio –iv > /home/someone/backup2.cpio
    e.g gzip
    compress:
    ls | cpio –ov | gzip > /home/someone/backup.cpio.gz
    decompress:
    gnuzip -c backup.cpio.gz | cpio -i
    ```
    - Creating an Archive with dd
    - backup entire partitions
    ```
    dd if=input_file of=output_file
    e.g entire disk
    dd if=/dev/sda of=/home/mybigbackup
    e.g partition
    dd if=/dev/sda1 of=/home/mybigbackup
    e.g MBR record backup
    dd if=/dev/sda of=/home/mbr.copy bs=512 count=1
    bs - block size
    count - how many
    ```
    ## 11 Managing Linux Processes and Log Files
  22. mbodo revised this gist Jun 28, 2017. 1 changed file with 17 additions and 0 deletions.
    17 changes: 17 additions & 0 deletions lpi.md
    Original file line number Diff line number Diff line change
    @@ -125,7 +125,24 @@
    > Links:
    - [Setuid](https://en.wikipedia.org/wiki/Setuid)
    - [Sticky bit](http://www.thegeekstuff.com/2013/02/sticky-bit/?utm_source=feedburner)
    ## 10 Archiving Files
    - Backup types:
    - Full - all files are backup (slow)
    - Incremental - only files updated from last backup incremental or full (restore in order)
    - Differential - only files updated from last full backup (so it increase in size, but restore is fast, we pick the last)
    - Selecting a Backup Schedule:
    - pick one day a week to full backup, other week days incremenetal or diferential backup
    - Determining What to Back Up:
    - /etc
    - /home
    - /opt
    - /var
    - /root
    - /srv
    - Using Linux Backup Utilities
    - tar,cpio,dd
    ## 11 Managing Linux Processes and Log Files
    * Understanding Linux Processes
  23. mbodo revised this gist Jun 28, 2017. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion lpi.md
    Original file line number Diff line number Diff line change
    @@ -294,8 +294,9 @@
    so
    cron.info /var/log/cron
    ```
    - logrotate - runs daily as cron job, config in /etc/logrotate.conf,
    individual services can be configured in /etc/logrotate.d/
    > Links:
    - [howto-linux-unix-write-to-syslog](https://www.cyberciti.biz/tips/howto-linux-unix-write-to-syslog.html)
  24. mbodo revised this gist Jun 28, 2017. 1 changed file with 20 additions and 1 deletion.
    21 changes: 20 additions & 1 deletion lpi.md
    Original file line number Diff line number Diff line change
    @@ -280,7 +280,26 @@
    ```
    killall -15 vi
    ```
    * Managing Linux Log Files
    - most linux services configured to write to /dev/log device
    - when services write -> input is captured through syslog
    - configured where to log is placed in /etc/syslog.conf
    - pattern is:
    ```
    facility.priority file
    facility e.g cron
    priority e.g info
    so
    cron.info /var/log/cron
    ```
    > Links:
    - [howto-linux-unix-write-to-syslog](https://www.cyberciti.biz/tips/howto-linux-unix-write-to-syslog.html)
    ## 13 Connecting Linux to a Network
    * What is protocol
  25. mbodo revised this gist Jun 28, 2017. 1 changed file with 4 additions and 4 deletions.
    8 changes: 4 additions & 4 deletions lpi.md
    Original file line number Diff line number Diff line change
    @@ -275,11 +275,11 @@
    kill -SIGTERM 8662
    ```
    - killall - same as kill instead of PID use process name e.g
    - killall - same as kill instead of PID use process name e.g
    ```
    killall -15 vi
    ```
    ```
    killall -15 vi
    ```
    ## 13 Connecting Linux to a Network
  26. mbodo revised this gist Jun 28, 2017. 1 changed file with 15 additions and 16 deletions.
    31 changes: 15 additions & 16 deletions lpi.md
    Original file line number Diff line number Diff line change
    @@ -252,35 +252,34 @@
    fg 1
    $ ./mysript.sh
    ...
    ```
    * Ending a Running Process
    - kill (64 signals)
    ```
    Syntax: kill -signal PID
    ```
    Syntax: kill -signal PID
    signal:
    signal:
    SIGHUP (1) - restarts the process with same PID
    SIGINT (2) - send Ctrl + c
    SIGKILL (9) - brute-force process will not clean up allocated resources
    SIGTERM (15) - (default for kill when no signal is set) terminate process immediately,
    SIGHUP (1) - restarts the process with same PID
    SIGINT (2) - send Ctrl + c
    SIGKILL (9) - brute-force process will not clean up allocated resources
    SIGTERM (15) - (default for kill when no signal is set) terminate process immediately,
    but allows process to clean up
    e.g let 8662 vi process
    kill -15 8662
    e.g let 8662 vi process
    kill -15 8662
    or
    or
    kill -SIGTERM 8662
    ```
    kill -SIGTERM 8662
    ```
    - killall - same as kill instead of PID use process name e.g
    ```
    killall -15 vi
    ```
    ```
    killall -15 vi
    ```
    ## 13 Connecting Linux to a Network
  27. mbodo revised this gist Jun 28, 2017. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions lpi.md
    Original file line number Diff line number Diff line change
    @@ -253,6 +253,7 @@
    $ ./mysript.sh
    ...
    ```
    * Ending a Running Process
    - kill (64 signals)
    @@ -280,6 +281,7 @@
    ```
    killall -15 vi
    ```
    ## 13 Connecting Linux to a Network
    * What is protocol
  28. mbodo revised this gist Jun 28, 2017. 1 changed file with 26 additions and 2 deletions.
    28 changes: 26 additions & 2 deletions lpi.md
    Original file line number Diff line number Diff line change
    @@ -254,8 +254,32 @@
    $ ./mysript.sh
    ...
    ```
    * Ending a Running Process
    - kill (64 signals)
    ```
    Syntax: kill -signal PID

    signal:

    SIGHUP (1) - restarts the process with same PID
    SIGINT (2) - send Ctrl + c
    SIGKILL (9) - brute-force process will not clean up allocated resources
    SIGTERM (15) - (default for kill when no signal is set) terminate process immediately,
    but allows process to clean up

    e.g let 8662 vi process
    kill -15 8662

    or

    kill -SIGTERM 8662
    ```
    - killall - same as kill instead of PID use process name e.g
    ```
    killall -15 vi
    ```
    ## 13 Connecting Linux to a Network
    * What is protocol
  29. mbodo revised this gist Jun 28, 2017. 1 changed file with 38 additions and 1 deletion.
    39 changes: 38 additions & 1 deletion lpi.md
    Original file line number Diff line number Diff line change
    @@ -218,7 +218,44 @@

    renice 5 3809 - ist not allowed for normal user
    ```
    * Managing Foreground and Background Processes
    - Running Processes in the Background (& | Ctrl + z):
    ```
    e.g
    touch myscript.sh && chmod -v 0775 myscript.sh
    vi myscript.sh
    myscript.sh:
    #!/bin/bash
    sleep 1000
    exit 0
    :wq
    $ ./mysript.sh
    ...
    press Ctrl + Z
    [1]+ 3908 Stopped ./myscript.sh
    jobs -l
    [1]+ 3908 ./myscript.sh
    then
    fg 1
    $ ./mysript.sh
    ...
    ```
    ## 13 Connecting Linux to a Network
    * What is protocol
  30. mbodo revised this gist Jun 28, 2017. 1 changed file with 93 additions and 0 deletions.
    93 changes: 93 additions & 0 deletions lpi.md
    Original file line number Diff line number Diff line change
    @@ -124,8 +124,101 @@
    > Links:
    - [Setuid](https://en.wikipedia.org/wiki/Setuid)
    - [Sticky bit](http://www.thegeekstuff.com/2013/02/sticky-bit/?utm_source=feedburner)
    ## 11 Managing Linux Processes and Log Files
    * Understanding Linux Processes
    - Binary executables
    - Internal shell commands
    - Shell scripts
    * How Linux Processes Are Loaded
    - Parent/Child process
    - PID - Process ID Number
    - PPID - Parent Process ID Number
    - init process PID 1, PPID 0 , which is Kernel process PID 0
    - forking e.g. (execute) $ vi
    ```
    bash (PPID=111, PID=211) --> start --> subshell (PPID=211, PID=311) --> vi (PPID=311, PID=411)

    so:
    a, vi (PPID=311, PID=411) runs within subshell (PPID=211, PID=311)
    b, when vi ends than also subshell (PPID=211, PID=311) ends
    c, returned back to bash (PPID=111, PID=211) process

    TODO not shure if this is still true
    ```
    * Viewing Running Processes
    - top - see h for help to manipulate top format output
    - ps
    ```
    ps - display processes only belogs to current shell
    ps -e (-A) - display all processes, PID, TTY, TIME, COMD
    ps -ef - like previous plus, UID, PPID, C, STIME
    ps -efl - like previous plus, F, S, PRI, ADDR, NI, SZ, WCHAN(if running than - )
    ```
    - free
    ```
    free -mt
    -m megabytes
    -t total
    ```
    * Prioritizing Processes
    - priority (PR) - higher number -> lower priority of process, default is 80
    - nice (-20 +19) - lower number -> higher priority of process, default is 0
    - to execute nice, user must by root, if not than cannot set nice values lower than 0
    ```
    as root

    nice -n -15 vi

    PRI will be 65
    NI will be -15
    ```
    ```
    as normal user

    nice -n +5 vi

    PRI will be 85
    NI will be 5

    nice -n -5 vi
    will violate premissions
    ```
    * Setting Priorities of Running Processes with renice
    - renice
    ```
    vi process runs under normal user

    as root user

    current process
    0 S 54321 3809 3790 0 91 11 - 31561 poll_s pts/0 00:00:00 vi

    PID is 3809
    PRI is 91
    NI is 11

    renice 5 3809

    PRI will be 85
    NI will be 5

    0 S 54321 3809 3790 0 85 5 - 31561 poll_s pts/0 00:00:00 vi

    as normal user, only higher number are allowed so:

    renice 6 3809 - will
    0 S 54321 3809 3790 0 86 6 - 31561 poll_s pts/0 00:00:00 vi

    renice back to

    renice 5 3809 - ist not allowed for normal user
    ```
    ## 13 Connecting Linux to a Network
    * What is protocol