snipt

Ctrl+h for KB shortcuts

Bash

change file permission to

1
2
3
4
5
# for files only
$find ./ -type f -exec chmod 644 {} +

# for directories only
$find ./ -type d -exec chmod 644 {} +
https://snipt.net/embed/63036dd4c315da178ae73571de57c0f3/
/raw/63036dd4c315da178ae73571de57c0f3/
63036dd4c315da178ae73571de57c0f3
bash
Bash
5
2019-07-22T11:47:31
True
False
False
/api/public/snipt/25321/
change-file-permission-to
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a> <a href="#L-5">5</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="c1"># for files only</span> </span><span id="L-2"><a name="L-2"></a><span class="nv">$find</span> ./ -type f -exec chmod <span class="m">644</span> <span class="o">{}</span> + </span><span id="L-3"><a name="L-3"></a> </span><span id="L-4"><a name="L-4"></a><span class="c1"># for directories only</span> </span><span id="L-5"><a name="L-5"></a><span class="nv">$find</span> ./ -type d -exec chmod <span class="m">644</span> <span class="o">{}</span> + </span></pre></div> </td></tr></table>
chmod, files, find, permission, recursively