so Linux-Zeugs, das ich immer wieder vergesse, weil ich es doch nicht jeden Tag brauche, aber immer wieder…
reset the screens (Trick Robert):
ctrl-alt-F7 ... ctrl-alt-F1
history completition
ctrl-r
tab-switcher behaviour
gsettings set org.gnome.shell.app-switcher current-workspace-only true
rpm on ubuntu:
alien -i bla.rpm
distribution:
cat /etc/*release*
lsb_release -a
Ubuntu full update:
update-manager -c -d
Kleinzeugs Netzwerk:
nmap -p 5000 172.30.1.1
[luna:~] rschumm% sudo nmap -PR 192.168.1.0/24 -sn
Kleinzeugs
watch -n 1 befehl
ugo Zeugs:
r=4
w=2
x=1
quickshell:
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 zipFileName.zip (entpacken)
tar -cvz Ordner -f tgzFileName.tgz (packen)
tar -xvzf tgzFileName.tgz (entpacken)
size rekursiv
du -sh -d 1 .
see here
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)
use a special key for git clone
in .ssh/config
host companygit
Hostname code.company.com
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
ssh-keygen -t rsa
ssh-keygen -lv -f id_rsa
change key password:
ssh-keygen -p
on macOS (agent)
add to keychain, if you use a password:
ssh-add ~/.ssh/id_rsa
ssh-add --apple-use-keychain ~/.ssh/id_rsa
ssh-add l
für .ssh, ugo-Zeugs:
chmod 700 ~/.ssh
chmod 644 ~/.ssh/authorized_keys
chmod 600 id_rsa
für git
und ssh
siehe hier.
hier als Alias in zsh
:
alias tunnelprod='ssh -fNT -L (localport):db.prod.ch:(originalport) -L (noch mehr) remy.schumm@db.prod.ch'
note: this will expose the IP of db.prod.ch
to the target system. To expose localhost
(of the target system) use:
alias tunnelprod='ssh -fNT -L (localport):localhost:(originalport) -L (noch mehr) remy.schumm@db.prod.ch'
the tunnel will still go to the target host mentionned in the last argument of the command.
check private key:
openssl rsa -in pkey.pem -check
expected: RSA key ok
check certificate:
openssl x509 -in cert.pem -text
expected: all the info
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
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
export PATH="/home/rschumm/minis/minishift-1.18.0-linux-amd64/:$PATH"
echo $PATH
printenv
alias and such:
alias schummsync='rsync -vrtz _site/* xxx@xxx.xxx.hostpoint.ch:~/www/public_html/schumm/'
#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:
#!/bin/bash
java Generator.java
#(needs JDK 11)
for file in $(find . -iname '*.yml'); do
echo "$file"
#ls -l "$file"
oc create -f "$file"
done
Partition sda2 füllt nicht die ganze Disk, ich will sie auf das Maximumm vergrössern:
sudo su -
fdisk /dev/sda
p
d
n
p
..dann auch alles default...
w
reboot
xfs_growfs /dev/sda2
general
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 interactive container with docker run
:
Docker Run CLI Reference
docker run -it --rm ubuntu /bin/bash
run a simple container (with a webapp inside) (localport:containerport)
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 quay.io/quarkus/centos-quarkus-maven:graalvm-1.0.0-rc14
…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 quay.io/quarkus/centos-quarkus-maven:19.0.2
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
tl;dr:
helm repo list
helm repo add dings https://charts.dings.io
helm repo update
helm search repo dings --versions
helm show chart dings/dings-chart
helm show all dings/dings-chart
on cluster:
helm install dings dings/dings -n k8sns
helm upgrade dings dings/dings -n k8sns
install Cockpit
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
/usr/lib/jvm
, in my sample: jdk-11.0.2+9
update-alternatives
for every binary, which is done by following snippets:% 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