Zum Inhalt springen

Shell: Unterschied zwischen den Versionen

Aus Computech CMS Wiki
Frederick (Diskussion | Beiträge)
Keine Bearbeitungszusammenfassung
Simon Zeberli (Diskussion | Beiträge)
Keine Bearbeitungszusammenfassung
Zeile 6: Zeile 6:
   ./sync_heilsarmee.sh
   ./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 ==
== Recursively chmod only directories or files ==



Version vom 1. März 2017, 12:56 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)