snipt

Ctrl+h for KB shortcuts

Bash

Carinha no terminal

1
2
3
4
5
6
7
# if [ "$color_prompt" = yes ]; then
#     PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
# else
#     PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
# fi
PS1="\`if [ \$? = 0 ]; then echo -e '\e[01;32m:) '; else echo -e '\e[01;31m:( '; fi\`\e[m"
unset color_prompt force_color_prompt
https://snipt.net/embed/ace5f438b72739a7371d3bb7702ae1e4/
https://snipt.net/raw/ace5f438b72739a7371d3bb7702ae1e4/
ace5f438b72739a7371d3bb7702ae1e4
bash
Bash
8
2016-09-28T10:18:36
True
False
False
Feb 25, 2014 at 10:22 AM
/api/public/snipt/116610/
carinha-no-terminal
<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> <a href="#L-6">6</a> <a href="#L-7">7</a></pre></div></td><td class="code"><div class="highlight"><pre><span id="L-1"><a name="L-1"></a><span class="c"># if [ &quot;$color_prompt&quot; = yes ]; then</span> </span><span id="L-2"><a name="L-2"></a><span class="c"># PS1=&#39;${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ &#39;</span> </span><span id="L-3"><a name="L-3"></a><span class="c"># else</span> </span><span id="L-4"><a name="L-4"></a><span class="c"># PS1=&#39;${debian_chroot:+($debian_chroot)}\u@\h:\w\$ &#39;</span> </span><span id="L-5"><a name="L-5"></a><span class="c"># fi</span> </span><span id="L-6"><a name="L-6"></a><span class="nv">PS1</span><span class="o">=</span><span class="s2">&quot;\`if [ \$? = 0 ]; then echo -e &#39;\e[01;32m:) &#39;; else echo -e &#39;\e[01;31m:( &#39;; fi\`\e[m&quot;</span> </span><span id="L-7"><a name="L-7"></a><span class="nb">unset </span>color_prompt force_color_prompt </span></pre></div> </td></tr></table>
terminal

Shell Session

Import sql file to MySQL database using SSH

mysql -p -u DB_USERNAME DB_NAME < PATH/TO/FILE.sql
https://snipt.net/embed/2889d808e26a0fbea9ed3b8e1bfeeecf/
https://snipt.net/raw/2889d808e26a0fbea9ed3b8e1bfeeecf/
2889d808e26a0fbea9ed3b8e1bfeeecf
shell-session
Shell Session
1
2016-09-28T16:53:53
True
False
False
Feb 17, 2014 at 05:03 PM
/api/public/snipt/114552/
import-sql-file-to-mysql-database-using-ssh
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span id="L-1"><a name="L-1"></a><span class="go">mysql -p -u DB_USERNAME DB_NAME &lt; PATH/TO/FILE.sql</span> </span></pre></div> </td></tr></table>
database, mysql, sql, ssh, terminal

Shell Session

Mount remote server drive with OSXFUSE and ssh

sshfs [-p PORT-NUMBER] USERNAME@MYDOMAIN.com:/remote/path /Local/Path/to/an/existing/folder
https://snipt.net/embed/178080a463bae7bdfcf47a9de1f1fd0b/
https://snipt.net/raw/178080a463bae7bdfcf47a9de1f1fd0b/
178080a463bae7bdfcf47a9de1f1fd0b
shell-session
Shell Session
1
2016-09-25T21:17:38
True
False
False
Feb 05, 2014 at 09:52 AM
/api/public/snipt/111141/
mount-remote-server-drive-with-osxfuse-and-ssh
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span id="L-1"><a name="L-1"></a><span class="go">sshfs [-p PORT-NUMBER] USERNAME@MYDOMAIN.com:/remote/path /Local/Path/to/an/existing/folder</span> </span></pre></div> </td></tr></table>
commandline, mac, server, ssh, terminal

Shell Session

Show hidden folders in mac OSX

Defaults write com.apple.finder AppleShowAllFiles TRUE
Killall FInder
https://snipt.net/embed/21e8099ab0ff222e01be15e4cb6f1f82/
https://snipt.net/raw/21e8099ab0ff222e01be15e4cb6f1f82/
21e8099ab0ff222e01be15e4cb6f1f82
shell-session
Shell Session
2
2016-09-29T09:29:53
True
False
False
Jan 31, 2014 at 12:28 PM
/api/public/snipt/109941/
show-hidden-folders-in-mac-osx
<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 id="L-1"><a name="L-1"></a><span class="go">Defaults write com.apple.finder AppleShowAllFiles TRUE</span> </span><span id="L-2"><a name="L-2"></a><span class="go">Killall FInder</span> </span></pre></div> </td></tr></table>
console, mac, terminal

Bash

Terminal check file permissions

stat -c %A fileNameToCheck
https://snipt.net/embed/69255e3c3dbfa946d35d09d6c7a914d2/
https://snipt.net/raw/69255e3c3dbfa946d35d09d6c7a914d2/
69255e3c3dbfa946d35d09d6c7a914d2
bash
Bash
1
2016-09-21T18:47:08
True
False
False
Nov 11, 2013 at 05:32 AM
/api/public/snipt/93399/
terminal-check-file-permissions
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span id="L-1"><a name="L-1"></a>stat -c %A fileNameToCheck </span></pre></div> </td></tr></table>
bash, terminal

Shell Session

Colorize console for git

git config --global color.ui true
https://snipt.net/embed/99042d201bbce5a6dc3a670d1ec83389/
https://snipt.net/raw/99042d201bbce5a6dc3a670d1ec83389/
99042d201bbce5a6dc3a670d1ec83389
shell-session
Shell Session
1
2016-09-25T06:40:25
True
False
False
Sep 27, 2013 at 01:48 PM
/api/public/snipt/83653/
colorize-console-for-git
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span id="L-1"><a name="L-1"></a><span class="go">git config --global color.ui true</span> </span></pre></div> </td></tr></table>
color, colorscheme, console, git, terminal
Copyrighted, illegal, or inappropriate content? Email support@snipt.net.