Last active
June 18, 2019 08:54
-
-
Save barthelemypousset/e94ade6b55bdda4faf1987c1c6b30323 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show build history of an image: | |
docker history --format "Date: {{.CreatedSince}}\nCommand: {{.CreatedBy}}\nSize: {{.Size}}\n" --no-trunc decastore-build-tools | |
Reduce filesize: | |
Tail -c 100000000 file.original > file.light; chown --reference=file.original file.light; rm file.original | |
Remove file older than 40 days: | |
find /path/to/files* -mtime +40 -exec ls {} \; | |
Save a file in VI without beeing logged as root (must have sudo rights): | |
:w !sudo tee % | |
Utiliser sed pour creer des groupe et filtre des infos: | |
cat serverlist/servers_zes.list | sed -r 's/(^.*)\.(.*)\.(.*$)/\1/g' | |
Dans VI,Supprimer les lignes commencant par #: | |
:g/^#.*$/d | |
Comment multiple line in vim: | |
ctrl-v | |
shift-i | |
# escape (wait a little) | |
Trouver un service qui attaque un serveur particulier: | |
netstat -nltp | grep ip_serveur | |
Puis observer le numero de process et le chercher: | |
ps -eaf | grep xxx | |
regarder log pour un service: | |
journlctl -u service --since "2 days ago" | |
Acceder aux cron des autres users: | |
/var/spool/cron | |
Tunnel SSH: | |
ssh -L 1234:Serveur_Cible:Port_Cible user@server | |
next connect to whatever service using port 1234 | |
Afficher les process: | |
ps -eo rss,pid,cmd|sort -n| cut -c 1-200 | |
ps -eo rss,pid,cmd --sort rss| cut -c 1-200 | |
reset yum: | |
rm -f /var/lib/rpm/__db* | |
db_verify /var/lib/rpm/Packages | |
rpm --rebuilddb | |
yum clean all | |
Undo commit to wrong branch: | |
git reset --soft | |
clear ram and swap: | |
echo 3 > /proc/sys/vm/drop_caches | |
swapoff -a && swapon -a | |
search on git (https://help.github.com/en/articles/searching-code): | |
org:<Company> filename:<exactfilename you're searching> <patern in file> in:file |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment