LINUXOPOLIS #91 • UPDATESsteemCreated with Sketch.

in #linux5 years ago (edited)

LINUXOPOLIS

A short summary of building a personal Linux environment.
Published with SteemPeak

ScreenshotScreenshot by Willi Glenz

UPDATES

006 └ disk                                          v2 19-05 update
070 windows                                         v2 19-05 update



CONTENTS

                    SYSTEM INFORMATION
096 host                                            v2 19-05 
023 └ memory                                        v1 19-05
006 └ disk                                          v2 19-05 update
032 lan                                             v2 19-05 
029 wan                                             v1 19-05 

017 DEBIAN                                          v2 19-05
005 /etc/apt/sources.list                           v2 19-05
009 /etc/fstab                                      v1 19-05
092 faq                                             v1 19-05
086 reference-handbook                              v1 19-05
081 administrator-handbook                          v1 19-05
091 installation                                    v1 19-05 
004 update & upgrade & dist-upgrade                 v1 19-05
036 i3wm                                            v2 19-05 
095 dwm                                             v1 19-05
093 stretch to buster                               v1 19-05 
015 shortcuts                                       v1 19-05
052 systemv                                         v1 19-05
080 systemd                                         v2 19-05
042 at                                              v1 19-05
028 cron                                            v1 19-05
031 swap space                                      v1 19-05
007 ramdisk                                         v2 19-05 
045 languages                                       v1 19-05
047 users                                           v1 19-05
049 backup                                          v2 19-05    
079 hard disk                                       v1 19-05 
044 raspberry pi                                    v2 19-05 
082 dhcp-server                                     v1 19-05
084 http-server-apache2                             v2 19-05 
041 sources                                         v2 19-05

013 TOOLBOX                                         V2 19-05
016 screen                                          v1 19-05
063 inxi                                            v1 19-05
033 snap                                            v1 19-05
018 glances                                         v1 19-05
039 task & timewarrior                              v1 19-05
050 gpg                                             v3 19-05
014 linux-from-scratch (lfs)                        v2 19-05
046 youtube-dl                                      v3 19-05                                
057 R                                               v1 19-05
021 neofetch                                        v1 19-05
011 fuzzi finder                                    v1 19-05
010 cryptocurrencies                                v1 19-05
003 dconf-editor                                    v1 19-05
002 gnome-tweak-tool                                v1 19-05
054 firefox                                         v2 19-05
076 javascript                                      v1 19-05
048 c                                               v2 19-05
066 perl                                            v1 19-05
024 awk                                             v1 19-05
061 git                                             v1 19-05

026 BASH                                            v3 19-05 
012 ~/.bashrc                                       v1 19-05    
094 bash-guide-for-beginners                        v1 19-05
085 bash-scripting-guide                            v1 19-05
008 aliases                                         v2 19-05
022 one-liner & cowsay                              v3 19-05
038 job-control                                     v1 19-05
055 bash-to-fish|zsh                                v3 19-05 
043 fish                                            v2 19-05
090 zsh                                             v1 19-05

020 VIM                                             v3 19-05
034 ~/.vimrc                                        v5 19-05 
037 first-steps                                     v4 19-05
053 vim-compressed                                  v7 19-05
072 buffers                                         v1 19-05
070 windows                                         v2 19-05 update
075 tabs                                            v3 19-05
077 marks                                           v1 19-05 
078 folds                                           v1 19-05
083 macros                                          v1 19-05
001 vim-mode in bash                                v2 19-05
067 vim-mode in fish                                v1 19-05
040 github repository                               v1 19-05
027 ranger                                          v2 19-05
074 tutorials                                       v1 19-05 
073 sources                                         v1 19-05

060 JAVA                                            v1 19-05
059 primitive-data-types                            v1 19-05
065 operators                                       v1 19-05
035 modifier                                        v1 19-05
069 cli                                             v1 19-05
056 basic-cli-snippet                               v2 19-05
062 basic-gui-snippet                               v1 19-05
064 jar-file                                        v2 19-05
068 intellij idea                                   v4 19-05 
030 eclipse                                         v1 19-05
058 netbeans                                        v1 19-05
071 scanner                                         v1 19-05
025 tutorials                                       v4 19-05
    
019 PYTHON                                          v3 19-05 
088 installation                                    v1 19-05
087 tutorials                                       v1 19-05

051 HTML                                            v2 19-05
089 selfhtml (de)                                   v1 19-05

#096

096 • HOST 
• IP-Address                    $ hostname -i
• Runtime and load              $ watch uptime
• Last reboot history           $ last reboot
• System information I          # inxi -v7
• System information II         # inxi -v7 -c0 | tee system.txt
• Hostname I                    $ hostname; hostname -f; hostname -d
• Hostname II                   $ cat /etc/hostname; hostnamectl; uname --nodename
• Hostname III                  $ cat /proc/sys/kernel/hostname
• Hostname IV                   # hostname mars
• Prelogin message              $ cat /etc/issue
• Shell                         $ echo $0
• Operating system              $ cat /etc/os-release; lsb_release -a; uname --operating-system
• Debian version                $ cat /etc/debian_version
• Debian Upgradeable packets    $ apt-show-versions -u > upgradeableVersions.txt; vim upgradeableVersions.txt
• Kernel                        $ uname -a
• Kernel name                   $ uname --kernel-name
• Kernel release                $ uname --kernel-release
• Kernel version                $ uname --kernel-version
• Kernel ring buffer I          # dmesg | less
• Kernel ring buffer II         # dmesg | tail -n 25
• Rootkit scanner               # chkrootkit
• System log I                  # logwatch | less
• System log II                 # tail -f /var/log/syslog
• Systemd journal               # journalctl
• CPU Model                     $ cat /proc/cpuinfo
• Memory                        $ watch free -h
• Physical Memory               $ grep MemTotal /proc/meminfo 
• MEM Info                      $ cat /proc/meminfo
• Processes I                   $ ps auxw | sort | less
• Processes II                  $ atop
• Processes III                 $ htop
• Processes IV                  $ top
• Processes V                   $ glances
• Disk I                        # lshw -short -class disk
• File System Hierarchy (FHS)   $ man hier
• Disk II                       $ df -hT
• Disk III                      # e4defrag /home -c
• Disk IV                       # du -hs /home/userxyz
• Disk V                        # du -h --max-depth=1 /home/userxyz | sort -n
• Disk VI                       # du -h --max-depth=1 / 2>/dev/null | sort -n
• Volumes                       # lshw -short -class volume
• USB                           # usbview; lsusb
• Documentation                 $ man -k . | less


# clear; echo; netstat -i; echo; netstat -r
# clear; netstat -tupanc
# ifconfig
# ifconfig -a | grep -Po '\b(?!255)(?:\d{1,3}\.){3}(?!255)\d{1,3}\b' | xargs nmap -A -p0-
# ifconfig eth0 down | up
# iw dev wlan0 scan | egrep "SSID|signal" | awk -F ":" '{print $2}' | sed 'N;s/\n/:/' | sort
# netstat -tulpn
$ dnsdomainname
$ domainname
$ inxi -i
$ ip address show
$ ip neigh show
$ netstat -a | less
$ netstat -ie
$ nmap --iflist
$ speedometer -r enp1s0f2
$ speedtest
$ sshfs name@server:/path/to/folder /path/to/mount/point


CONFIGURATION

/etc/hosts
/etc/hostname
/etc/resolv.conf
/etc/network/interfaces
/etc/init.d/networking
/etc/NetworkManager/system-connections/
/etc/ssh/ssh_config
# macchanger -r eth0
# nm-connection-editor
# hostname mars; cat /proc/sys/kernel/hostname


095 • DWM 
# apt install dwm

<shift-alt-enter>   terminal
<shift-alt-c>       kill a window
<shift-alt-q>       quit dwm

<alt-j>             next window
<alt-k>             previous window
<alt-t>             tiled layout mode
<alt-f>             floating layout mode
<alt-m>             monocle layout  
$ man dwm
• dwm.suckless.org


094 • BASH ~ BASH-GUIDE-FOR-BEGINNERS
ldp.org/LDP/Bash-Beginners-Guide/html/index.html


093 • DEBIAN ~ UPGRADE STRETCH TO BUSTER
$ hostnamectl

# apt update
# apt upgrade
# apt dist-upgrade

# cp /etc/apt/sources.list /etc/apt/sources.list.backup1
# sed -i.backup2 's/stretch/buster/g' /etc/apt/sources.list

# apt update
# apt upgrade
# apt dist-upgrade

$ hostnamectl


092 • DEBIAN ~ FAQ
# apt-get install debian-faq
$ dpkg -L debian-faq | grep -i index
> /usr/share/doc/debian/FAQ/index.en.html
> file:///usr/share/doc/debian/FAQ/index.en.html
FAQ     : debian.org/doc/manuals/debian-faq/


091 • DEBIAN ~ INSTALLATION
• Installation Guide    : debian.org/releases/stable/amd64/
• Release Notes         : debian.org/releases/stable/amd64/release-notes/


090 • ZSH 
$ apt install zsh

OH-MY-ZSH
• github.com/robbyrussell/oh-my-zsh
$ sh -c "$(wget https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"
$ uninstall_oh_my_zsh
• MAN-Pages : $ man zsh
• FAQ       : zsh.sourceforge.net/FAQ/


089 • HTML - SELFHTML (DE)
# apt install selfhtml
# apt show selfhtml
$ dpkg -L selfhtml | less
> file://usr/share/doc/selfhtml/html/index.htm


