Skip to content

Instantly share code, notes, and snippets.

@tomschall
Last active February 21, 2024 10:38
Show Gist options
  • Save tomschall/cb3ff1f5d98a6fd9de15f346fd545e71 to your computer and use it in GitHub Desktop.
Save tomschall/cb3ff1f5d98a6fd9de15f346fd545e71 to your computer and use it in GitHub Desktop.
::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::: bash ::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::
Show all builtin commands:
man builtin
::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::: tldr ::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::
https://tldr.sh/
::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::: fc :::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::
Fix commands using this command
ech hallo thomas
fc
Now edit command, and save. It then get's executed immeditately.
echo hallo thomas
::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::grep:::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::
Rekursiv über alle Verzeichnisse (r), Groß- und Kleinschreibung wird ignoriert (i), Zeilennummern werden ausgegeben (n)
grep -nri String Verzeichnis
Beispiele: grep -nri "schlüssel" /home/thomas/
grep --color="auto" -nri "create_post" /var/www/
Nur die Zeilennummer ausgeben
egrep -n "schlüssel" /home/thomas/Arbeitsfläche/notes.txt | cut -d":" -f1
mit pdfgrep pdf-Dateien durchsuchen, Zeilennummer anzeigen, Groß- und Kleinschreibung ignorieren
pdfgrep -in linux 10-bash-shortcuts-you-should-know.pdf
alle dateien nach string durchsuchen und mit neuem string ersetzen
grep -rl http:\/\/sozialinfo.ch ./ | xargs perl -pi~ -e 's/http:\/\/sozialinfo.ch/https:\/\/sozialinfo.ch/'
grep -rl http:\/\/www.sozialinfo.ch ./ | xargs perl -pi~ -e 's/http:\/\/www.sozialinfo.ch/https:\/\/www.sozialinfo.ch/'
grep -rl http:\/\/sozialinfo-stellen.ch ./ | xargs perl -pi~ -e 's/http:\/\/sozialinfo-stellen.ch/https:\/\/sozialinfo-stellen.ch/'
grep -rl http:\/\/www.sozialinfo-stellen.ch ./ | xargs perl -pi~ -e 's/http:\/\/www.sozialinfo-stellen.ch/https:\/\/www.sozialinfo-stellen.ch/'
::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::ls::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::
Alles ausgeben (a), langes Listenformat wählen (l), humand readable (h), mittels pipe an less übergeben (| less)
ls -alh | less
Farbe an less mitübergeben, alles ausgeben (a), langes Listenformat wählen (l), humand readable (h), mittels pipe an less übergeben (| less)
ls --color -alh | less -R
Ausgabe von ls in eine Datei schreiben
nohup ls -al /home/thomas/ > ls.log 2>&1 &
::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::terminal:::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::
Strg+Alt+T oder Strg+Alt+F1 - Terminal öffnen
Programm im Hintergrund starten und von der Benutzersitzung lösen.
/usr/bin/xeyes & disown
Alle Prozesse mit PID werden aufgelistet
jobs -l
Prozess in den Hintergrund
bg %1
Prozess in den Vordergrund
fg %1
Prozess von der Benutzersitzung lösen
disown -h 5741
Alle laufenden Prozesse von der Benutzersitzung lösen
disown -a
Aktueller Bash Prompt:
PS1='\[\033[1;73m\][`date +%H:%M:%S`]\[\033[1;32m\][\[\033[1;34m\]\u\[\033[1;33m\]@\[\033[1;32m\]\h:\[\033[1;34m\]\w\[\033[1;32m\]]\[\033[1;32m\]\\$\[\033[0m\] '
dateien bzw. ordner finden
locate dateiname
rekursiv über verzeichnisse suchen, braucht viel länger als locate
find /verzeichnis -iname "test"
:::::::::::::::::::::::::::::::
:::::::::::::Unity:::::::::::::
:::::::::::::::::::::::::::::::
Support Test: cd /usr/lib/nux && ./unity_support_test -p
Grafikkarte erkennen: lspci -nnk | grep -i VGA -A2
Unity zurücksetzen: unity --reset
:::::::::::::::::::::::::::::::
:::::::::::::Unity:::::::::::::
:::::::::::::::::::::::::::::::
compiz --replace & disown
unity --replace & disown
abmelden und wieder anmelden
:::::::::::::::::::::::::::::::
:::::::Paketmanagement:::::::::
:::::::::::::::::::::::::::::::
Im Terminal .deb Pakete installieren:
Für das Terminal bzw. die Textkonsole dient zur Installation eines .deb-Paketes der Befehl dpkg:
sudo dpkg --install /PFAD/ZUR/PAKETDATEI.deb
Wenn Pakete gegenseitige Abhängigkeiten haben oder wenn alle Pakete in einem Ordner installiert werden sollen, ist folgender Befehl hilfreich:
sudo dpkg --install *.deb
Abhängigkeiten auflösen
Mittels
sudo apt-get -f install
lassen sich die fehlenden Abhängigkeiten automatisch nachinstallieren.
:::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::Programme aus den Sourcen installieren :::::::::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::
Um ein Programm installieren zu können, muss es natürlich erst einmal von einem Datenmedium oder dem Internet heruntergeladen werden. Oft liegen dies Programme in gepackten Datein vor, die es natürlich erst zu entpacken gilt.
"tar" Dateien entpacken:
Ein "tar"-Archiv wird mit folgendem Befehl ausgepackt:
tar xfv [ARCHIVNAME].tar
Die Optionen bedeuten folgendes: "x" steht für extract, also auspacken, "f" für file (aus einer Datei) und "v" für verbose (gesprächig). Verwendet man statt "x" ein "c" (create), kann man Verzeichnis und/oder Dateien einpacken und ein eigenes Archiv erzeugen.
"gz" Dateien entpacken:
gunzip [Dateiname]
"bz2" Dateien entpacken:
bunzip2 [DATEI].bz2
"zip" Dateien entpacken
unzip [ARCHIV].zip
Installations Dreisatz: Nachdem du das Programm erfolgreich entpackt hast, musst du in einer Konsole zu dem Verzeichnis wechseln, in dem sich das Programm nun befindet und den unter Linux typischen Dreisatz ausführen:
1. ./configure
2. make
3a. make test (optional)
3b. make install
Wenn dabei Fehler auftreten sollten hast du sehr wahrscheinlich einige Abhängigkeiten nicht richtig aufgelöst und musst dazu manuell Bibliotheken nachinstallieren.
:::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::: Compiz und Unity :::::::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::
compiz --replace - Compiz neustarten
unity --replace - Unity neustarten
:::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::: logkeys ::::::::::::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::
sudo logkeys --start --keymap /usr/bin/logkeys.de-ch.map --output /var/log/logkeys
sudo logkeys --kill
::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::lftp:::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::
set ssl:verify-certificate no
lftp -u web1328,menspuren -p 21 ftp://1328.menschenklang.ch/
::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::ncftp::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::
ncftp -u web1328 -p menspuren ftp://1328.menschenklang.ch
mget -r typo345/*
ncftp -u sozialinfo -p info2.0sozial13 ftp://www.sozialinfo.ch
::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::tmux::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::
Kurztasten
Das Programm kann ausschließlich über Kurztasten (Shortcuts) bedient werden.
Die Kommandosequenz wird standardmäßig mit Strg + B eingeleitet und die
folgende Eingabe wird als weiteres Kürzel interpretiert.
Einige ausgewählte Tastaturkürzel (Shortcuts)
Tastaturkürzel Bedeutung
?D (detach) Ausklinken/aushängen der akt. Sitzung (Client) und in den Hintergrund verschieben,
S (switch) Wechseln zwischen verschiedenen Sitzungen (Client).
C (create) Erzeugen eines neuen Fensters (Shell),
& Beenden der aktuellen Fensters, muss mit y bestätigt werden.
, Umbenennen des aktuellen Fenstertitels
L (last) Wechseln zum letzten aktiven Fenster (ist durch - markiert)
P (previous) Wechsel zum vorherigen Fenster (z.B. von 3 nach 2).
N (next) Wechsel zum nächsten Fenster.
1 etc. Wechsel zur Fenster-Nr.
" Aktuelles Pane horizontal teilen (erzeugt weiteres Pane)
% Aktuelles Pane vertikal teilen (erzeugt weiteres Pane)
W Liste der Fenster anzeigen. Fenster wechseln.
↓ / ↑ Ins vorherige/nächste Pane wechseln
       Wechsel zwischen verschiedenen Aufteilungen der Panes
! Das aktuelle Pane aus dem Fenster lösen und ein neues Fenster mit diesem Pane erstellen.
[ Scroll modus aktivieren, in dem Pfeiltasten zum Scrollen benutzt werden können.
::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::nmap::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::
Als erstes müssen wir erst-einmal herausfinden, welche Port eigentlich offen sind.
nmap localhost
bzw.
nmap deine_IP
bzw. um nur zu schauen, welche PC im Netzwerk sind
nmap -sP 192.168.50.0/24
bzw. wenn man mehr Infos zu einer IP-Adresse haben möchte
sudo nmap -O -T4 -sS 192.168.1.100
oder man möchte nur Infos zu einem bestimmten Port haben
nmap -sV -P0 -p 80 suckup.de
mit dem folgenden Kommando kann man dann den Port, daraufhin analysieren welche PID-Nummer (Programm) diesen nutzt.
z.B.
nmap localhost -p 80
Ausgabe:
Starting Nmap 5.00 ( http://nmap.org ) at 2010-02-08 00:47 CET
Interesting ports on local (127.0.0.1):
PORT STATE SERVICE
80/tcp filtered http
fuser -n tcp 80
Ausgabe:
80/tcp: 32182 32183 32184
ps aux | grep 32182
Ausgabe:
nginx: master process /usr/sbin/nginx
Ggf. kann man auch mit netstat + ss + lsof die Ports analysieren!
::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::meld::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::
Programm um Dateien und deren Inhalte bzw. ganze Verzeichnisse rekursiv zu vergleichen
::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::uptime::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::
w
uptime
::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::Zeilen zählen:::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::
Zeilen von Dateien in einem Verzeichnis zählen:
Alle Dateien zusammen: cat *.cpp | wc -l
Jede Datei einzeln: for FILE in *.txt; do echo "$FILE: $(cat $FILE | wc -l)" done
Zeilen von allen Dateien rekursiv über diverse Verzeichnisse zählen - Ausgangspunkt ./
find ./ -type f -exec wc -l {} \; | awk '{total += $1} END{print total}'
Zeilen von allen PHP Dateien rekursiv über alle Verzeichnisse:
find ./ -name '*.php' | xargs wc -l
::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::Soundkarte::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::
pacmd list-sinks - to list name or index number of possible sinks
pacmd set-default-sink "SINKNAME" - to set the default output sink
pacmd set-default-source "SOURCENAME" - to set the default input
pacmd set-sink-volume index volume
pacmd set-source-volume index volume for volume control (0 = Mute, 65536 = 100%)
Changing the output sink through the command line interface can only take effect if
stream target device reading is disabled. This can be done by editing the corresponing line in:
sudo gedit /etc/pulse/default.pa
load-module module-stream-restore restore_device=false
::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::apt:::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::
apt-cache search 'PDF' | grep ' - .*PDF'
::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::mysql:::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::
MySQL Dump erstellen: /usr/local/mysql/current/bin/mysqldump sozii -u sozii -p > sozii.dump.sql
MySQL Dump in die DB importieren: /usr/local/mysql/current/bin/mysql -u soziite -p soziite < sozii.dump.sql
Pfad zur MySQL Binary: /usr/local/mysql/current/bin/
MySQL Dump sozialinfo.ch LIVE: /usr/local/mysql/current/bin/mysqldump sozii -u sozii -p > sozii.dump.sql
Export ohne Trigger (sozialinfo.ch):
/usr/local/mysql/current/bin/mysqldump --skip-triggers sozii -u sozii -p > sozii.dump.sql
Mit Xampp Dump in die DB importieren:
/opt/lampp/bin/mysql -u root -p sozialinfo_live < sozii.dump.sql
::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::php:::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::
/usr/local/php/bin/php
::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::pavucontrol::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::
pavucontrol - tool für die soundkarteneinstellungen
::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::wifiphisher::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::
https://github.com/sophron/wifiphisher
::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::git:::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::
git config --global user.name "John Doe"
git config --global user.email "[email protected]"
git init
git status
git add .
git commit -m 'initial project version'
git log -3
Mit Author committen
git commit --author="John Doe <>" -m "Impersonation is evil."
Klon erstellen
git clone [email protected]:cantonbecker/bitcoinpaperwallet.git
git remote
Remote Repository einrichten:
git remote add <name> <url>
Beispiel Read Only:
git remote add origin https://[email protected]/sozialinfo/sozialinfo.git
Beispiel Read and Write:
git remote add origin [email protected]:sozialinfo/sozialinfo.git
bitbucket:
Already have a Git repository on your computer? Let's push it up to Bitbucket.
cd /path/to/my/repogit
remote add origin https://[email protected]/sozialinfo/stepodev.git
git push -u origin --all # pushes up the repo and its refs for the first time
git push -u origin --tags # pushes up any tags
git fetch
Änderungen holen und mergen:
git fetch <remote>
git fetch <remote> <branch>
Beispiel:
git fetch origin
This will display the branches that were downloaded:
a1e8fb5..45e66a4 master -> origin/master
a1e8fb5..9e8ab1c develop -> origin/develop
* [new branch] some-feature -> origin/some-feature
For example, the next code snippet shows the branches you might see after fetching from the origin remote:
git branch -r
# origin/master
# origin/develop
# origin/some-feature
To see what commits have been added to the upstream master, you can run a git log using origin/master as a filter
git log --oneline master..origin/master
To approve the changes and merge them into your local master branch with the following commands:
git checkout master
git log origin/master
Then we can use git merge origin/master
git merge origin/master
git pull
Merging upstream changes into your local repository is a common task in Git-based collaboration workflows.
We already know how to do this with git fetch followed by git merge, but git pull rolls this into a single command.
git pull <remote>
Erklärung: Fetch the specified remote’s copy of the current branch and immediately merge it into the local copy.
This is the same as git fetch <remote> followed by git merge origin/<current-branch>.
Mit Rebase:
git pull --rebase <remote>
Same as the above command, but instead of using git merge to integrate the remote branch with the local one, use git rebase.
Beispiel:
git checkout master
git pull --rebase origin
This simply moves your local changes onto the top of what everybody else has already contributed.
git push
Pushing is how you transfer commits from your local repository to a remote repo. It's the counterpart to git fetch,
but whereas fetching imports commits to local branches, pushing exports commits to remote branches.
This has the potential to overwrite changes, so you need to be careful how you use it. These issues are discussed below.
git push <remote> <branch>
Push the specified branch to <remote>, along with all of the necessary commits and internal objects. This creates
a local branch in the destination repository. To prevent you from overwriting commits,
Git won’t let you push when it results in a non-fast-forward merge in the destination repository.
git push <remote> --all
Push all of your local branches to the specified remote.
git push <remote> --tags
Tags are not automatically pushed when you push a branch or use the --all option.
The --tags flag sends all of your local tags to the remote repository.
Beispiel:
The following example describes one of the standard methods for publishing local contributions to the central repository.
First, it makes sure your local master is up-to-date by fetching the central repository’s copy and rebasing your changes
on top of them. The interactive rebase is also a good opportunity to clean up your commits before sharing them.
Then, the git push command sends all of the commits on your local master to the central repository.
git checkout master
git fetch origin master
git rebase -i origin/master
# Squash commits, fix up commit messages etc.
git push origin master
Änderungen mit "fetch" ins Bare Repository holen und in Work Dir auschecken
git fetch origin master:master
GIT_WORK_TREE=/home/www/soziite/htdocs/ git checkout -f
::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::noch mehr git:::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::
Lets say I have a bare repository named /srv/production.git on the destination system/server.
On the destination system I can use the command cd /srv/production.git; GIT_WORK_TREE=/srv/production-www/ git checkout -f
If I am in a non-bare repository the command is slightly different. Lets say I have a non-bare respository at /srv/testing. To checkout that I would use cd /srv/testing/.git; GIT_WORK_TREE=/srv/production-www/ git checkout -f
In fact on my system I even automate this in a post-commit hook in my production.git repository. So when you push to production.git the latest version is automatically check out to the web root.
#!/bin/sh
#
# An example hook script that is called after a successful
# commit is made.
#
# To enable this hook, rename this file to "post-commit".
GIT_WORK_TREE=/srv/production-www/ git checkout -f
# ... misc other commands to verify permissions are set correctly.
If your only access to the remote system is webdav, it certainly should be possible to write a post-commit hook that will checkout to the webdav host, either directly or to a temporary location, which you can then script an upload.
BARE REPOSITORY
As mentioned in "how do I pull to a bare repository?", you should do a:
git fetch origin master:master
Or, for all the branches:
git fetch origin +refs/heads/*:refs/heads/*
Colin D Bennett added:
If you want to fetch these on a regular basis, you should consider:
git config remote.origin.fetch +refs/heads/*:refs/heads/*
which will allow you to type git fetch to sync your branches with the remote.
Note that this make sense only in a bare repository where local branches are not supposed to be edited.
COMMITS LOESCHEN - MIT VORSICHT ZU GENIESSEN
Careful: git reset --hard WILL DELETE YOUR WORKING DIRECTORY CHANGES. Be sure to stash any local changes you want to keep before running this command.
Assuming you are sitting on that commit, then this command will wack it...
git reset --hard HEAD~1
The HEAD~1 means the commit before head.
Or, you could look at the output of git log, find the commit id of the commit you want to back up to, and then do this:
git reset --hard <sha1-commit-id>
If you already pushed it, you will need to do a force push to get rid of it...
git push origin HEAD --force
However, if others may have pulled it, then you would be better off starting a new branch. Because when they pull, it will just merge it into their work, and you will get it pushed back up again.
If you already pushed, it may be better to use git revert, to create a "mirror image" commit that will undo the changes. However, both commits will both be in the log.
FYI -- git reset --hard HEAD is great if you want to get rid of WORK IN PROGRESS. It will reset you back to the most recent commit, and erase all the changes in your working tree and index.
Den letzten Commit ändern:
Manchmal hat man einen Commit zu früh angelegt und möglicherweise vergessen, einige Dateien hinzuzufügen, oder eine falsche Commit Meldung verwendet. Wenn Du den letzten Commit korrigieren willst, kannst Du dazu git commit zusammen mit der --amend Option verwenden:
$ git commit --amend
git fetch:
if <dst> is not empty string, the local ref that matches it is fast-forwarded using <src>.
Knowing that:
git fetch is equivalent to git fetch origin master:master (from the default value of your branch config), so it will update the remote tracking branch: the destination of the refspec is specified for you.
git fetch origin master is equivalent to "git fetch origin master:", not to "git fetch origin master:master"; it stores fetched value of 'master' branch (of remote 'origin') in FETCH_HEAD, and not in 'master' branch or remote-tracking 'remotes/origin/master' branch (from Jakub Narębski's answer)
In other word, you didn't specify the destination of your refspec
::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::: tar.gz ::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::
komprimiertes Archiv erzeugen:
tar cfvz [ARCHIV].tar.gz [VERZEICHNIS] [DATEI]
komprimiertes Archiv entpacken:
tar xfvz [ARCHIV].tar.gz
::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::: tar.bz2 ::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::
komprimiertes Archiv erzeugen:
tar cfvj [ARCHIV].tar.bz2 [VERZEICHNIS] [DATEI]
komprimiertes Archiv entpacken:
tar xfvj [ARCHIV].tar.bz2
::::::::::::::::::::::::::::::::::::::::::::::::::
::::::Live Server auf Test Server kopieren::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::
- fileadmin und typo3conf - beide ordner packen und kopieren (owner ist beim entpacken richtig)
- dbdump machen, als gz komprimieren (owner ist beim entpacken richtig)
- stickyconf.php anpassen (DB Zugangsdaten)
- folgende sitepackage ts-files anpassen (base url usw.):
-- sitepackage/ext_localconf.php
-- sitepackage/packages/local/site/sozialinfoch/preset/lib/setup.txt ---> muss nicht unbedingt angepasst werden bzw. sollte immer sozialinfo.ch als domain enthalten wegen dem deployment
-- sitepackage/packages/local/site/sozialinfoch/preset/plugin/felogin/constants.txt
-- sitepackage/packages/local/site/sozialinfoch/preset/setup.txt
- im backend bei der rootpage den domaineintrag ändern
- in der localconf.php die "evo_nginx_boost" einträge entfernen (nur wenn memcache nicht installiert ist)
Datenbank auf sozii exportieren und auf soziite importieren:
user sozii (backup verzeichnis unter /home/www/soziite/backup muss vorhanden sein, sonst erst anlegen mit soziite):
ssh [email protected]
/usr/local/mysql/current/bin/mysqldump sozii -u sozii -p --skip-triggers > sozii.dump.sql
gzip sozii.dump.sql
cp sozii.dump.sql.gz /home/www/soziite/backup/
user soziite:
cd backup
/usr/local/mysql/current/bin/mysql -u soziite -p soziite < sozii.dump.sql
/usr/local/mysql/current/bin/mysqldump extba -u extba -p --skip-triggers > extba.dump.sql
::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::SSH:::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::
Add Identity without Keychain
There may be times in which you don't want the passphrase stored in the keychain, but don't want to have to enter the passphrase over and over again.
You can do that like this:
ssh-add ~/.ssh/id_rsa
This will ask you for the passphrase, enter it and it will not ask again until you restart.
Add Identity Using Keychain
As @dennis points out in the comments, to persist the passphrase through restarts by storing it in your keychain, you can use the -K option (-k for Ubuntu) when adding the identity like this:
ssh-add -K ~/.ssh/id_rsa
Once again, this will ask you for the passphrase, enter it and this time it will never ask again for this identity.
::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::Docker::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::
docker-compose up -d --build
docker-compose up -d
docker-compose stop
docker container ls -a
docker container rm -f 928 a2f
docker image ls -a
docker image rm -f 66bc 2a7d
docker-compose ps
(-i Input -t Allocated TTY)
docker exec -i -t loving_heisenberg /bin/bash
docker exec -i -t a8a bash
docker container run -d -p 3306:3306 --name db -e MYSQL_RANDOM_ROOT_PASSWORD=yes mysql
docker container run -d --name webserver -p 8080:80 httpd
docker container run -d --name proxy -p 80:80 nginx
docker container top nginx
docker container inspect mysql
docker container stats
Cleanup:
docker system prune
Stop all running containers:
docker kill $(docker ps -q)
Remove all docker containers:
docker rm $(docker ps -a -q)
oder
docker container rm $(docker container ls -aq)
Delete all docker images:
docker rmi $(docker images -q)
Delete all volumes
docker volume prune
docker-compose build --build-arg ssh_prv_key="$(cat ~/.ssh/id_rsa)" --build-arg ssh_pub_key="$(cat ~/.ssh/id_rsa.pub)"
docker-compose up --no-build
Set Temporary Env Vars:
export ssh_pub_key="$(cat ~/.ssh/id_rsa.pub)"
export ssh_prv_key="$(cat ~/.ssh/id_rsa)"
::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::perl:::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::
perl -p -i -e 's/oldstring/newstring/g' `find ./ -name *.html`
perl -p -i -e 's/oldstring/newstring/g' *
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment