so Linux-Zeugs, das ich immer wieder vergesse, weil ich es doch nicht jeden Tag brauche, aber immer wieder…

  1. Linux Kleinzeugs
    1. git stuff
    2. scp stuff
    3. ssh stuff
    4. users und so
    5. regex, sed etc.
    6. firewall
    7. garbage
    8. alternatives
    9. tcsh
    10. bash und zsh
    11. Partition resize in RHEL
  2. Docker Kleinzeugs
  3. keeping overview over the Linux System:
  4. legacy
    1. quick and dirty manual install of JDK 11 on Ubuntu 18.04

Linux Kleinzeugs

reset the screens (Trick Robert):

ctrl-alt-F7 ... ctrl-alt-F1 

history completition


tab-switcher behaviour

gsettings set current-workspace-only true

rpm on ubuntu:

alien -i bla.rpm


cat /etc/*release*
lsb_release -a

Ubuntu full update:

update-manager -c -d

Kleinzeugs Netzwerk:

nmap -p 5000
[luna:~] rschumm% sudo nmap -PR -sn


watch -n 1 befehl 

ugo Zeugs:



bash -c 'for i in {1..110}; do mkdir "$i"; done' 

Login-Screen Ubuntu:

sudo vi /usr/share/gnome-shell/theme/ubuntu.css
Sektion lockDialogGroup 

zip, tar

zip -r zipFileNameOhneZip Ordner (packen)
unzip (entpacken)

tar -cvz Ordner -f tgzFileName.tgz (packen)
tar -xvzf tgzFileName.tgz (entpacken)


du -sh -d 1 . 

git stuff

see here

scp stuff

quick scp

scp luna:file .     (copy file in home of luna to here)
scp file remy@kassandra: (copy file from here to home of kassandra)

ssh stuff

use a special key for git clone

in .ssh/config

host companygit
    IdentityFile ~/.ssh/long_19_id_rsa
    IdentitiesOnly yes

and then replace the hostame in the git url:

git clone git@companygit:team/myRepo.git

add key:

echo 'ssh-rsa AAA... bla bla = rschumm@luna' >> authorized_keys

keygen and list type:

ssh-keygen -lv -f id_rsa

change key password:

ssh-keygen -p

für .ssh, ugo-Zeugs:

chmod 700 ~/.ssh
chmod 644 ~/.ssh/authorized_keys
chmod 600 id_rsa 

für git und ssh siehe hier.

users und so

sudo useradd --create-home --groups sudo cloud-user
sudo passwd cloud-user

Bem: useradd nur für simple user, adduser sollte alles machen, inkl. home-dir. cf Cheat

sudo usermod -aG sudo cloud-user
userdel -r cloud-user

regex, sed etc.

echo 'hallo welt' | sed 's/welt/winterthur/'


RHEL etc.

firewall-cmd --list-all
firewall-cmd --zone=public --add-port=8080/tcp
firewall-cmd --zone=public --remove-port=8080/tcp
firewall-cmd --zone=public --list-ports


logs and caches:

sudo journalctl --vacuum-time=10d
sudo apt-get clean


update-alternatives --list java
sudo update-alternatives --config java
update-alternatives --install ... 

update-alternatives --query mvn
to install:  --install <Link> <Name> <Pfad> <Priorität>
sudo update-alternatives --install /usr/bin/mvn mvn /home/rschumm/Software/apache-maven-3.6.0-bin/apache-maven-3.6.0/bin/mvn 100

to set JAVA_HOME: find out where Java is with: update-alternatives --config java, then, in .bashrc:

export JAVA_HOME="/usr/lib/jvm/jdk-11.0.2+9"


set path = ($path $HOME/.gem/ruby/2.3.0/bin/ .)
set path = (/Applications/maven/apache-maven-3.6.3/bin $path:q)
setenv  M2_HOME /Applications/maven/apache-maven-3.x.x
alias mvn $M2_HOME/bin/mvn

alias 2x mit Parameter, einmal normal und einmal frei: 
alias studrepos java -jar /Users/rschumm/zhaw/1974/git/praktikumgit/target/praktikumgit.jar
alias heute 'curl -i  -H "Content-Type: application/yaml" -X POST http://localhost:8080/stunden/heute --data-binary @\!:1'
alias lösche 'curl -i -X DELETE http://localhost:8080/stunden/tag/\!:1'

alias reload source ~/.tcshrc

bash und zsh

export PATH="/home/rschumm/minis/minishift-1.18.0-linux-amd64/:$PATH"
echo $PATH

alias and such:

alias schummsync='rsync -vrtz _site/*'

#function will be accessible just like an alias: 
open() {
    #open the explorer just like in macOS
    nautilus "$1" & 

Bemerkung: Sachen wie @\!:1 funktionieren in zsh nicht! Da muss eine Funktion her.

Beipiel: ruft ein Java-Programm auf und lässt das OpenShift Command laufen:


#(needs JDK 11)

for file in $(find . -iname '*.yml'); do 
     echo "$file"
     #ls -l "$file"
     oc create -f "$file"

Partition resize in RHEL

Partition sda2 füllt nicht die ganze Disk, ich will sie auf das Maximumm vergrössern:

sudo su - 
fdisk /dev/sda





..dann auch alles default... 



xfs_growfs /dev/sda2

Docker Kleinzeugs


docker pull
docker login -u user -p token 

docker images
docker image ls
docker image rm 

garbage collect docker:

docker images 
sudo docker system prune -a

quick interact docker:

run a simple container (with a webapp inside)

rschumm@kassandra:~$ docker run -i --rm -p 8080:8080 schumm/mywebapp

run a new container (with interacting local data)

docker run -it --rm --entrypoint /bin/bash

…with a local directory mounted as a volume, here e.g. /project (note: the local dir must be chmod o+w). This examples runs a source to build image and then starts the mvn build in this container.

docker run -it  --entrypoint /bin/bash --rm -v /home/rschumm/git/halloquarkus:/project
mvn clean verify -Pnative -DskipTests 

attach to an already running container

docker ps 
docker exec -it 91e /bin/bash

save a docker image as file:

rschumm@kassandra:~$ docker save -o schumm.tar schumm/myimage

keeping overview over the Linux System:

install Cockpit



quick and dirty manual install of JDK 11 on Ubuntu 18.04

n.b.: finally, in ubuntus jdk11 is also jdk11 inside like it’s «written on the box». So no need anymore for this.

update-java-alternatives -l | -s 
% sudo sh -c 'for bin in /usr/lib/jvm/jdk-11.0.2+9/bin/*; do update-alternatives --install /usr/bin/$(basename $bin) $(basename $bin) $bin 100; done'

% sudo sh -c 'for bin in /usr/lib/jvm/jdk-11.0.2+9/bin/*; do update-alternatives --set $(basename $bin) $bin; done'

then choose the installation with update-alternatives --config java

zurück zum Seitenanfang