[LINUX] Recursively change permissions only on files or dirs

Use the command below to recursively change permissions only on files:

~$ find /<path> -type f -exec chmod 644 {} \;

While use the following command to recursively change permissions only on directories:

~$ find /<path> -type d -exec chmod 755 {} \;

where:
/<path> is the path containing the interested files or directories.
644 assigns permissions of “read/write” on the owner, while “read” on the group and others.
755 assigns permissions of “read/write/execute” on the owner, while “read/execute” on the group and others.

[LINUX] Recursively change permissions on specific file type

Use the following command to recursively change permissions only on specific file type (e.g, all php files in the main path and related sub-directories):

~$ find . -name "*.php" -exec chmod +x {} \;

The command above searches all php files and excute the chmod command to apply the execution permission (+x).

If you have found this post useful, please visit the Contribute page

[REGEX] Common Regular Expressions

We all know that “regex is the power”! 🙂 So, below some common regular expressions:

Anything (Lazy):		.*?
Anything (Greedy):		.*
Alphanumeric:			[a-zA-Z0-9]
Alphanumeric (including _):	\w
White Space:			\s
Tab:				\t
Email Address:			[\w\.-]+@[a-zA-Z\d\.-]+
IP Address:			\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}
Port Number:			\d{1,5}
MAC Address:			([0-9a-fA-F]{2}\:){5}[0-9a-fA-F]{2}
Protocol:			(tcp|udp|icmp)
Device Time:			\w{3}\s\d{2}\s\d{2}:\d{2}:\d{2}

[LINUX] Type Special Characters

Below you can find a list of keyboard codes to type the corresponding special characters:

` : AltGr-'
{ : AltGr-7
} : AltGr-0
~ : AltGr-ì
¹ : AltGr-1
² : AltGr-2
³ : AltGr-3
¼ : AltGr-4
½ : AltGr-5
⅛ : AltGr-Shift-4
⅜ : AltGr-Shift-5
⅝ : AltGr-Shift-6
⅞ : AltGr-Shift-7
¬ : AltGr-6
“ : AltGr-v
” : AltGr-b
« : AltGr-z
» : AltGr-x
€ : AltGr-e
@ : AltGr-q
← : AltGr-y
→ : AltGr-i
↓ : AltGr-u
< : AltGr-Shift-z
> : AltGr-Shift-x
© : AltGr-Shift-c
® : AltGr-Shift-r
™ : AltGr-Shift-8
× : AltGr-Shift-,
÷ : AltGr-Shift--