088 • PYTHON ~ INSTALLATION
# apt get install python python3 idle3
# snap install pycharm-community --classic

INSTALLATION v3.7.3

$ mkdir ~/tmp; cd ~/tmp;
$ wget https://www.python.org/ftp/python/3.7.3/Python-3.7.3.tar.xz
$ xz --uncompress Python-3.7.3.tar.xz
$ tar -xf Python-3.7.3.tar
$ rm Python-3.7.3.tar
$ cd Python-3.7.3/
$ view README.rst
$ ./configure
$ make
$ make test
# make install
$ rm -r ~/tmp; ls -lisa ~

UPDATE-ALTERNATIVE

$ python<tab><tab>
$ python --version
# update-alternatives --list python
# update-alternatives --install /usr/local/bin/python3 python /usr/bin/python3.7 1
# update-alternatives --config python
# update-alternatives --list python
$ python --version

# update-alternatives --remove python /usr/bin/python2.7
• Download          : python.org/downloads/
• Documentation     : docs.python.org/3.7/


087 • PYTHON - TUTORIALS
• Python from Scratch   : open.cs.uwaterloo.ca/python-from-scratch/
• Tutorial              : docs.python.org/3/tutorial/index.html
• Dive Into Python 3    : file:///usr/share/doc/diveintopython3/html/index.html
• Tutorial              : file:///usr/share/doc/python3.5/html/tutorial/index.html


086 • DEBIAN-REFERENCE-HANDBOOK
# apt-get install debian-reference
$ dpkg -L debian-reference
$ ls -l /usr/share/doc/debian-reference/docs/ | grep -i index
> /usr/share/doc/debian-reference/docs/index.en.html
> file:///usr/share/doc/debian-reference/docs/index.en.html
debian.org/doc/manuals/debian-reference/


085 • BASH-SCRIPTING-GUIDE
# apt search abs-guide
# apt show abs-guide
# apt install abs-guide
$ dpkg -L abs-guide
> file:///usr/share/doc/abs-guide/html/index.html
tldp.org/LDP/abs/html/


084 • APACHE-HTTP-SERVER
# apt search apache2
# apt show apache2
# apt install apache2 apache2-doc

$ ip a
$ w3m localhost|---.---.---.---

$ /var/www/html/index.html

$ systemctl status apache2.service
$ ps aux | grep -i apache
# netstat -tulpn
# tail -f /var/log/apache2/access.log
# tail -f /var/log/apache2/error.log

$ dpkg -L apache2-doc | less
> file:///usr/share/doc/apache2-doc/manual/en/mod/index.html


083 • VIM ~ MACROS
[ qa q @a           ] start stop run
[ :reg              ] register
[ :put a            ] edit a
[ 0"ay$             ] update a

:map <F2> a<C-R>=strftime("%c")<CR><ESC>
:map <F2> ggVG"+y
:map <F2> :set list!


082 • DHCP-SERVER
INSTALLATION

 $ apt-cache show isc-dhcp-server
 # apt-get install isc-dhcp-server
 # man dhcpd
 # man dhcpd.conf

CONFIGURATION

 # ifconfig; ip a
 # service isc-dhcp-server start | stop | restart
 # systemctl start isc-dhcp-server
 # systemctl enable isc-dhcp-server
 # ufw allow 67/udp
 # ufw reload
 # vim /etc/dhcp/dhcpd.conf
 > option broadcast-address 192.168.0.255;
 > option domain-name "linux.local";
 > default-lease-time 3600; 
 > max-lease-time 7200;
 > authoritative;
 >
 > subnet 192.168.0.0 netmask 255.255.255.0 {
 >      option routers 192.168.0.1;
 >      option subnet-mask 255.255.255.0;
 >      option domain-search "linux.local";
 >      option domain-name-servers 8.8.8.8, 8.8.4.4;
 >      range 192.168.0.10 192.168.0.100;
 >      range 192.168.0.150 192.168.0.200;
 > } 

SOURCES

 • isc.org/downloads/dhcp/
 • help.ubuntu.com/community/isc-dhcp-server
 • tools.ietf.org/html/rfc1531
 • en.wikipedia.org/wiki/Dynamic_Host_Configuration_Protocol


081 • DEBIAN ~ ADMINISTRATOR-HANDBOOK
# apt-get install debian-handbook
$ dpkg -L debian-handbook | grep -i index
> /usr/share/doc/debian-handbook/html/en-US/index.html
$ firefox file:///usr/share/doc/debian-handbook/html/en-US/index.html


080 • SYSTEMD
$ systemctl
$ systemctl list-units | grep .service
$ systemctl list-unit-files
$ systemctl is-enabled ufw.service
$ systemctl status apache2.service
$ systemctl status ssh.service

# systemctl enable|disable apache2.service
# systemctl start|stop|restart apache2.service

# journalctl
# journalctl -b
# journalctl -b -p err
# journalctl -b -u NetworkManager
# journalctl -b -u NetworkManager --since='yesterday'
# journalctl -b -u NetworkManager --since='yesterday' -p err

/etc/systemd/
/etc/systemd/system/


079 • HARD DISK
$ lsblk
# blkid /dev/sda1
# badblocks -v /dev/sdb
# tune2fs -l /dev/sdb       
# tune2fs -m 0 /dev/sdb 
$ cat /sys/devices/virtual/thermal/thermal_zone0/temp
# fdisk -l
# hwinfo --short | less
# hwinfo --disk
# lshw -short | less
$ mount | column -t
# mount -t tmpfs -o size=2048M tmpfs /media/ramdisk
# mount -o loop /home/user/iso/xyz.iso /mnt/
# smartctl -i /dev/sda
$ sync


078 • VIM ~ FOLDS
$vim ~/.vimrc
[autocmd BufWinLeave *.* mkview             ]
[autocmd BufWinEnter *.* silent loadview    ]
:wq

[ zf                                        ] create 
[ zo zn             ][ :%foldopen           ] open none
[ zc zm             ][ :%foldclose          ] close more
[ zd                                        ] delete

[:mkview :loadview                          ] save load
[:set foldmethod :set fdm                   ] foldmethod


077 • VIM ~ MARKS
[ ma 'a `a                          ] set mark
[ :marks :marks ABC                 ] list marks
[ mA mB 'A 'B                       ] different files
[ :delmarks A-Z a,b,c :delmarks!    ] delete marks


076 • JAVASCRIPT
TUTORIALS
 • JavaScriptInfo                   : javascript.info
 • W3Schools                        : w3schools.com/Js/
 • TutorialsPoint                   : tutorialspoint.com/javascript/


075 • VIM ~ TABS
[ :tabnew                                   ] tab new
[ :tabe dummy.txt                           ] tab edit
[ :tab split                                ] tab split
[ :tabn :tabn2 :tabp    ][ gt 3gt gT        ] tab next previous
[ :tabmove 0                                ] tab move
[ :tab ba                                   ] tab buffer all
[ :tabonly                                  ] tab only
[ :tabm :tabm 0                             ] tab move
[ :tabclose :q                              ] tab close quit


074 • VIM ~ TUTORIALS
• TutorialsPoint    : tutorialspoint.com/vim/index.htm
• Bram Moolenaar    : moolenaar.net/habits.html
• Ben McCormick I   : benmccormick.org/2014/06/30/learning-vim-in-2014-the-basics
• Ben McCormick II  : benmccormick.org/2014/07/02/learning-vim-in-2014-vim-as-language


073 • VIM ~ SOURCES
[ $ man vim                                         ] 
[ :help :h :resize                                  ] 
[ :h user-manual :resize                            ] 
[ file:///usr/share/doc/vim-doc/html/index.html     ] 

• Documentation I   - vimhelp.org
• Documentation II  - vimhelp.org/usr_toc.txt.html
• FAQ               - vimhelp.org/vim_faq.txt.html
• Wiki              - vim.wikia.com/wiki/Vim_Tips_Wiki


072 • VIM ~ BUFFERS
[:buffer :ls                    ] buffers list
[:bp :b# :bn :b1                ] buffer previous next 1
[:set hidden|nohidden :bp! :bn! ] buffer hidden
[:bd                            ] buffer delete
[:mks :mks!                     ] save session


071 • JAVA ~ SCANNER
import java.util.Scanner;
Scanner scanner = new Scanner(System.in);
System.out.print("Input: ");
String msg = scanner.nextLine();
scanner.close();

file:///usr/share/doc/openjdk-11-jre-headless/api/java.base/java/util/Scanner.html


070 • VIM ~ WINDOWS
split   [^ws ^wv            ][:sp :vs :vs|b2            ]

rotate  [^wr ^wR ^wx                                    ]
new     [^wn                                            ] 
resize  [^w= ^w_ ^w20< ^w|  ][:res :vertical res 120    ]
close   [^wc ^wq            ][:q :close                 ]
docu    [                   ][:h ^w                     ]
move    [^whjkl ^wt ^wb ^wp ^ww ^wx                     ] 
buffer  [^wo        ][:ls :ba :vert ba :vert 2ba :vs|b2 ]
session [:mks session $ vim -S session                  ] 

vimrc   [:set splitright laststatus=2                   ]


069 • JAVA ~ CLI
# apt-get install default-jdk default-jdk-doc
# apt-get install openjdk-11-jdk openjdk-11-doc
$ java -version; javac -version
# update-java-alternatives -l
# update-java-alternatives -s java-1.11.0-openjdk-amd64
# update-alternatives --display java
# update-alternatives --config java
$ mkdir -p ~/Projects/Phoenix/source/{tools,docu,de/wglenz/phoenix};
$ cd ~/Projects/source; tree
$ vim -O de/wglenz/phoenix/Main.java de/wglenz/phoenix/Class2.java
$ vim, ^wt ^wl :terminal ^wr htop ^wt ^w=


068 • INTELLIJ IDEA
KEYMAP

<shift-F10>         run
<ctrl-alt-l>        reformat code

INSTALLATION

 # snap refresh
 # snap install intellij-idea-community --classic

TUTORIALS

 • JetBrains        : jetbrains.com/idea/documentation/
 • TutorialsPoint   : tutorialspoint.com/intellij_idea/index.htm
Homepage        : jetbrains.com/idea/
Download        : jetbrains.com/idea/download/#section=linux
Documentation   : jetbrains.com/idea/documentation/


067 • VIM-MODE IN FISH
~>  vim .config/fish/config.fish
    #fish_default_key_bindings
    fish_vi_key_bindings
    :wq
~>  <ctrl-d>


066 • PERL
 • Homepage         : perl.org
 • Documentation    : perl.org/docs.html 
 • CPAN             : cpan.org 
# apt-get install perl-doc
$ perldoc perlintro
$ perl -v

$ vim ~/scripts/file.pl
  #!/usr/bin/perl
  use strict;
  use warnings;
:w

TUTORIALS
• Learning          : perl.org/learn.html
• TutorialsPoint    : tutorialspoint.com/perl/
• Beginning Perl    : learn.perl.org/books/beginning-perl


065 • JAVA OPERATORS
Arithmetic      + - * / & ++ --
Relational      == != > < >= <=
Bitwise         & | ^ ~ << >> >>>
Logical         && || !
Assignment      = += -= *= /= %= <<= >>=  &= ^= |=
Miscellaneous   ?: instanceof


064 • JAR-FILE
PROJECT-FOLDER
$ cd ~; clear; lsd -l
$ mkdir -p ~/projects/phoenix/source/de/wglenz/phoenix
$ clear; lsd -l
$ tree ~/projects

SOURCE-CODE
$ cd ~/projects/phoenix/source/
$ tree
$ vim de/wglenz/phoenix/Main.java
> package de.wglenz.phoenix;
> public class Main { ... }
:wq
$ tree ..

BYTE-CODE
$ cd ~/projects/phoenix/source/
$ javac -d ../classes de/wglenz/phoenix/*.java
$ tree ..

MANIFEST-FILE
$ cd ~/projects/phoenix/classes/
$ tree ..
$ vim manifest.txt
> Main-Class: de.wglenz.phoenix.Main
:wg
$ tree ..

JAR-FILE
$ cd ~/projects/phoenix/classes/
$ tree ..
$ jar -cvmf manifest.txt phoenix.jar de
$ jar -tf phoenix.jar
$ tree ..
$ tree ~/projects/

RUN-APPLICATION
$ tree ~/projects/
$ cd ~/projects/phoenix/classes/
$ java -jar phoenix.jar


063 • INXI
$ vim ~/scripts/check   

  1 #!/bin/bash
  2 # check [host cpu disk network] 
  3 # Wrapper for inxi, nmap and ip
  4 #
  5 
  6 clear
  7 
  8 while [ -n "$1" ]
  9 do
 10    case "$1" in
 11       "host" )
 12          echo
 13          inxi -v7
 14          echo
 15          ;;
 16       "cpu" )
 17          echo
 18          inxi -f
 19          echo
 20          ;;
 21       "disk" )
 22          echo
 23          inxi -Dp
 24          echo
 25          ;;
 26       "network" )
 27          echo
 28          inxi -i
 29          nmap --iflist
 30          ip neigh
 31          echo
 32          ;;
 33    esac
 34    shift
 35 done
 36 
 37 exit
 
 :wq


062 • JAVA BASIC-GUI-SNIPPET
package de.wglenz.java;

import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;

public class Main {

    JFrame frame;
    JPanel panelWest;
    JPanel panelCenter;
    JLabel label;
    JButton buttonWest;
    JButton buttonSouth;
    JButton buttonEast;

    public Main() {
        super();

        panelWest = new JPanel();
        panelCenter = new JPanel();
        label = new JLabel("LabelCenter");
        
        buttonWest = new JButton("ButtonWest");
        buttonWest.addActionListener(new Listener1());

        buttonSouth = new JButton("ButtonSouth");
        buttonSouth.addActionListener(new Listener2());

        buttonEast = new JButton("ButtonEast");
        buttonEast.addActionListener(new Listener3());

        frame = new JFrame("Phoenix v 0.003");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.getContentPane().add(BorderLayout.CENTER, panelCenter);
        frame.getContentPane().add(BorderLayout.WEST, panelWest);
        frame.getContentPane().add(BorderLayout.SOUTH, buttonSouth);
        frame.getContentPane().add(BorderLayout.EAST, buttonEast);
        frame.setSize(1200, 600);
        frame.setVisible(true);
        
        panelCenter.add(label);
        panelWest.add(buttonWest);  
        }

    public static void main(String... args) {
        Main phoenix = new Main();
        phoenix.run();
        }

    class Listener1 implements ActionListener {
        public void actionPerformed(ActionEvent e) {
            label.setText("ButtonWest: OK");
            }
        }

    class Listener2 implements ActionListener {
        public void actionPerformed(ActionEvent e) {
            label.setText("ButtonSouth: OK");
            }
        }

    class Listener3 implements ActionListener {
        public void actionPerformed(ActionEvent e) {
            label.setText("ButtonEast: OK");
            }
        }

    public void run() {
        //
        }

}


061 • GIT
 • Homepage     : git-scm.com
 • Reference    : git-scm.com/docs
 • Videos       : git-scm.com/videos
 • Git-Book     : git-scm.com/book/en/v2
# apt install git


060 • JAVA API
$ apt-cache show openjdk-11-jdk
# apt install openjdk-11-doc
$ firefox file:///usr/share/doc/openjdk-11-jre-headless/api/index.html


059 • JAVA PRIMITIVE-DATA-TYPES
PRIMITIVE DATA TYPES

TYPE        SIZE    RANGE                   DEFAULT CLASS&FIELD
byte        8 bit   -2^7 to 2^7 -1          0
short       16 bit  -2^15 to 2^15 -1        0
int         32-bit  -2^31 to 2^31 -1        0       Integer.MIN_VALUE to Integer.MAX_VALUE
long        64 bit  -2^63 to 2^63-1         0L
float       32 bit  -3.4E38 to 3.4E38       0f
double      64 bit  -1.7E308 to 1.7E308     0d
char        16 bit  '\u0000' to '\uffff'    '\u0000'
                    (0 to 65,565)
boolean     1 bit                           false

WRAPPER CLASSES

public Short(short|String value|s)
public Integer(int|String value|s)
public Long(long|String value|s)
public Float(float|double|String value|value|s)
public Double(double|String value|s)
public Character(char value)
public Boolean(boolean|String value|s)


058 • NETBEANS
 • Homepage         : netbeans.apache.org
 • Documentation    : docs.oracle.com/cd/E50453_01/doc.80/e50452.pdf
 • Shortcuts        : netbeans.org/project_downloads/usersguide/shortcuts-80.pdf
# snap install netbeans

alt + insert                : Generate code
alt + shift + f             : Format selection
ctrl + x                    : Delete line
ctrl + e                    : Delete line
shift + ctrl + minus | plus : Collaps | Expand all


057 • R
 • Homepage : r-project.org
 • CRAN     : cloud.r-project.org/index.html
 • Journal  : journal.r-project.org
 • Manual   : cran.r-project.org/manuals.html
$ R
> help.start()

TUTORIALS
 • Introduction to R Programming    : youtu.be/92zCRV3eQxw
 • An Introduction to R             : cran.r-project.org/doc/manuals/r-release/R-intro.pdf


056 • JAVA BASIC-CLI-SNIPPET
package de.wglenz.phoenix;
import java.util.Scanner;

public class Main {

   private String msg;
   private Scanner scanner;

   public Main() {
      super();
      msg = "Hello World!";
      scanner = new Scanner(System.in);
      }

   public static void main(String[] args) {
      Main phoenix = new Main();
      phoenix.run();
      }

   public void run() {
      System.out.print("Input: ");
      msg = scanner.nextLine();
      System.out.println(msg);
      scanner.close;
      }

}


055 • BASH-TO-FISH|ZSH
$ grep -i user /etc/passwd
$ echo $SHELL
$ cat /etc/shells
# apt install fish zsh
$ cat /etc/shells

• Option 1: # vim /etc/passwd               
• Option 2: $ chsh -s /usr/bin/fish         
• Option 3: # usermod -s /bin/bash user     

$ chsh -s /usr/bin/fish
$ chsh -s /bin/fish

$ cat /etc/passwd | cut -d: -f7 | sort | uniq -c | sort -nr


054 • FIREFOX
send.firefox.com

about:blank
about:cache
about:config
about:crashes
about:downloads
about:memory
about:performance
about:plugins
about:profiles
about:serviceworkers
about:support


053 • VIM-COMPRESSED
[ :ab :abc :unab ^v                                 ] abbreviate
[ a A i I o O s S C ~                               ] append insert substitute
[ $ vim -u NONE -N                                  ] baseline
[ :ls :buffers :badd :b1 :b2 :bn :bp :bf :bl        ] buffer
[ r x ~                                             ] character replace delete change
[ ci( ci{ ci< ci"                                   ] change inner ...
[ v j " + y                                         ] clipboard
[ <esc> gg v G "+ y                                 ] copy
[ dd D x d$ dip diw daw dit di" das                 ] delete
[ $ vim -O ~/.vimrc ~/.bashrc ^ww ^wr ^wc ^wq       ] edit
[ ~ :e :edit $ ^xe                                  ] edit
[ zf5j zo zc zd                                     ] folding
[ :ve ^g g^g                                        ] information
[ qa :reg a @a                                      ] macros
[ m1 '1 `1 marks                                    ] mark
[ [InsertMode] ^n                                   ] match
[ hjkl gj gk gg G HML                               ] move cursor
[ 1% 50% 100% zz zb zt z<enter>                     ] move cursor
[ :set nu|nonu :set rnu|nornu                       ] numbers
[ .                                                 ] repeat
[ / f * # q/ q? q: :%s/one/two/g                    ] search
[ /\cabc /\Cabc /\<abc\> :nohl                      ] search
[ :set incsearch noincsearch :set hls nhls          ] search
[ $ vimtutor en                                     ] tutorial
[ u U ^r                                            ] undo redo
[ ^wv ^ws ^wq ^ww ^wr ^wc                           ] windows
[ gg G ^g 50% ^e ^y ^n ^u ^d ^f ^b                  ] windows
[ :set ruler noruler                                ] windows
[ :set linebreak nolinebreak                        ] windows
[ :call matchadd('colorColumn', '\%81v', 100)       ] windows
[ :q :q! :qa :qa! :wq :wqa :exit ZZ ZQ              ] exit


052 • SYSTEMV 
# tasksel
# tasksel --list-tasks
# service --status-all | less
# service --status-all | awk '/[+]/ { print $4  }' | tee /tmp/active.txt
# service network-manager restart
# service ssh status
# service cron status
# service apache2 start | restart | stop
# apt-get install printer-driver-cups
# ufw status


051 • HTML 
BASE-DOCUMENT

<!DOCTYPE html>
<html lang="en-US">
    <head>
        <meta charset="utf-8">
        <title>Homepage</title>
    </head>
    
    <body>
    <h1>Heading 1</h1>
    <h2>Heading 2</h2>
    <p>This is the first paragraph</p>
    <p>This is the second paragraph</p>
    <center><b>text</b></center>
    <a href="url">text</a>
    </body>
</html>

EDITOR

$ apt install bluefish

SOURCES

• w3schools.com/html/default.asp
• tutorialspoint.com/html/index.htm
• open.cs.uwaterloo.ca/web-basics


050 • GPG - GnomePrivacyGuard
• Homepage          : gnupg.org
• Documentation     : gnupg.org/documentation/manuals/gnupg.pdf
• HowTo             : dewinter.com/gnupg_howto/english/GPGMiniHowto.html
FIRST-STEPS

$ gpg --version
$ gpg --dump-options | less
$ tree ~/.gnupg

KEY-GENERATION

$ gpg --full-gen-key

ENCRYPTION

$ echo "Hello World!" >> file
$ gpg -r [email protected] -e file
$ shred -u file

DECRYPTION

$ gpg -d file.gpg
$ gpg -d file.gpg >> file


049 • BACKUP
$ archivemount archive.tar.gz ~/mnt/
# dd if=/dev/sdABC of=/dev/sdXYZ bs=64K conv=noerror,sync
$ tar -cvzf ~/backup/backup.tar.gz ~/java
$ tar -tvf backup.tar.gz
$ ssh [email protected] "tar -zcf - /home/user/scripte" > scripte.tar.gz

TOOLS
• grsync rsync


048 • C
$ gcc -v

HELLO WORLD

$ vim hello.c
> #include <stdio.h>
>
> int main() 
> {
>    printf("Hello, World! \n");
>    return 0;
> }
:wq
$ gcc hello.c
$ ./a.out

SOURCES
• TutorialsPoint        : tutorialspoint.com/cprogramming/


047 • USERS
PATHS

/etc/passwd 
/etc/shadow 
/etc/group 
/etc/profile 
/etc/default/useradd

~/.bashrc 
~/.profile

STATUS

# passwd -S user1
$ clear; finger; echo; finger user1; echo
$ cut -d: -f1 < /etc/passwd | sort | xargs
# find /home -uid 1000 | wc -l
# find /home -uid 1000 | tee 1000-files.txt
# find / -uid 1000 -exec chown -v 1002:1002 {} \;
$ id -u root
$ id -u user1
$ id user1
$ fuser -v /media/xyz
$ getent passwd user1

CREATING I                  // Debian

# ls -lisa /etc/skel
# vim /etc/adduser.conf
# adduser user1 
# passwd -S user1       
$ clear; finger; echo; finger user1; echo
$ id user1

CREATING II                 // Low level

# ls -lisa /etc/skel
# useradd -D
# vim /etc/default/useradd
# useradd user1                                                 // Default
# useradd user1 -c "User's full name" -d /home/test -u 1099     // Modified
# passwd user1
# passwd -S user1
$ clear; finger; echo; finger user1; echo
$ id user1

MODIFYING

# usermod -c "Another full name" user1
# chown -R user1:user1 /home/userxyz
# vim /etc/sudoers

DELETING

# passwd -u user1
# passwd -l user1
# userdel -r user1

046 • YOUTUBE-DL
 • Documentation    : github.com/ytdl-org/youtube-dl/blob/master/README.md#readme
FISH-FUNCTION

~> vim /home/user/.config/fish/functions/yt.fish

  function yt
     sudo -H pip install --upgrade youtube-dl
  end

:wq


045 • LANGUAGES
INSTALLATION/CONFIGURATION

• # apt-get purge locales
• # apt-get install locales
• # dpkg-reconfigure locales
• # dpkg-reconfigure keyboard-configuration
• # locale-gen

PATHS

• /etc/locale.gen
• /etc/default/locale
• /etc/environment  ( login - gdm - ssh )

COMMANDS

• $ locale
• $ apt-cache show locales
• $ locale -a

LANGUAGE-CODE

• language-code_COUNTRY-CODE
• ISO-8859-1    “Latin 1”
• ISO-8859-15   “Latin 9”
• UTF-8         unicode.org

SOURCES

• file:///usr/share/doc/debian-handbook/html/en-US/basic-configuration.html#sect.config-language-support
• wiki.debian.org/Locale
• unicode.org


044 • RASPBERRY PI
 • Homepage         : raspberrypi.org 
 • Configuration    : raspberrypi.org/documentation/configuration/
 • Download         : raspberrypi.org/downloads/raspbian/
MAGPI 

 • Issue 81 2019-05 : raspberrypi.org/magpi-issues/MagPi81.pdf
 • Issue 80 2019-04 : raspberrypi.org/magpi-issues/MagPi80.pdf
 • Issue 79 2019-03 : raspberrypi.org/magpi-issues/MagPi79.pdf
 • Issue 78 2019-02 : raspberrypi.org/magpi-issues/MagPi78.pdf
 • Issue 77 2019-01 : raspberrypi.org/magpi-issues/MagPi77.pdf

 • Issue 76 2018-12 : raspberrypi.org/magpi-issues/MagPi76.pdf
 • Issue 75 2018-11 : raspberrypi.org/magpi-issues/MagPi75.pdf
 • Issue 74 2018-10 : raspberrypi.org/magpi-issues/MagPi74.pdf
 • Issue 73 2018-09 : raspberrypi.org/magpi-issues/MagPi73.pdf
 • Issue 72 2018-08 : raspberrypi.org/magpi-issues/MagPi72.pdf
 • Issue 71 2018-07 : raspberrypi.org/magpi-issues/MagPi71.pdf
 • Issue 70 2018-06 : raspberrypi.org/magpi-issues/MagPi70.pdf
 • Issue 69 2018-05 : raspberrypi.org/magpi-issues/MagPi69.pdf
 • Issue 68 2018-04 : raspberrypi.org/magpi-issues/MagPi68.pdf
 • Issue 67 2018-03 : raspberrypi.org/magpi-issues/MagPi67.pdf
 • Issue 66 2018-02 : raspberrypi.org/magpi-issues/MagPi66.pdf
 • Issue 65 2018-01 : raspberrypi.org/magpi-issues/MagPi65.pdf

DOCUMENTATION

 • Beginners Guide  : raspberrypi.org/magpi-issues/Beginners_Guide_v1.pdf
 • Beginners Book   : raspberrypi.org/magpi-issues/Beginners_Book_v1.pdf

$ clear; lsblk; lsblk -l
$ dd bs=4M if=2018-10-09-raspbian-stretch.img of=/dev/sdX status=progress conv=fsync
# raspi-config


043 • FISH
 • Homepage         : fishshell.com
 • Tutorial         : fishshell.com/docs/current/tutorial.html
 • Documentation    : fishshell.com/docs/current/index.html
 • Commands         : fishshell.com/docs/current/commands.html
 • FAQ              : fishshell.com/docs/current/faq.html
 • Design           : fishshell.com/docs/current/design.html
# apt-get install fish
$ man fish
~> fish_config
~> cd ~/.config/fish/functions

CONFIGURATION

~> fish_config
~> vim ~/.config/fish/config.fish
~> fish_vi_key_bindings
-> fish_default_key_bindings

PATHS

~/.config/fish
~/.config/fish/functions

EXAMPLES

$ fish
~> help

function c
   clear
   echo
   neofetch
   cowsay -W 131 -f moose (cat ~/bin/oneliner.txt | shuf -n1)
   echo
end

function s -d "Steem Price"
   if $argv = "";
      set argv 3;
   end
   set STEEM rate.sx/steem@{$argv}d
   clear
   curl $STEEM 
end


042 • AT
$ at now | midnight | noon | teatime | HH:MM
> echo "Hello World!"
> <ctrl-d>
$ from

$ tty               # Terminal number
$ at now +60 minutes
> echo "Hello World!" > /dev/pts/2
> <ctrl-d>

$ at 1am tomorrow
$ at now +1 minutes | hours | weeks
$ at 4pm +3 days
$ at 10am Jul 31

$ at noon shutdown -h now
$ atq           : list pending jobs
$ atrm id       : id from atq

SOURCES
$ man at
$ man at.allow
$ man at.deny
$ man atd
• time specification can be found in /usr/share/doc/at/timespec


041 • SOURCES
MAN-PAGES ( -? --help man info pinfo /usr/share/doc )
• $ manpath
• $ mandb
• $ man man
• $ man -a bash
• $ man -t bash | lp
• $ man -k bash; apropos bash; whatis bash

DEBIAN-REFERENCE-CARD
• # apt-get install debian-refcard
• $ dpkg -L debian-refcard | grep -i index
• > /usr/share/doc/debian-refcard/index.html
• > file:///usr/share/doc/debian-refcard/index.html
• > file:///usr/share/doc/debian-refcard/refcard-en-a4.pdf.gz

DEBIAN-DOCUMENTATION
• $ ls -l /usr/share/doc | less
• $ man man
• wiki.debian.org

LINUX
• linux.com
• kernel.org
• linuxlinks.com
• tldp.org/LDP/intro-linux/html/index.html
• tldp.org/sorted_howtos_full.html

OPEN-BOOKS
• O'Reilly          - oreilly.com/openbook
• Rheinwerk (de)    - rheinwerk-verlag.de/openbook/


040 • VIM - GITHUB REPOSITORY
$ cd ~/Apps                                     # Place of your local installations
$ git clone https://github.com/vim/vim.git      # At the first time
$ git pull                                      # Update to the latest version
$ cd vim/src
# make distclean                                # If you build Vim before
# make
# make install


SOURCE
• vim.org/git.php


039 • TASK & TIMEWARRIOR
INSTALLATION

$ apt-cache search taskwarrior timewarrior
# apt-get install taskwarrior tasksh timewarrior
$ apt-cache show taskwarrior taskwarrior
$ man task

CONFIGURATION TASKWARRIOR

$ vim ~/.taskrc

CONFIGURATION TIMEWARRIOR

$ ls -l ~/.timewarrior
$ cp /usr/local/share/doc/timew/ext/on-modify.timewarrior ~/.task/hooks/
$ chmod +x ~/.task/hooks/on-modify.timewarrior 
$ vim ~/.timewarrior/timewarrior.cfg
> define exclusions:
>   monday    = <9:00 12:30-13:00 >17:00
>   tuesday   = <9:00 12:30-13:00 >17:00
>   wednesday = <9:00 12:30-13:00 >17:00
>   thursday  = <9:00 12:30-13:00 >17:00
>   friday    = <9:00 12:30-13:00 >17:00
>   saturday  = >0:00
>   sunday    = >0:00
:wq

STOPWATCH

$ timew
$ timew start
$ timew stop

TASKWARRIOR

$ task
$ task add project:Phoenix Task1
$ task add project:Running Task2
$ task
$ task 1 edit
$ task 1 modify priority:H
$ task 1 modify due:eow
$ task 1 modify due:eom
$ task 1 modify project:Java
$ task 1 start
$ task 1 stop
$ task 1 information
$ task calc now + 21d
$ task calendar 2019
$ task
$ task 1 done
$ task 2 delete
$ task
$ task burndown.daily; task burndown.weekly; task burndown.monthly
$ alias t='clear; task'
$ alias tt='clear; task burndown.daily'

TIMEWARRIOR

$ timew start | stop | continue
$ timew running start | stop
$ timew day | week | month
$ timew tags
$ timew summary

SOURCES TASKWARRIOR

• Homepage          taskwarrior.org
• Documentation     taskwarrior.org/docs
• Tutorial          taskwarrior.org/docs/30second.html

SOURCES TIMEWARRIOR

• Tutorial          taskwarrior.org/docs/timewarrior/tutorial.html
• Documentation     taskwarrior.org/docs/timewarrior


038 • JOB-CONTROL
$ vim ~/.vimrc <ctrl>+z
$ vim ~/.bashrc <ctrl>+z
$ ranger <ctrl>+z
$ htop <ctrl>+z
$ glances &
$ jobs
$ fg 1

RUN A BACKGROUNd-JOB
$ sleep 10000 &
$ jobs -l
$ kill 12345

SOURCES
$ help jobs
$ help fg
$ help bg


037 • VIM FIRST-STEPS
INSTALL VIM
 # apt-get install vim gvim vim-doc vim-scripts 
 $ dpkg -L vim-doc
 # update-alternatives --config editor
 $ vim --version | less

REMAP <CAPS LOCK> TO <ESC>
 • GNOME-TWEAK-TOOL: Typing-Tab > Caps Lock key behaviour > Make Caps Lock an additional ESC

LEARN AND TRAIN THE BASICS
 $ vimtutor en
 $ firefox vim-adventures.com
 • vim, :h user-manual :resize

DISABLE YOUR ARROW KEYS
 $ vim ~/.vimrc 
   map <up> <nop>
   imap <up> <nop>
   map <down> <nop>
   imap <down> <nop>
   map <left> <nop>
   imap <left> <nop>
   map <right> <nop>
   imap <right> <nop>
 :wq

CONFIGURE YOUR BASH-ENVIRONMENT
 : echo $MYVIMRC
 # update-alternatives --config editor
 $ vim ~/.bashrc
   EDITOR=/usr/bin/vim
   VISUAL=$EDITOR
   export EDITOR VISUAL
 :wq

ACTIVATE VIM-MODE IN BASH
 $ vim ~/.bashrc
   set -o vi
   bind -m vi-insert "\C-l"     # clear-screen
 :wq

ACTIVATE VIM-PLUGIN IN FIREFOX
 Plugin: Vim Vixen


036 • I3WM
Exit                                    <alt><shift>e
Help                                    F1
-------------------------------------------------------
Terminal                                <alt><enter>
Menu                                    <alt>d
Workspace                               <alt>0-9
Move a window to another workspace      <alt><shift>0-9
Fullscreen                              <alt>f
Kill a window                           <alt><shift>q
Homepage                                : i3wm.org
Documentation                           : i3wm.org/docs/userguide.html
ReferenceCard                           : i3wm.org/docs/refcard.html
Tutorial                                : youtu.be/Wx0eNaGzAZU


035 • JAVA MODIFIER
                Class Package Subclass World
private            ok       -        -     -
default            ok      ok        -     -
protected          ok      ok       ok     -
public             ok      ok       ok    ok


034 • VIM-VIMRC
[ $ vim ~/.vimrc                    ] edit ~/.vimrc
[ vim, :w ~/.vimrc_backup           ] backup ~/.vimrc

"IDE
syntax on
set autoindent
set smartindent
set cindent

"FOLDING
autocmd BufWinLeave *.* mkview          
autocmd BufWinEnter *.* silent loadview

let mapleader = ","                     "Leaderkey
set scrolloff=99                        "Scrolling behaviour
set splitright                          "Splitting behaviour
set rnu                                 "Relative line numbers
set nonu                                "Line numbers
set nocompatible
set showmode
set ruler                               
set linebreak
set showcmd
set laststatus=1
set background=dark
set encoding=utf8
filetype on
filetype plugin on
set mouse=a
"set colorcolumn=80
"set cursorline

"DISABLE ARROW KEYS
map <up> <nop>
imap <up> <nop>
map <down> <nop>
imap <down> <nop>
map <left> <nop>
imap <left> <nop>
map <right> <nop>
imap <right> <nop>

"SEARCH
set nohlsearch
set incsearch

"TABs
set tabstop=4
set softtabstop=4
set shiftwidth=4
"set expandtab

"KEY MAPPINGS
"map <F2> :echo 'Current time is ' . strftime('%c')<CR>
nmap <F2> ggVG"+y
map <F5> :set list!<CR>
map <F6> :setlocal spell! spelllang=en_us<CR>
map <F8> :set nu!<CR>
map <Leader><F8> :set rnu!<CR>
map <Leader>, :w<CR>

"ABBREVIATIONS
:iab ii <esc>
:iab psv public static void(String[] args) {<cr>}<esc>ko 
:iab sout System.out.println(                            


033 • SNAP
INSTALLATION

# apt update &&  apt install snapd
$ snap version
$ whereis snapd

$ vim ~/.bashrc
> export PATH=/snap/bin:$PATH
:wq

PACKAGES

$ snap find idea
$ snap info intellij-idea-community
# snap install intellij-idea-community --classic
$ snap find eclipse
$ snap info eclipse
# snap install eclipse --classic

UPDATE

$ snap list
# snap refresh
Homepage        : snapcraft.io
Documentation   : docs.snapcraft.io/snap-documentation/3781


032 • LAN
• ufw - ufw status                  # ufw status
• netstat - TCP Sessions            # netstat -tupan
• nmap - Interfaces & Routes        $ nmap --iflist
• arp-scan - ARP                    # arp-scan --localnet
• ip - Neighbours                   $ ip neigh; ip monitor
• mtr - Network diagnostic          $ mtr --curses google.com
• sntop - Network status            $ sntop
• nmap - Services                   $ nmap -A -T4 -Pn a.b.c.d
• nmap - Identify Internet Services $ nmap a.b.c.d; nmap -sP a.b.c.d/24

• SYSSTAT           $ sar -o file 10 8640
    Homepage        : sebastien.godard.pagesperso-orange.fr/index.html
    Documentation   : sebastien.godard.pagesperso-orange.fr/documentation.html
    Tutorial        : sebastien.godard.pagesperso-orange.fr/tutorial.html

• BLEACHBIT         # bleachbit --gui &       
    Homepage        : bleachbit.org
    Documentation   : docs.bleachbit.org
    Tutorial        : bleachbit.org/videos

• CACTI             : localhost/cacti : user admin  
    Homepage        : cacti.net
    Documentation   : cacti.net/documentation.php
    Tutorial        : nwlab.net/tutorials/cacti/cacti-tutorial.html

• ZABBIX                    
    Homepage        : zabbix.com
    Documentation   : zabbix.com/documentation/1.8/start
    Tutorial        : zabbix.com/documentation/1.8/manual/tutorials

• $ ip route show
• $ ping -c4 8.8.8.8
• $ ping router.linux.local
• $ host 8.8.4.4
• $ nmap -A -T4 a.b.c.d
• $ nmap -sP a.b.c.d/24
• $ ssh -X [email protected]
linuxhowtos.org/Security/understandssh.htm
linux.die.net/Intro-Linux/chap_10.html
file:///usr/share/doc/debian-handbook/html/en-US/index.html


031 • SWAP SPACE
CHECK

$ free -h
$ top | htop | atop | glances
$ vmstat -w
$ cat /proc/swaps
# fdisk -l
$ cat /proc/sys/vm/swappiness 

TROUBLESHOOTING

01 # swapon -s
02 # ls -lh /tmp 
03 # dd if=/dev/zero of=/tmp/swap_tmp bs=1024 count=1000000
04 # ls -lh /tmp
05 # chmod 600 /tmp/swap_tmp
06 # mkswap /tmp/swap_tmp
07 # swapon /tmp/swap_tmp
08 # swapon -s
09 # echo 100 > /proc/sys/vm/swappiness

PERMANENT

# blkid
# vim /etc/fstab
> # Emergency swap partition
> UUID= (value from blkid)     none     swap     sw    0     0
:wq


030 • ECLIPSE
KEYS

• Activate Editor       F12
• Quick Assist          control+1           control+2 control+3
• Content Assist        control+space   
• Active Keybindings    shift+control+l
• Full Screen           alt+F11
• Maximum Editor        control+m
• Open Declaration      F3
• Toggle Breakpoint shift+control+b
• Insert line           shift+enter         shift+control+enter
• Run Debug             control+F11         F11
    
EDITING

• Toggle Comment        control+shift+/     
• Format                control+shift+f     
• Maximum View          control+m           
• Folding               control+<Num-Div>   
• Delete line           control+d           
• Undo                  control+z            
• Goto line number      control+l           
• Format                control+shift+f     
• sysout^<space>
• main^<space>
    
FOLDING

• control+shift+num-div
• control+num-plus
• control+num-minus 
• control+num-multiply

SOURCES

• Homepage      eclipse.org
• Download      eclipse.org/downloads/download.php?file=/oomph/epp/2018-12/R/eclipse-inst-linux64.tar.gz
• Documentation help.eclipse.org/2019-03/index.jsp
• Tutorial      tutorialspoint.com/eclipse/


029 • WAN 
$ w3m myip.is
$ w3m ifconfig.me
$ curl ifconfig.me/all
$ traceroute 8.8.8.8
$ mtr --curses 8.8.4.4


028 • CRON
COMMANDS

$ ls -ld /etc/cron*
# ranger /etc/cron.d
# crontab -l
# crontab -e
$ crontab -e

DAEMON

$ systemctl status cron.service
# service cron status
# service --status-all | less

CONFIGURATION

$ crontab -u user -e
> ┌──────────────── minute          (0 - 59) 
> │ ┌────────────── hour            (0 - 23) 
> │ │ ┌──────────── day of month    (1 - 31) 
> │ │ │ ┌────────── month           (1 - 12) 
> │ │ │ │ ┌──────── day of week     (0 - 6) Sunday to Saturday 
> │ │ │ │ │ 
> * * * * *         echo "Test" >> /tmp/crontest.txt
> 0 9 * * *         tar -zcf /var/backups/eclipse.tgz /home/user/eclipse-workspace/
> 0 9 * * 4         rm -rf /home/user/tmp/*
> 0 0 1,15 * *      echo "Test" >> /tmp/crontest.txt
> */10 * * * *      echo "Test" >> /tmp/crontest.txt
> 0 0-5 * * *       echo "Test" >> /tmp/crontest.txt
> 0 0 */2 * *       echo "Test" >> /tmp/crontest.txt
> */30 9/17 * * 1-5 echo "Test" >> /tmp/crontest.txt
> 0 12  *  *  *     /usr/sbin/tripwire --check
:wq

SOURCES

$ w3m crontab.guru
$ man cron
$ man -a crontab
$ man 5 crontab


027 • RANGER - A console file manager with VI key bindings
F1      F2      F3      F4      F5      F6      F7      F8      F10
help    rename  view    edit    copy    cut     mkdir   delete  exit    

Exit                : q
Help                : ? <f1>
--------------------------------------
Shell               : S s
Show hidden files   : <ctrl>h
File rename         : <ctrl>cw :rename
File delete         : <ctrl>dD :delete
File tag            : t ct
Go home             : gh
Go /etc             : ge

INSTALLATION

# pip install ranger-fm

CONFIGURATION

$ ranger --copy-config=all
$ vim ~/.config/ranger/rc.conf
> set draw_borders true
:wq

SOURCES

• Homepage          : ranger.github.io
• Documentation     : github.com/ranger/ranger/wiki 
• User-Guide        : github.com/ranger/ranger/wiki/Official-user-guide
• Wiki-Arch-Linux   : wiki.archlinux.org/index.php/Ranger


026 • BASH
SESSION

$ sudo !!
# apt-get update && apt-get upgrade && apt-get dist-upgrade; apt-get autoremove -yy
# init 0
# init 6
# shutdown -c
# shutdown -h 1:00
# shutdown -r now

SUDO

# visudo 
> Defaults:user timestamp_timeout=30
Homepage        : gnu.org/software/bash/
Documentation   : gnu.org/software/bash/manual/html_node/index.html


025 • JAVA
• Homepage          : oracle.com/java/
• Whitepaper        : oracle.com/technetwork/java/langenv-140151.html
• Download          : oracle.com/technetwork/java/javase/downloads/index.html
• Documentation     : docs.oracle.com/en/java/javase/12/index.html
• API               : docs.oracle.com/en/java/javase/12/docs/api/index.html
TUTORIALS

• Bradley Kjell     : chortle.ccsu.edu/java5/index.html
• TutorialsPoint    : www.tutorialspoint.com/java/index.htm
• JavaTpoint        : www.javatpoint.com/java-tutorial

ORACLE-TUTORIALS

Index               : docs.oracle.com/javase/tutorial/reallybigindex.html
Getting Started     : docs.oracle.com/javase/tutorial/getStarted
Language Basics     : docs.oracle.com/javase/tutorial/java/nutsandbolts/index.html
OOP Concepts        : docs.oracle.com/javase/tutorial/java/concepts/index.html
Classes and Objects : docs.oracle.com/javase/tutorial/java/javaOO/index.html
Annotations         : docs.oracle.com/javase/tutorial/java/annotations/index.html
Interfaces and Inheritance: docs.oracle.com/javase/tutorial/java/IandI/index.html
Numbers and Strings : docs.oracle.com/javase/tutorial/java/data/index.html
Generics            : docs.oracle.com/javase/tutorial/java/generics/index.html
Packages            : docs.oracle.com/javase/tutorial/java/package/index.html
Exceptions          : docs.oracle.com/javase/tutorial/essential/exceptions/index.html
Basic I/O           : docs.oracle.com/javase/tutorial/essential/io/index.html
Concurrency         : docs.oracle.com/javase/tutorial/essential/concurrency/index.html
Platform Environment: docs.oracle.com/javase/tutorial/essential/environment/index.html
Regular Expressions : docs.oracle.com/javase/tutorial/essential/regex/index.html
Collections         : docs.oracle.com/javase/tutorial/collections/index.html
Date & Time         : docs.oracle.com/javase/tutorial/datetime/index.html
Deployment          : docs.oracle.com/javase/tutorial/deployment/index.html
Swing               : docs.oracle.com/javase/tutorial/uiswing/index.html
JavaFX              : docs.oracle.com/javase/8/javase-clienttechnologies.htm
Networking          : docs.oracle.com/javase/tutorial/networking/index.html
Generics            : docs.oracle.com/javase/tutorial/extra/generics/index.html
Internationalization: docs.oracle.com/javase/tutorial/i18n/index.html
JavaBeans           : docs.oracle.com/javase/tutorial/javabeans/index.html
JDBC                : docs.oracle.com/javase/tutorial/jdbc/index.html
RMI                 : docs.oracle.com/javase/tutorial/rmi/index.html
Reflection          : docs.oracle.com/javase/tutorial/reflect/index.html
Security            : docs.oracle.com/javase/tutorial/security/index.html
Sound               : docs.oracle.com/javase/tutorial/sound/index.html
2D Graphics         : docs.oracle.com/javase/tutorial/2d/index.html

AWK • SWING • JavaFX

• O'Reilly          : oreilly.com/openbook/javawt/book/index.html
• Bradley Kjell     : chortle.ccsu.edu/java5/Notes/chap55/ch55_1.html
• TutorialsPoint    : tutorialspoint.com/swing/index.htm
• Oracle Trail      : docs.oracle.com/javase/tutorial/uiswing/
• Oracle JavaFX     : docs.oracle.com/javase/8/javase-clienttechnologies.htm


024 • AWK
$ awk 'BEGIN { print "Don\47t Panic!" }'
$ awk -F: '{ print $1 }' /etc/passwd | sort | tee user.txt
$ awk -F: '$1 == "userxyz" { print $0 }' /etc/passwd
$ awk -F: '/userxyz|root/ { print $0 }' /etc/passwd

INSTALLATION

# apt-get install gawk gawk-doc
$ dpkg -L gawk-doc | less
> file:///usr/share/doc/gawk-doc/gawk-html/index.html#Top

DOKUMENTATION

• Manual            : gnu.org/software/gawk/manual/gawk.html
• Tutorial I        : tutorialspoint.com/awk/index.htm
• Tutorial II       : tldp.org/LDP/abs/html/sedawk.html


023 • MEMORY
SYSTEM-INFORMATION

$ top $ htop $ atop $ glances
$ watch free -h
$ less /proc/meminfo
$ cat /proc/sys/vm/swappiness
# sysctl -a

TROUBLESHOOTING

# sysctl -a
# sysctl vm.swappiness=15
# sysctl -a

# sysctl -a
# bash -c "sync; echo 3 > /proc/sys/vm/drop_caches"
# sysctl -p
# sysctl -a


022 • ONE-LINER & COWSAY
INSTALLATION

$ cp ~/.bashrc ~/.bashrc_old
$ echo 'clear' >> ~/.bashrc
$ echo 'echo' >> ~/.bashrc
$ echo 'neofetch' >> ~/.bashrc
$ echo 'cowsay -W 80 -f moose $(cat ~/bin/oneliner.txt | shuf -n1)' >> ~/.bashrc
$ echo 'echo'
$ . ~/.bashrc

ONE-LINER-TEXTFILE

$ vim ~/bin/oneliner.txt

# bash -c "sync; echo 3 > /proc/sys/vm/drop_caches"
# find / -uid 1000 -exec chown -v 1002:1002 {} \;
# find / -user userxyz -type f -exec rm -f {} \;
# find /home -user userxyz -mtime -3
# find /home -user userxyz -size +1G
# mkdir -p /mnt/ram; mount -t tmpfs tmpfs /mnt/ram -o size=8192M
$ alias ea='vim ~/.bash_aliases && source ~/.bash_aliases'
$ cat /etc/passwd | cut -d: -f7 | sort | uniq -c | sort -nr
$ cat /etc/shells
$ curl cheat.sh/:list | less
$ curl wttr.in
$ echo "It is now $(date +%T) on $(date +%A)"
$ find -size +100M | less
$ find -size +1G | less
$ find . -name "*.jpg" -exec convert {} -scale 50% +repage {} \;
$ find /etc -type f -print 2> /dev/null | less
$ find /etc/*tab -type f -print
$ find ~ -maxdepth 1 -type f -exec grep "^alias " '{}' \; -print
$ find ~ -maxdepth 1 -type f -exec grep "^alias " '{}' \; -print
$ find ~ -maxdepth 1 -type f -mtime 3
$ mkdir -p Backups/{Sales,Development,HR}/{Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec}/{Sun,Mon,Tue,Wed,Thu,Fri,Sat}
$ mkdir -p dummy/{1..100}/{1..100}
$ mount | column -t
$ mpg123 -zvC /home/user/music/*
$ ranger ~/.local/share/Trash/
$ scp -r folder/ [email protected]:~
$ scp dummy.txt [email protected]:~
$ sudo -H pip install --upgrade youtube-dl
$ watch -d -n 5 ls -l
$ watch free -h
$ watch mail

:%sort
:wq


021 • NEOFETCH
$ apt-cache search neofetch
$ apt-cache show neofetch
# apt install neofetch
$ cp ~/.bashrc ~/.bashrc_old
$ \ls -lisa ~/.bashrc*
$ echo "neofetch" >> ~/.bashrc
$ . ~/.bashrc

---
$ inxi -v1


020 • VIM
 • Homepage     : vim.org
 • Reference    : vimhelp.org/quickref.txt.html
MODES                   

• Normal Mode           <esc>
• Insert Mode           i, a, c
• Visual Mode           v, V, <ctrl-v>
• Command-line Mode     :, /, ?

INSERT MODE

i   : Insert text before the cursor.
I   : Insert text before the first non-blank in the line.
s   : Delete character under the cursor and start insert mode.
S   : Delete line and start insert mode.
a   : Enter insert mode after cursor.
A   : Enter insert mode at the end of the line.
o   : Enter insert mode on the next line.
O   : Enter insert mode on th above line.
C   : Delete from cursor to end of line and begin insert.

TEXT OBJECTS

aw  : a word
aW  : a WORD
iw  : inner word
iW  : inner WORD
ap  : a paragraph
ip  : inner paragraph
ab  : a bracket
ib  : inner bracket
at  : a tag
it  : inner tag
i"  : inner quotes
ip  : inner paragraph
i{  : inner brackets
as  : a sentence


019 • PYTHON
 • Homepage             : python.org
 • Documentation        : docs.python.org/3.7/
 • Download             : python.org/downloads/
# apt-get install python3 python-pip spyder3 diveintopython3
$ python3
$ python -m SimpleHTTPServer

DIVE-INTO-PYTHON-3

# apt install diveintopython3
$ dpkg -L diveintopython3 | grep -i index
> /usr/share/doc/diveintopython3/html/index.html
> file:///usr/share/doc/diveintopython3/html/index.html

SOURCES

• CheatSheet            : cheat.sh/python/:learn
• IDE                   : Spyder3


018 • GLANCES
$ apt-cache search glances
# apt install glances glances-doc
$ apt-cache show glances
$ man glances
$ dpkg -L glances
$ w3m /usr/share/doc/glances/html/quickstart.html

ALTERNATIVE

• Github                            : github.com/nicolargo/glances
# pip install --upgrade glances


017 • DEBIAN
Tutorials               : debiantutorials.com
DistroWatch             : distrowatch.com/table.php?distribution=debian 
w3Tech                  : w3techs.com

Debian News             : debian.org/News
Debian Security         : debian.org/security/#DSAS
Debian Version          $ cat /etc/debian_version

Package Documentation   : /usr/share/doc
Sources List Generator  : debgen.simplylinux.ch 
Debian Backports        : backports.org

DOCUMENTATION

• Documentation         : debian.org/doc

• Wiki                  : wiki.debian.org/FrontPage
• Debian & Java         : debian.org/doc/manuals/debian-java-faq/index.en.html
• Securing Debian       : debian.org/doc/manuals/securing-debian-howto/index.en.html
• Menu System           : debian.org/doc/packaging-manuals/menu.html/ch1.html
• Networking HowTo      : tldp.org/HOWTO/NET3-4-HOWTO.html
• Gnome                 : help.gnome.org

• Reference Card        # apt install debian-refcard
                        $ dpkg -L debian-refcard | less
                        $ w3m /usr/share/doc/debian-refcard/index.html
                        
• Reference             : debian.org/doc/manuals/debian-reference/
                        # apt install debian-reference-en
                        $ dpkg -L debian-reference-en
                        $ w3m /usr/share/doc/debian-reference/docs/index.en.html
                        
• Handbook              : debian.org/doc/manuals/debian-handbook/
                        # apt install debian-handbook
                        $ dpkg -L debian-handbook | less
                        $ w3m /usr/share/doc/debian-handbook/html/en-US/index.html                      
Homepage                : debian.org
Download                : debian.org/distrib/netinst#smallcd


016 • SCREEN
# apt install screen

DOCUMENTATION

$ man screen
$ w3m gnu.org/software/screen/manual/screen.html
• ctrl a?           : Keybindings

SESSIONS

$ screen -S firstsession glances
$ screen -X -S firstsession quit
$ screen -ls        : List screen sessions
$ screen -r         : Reattaching
$ screen -x         : Attach to a not detached screen session
• ctrl ad           : Detach session
• ctrl ax           : Lock session

WINDOWS

• ctrl ac           : Create window
• ctrl aA           : Rename window
• ctrl aa           : Toggle window
• ctrl a[0 .. 9]    : Toggle window
• ctrl a|           : Split window vertically
• ctrl aS           : Split window horizontally
• ctrl aX           : Kill pane
• ctrl an           : Next window
• ctrl ap           : Previous window
• ctrl ak           : Kill window
• ctrl a\           : Kill all windows
• ctrl aw           : Window bar 
• ctrl a"           : Window list
• ctrl ah           : Hardcopy

EXAMPLE

$ screen -S firstsession
• ctrl aS
• ctrl a|
$ htop
• ctrl a<tab>
• ctrl ac
$ atop
• ctrl <tab>
• ctrl ac
$ df -hT

CONFIGURATION

# vim /etc/screenrc
$ vim ~/.screenrc


015 • SHORTCUTS
DAILY USE

• <ctrl>+z fg bg jobs <ctrl>+u <ctrl>+k <ctrl>+w <alt>+. <bash-vim-mode>

CHARACTER

• ctrl f    : Move forward one character
• ctrl b    : Move backward one character
• ctrl h    : Generate a backspace character
• ctrl d    : Delete one character

EDITOR

• ctrl xe   : Editor

DESKTOP

• alt F2    : Run Command

HISTORY

• ctrl r    : Search from history searching mode
• ctrl g    : Escape from history searching mode
• alt .     : Use the last word of the previous command

LINE

• esc #     : Making the line a comment
• ctrl a    : Go to the beginning of the line
• ctrl e    : Go to the end of the line
• ctrl xx   : Move between start of commandline and current position and back again
• ctrl eu   : Clear the line 
• ctrl k    : Delete from cursor to the end of the line
• ctrl u    : Delete from cursor to the start of the line

TERMINAL

$ gnome-terminal
• ctrl alt F3
• reset             : Reset the terminal
• ctrl d or exit    : Exit the terminal
• shutdown -h now   : Shut down the system

SCREEN

• ctrl +-   : Size
• ctrl l    : Clear the screen
• ctrl s    : Stop output to the screen
• ctrl q    : Allow output to the screen


014 • LINUX-FROM-SCRATCH (LFS)
• Homepage      : linuxfromscratch.org/lfs/index.html
• Documentation : linuxfromscratch.org/lfs/view/stable/
• Download      : linuxfromscratch.org/lfs/downloads/stable/
• DistroWatch   : distrowatch.com/table.php?distribution=lfs
PROJECTS

• Linux From Scratch            : linuxfromscratch.org/lfs/
• Beyond Linux From Scratch     : linuxfromscratch.org/blfs/
• Automated Linux From Scratch  : linuxfromscratch.org/alfs/
• Cross Linux From Scratch      : trac.clfs.org/

STEPS

03 Virtualbox       : # apt install virtualbox
02 Debian Live-CD   : cdimage.debian.org/debian-cd/current-live/amd64/iso-hybrid/
01 RTFM             : linuxfromscratch.org/lfs/view/stable/


013 • TOOLBOX
# apt install ...
A - alacarte atop aview
B - backintime-qt4 bluefish boostnote
C - calcurse clipit cherrytree cmus
E - espeak 
F - firmware-iwlwifi firmware-realtek focuswriter fzf
G - gdebi gkrellm glances gnome-clocks gnome-do gparted grsync guake 
H - htop hwinfo 
I - inxi i3-wm
K - kismet  
L - libreoffice links lsd lvm2  
M - mc menulibre 
N - netcat net-tools nmap
P - powertop printer-driver-cups 
R - ranger
S - screen sudo syncthing
T - taskwarrior terminator tilda timeshift timewarrior tripwire 
V - veracrypt* vim virtualbox vym 
W - w3m
Y - youtube-dl


012 • BASHRC
$ vim ~/.bashrc
>
> HISTCONTROL=ignoreboth:erasedups
> HISTSIZE=1000
> HISTFILESIZE=1000
>
> alias h='clear; echo; history 30; echo'
>
> set -o vi
> bind -m vi-insert "\C-l":clear-screen
> EDITOR=/usr/bin/vim
> VISUAL=$EDITOR
> export EDITOR VISUAL
>
:wq


011 • FUZZI FINDER
$ fzf -e --preview 'head -100 {}'


010 • CRYPTOCURRENCIES
$ curl rate.sx
$ curl rate.sx/btc@3d
$ curl rate.sx/steem@3d


009 • /ETC/FSTAB
# blkid
# vim /etc/fstab
> #RAMDISK
> none /media/ramdisk tmpfs nodev,nosuid,noexec,nodiratime,size=1024M 0 0


008 • ALIASES
$ alias
$ ls -l ~/.bash_aliases
$ cp ~/.bash_aliases ~/.bash_aliases_backup
$ alias > ~/.bash_aliases

$ vim ~/.bash_aliases
alias a='clear; echo; alias; echo'
alias b30='clear; curl rate.sx/btc@30d'
alias b3='clear; curl rate.sx/btc@3d'
alias b='clear; curl rate.sx/btc@3d'
alias bu='buku'
alias c='clear; neofetch; cowsay -W 131 -f moose $(cat ~/bin/oneliner.txt | shuf -n1); echo'
alias cc='clear; ncal -wy'
alias cd2='clear; \cd ~/2019; echo; lsd -l; echo'
alias cdh='\cd; clear; echo; lsd -l; echo'
alias cdp='clear; \cd ~/.phoenix; echo; lsd -l; echo'
alias d='clear; curl rate.sx/dash@3d'
alias dir='dir --color=auto'
alias ea='vim ~/.bash_aliases && source ~/.bash_aliases'
alias egrep='egrep --color=auto'
alias fgrep='fgrep --color=auto'
alias g='clear; glances'
alias grep='grep --color=auto'
alias h='clear; echo; history 30; echo'
alias i='intellij-idea-community &'
alias l='clear; echo; lsd -l; echo'
alias ls='ls --color=auto'
alias p='(clear; \cd ~/.phoenix; java -jar phoenix.jar)'
alias py='clear; python3'
alias r='ranger'
alias rs='clear; rsync -avzP --delete --stats --exclude-from "/home/user1/.exclude.txt"  /home/user1/ /media/veracrypt1/'
alias s30='clear; curl rate.sx/steem@30d'
alias s3='clear; curl rate.sx/steem@3d'
alias s='clear; curl rate.sx/steem@3d'
alias sc='screen -S firstsession'
alias ss='clear; curl rate.sx/steem@1d; gnome-screenshot -ac'
alias t='clear; task; timew week; timew summary'
alias tm='clear; timew month'
alias tt='clear; task burndown.daily'
alias ttt='clear; task calendar 2019'
alias tw='timew'
alias u='clear; sudo apt-get update && sudo apt-get upgrade && sudo apt-get dist-upgrade; sudo apt-get autoremove -yy'
alias vdir='vdir --color=auto'
alias yt='sudo -H pip install --upgrade youtube-dl'
:wq
$ . ~/.bashrc


007 • RAMDISK
$ df -hT    : active tmpfs
$ free -h   : free ram for a new tmpfs

TEMPORARY-TMPFS

# mkdir -p /media/ramdisk 
$ mount | column -t
# mount -t tmpfs -o size=1024M ramdisk /media/ramdisk
# mount -a
$ mount | column -t
# umount ramdisk
$ mount | column -t

PERMANENT-TMPFS

# mkdir -p /media/ramdisk
# vim /etc/fstab
> ramdisk /media/ramdisk tmpfs nodev,nosuid,noexec,nodiratime,size=1024M 0 0
# mount -a
$ mount | column -t
# umount ramdisk
$ mount | column -t


006 • DISK 
FREE-UP-SPACE
$ du -sch ~
# du -a /home/user | sort -nr | head -n 10
# du -kx /home/user | sort -nr -k1 | head -n 10


005 • DEBIAN ~ /ETC/APT/SOURCES.LIST
• # vim /etc/apt/sources.list

• # Security updates
• deb http://security.debian.org/debian-security stretch/updates main contrib non-free
• deb-src http://security.debian.org/debian-security stretch/updates main contrib non-free

• # Base repository
• deb http://ftp.de.debian.org/debian/ stretch main contrib non-free
• deb-src http://ftp.de.debian.org/debian/ stretch main contrib non-free

• # Stable updates
• deb http://ftp.de.debian.org/debian/ stretch-updates main contrib non-free
• deb-src http://ftp.de.debian.org/debian/ stretch-updates main contrib non-free

• # Stable backports
• deb http://ftp.debian.org/debian stretch-backports main contrib non-free
• deb-src http://ftp.debian.org/debian stretch-backports main contrib non-free

• # Virtualbox
• deb https://download.virtualbox.org/virtualbox/debian stretch contrib


004 • DEBIAN ~ UPDATE & UPGRADE & DIST-UPGRADE
alias u='clear; sudo apt-get update && sudo apt-get upgrade && sudo apt-get dist-upgrade; sudo apt-get autoremove -yy'


003 • DCONF-EDITOR
# apt install dconf-editor && apt show dconf-editor
• /org/gnome/terminal/legacy/default-show-menubar


002 • GNOME-TWEAK-TOOL
# apt install gnome-tweak-tool && apt show gnome-tweak-tool
• Typing-Tab > Caps Lock key behaviour > Make Caps Lock an additional ESC|


001 • VIM-MODE in BASH
$ vim ~/.bashrc
  set -o vi
  bind -m vi-insert "\C-l"      # clear-screen
:wq
Sort:  

This post had received 11.66% upvote from @steemitportugal account!
Vote for @steemitportugal to Witness. Your vote is very important to us!
Visit our WebSite www.steemitportugal.com (tutorials,news...)
Thank you very much.
Click here to vote
steemitportugal
Delegation for daily voting: 10SP-25SP-50SP-100SP-250SP-500SP-1000SP

Coin Marketplace

STEEM 0.26
TRX 0.14
JST 0.034
BTC 57115.94
ETH 3236.47
USDT 1.00
SBD 4.16