Skip to content

Instantly share code, notes, and snippets.

@sebastianneubert
Last active August 29, 2015 14:17
Show Gist options
  • Save sebastianneubert/8c2c8ca6ac221af65a07 to your computer and use it in GitHub Desktop.
Save sebastianneubert/8c2c8ca6ac221af65a07 to your computer and use it in GitHub Desktop.
Bash Tricks

rekursive Suche:

find . -type f -name \*.php -exec grep -l -i "text" {} \;

Filepermissions anpassen:

find . -type d -exec chmod 775 {} \;
find . -type f -exec chmod 664 {} \;

MD5 auf der Konsole

echo -n "text"|md5sum

RSYNC von zwei Verzeichnissen

rsync -a SOURCEDIR/ DESTINATIONDIR/

bestimmte Dateinamen/Unterverzeichnisse in einem Verzeichnis finden:

find . -type d 2>/dev/null | grep PLUGINNAME | awk -F"PLUGINNAME/" '{print $1}'|sort -u

Dateien finden, die größer sind als 10MB

ls -lahS $(find / -type f -size +10000k 2> /dev/null )

Die 10 größten Ordner im System anzeigen

du -m | sort -n | tail -n 10

Wie oft findet er SUCH?

SUCH="xxx"; COUNT=0; for LINE in `cat /tmp/test`; do echo $LINE|grep $SUCH &&COUNT=`expr $COUNT + 1`; done

Welche Zeile findet er SUCH?

SUCH=""; COUNT=0; for LINE in `cat /tmp/test`; do COUNT=`expr $COUNT + 1`; echo $LINE|grep $SUCH && echo $COUNT; done

Wiederkehrender Aufruf einer bestimmten URL

while true; do curl -I http://www.test.de; sleep 10; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment