Snipt.net is closing on December 31st, 2016

For more information, please visit this blog post.

snipt

Ctrl+h for KB shortcuts

Bash

buscar archivos por permiso

#buscará los archivos con permiso s en grupo
find . -perm -g=s 
https://snipt.net/embed/7fb2c1de149218ad21cad873b6e085d7/
https://snipt.net/raw/7fb2c1de149218ad21cad873b6e085d7/
7fb2c1de149218ad21cad873b6e085d7
bash
Bash
2
2016-12-07T20:44:50
True
False
False
/api/public/snipt/28614/
buscar-archivos-por-permiso
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</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">#buscará los archivos con permiso s en grupo</span> </span><span id="L-2"><a name="L-2"></a>find . -perm -g<span class="o">=</span>s </span></pre></div> </td></tr></table>
bash, chmod, find, permission

Bash

adjust permission diretories and files

1
2
3
4
#Find all directories and change permission to 755
find -type d -exec chmod 755 {} \;
#Find all files and change permission to 644
find -type f -exec chmod 644 {} \;
https://snipt.net/embed/4194e08c5a201c7d493a4fe72d8c312e/
https://snipt.net/raw/4194e08c5a201c7d493a4fe72d8c312e/
4194e08c5a201c7d493a4fe72d8c312e
bash
Bash
5
2016-12-09T20:55:09
True
False
False
/api/public/snipt/26273/
adjust-permission-diretories-and-files
<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></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="c1">#Find all directories and change permission to 755</span> </span><span id="L-2"><a name="L-2"></a>find -type d -exec chmod <span class="m">755</span> <span class="o">{}</span> <span class="se">\;</span> </span><span id="L-3"><a name="L-3"></a><span class="c1">#Find all files and change permission to 644</span> </span><span id="L-4"><a name="L-4"></a>find -type f -exec chmod <span class="m">644</span> <span class="o">{}</span> <span class="se">\;</span> </span></pre></div> </td></tr></table>
bash, find, permission

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/
https://snipt.net/raw/63036dd4c315da178ae73571de57c0f3/
63036dd4c315da178ae73571de57c0f3
bash
Bash
5
2016-12-10T06:15:13
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

Bash

Correct permissions for svn files in project

1
2
3
find -name .svn -exec sudo chmod 775 {} \;
find $(find -name .svn) -type d -exec sudo chmod 775 {} \;
find $(find -name .svn) ! -type d -exec sudo chmod 664 {} \;
https://snipt.net/embed/898e3c18a6e049df390f9cc322ea4fa9/
https://snipt.net/raw/898e3c18a6e049df390f9cc322ea4fa9/
898e3c18a6e049df390f9cc322ea4fa9
bash
Bash
3
2016-12-10T03:07:51
True
False
False
/api/public/snipt/12525/
correct-permissions-for-svn-files-in-project
<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></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>find -name .svn -exec sudo chmod <span class="m">775</span> <span class="o">{}</span> <span class="se">\;</span> </span><span id="L-2"><a name="L-2"></a>find <span class="k">$(</span>find -name .svn<span class="k">)</span> -type d -exec sudo chmod <span class="m">775</span> <span class="o">{}</span> <span class="se">\;</span> </span><span id="L-3"><a name="L-3"></a>find <span class="k">$(</span>find -name .svn<span class="k">)</span> ! -type d -exec sudo chmod <span class="m">664</span> <span class="o">{}</span> <span class="se">\;</span> </span></pre></div> </td></tr></table>
bash, cmd, linux, permission, svn

Bash

Correct permission and owenership recursively.

1
2
3
4
5
#!/bin/bash

find $1 -exec chown ahhong:www-data {} \;
find $1 -type d -exec chmod 775 {} \;
find $1 -type f -exec chmod 664 {} \;
https://snipt.net/embed/86b5ee58b4824c6a505d209ddd9f7f2b/
https://snipt.net/raw/86b5ee58b4824c6a505d209ddd9f7f2b/
86b5ee58b4824c6a505d209ddd9f7f2b
bash
Bash
5
2016-12-07T13:20:18
True
False
False
/api/public/snipt/7433/
correct-permission-and-owenership-recursively
<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="ch">#!/bin/bash</span> </span><span id="L-2"><a name="L-2"></a> </span><span id="L-3"><a name="L-3"></a>find <span class="nv">$1</span> -exec chown ahhong:www-data <span class="o">{}</span> <span class="se">\;</span> </span><span id="L-4"><a name="L-4"></a>find <span class="nv">$1</span> -type d -exec chmod <span class="m">775</span> <span class="o">{}</span> <span class="se">\;</span> </span><span id="L-5"><a name="L-5"></a>find <span class="nv">$1</span> -type f -exec chmod <span class="m">664</span> <span class="o">{}</span> <span class="se">\;</span> </span></pre></div> </td></tr></table>
bash, chmod, chown, ownership, permission
Copyrighted, illegal, or inappropriate content? Email [email protected].