Shell: Unterschied zwischen den Versionen
Keine Bearbeitungszusammenfassung |
Keine Bearbeitungszusammenfassung |
||
| Zeile 48: | Zeile 48: | ||
chmod 644 (find . -type f) | chmod 644 (find . -type f) | ||
==Find und Sed Befehle== | |||
<code>find dev9*/web/themes/custom* -type f -name '*.less' -exec echo {} \; | sed -i 's/SUCHEN/ERSETZEN/g' {} \;</code> | |||
Version vom 7. Dezember 2022, 09:09 Uhr
Dos 2 Unix
dos2unix dateiname dos2unix *
Cygwin rsync script Start
./sync_heilsarmee.sh
find Datei oder Ornder
Ordner Suchen und Finden:
find /var/www/ -type d -name "download_file" -print
Datei in Ordner Suchen und Finden
find /var/www/ -path "*/sites/all/modules/webform/components/select.inc" -print
Recursively chmod only directories or files
http://rainsoftletters.wordpress.com/2008/07/22/recursively-chmodi-only-directories-or-files/
Recursively chmod directories only.
bash
find . -type d -exec chmod 755 {} \+ # This will “find” all directories, starting at “.“, and chmod them to 755.
find . -type d -exec chmod g+w {} \+
or
chmod g-x `find . -type d` chmod 644 `find . -type d`
fish
chmod g+x (find . -type d)
Recursively chmod files only
bash
find . -type f -exec chmod 644 {} \+
or
chmod 644 `find . -type f`
This snippet does the opposite and finds only files. The difference (beside the file permissions) is the “-type f“, “f” specifies files and “d” directories. If you check the comments, you’LL3D find a few additional snippets:
find . -type f -name '*.htm*' -exec chmod 644 {} \+
This lets you “find” files (“-type f“) with a specific extension (“-name '*.htm*'“) and chmod them with your desired permission (“-exec chmod 644 {}“).
chmod -R o+rX
This snippet will recursively chmod “other” (“o“) permissions with read/eXecutable (“+rX“), and the capital X ensures that directories and files set (user/group permissions) to executable will be properly modified, while ignoring regular (non-executable) files.
fish
chmod g+x (find . -type f)
chmod 644 (find . -type f)
Find und Sed Befehle
find dev9*/web/themes/custom* -type f -name '*.less' -exec echo {} \; | sed -i 's/SUCHEN/ERSETZEN/g' {} \;