snipt

Ctrl+h for KB shortcuts

Bash

Install from an RPM file

$ rpm -iv <rpm_file>
https://snipt.net/embed/a71a014acd1e993157c58213d0af02ba/
/raw/a71a014acd1e993157c58213d0af02ba/
a71a014acd1e993157c58213d0af02ba
bash
Bash
1
2019-07-07T15:28:57
True
False
False
/api/public/snipt/26663/
install-from-an-rpm-file
<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></span><span id="L-1"><a name="L-1"></a>$ rpm -iv &lt;rpm_file&gt; </span></pre></div> </td></tr></table>
bash, linux, rpm

Bash

Show the current Linux distro

$ cat /etc/issue
https://snipt.net/embed/a169ef1c8f6334003f7fcb5bbb15777a/
/raw/a169ef1c8f6334003f7fcb5bbb15777a/
a169ef1c8f6334003f7fcb5bbb15777a
bash
Bash
1
2019-07-02T21:41:34
True
False
False
/api/public/snipt/26662/
show-the-current-linux-distro
<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></span><span id="L-1"><a name="L-1"></a>$ cat /etc/issue </span></pre></div> </td></tr></table>
bash, linux

Bash

Change password

1
2
3
4
5
# Change your own password
$ passwd

# Change a user's password
$ passwd <username>
https://snipt.net/embed/230c5ef9948768b0adda362eda497200/
/raw/230c5ef9948768b0adda362eda497200/
230c5ef9948768b0adda362eda497200
bash
Bash
5
2019-06-20T12:45:24
True
False
False
/api/public/snipt/26661/
change-password-1
<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"># Change your own password</span> </span><span id="L-2"><a name="L-2"></a>$ passwd </span><span id="L-3"><a name="L-3"></a> </span><span id="L-4"><a name="L-4"></a><span class="c1"># Change a user&#39;s password</span> </span><span id="L-5"><a name="L-5"></a>$ passwd &lt;username&gt; </span></pre></div> </td></tr></table>
bash, linux

Bash

Run programs and summarize system resource usage

$ time <command>
https://snipt.net/embed/6c3d564b787962437b23aeb56f6d1f92/
/raw/6c3d564b787962437b23aeb56f6d1f92/
6c3d564b787962437b23aeb56f6d1f92
bash
Bash
1
2019-07-10T02:47:11
True
False
False
/api/public/snipt/26383/
run-programs-and-summarize-system-resource-usage
<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></span><span id="L-1"><a name="L-1"></a>$ <span class="nb">time</span> &lt;command&gt; </span></pre></div> </td></tr></table>
bash

Bash

Yank a range of lines

:<start_line>,<end_line>y
https://snipt.net/embed/88f6ccc50a6f16a77d13eb298b5fc0d2/
/raw/88f6ccc50a6f16a77d13eb298b5fc0d2/
88f6ccc50a6f16a77d13eb298b5fc0d2
bash
Bash
1
2019-07-07T12:01:04
True
False
False
/api/public/snipt/26244/
yank-a-range-of-lines
<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></span><span id="L-1"><a name="L-1"></a>:&lt;start_line&gt;,&lt;end_line&gt;y </span></pre></div> </td></tr></table>
vim

Bash

Search and replace

:%s/foo/bar/gc
https://snipt.net/embed/86d5efcf47238b08e13026103ca333e4/
/raw/86d5efcf47238b08e13026103ca333e4/
86d5efcf47238b08e13026103ca333e4
bash
Bash
1
2019-07-07T17:02:59
True
False
False
/api/public/snipt/26241/
search-and-replace
<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></span><span id="L-1"><a name="L-1"></a>:%s/foo/bar/gc </span></pre></div> </td></tr></table>
vim

Bash

Navigate between words

1
2
3
4
5
# Next word
w

# Previous word
b
https://snipt.net/embed/3fd5e4a191e821b2617eaf64a1a39805/
/raw/3fd5e4a191e821b2617eaf64a1a39805/
3fd5e4a191e821b2617eaf64a1a39805
bash
Bash
5
2019-07-21T04:01:14
True
False
False
/api/public/snipt/26208/
navigate-between-words
<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"># Next word</span> </span><span id="L-2"><a name="L-2"></a>w </span><span id="L-3"><a name="L-3"></a> </span><span id="L-4"><a name="L-4"></a><span class="c1"># Previous word</span> </span><span id="L-5"><a name="L-5"></a>b </span></pre></div> </td></tr></table>
vim

Bash

Go to line

:<line_number>
https://snipt.net/embed/e6d3b039d601e76d874292a3522c702b/
/raw/e6d3b039d601e76d874292a3522c702b/
e6d3b039d601e76d874292a3522c702b
bash
Bash
1
2019-06-27T17:56:47
True
False
False
/api/public/snipt/26207/
go-to-line
<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></span><span id="L-1"><a name="L-1"></a>:&lt;line_number&gt; </span></pre></div> </td></tr></table>
vim

Bash

Reload .vimrc after editing it

:so %
https://snipt.net/embed/a69cb5f004c8682599972beba6570a9e/
/raw/a69cb5f004c8682599972beba6570a9e/
a69cb5f004c8682599972beba6570a9e
bash
Bash
1
2019-07-08T17:55:36
True
False
False
/api/public/snipt/26206/
reload-vimrc-after-editing-it
<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></span><span id="L-1"><a name="L-1"></a>:so % </span></pre></div> </td></tr></table>
vim

Bash

Create a new user

$ useradd -mU -p <password> <username>
https://snipt.net/embed/8bd9b2535e2780ae7d0d3a83de6e7b60/
/raw/8bd9b2535e2780ae7d0d3a83de6e7b60/
8bd9b2535e2780ae7d0d3a83de6e7b60
bash
Bash
1
2019-06-10T12:24:52
True
False
False
/api/public/snipt/26172/
create-a-new-user
<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></span><span id="L-1"><a name="L-1"></a>$ useradd -mU -p &lt;password&gt; &lt;username&gt; </span></pre></div> </td></tr></table>
bash, linux, user