id int64 | site string | title string | question_body string | question_body_md string | question_score int32 | question_view_count int32 | question_answer_count int32 | question_comment_count int32 | question_favorite_count int32 | question_tags list | question_creation_date string | question_last_edit_date string | question_user_id int64 | accepted_answer_id int64 | answers list | best_answer string | text string | char_length int32 | tokens_estimate int32 | meta dict |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
610,031 | unix.stackexchange.com | How can a shell output affect the typed text after the command prompt? | <p>I have experienced similar behaviour before, but only now I can reproduce it: Output from a command affecting the text after the next command prompt, ready to be <kbd>Enter</kbd>ed by the user.</p>
<p>Take the following example:</p>
<pre class="lang-bsh prettyprint-override"><code>cat /usr/share/terminfo/a/ansi
</co... | I have experienced similar behaviour before, but only now I can reproduce it: Output from a command affecting the text after the next command prompt, ready to be Entered by the user. Take the following example: ``` cat /usr/share/terminfo/a/ansi ``` which has the following effect: (https://i.stack.imgur.com/ewxYc.png) ... | 8 | 171 | 1 | 1 | 1 | [
"<bash><shell><terminal><prompt>"
] | 2020-09-18T11:01:19.010 | 2020-09-23T14:39:04.380 | 433,395 | 610,821 | [
{
"id": 610821,
"body": "<p>What you are seeing is the attribute string for the terminal. Terminals might respond differently to one or more of these commands.</p>\n<p>A quick way to reproduce them:</p>\n<pre><code>$ echo -e '\\033[c'\n</code></pre>\n<p>In my case, inside <code>Gnome terminal</code> this <e... | What you are seeing is the attribute string for the terminal. Terminals might respond differently to one or more of these commands. A quick way to reproduce them: ``` $ echo -e '\033[c' ``` In my case, inside `Gnome terminal` this types `65;1;9c`, inside `xterm` it types `64;1;2;6;9;15;18;21;22c` and in the console, af... | # How can a shell output affect the typed text after the command prompt?
**Tags:** <bash><shell><terminal><prompt>
**Question (score 8):**
I have experienced similar behaviour before, but only now I can reproduce it: Output from a command affecting the text after the next command prompt, ready to be Entered by the u... | 2,932 | 733 | {
"source": "stackexchange-archive.org",
"license": "CC BY-SA 4.0",
"dump_version": "2021-12-07",
"extraction_date": "2026-07-02T12:57:40Z",
"parser_version": "stackexchange-streaming-v1.0",
"site_name": "unix.stackexchange.com",
"original_7z_url": "https://archive.org/download/stack-exchange-2021-12-07/u... |
610,133 | unix.stackexchange.com | scp performance over 1Gbit LAN | <p>On my wired LAN, with 1GBit/s devices, I have two Linux machines (One Haswell, One Skylake Xeon) and when I do a secure copy of a large file, I see 38MB/s.</p>
<p>Seeing that this is 3 times below the 1000Mbit/s spec, I wonder if this performance is as expected?</p>
<p>Both machines use SSD for storage, both run 64b... | On my wired LAN, with 1GBit/s devices, I have two Linux machines (One Haswell, One Skylake Xeon) and when I do a secure copy of a large file, I see 38MB/s. Seeing that this is 3 times below the 1000Mbit/s spec, I wonder if this performance is as expected? Both machines use SSD for storage, both run 64bit Ubuntu. During... | 10 | 1,918 | 4 | 1 | 2 | [
"<networking><scp><ethernet>"
] | 2020-09-18T20:47:01.943 | 2020-09-19T17:55:08.153 | 188,363 | 610,142 | [
{
"id": 610142,
"body": "<p>It does seem slow from a theoretical stand point although I've not seen any transfers much quicker practically on home hardware.</p>\n<p>Some experiments you might like to try to rule out possible limiting factors:</p>\n<ul>\n<li>Assess your raw SSH speed by copying from <code>/d... | It does seem slow from a theoretical stand point although I've not seen any transfers much quicker practically on home hardware. Some experiments you might like to try to rule out possible limiting factors: - Assess your raw SSH speed by copying from `/dev/zero` to `/dev/null`. This rules out a HD bottle neck. ``` ssh ... | # scp performance over 1Gbit LAN
**Tags:** <networking><scp><ethernet>
**Question (score 10):**
On my wired LAN, with 1GBit/s devices, I have two Linux machines (One Haswell, One Skylake Xeon) and when I do a secure copy of a large file, I see 38MB/s. Seeing that this is 3 times below the 1000Mbit/s spec, I wonder i... | 2,341 | 585 | {
"source": "stackexchange-archive.org",
"license": "CC BY-SA 4.0",
"dump_version": "2021-12-07",
"extraction_date": "2026-07-02T12:57:40Z",
"parser_version": "stackexchange-streaming-v1.0",
"site_name": "unix.stackexchange.com",
"original_7z_url": "https://archive.org/download/stack-exchange-2021-12-07/u... |
610,303 | unix.stackexchange.com | How to sort a first file (csv) based on the second file keys | <p>I am trying to find a solution where I can sort my first file using the first column based on the second file keys</p>
<p>First file example (file1.csv)</p>
<pre><code>COLUMN1 COlUMN2
apple fruit
dog animal
cat animal
cow animal
</code></pre>
<p>Second file example (sort_keys.txt)</p>
<pre><code>cat
dog
apple
cow
</... | I am trying to find a solution where I can sort my first file using the first column based on the second file keys First file example (file1.csv) ``` COLUMN1 COlUMN2 apple fruit dog animal cat animal cow animal ``` Second file example (sort_keys.txt) ``` cat dog apple cow ``` Expected output (sorted.txt) ``` COLUMN1 CO... | 5 | 673 | 5 | 6 | 0 | [
"<linux><awk><sort><csv>"
] | 2020-09-20T03:19:32.840 | 2020-09-20T12:40:27.723 | 193,695 | null | [
{
"id": 610380,
"body": "<pre><code>$ awk 'NR==1; NR==FNR{a[$1]=$2; next} {print $1, a[$1]}' file1 sort_keys.txt\nCOLUMN1 COlUMN2\ncat animal\ndog animal\napple fruit\ncow animal\n</code></pre>\n",
"body_md": "``` $ awk 'NR==1; NR==FNR{a[$1]=$2; next} {print $1, a[$1]}' file1 sort_keys.txt COLUMN1 COlUM... | ``` $ awk 'NR==1; NR==FNR{a[$1]=$2; next} {print $1, a[$1]}' file1 sort_keys.txt COLUMN1 COlUMN2 cat animal dog animal apple fruit cow animal ``` | # How to sort a first file (csv) based on the second file keys
**Tags:** <linux><awk><sort><csv>
**Question (score 5):**
I am trying to find a solution where I can sort my first file using the first column based on the second file keys First file example (file1.csv) ``` COLUMN1 COlUMN2 apple fruit dog animal cat ani... | 2,560 | 640 | {
"source": "stackexchange-archive.org",
"license": "CC BY-SA 4.0",
"dump_version": "2021-12-07",
"extraction_date": "2026-07-02T12:57:40Z",
"parser_version": "stackexchange-streaming-v1.0",
"site_name": "unix.stackexchange.com",
"original_7z_url": "https://archive.org/download/stack-exchange-2021-12-07/u... |
610,484 | unix.stackexchange.com | awk: split file by column name and add header row to each file | <p>I have a pipe delimited file <code>a.txt</code> which includes a header row. The first column holds a filename.</p>
<p>I would like to split <code>a.txt</code> into several different files - the name of which is determined by the first column. I would also like to have the header row of <code>a.txt</code> repeated a... | I have a pipe delimited file `a.txt` which includes a header row. The first column holds a filename. I would like to split `a.txt` into several different files - the name of which is determined by the first column. I would also like to have the header row of `a.txt` repeated at the top of each file . so I have `a.txt`:... | 6 | 756 | 2 | 0 | 0 | [
"<text-processing><awk><split>"
] | 2020-09-21T09:02:00.687 | 2020-09-21T09:15:43.240 | 433,744 | 610,485 | [
{
"id": 610485,
"body": "<p>The solution would be to store the header in a separate variable and print it on the first occurence of a new <code>$1</code> value (=file name):</p>\n<pre><code>awk -F'|' 'FNR==1{hdr=$0;next} {if (!seen[$1]++) print hdr>$1; print>$1}' a.txt \n</code></pre>\n<ul>\n<li>This ... | The solution would be to store the header in a separate variable and print it on the first occurence of a new `$1` value (=file name): ``` awk -F'|' 'FNR==1{hdr=$0;next} {if (!seen[$1]++) print hdr>$1; print>$1}' a.txt ``` - This will store the entire first line of `a.txt` in a variable `hdr` but otherwise leave that p... | # awk: split file by column name and add header row to each file
**Tags:** <text-processing><awk><split>
**Question (score 6):**
I have a pipe delimited file `a.txt` which includes a header row. The first column holds a filename. I would like to split `a.txt` into several different files - the name of which is deter... | 4,251 | 1,062 | {
"source": "stackexchange-archive.org",
"license": "CC BY-SA 4.0",
"dump_version": "2021-12-07",
"extraction_date": "2026-07-02T12:57:40Z",
"parser_version": "stackexchange-streaming-v1.0",
"site_name": "unix.stackexchange.com",
"original_7z_url": "https://archive.org/download/stack-exchange-2021-12-07/u... |
610,494 | unix.stackexchange.com | How do I remove the first 300 million lines from a 700 GB txt file on a system with 1 TB disk space? | <p>How do I remove the first 300 million lines from a 700 GB text file
on a system with 1 TB disk space total, with 300 GB available?
(My system has 2 GB of memory.)
The answers I found use sed, tail, head:</p>
<ul>
<li><a href="https://unix.stackexchange.com/questions/37790/how-do-i-delete-the-first-n-lines-of-an-as... | How do I remove the first 300 million lines from a 700 GB text file on a system with 1 TB disk space total, with 300 GB available? (My system has 2 GB of memory.) The answers I found use sed, tail, head: - How do I delete the first n lines of a text file using shell commands? (https://unix.stackexchange.com/questions/3... | 162 | 93,835 | 13 | 26 | 60 | [
"<text-processing>"
] | 2020-09-21T10:08:37.237 | 2021-06-17T10:52:42.790 | 160,012 | 610,528 | [
{
"id": 610505,
"body": "<p>Removing the first n lines (or bytes) can be done in-place using <code>dd</code> (or alternatively <a href=\"https://unix.stackexchange.com/a/610558/30851\">using loop devices</a>). It does not use a temporary file and there is no size limit; however, it is dangerous since there ... | Removing the first n lines (or bytes) can be done in-place using `dd` (or alternatively using loop devices (https://unix.stackexchange.com/a/610558/30851)). It does not use a temporary file and there is no size limit; however, it is dangerous since there is no track of progress, and any error leaves you with a broken f... | # How do I remove the first 300 million lines from a 700 GB txt file on a system with 1 TB disk space?
**Tags:** <text-processing>
**Question (score 162):**
How do I remove the first 300 million lines from a 700 GB text file on a system with 1 TB disk space total, with 300 GB available? (My system has 2 GB of memory... | 7,958 | 1,989 | {
"source": "stackexchange-archive.org",
"license": "CC BY-SA 4.0",
"dump_version": "2021-12-07",
"extraction_date": "2026-07-02T12:57:40Z",
"parser_version": "stackexchange-streaming-v1.0",
"site_name": "unix.stackexchange.com",
"original_7z_url": "https://archive.org/download/stack-exchange-2021-12-07/u... |
610,635 | unix.stackexchange.com | MacOS quotation marks turning italic and breaking scripts | <p>Whenever I have to write scripts or change my <code>.zshrc</code> file for example, it often breaks whenever I type an <code>"</code> (quotation mark) -- it gets automatically converted to a italic quotation mark: <code>“</code> and it doesn't get recognized by the shell when I run the script. I often have to m... | Whenever I have to write scripts or change my `.zshrc` file for example, it often breaks whenever I type an `"` (quotation mark) -- it gets automatically converted to a italic quotation mark: `“` and it doesn't get recognized by the shell when I run the script. I often have to manually copy/paste a clean quotation mark... | 5 | 452 | 1 | 3 | 0 | [
"<scripting><terminal><keyboard><macos>"
] | 2020-09-22T01:51:57.337 | 2020-09-22T15:46:46.697 | 404,760 | 610,637 | [
{
"id": 610637,
"body": "<p>These aren't italic, they're the "typographically correct" open- and close-quotes. But they are pretty useless in a shell</p>\n<p>To disable them globally:\nSystem Preferences > Keyboard > Text > uncheck "Use smart quotes and dashes"</p>\n<p>To disabl... | These aren't italic, they're the "typographically correct" open- and close-quotes. But they are pretty useless in a shell To disable them globally: System Preferences > Keyboard > Text > uncheck "Use smart quotes and dashes" To disable them in-application, if the menu is available, deselect "Smart Quotes" in the Edit >... | # MacOS quotation marks turning italic and breaking scripts
**Tags:** <scripting><terminal><keyboard><macos>
**Question (score 5):**
Whenever I have to write scripts or change my `.zshrc` file for example, it often breaks whenever I type an `"` (quotation mark) -- it gets automatically converted to a italic quotatio... | 979 | 244 | {
"source": "stackexchange-archive.org",
"license": "CC BY-SA 4.0",
"dump_version": "2021-12-07",
"extraction_date": "2026-07-02T12:57:40Z",
"parser_version": "stackexchange-streaming-v1.0",
"site_name": "unix.stackexchange.com",
"original_7z_url": "https://archive.org/download/stack-exchange-2021-12-07/u... |
610,763 | unix.stackexchange.com | Execute a command after some time if no input from user | <p><strong>See <a href="https://unix.stackexchange.com/a/642396/224511">this answer below</a> for a zsh solution</strong></p>
<hr />
<p>Let's say I have the following in my <code>~/.bash_aliases</code> to ask for confirmation before suspending the system:</p>
<pre><code>function suspend()
{ #
echo "Please conf... | See this answer below (https://unix.stackexchange.com/a/642396/224511) for a zsh solution Let's say I have the following in my `~/.bash_aliases` to ask for confirmation before suspending the system: ``` function suspend() { # echo "Please confirm/cancel system suspension:" select confirmation in "confirm" "cancel"; do ... | 7 | 946 | 6 | 0 | 0 | [
"<bash><shell-script>"
] | 2020-09-22T15:02:51.337 | 2021-03-27T17:38:01.500 | 224,511 | 610,832 | [
{
"id": 610832,
"body": "<p>Your attempt with <code>sleep</code> would not work as the <code>sleep</code> call and the subsequent test on <code>$flag_cancel</code> happens in a background job. Any change to the variable <code>flag_cancel</code> in the main part of the code would not affect the value of the... | Your attempt with `sleep` would not work as the `sleep` call and the subsequent test on `$flag_cancel` happens in a background job. Any change to the variable `flag_cancel` in the main part of the code would not affect the value of the variable in the backgrounded subshell and the code would unconditionally suspend the... | # Execute a command after some time if no input from user
**Tags:** <bash><shell-script>
**Question (score 7):**
See this answer below (https://unix.stackexchange.com/a/642396/224511) for a zsh solution Let's say I have the following in my `~/.bash_aliases` to ask for confirmation before suspending the system: ``` f... | 5,454 | 1,363 | {
"source": "stackexchange-archive.org",
"license": "CC BY-SA 4.0",
"dump_version": "2021-12-07",
"extraction_date": "2026-07-02T12:57:40Z",
"parser_version": "stackexchange-streaming-v1.0",
"site_name": "unix.stackexchange.com",
"original_7z_url": "https://archive.org/download/stack-exchange-2021-12-07/u... |
610,779 | unix.stackexchange.com | Pop OS: systemd-boot can't detect Windows | <p>I've followed the classic procedure to install Windows and Linux in dual boot. First I installed Windows in UEFI mode, then I use a bootable PopOS key to resize the main Windows partition; I created a Linux partition as well as a 500MB <code>/boot/efi</code> partition in the remaining space.</p>
<p><strong>My proble... | I've followed the classic procedure to install Windows and Linux in dual boot. First I installed Windows in UEFI mode, then I use a bootable PopOS key to resize the main Windows partition; I created a Linux partition as well as a 500MB `/boot/efi` partition in the remaining space. My problem is, `systemd-boot` can't se... | 8 | 11,970 | 4 | 1 | 2 | [
"<windows><dual-boot><uefi><systemd-boot><pop-os>"
] | 2020-09-22T16:18:00.863 | 2020-09-27T20:11:00.647 | 418,104 | 612,735 | [
{
"id": 628581,
"body": "<p>Try This method has only been tested on a multi drive system</p>\n<p>Find Windows EFI Partition</p>\n<pre><code>lsblk -o NAME,FSTYPE,SIZE,MOUNTPOINT\n</code></pre>\n<p>Create Path & Mount Windows EFI Partition</p>\n<pre><code>sudo mkdir /mnt/win-efi\nsudo mount /dev/sdb1 /mnt... | Try This method has only been tested on a multi drive system Find Windows EFI Partition ``` lsblk -o NAME,FSTYPE,SIZE,MOUNTPOINT ``` Create Path & Mount Windows EFI Partition ``` sudo mkdir /mnt/win-efi sudo mount /dev/sdb1 /mnt/win-efi ``` Copy Contents of Windows EFI to POP EFI ``` sudo cp -r /mnt/win-efi/EFI/Microso... | # Pop OS: systemd-boot can't detect Windows
**Tags:** <windows><dual-boot><uefi><systemd-boot><pop-os>
**Question (score 8):**
I've followed the classic procedure to install Windows and Linux in dual boot. First I installed Windows in UEFI mode, then I use a bootable PopOS key to resize the main Windows partition; I... | 3,847 | 961 | {
"source": "stackexchange-archive.org",
"license": "CC BY-SA 4.0",
"dump_version": "2021-12-07",
"extraction_date": "2026-07-02T12:57:40Z",
"parser_version": "stackexchange-streaming-v1.0",
"site_name": "unix.stackexchange.com",
"original_7z_url": "https://archive.org/download/stack-exchange-2021-12-07/u... |
610,812 | unix.stackexchange.com | Is there a way to have more than one operating system on a computer? | <p>I want to have a linux OS and a Windows 10 OS on the same computer. Is there a way were it's like when I turn on the computer I get an option for choosing which OS I want to boot up? I want to use Ubuntu for programming and Windows 10 for gaming since I've heard that a lot of games mainly work on Windows operating s... | I want to have a linux OS and a Windows 10 OS on the same computer. Is there a way were it's like when I turn on the computer I get an option for choosing which OS I want to boot up? I want to use Ubuntu for programming and Windows 10 for gaming since I've heard that a lot of games mainly work on Windows operating syst... | 5 | 3,864 | 7 | 2 | 0 | [
"<linux><ubuntu>"
] | 2020-09-22T19:44:30.943 | 2020-09-23T22:48:21.100 | 424,184 | null | [
{
"id": 610815,
"body": "<p>Yes, of course you can have 2 or even more operating systems installed\non the same computer. It's called dual-boot, see\n<a href=\"https://opensource.com/article/18/5/dual-boot-linux\" rel=\"noreferrer\">this article</a> for\nexample.</p>\n<p>Apart from installing additional ope... | Yes, of course you can have 2 or even more operating systems installed on the same computer. It's called dual-boot, see this article (https://opensource.com/article/18/5/dual-boot-linux) for example. Apart from installing additional operating systems you can consider running them in a virtual machine - it should be muc... | # Is there a way to have more than one operating system on a computer?
**Tags:** <linux><ubuntu>
**Question (score 5):**
I want to have a linux OS and a Windows 10 OS on the same computer. Is there a way were it's like when I turn on the computer I get an option for choosing which OS I want to boot up? I want to use... | 11,196 | 2,799 | {
"source": "stackexchange-archive.org",
"license": "CC BY-SA 4.0",
"dump_version": "2021-12-07",
"extraction_date": "2026-07-02T12:57:40Z",
"parser_version": "stackexchange-streaming-v1.0",
"site_name": "unix.stackexchange.com",
"original_7z_url": "https://archive.org/download/stack-exchange-2021-12-07/u... |
610,946 | unix.stackexchange.com | repeating a character using printf and appending a newline at the end | <p>In order to repeat a character N times, we could use <code>printf</code>. E.g to repeat <code>@</code> 20 times, we could use something like this:</p>
<pre><code>N=20
printf '@%.0s' $(seq 1 $N)
</code></pre>
<p>output:</p>
<pre><code>@@@@@@@@@@@@@@@@@@@@
</code></pre>
<p>However, there is no newline character at the... | In order to repeat a character N times, we could use `printf`. E.g to repeat `@` 20 times, we could use something like this: ``` N=20 printf '@%.0s' $(seq 1 $N) ``` output: ``` @@@@@@@@@@@@@@@@@@@@ ``` However, there is no newline character at the end of that string. I've tried piping the output to `sed`: ``` printf '@... | 8 | 2,272 | 7 | 5 | 1 | [
"<sed><printf>"
] | 2020-09-23T12:55:23.710 | 2020-09-23T13:19:40.833 | 267,622 | 610,965 | [
{
"id": 610968,
"body": "<pre class=\"lang-none prettyprint-override\"><code>printf %.1s @{1..20} $'\\n'\n</code></pre>\n<p>the shell expands the braces first, this is called "Brace Expansion".<br />\n<code>@{1..20}</code> into <code>@1 @2 @3 ...</code> and so on<br />\nThen the first byte of each... | ``` printf %.1s @{1..20} $'\n' ``` the shell expands the braces first, this is called "Brace Expansion". `@{1..20}` into `@1 @2 @3 ...` and so on Then the first byte of each parameter will be output, including the last argument `$'\n'` consisting of one byte - the newline character | # repeating a character using printf and appending a newline at the end
**Tags:** <sed><printf>
**Question (score 8):**
In order to repeat a character N times, we could use `printf`. E.g to repeat `@` 20 times, we could use something like this: ``` N=20 printf '@%.0s' $(seq 1 $N) ``` output: ``` @@@@@@@@@@@@@@@@@@@@... | 5,184 | 1,296 | {
"source": "stackexchange-archive.org",
"license": "CC BY-SA 4.0",
"dump_version": "2021-12-07",
"extraction_date": "2026-07-02T12:57:40Z",
"parser_version": "stackexchange-streaming-v1.0",
"site_name": "unix.stackexchange.com",
"original_7z_url": "https://archive.org/download/stack-exchange-2021-12-07/u... |
611,158 | unix.stackexchange.com | How do I monitor microphone input? | <p>How do I monitor microphone input in Linux?</p>
<p>Note: monitoring is not the same as recording and playing what was recorded.</p>
<hr />
<p>In Windows, I can listen to my own microphone in the following ways:</p>
<ol>
<li><p>With some program, which will capture my microphone and send it to
my sound card for playi... | How do I monitor microphone input in Linux? Note: monitoring is not the same as recording and playing what was recorded. In Windows, I can listen to my own microphone in the following ways: - With some program, which will capture my microphone and send it to my sound card for playing. For example, with `ffplay` command... | 6 | 3,439 | 2 | 1 | 0 | [
"<ubuntu><audio>"
] | 2020-09-24T12:26:45.903 | 2021-03-15T04:20:18.960 | 28,089 | null | [
{
"id": 616474,
"body": "<p>You should be able to monitor your microphone with PulseAudio's <a href=\"https://www.freedesktop.org/wiki/Software/PulseAudio/Documentation/User/Modules/#module-loopback\" rel=\"noreferrer\">loopback module</a>. Module should automatically create loopback outputs for available i... | You should be able to monitor your microphone with PulseAudio's loopback module (https://www.freedesktop.org/wiki/Software/PulseAudio/Documentation/User/Modules/#module-loopback). Module should automatically create loopback outputs for available input devices. To load the module manually ``` pactl load-module module-lo... | # How do I monitor microphone input?
**Tags:** <ubuntu><audio>
**Question (score 6):**
How do I monitor microphone input in Linux? Note: monitoring is not the same as recording and playing what was recorded. In Windows, I can listen to my own microphone in the following ways: - With some program, which will capture ... | 1,371 | 342 | {
"source": "stackexchange-archive.org",
"license": "CC BY-SA 4.0",
"dump_version": "2021-12-07",
"extraction_date": "2026-07-02T12:57:40Z",
"parser_version": "stackexchange-streaming-v1.0",
"site_name": "unix.stackexchange.com",
"original_7z_url": "https://archive.org/download/stack-exchange-2021-12-07/u... |
611,220 | unix.stackexchange.com | Replacing date with EPOCH in column output | <p>I have a set of data like so:</p>
<pre><code>user1 1234 01/01/2020
user2 2345 02/02/2020
</code></pre>
<p>I need to convert the third column (date) to EPOCH while retaining the username and id number.</p>
<pre><code>user1 1234 1577862000
user2 2345 1580626800
</code></pre>
<p>I have been able to get the conversion a... | I have a set of data like so: ``` user1 1234 01/01/2020 user2 2345 02/02/2020 ``` I need to convert the third column (date) to EPOCH while retaining the username and id number. ``` user1 1234 1577862000 user2 2345 1580626800 ``` I have been able to get the conversion and printing working, but the new date is being appe... | 5 | 320 | 2 | 0 | 1 | [
"<awk><printf>"
] | 2020-09-24T17:41:40.173 | 2020-09-24T17:47:40.173 | 408,932 | 611,222 | [
{
"id": 611222,
"body": "<p><code>print</code> appends a newline by default. Use <code>printf</code>:</p>\n<pre><code>awk '{printf "%s %s ",$1,$2; system("date -d "$3" +%s")}' data\n</code></pre>\n<p>If a special output field separator <code>OFS</code> had been defined, you cou... | `print` appends a newline by default. Use `printf`: ``` awk '{printf "%s %s ",$1,$2; system("date -d "$3" +%s")}' data ``` If a special output field separator `OFS` had been defined, you could use ``` awk '{printf "%s%s%s%s",$1,OFS,$2,OFS; system("date -d "$3" +%s")}' data ``` Notice that each `%s` gets one of the rema... | # Replacing date with EPOCH in column output
**Tags:** <awk><printf>
**Question (score 5):**
I have a set of data like so: ``` user1 1234 01/01/2020 user2 2345 02/02/2020 ``` I need to convert the third column (date) to EPOCH while retaining the username and id number. ``` user1 1234 1577862000 user2 2345 1580626800... | 1,791 | 447 | {
"source": "stackexchange-archive.org",
"license": "CC BY-SA 4.0",
"dump_version": "2021-12-07",
"extraction_date": "2026-07-02T12:57:40Z",
"parser_version": "stackexchange-streaming-v1.0",
"site_name": "unix.stackexchange.com",
"original_7z_url": "https://archive.org/download/stack-exchange-2021-12-07/u... |
611,228 | unix.stackexchange.com | Getting series of file conflicts like runc and containerd when trying to install docker on CentOS 8 | <p>I get what I believe is a file conflict error when I try to install docker/docker-ce on CentOS 8.
This is also a follow up from <a href="https://unix.stackexchange.com/questions/603693/how-to-install-docker-on-centos">How to install docker on CentOS?</a></p>
<p>So here's what I do to get the error:</p>
<pre><code>dn... | I get what I believe is a file conflict error when I try to install docker/docker-ce on CentOS 8. This is also a follow up from How to install docker on CentOS? (https://unix.stackexchange.com/questions/603693/how-to-install-docker-on-centos) So here's what I do to get the error: ``` dnf config-manager --add-repo=https... | 9 | 10,654 | 1 | 0 | 2 | [
"<centos><docker>"
] | 2020-09-24T18:15:26.840 | 2021-08-24T17:29:15.443 | 434,367 | 611,231 | [
{
"id": 611231,
"body": "<p>The <code>podman</code> and <code>buildah</code> packages conflict with <code>docker-ce</code>. Remove them first:</p>\n<pre><code>yum erase podman buildah\n</code></pre>\n<p>And you can then install <code>docker-ce</code>:</p>\n<pre><code>yum install docker-ce\n</code></pre>\n<p... | The `podman` and `buildah` packages conflict with `docker-ce`. Remove them first: ``` yum erase podman buildah ``` And you can then install `docker-ce`: ``` yum install docker-ce ``` Or ``` dnf install docker-ce ``` | # Getting series of file conflicts like runc and containerd when trying to install docker on CentOS 8
**Tags:** <centos><docker>
**Question (score 9):**
I get what I believe is a file conflict error when I try to install docker/docker-ce on CentOS 8. This is also a follow up from How to install docker on CentOS? (ht... | 3,064 | 766 | {
"source": "stackexchange-archive.org",
"license": "CC BY-SA 4.0",
"dump_version": "2021-12-07",
"extraction_date": "2026-07-02T12:57:40Z",
"parser_version": "stackexchange-streaming-v1.0",
"site_name": "unix.stackexchange.com",
"original_7z_url": "https://archive.org/download/stack-exchange-2021-12-07/u... |
611,331 | unix.stackexchange.com | nl: How to start line numbers on the second line? | <p>This is the standard output of <code>ls -ln | nl</code></p>
<pre><code>wolf@linux:~$ ls -lh | nl
1 total 24
2 -rw-rw-r-- 1 wolf wolf 186 Sep 24 22:18 01.py
3 -rw-rw-r-- 1 wolf wolf 585 Sep 24 22:21 02.py
4 -rw-rw-r-- 1 wolf wolf 933 Sep 24 22:26 03.py
wolf@linux:~$
</code></pre>
<p>Inst... | This is the standard output of `ls -ln | nl` ``` wolf@linux:~$ ls -lh | nl 1 total 24 2 -rw-rw-r-- 1 wolf wolf 186 Sep 24 22:18 01.py 3 -rw-rw-r-- 1 wolf wolf 585 Sep 24 22:21 02.py 4 -rw-rw-r-- 1 wolf wolf 933 Sep 24 22:26 03.py wolf@linux:~$ ``` Instead of starting the number from `total 24`, would it be possible to ... | 7 | 709 | 4 | 0 | 0 | [
"<ls><nl>"
] | 2020-09-25T11:29:41.820 | 2020-12-30T15:44:11.680 | 409,008 | null | [
{
"id": 611438,
"body": "<h3>Consume the first line with something else and pass the rest to <code>nl</code></h3>\n<pre><code>$ ls -lh | { sed -u q; nl; }\ntotal 24\n 1 -rw-rw-r-- 1 wolf wolf 186 Sep 24 22:18 01.py\n 2 -rw-rw-r-- 1 wolf wolf 585 Sep 24 22:21 02.py\n 3 -rw-rw-r-- 1 wolf wo... | ### Consume the first line with something else and pass the rest to `nl` ``` $ ls -lh | { sed -u q; nl; } total 24 1 -rw-rw-r-- 1 wolf wolf 186 Sep 24 22:18 01.py 2 -rw-rw-r-- 1 wolf wolf 585 Sep 24 22:21 02.py 3 -rw-rw-r-- 1 wolf wolf 933 Sep 24 22:26 03.py ``` `sed` (with `-u` to disable buffering), will consume one ... | # nl: How to start line numbers on the second line?
**Tags:** <ls><nl>
**Question (score 7):**
This is the standard output of `ls -ln | nl` ``` wolf@linux:~$ ls -lh | nl 1 total 24 2 -rw-rw-r-- 1 wolf wolf 186 Sep 24 22:18 01.py 3 -rw-rw-r-- 1 wolf wolf 585 Sep 24 22:21 02.py 4 -rw-rw-r-- 1 wolf wolf 933 Sep 24 22:2... | 3,626 | 906 | {
"source": "stackexchange-archive.org",
"license": "CC BY-SA 4.0",
"dump_version": "2021-12-07",
"extraction_date": "2026-07-02T12:57:40Z",
"parser_version": "stackexchange-streaming-v1.0",
"site_name": "unix.stackexchange.com",
"original_7z_url": "https://archive.org/download/stack-exchange-2021-12-07/u... |
611,355 | unix.stackexchange.com | Does zsh use canonical-mode for the terminal? | <p>I have been exploring <code>terminfo</code> and <code>stty</code>.
If I run <code>stty -a|grep icanon</code> it appears that canonical mode is set, but if I try to turn it off with <code>stty -icanon</code> and check again, I see that it is still set.
When I do the same thing under bash, I am able to disable icanon,... | I have been exploring `terminfo` and `stty`. If I run `stty -a|grep icanon` it appears that canonical mode is set, but if I try to turn it off with `stty -icanon` and check again, I see that it is still set. When I do the same thing under bash, I am able to disable icanon, but I don't notice any change in behaviour. So... | 5 | 260 | 1 | 0 | 1 | [
"<bash><terminal><zsh><readline>"
] | 2020-09-25T13:03:25.073 | 2020-09-26T23:56:37.897 | 121,109 | null | [
{
"id": 611363,
"body": "<blockquote>\n<p>When I do the same thing under bash, I am able to disable icanon, but I don't notice any change in behaviour.</p>\n</blockquote>\n<p>That's because bash turns the canonical mode <em>off</em> when reading commands from the user (in order to be able to implement line ... | When I do the same thing under bash, I am able to disable icanon, but I don't notice any change in behaviour. That's because bash turns the canonical mode off when reading commands from the user (in order to be able to implement line editing features not offered by the terminal driver -- like inserting text, moving the... | # Does zsh use canonical-mode for the terminal?
**Tags:** <bash><terminal><zsh><readline>
**Question (score 5):**
I have been exploring `terminfo` and `stty`. If I run `stty -a|grep icanon` it appears that canonical mode is set, but if I try to turn it off with `stty -icanon` and check again, I see that it is still ... | 2,146 | 536 | {
"source": "stackexchange-archive.org",
"license": "CC BY-SA 4.0",
"dump_version": "2021-12-07",
"extraction_date": "2026-07-02T12:57:40Z",
"parser_version": "stackexchange-streaming-v1.0",
"site_name": "unix.stackexchange.com",
"original_7z_url": "https://archive.org/download/stack-exchange-2021-12-07/u... |
611,406 | unix.stackexchange.com | How to assign a friendly name to a port number in Linux? | <p>I'd like to assign a friendly name to a port number, how should I do it?</p>
<p>For example: I'd like "0.0.0.0:my-service-name" translates to "0.0.0.0:1234"</p>
| I'd like to assign a friendly name to a port number, how should I do it? For example: I'd like "0.0.0.0:my-service-name" translates to "0.0.0.0:1234" | 14 | 978 | 1 | 0 | 4 | [
"<linux>"
] | 2020-09-25T17:50:30.117 | 2020-09-26T12:44:29.990 | 434,536 | 611,410 | [
{
"id": 611410,
"body": "<p>Yes, you can do this, by adding your port definition to <a href=\"https://man7.org/linux/man-pages/man5/services.5.html\" rel=\"noreferrer\"><code>/etc/services</code></a>. For a TCP service, you’d add</p>\n<pre><code>my-service-name 1234/tcp\n</code></pre>\n<p>Once that’s don... | Yes, you can do this, by adding your port definition to `/etc/services` (https://man7.org/linux/man-pages/man5/services.5.html). For a TCP service, you’d add ``` my-service-name 1234/tcp ``` Once that’s done, you’ll be able to write “0.0.0.0:my-service-name” instead of “0.0.0.0:1234”. The canonical list of services is ... | # How to assign a friendly name to a port number in Linux?
**Tags:** <linux>
**Question (score 14):**
I'd like to assign a friendly name to a port number, how should I do it? For example: I'd like "0.0.0.0:my-service-name" translates to "0.0.0.0:1234"
### Answer (score 26 · accepted)
Yes, you can do this, by adding... | 859 | 214 | {
"source": "stackexchange-archive.org",
"license": "CC BY-SA 4.0",
"dump_version": "2021-12-07",
"extraction_date": "2026-07-02T12:57:40Z",
"parser_version": "stackexchange-streaming-v1.0",
"site_name": "unix.stackexchange.com",
"original_7z_url": "https://archive.org/download/stack-exchange-2021-12-07/u... |
611,713 | unix.stackexchange.com | How to pop the last positional argument of a bash function or script? | <p>I often need to pop the last positional argument of a bash function or script.</p>
<p>By "pop" I mean: "remove it from the list of positional arguments, and (optionally) assign it to a variable."</p>
<p>Given how frequently I need this operation, I am a bit surprised that best I have found is wha... | I often need to pop the last positional argument of a bash function or script. By "pop" I mean: "remove it from the list of positional arguments, and (optionally) assign it to a variable." Given how frequently I need this operation, I am a bit surprised that best I have found is what is illustrated by the example below... | 17 | 2,114 | 5 | 4 | 1 | [
"<bash><shell-script>"
] | 2020-09-27T20:17:44.680 | 2020-09-27T20:31:51.370 | 10,618 | 611,717 | [
{
"id": 611717,
"body": "<p>You can access the last element with <code>${argv[-1]}</code> (bash 4.2 or above) and remove it from the array with the <code>unset</code> builtin (bash 4.3 or above):</p>\n<pre><code>last=${argv[-1]}\nunset 'argv[-1]'\n</code></pre>\n<p>The quotes around <code>argv[-1]</code> ar... | You can access the last element with `${argv[-1]}` (bash 4.2 or above) and remove it from the array with the `unset` builtin (bash 4.3 or above): ``` last=${argv[-1]} unset 'argv[-1]' ``` The quotes around `argv[-1]` are required as `[...]` is a glob operator, so `argv[-1]` unquoted could expand to `argv-` and/or `argv... | # How to pop the last positional argument of a bash function or script?
**Tags:** <bash><shell-script>
**Question (score 17):**
I often need to pop the last positional argument of a bash function or script. By "pop" I mean: "remove it from the list of positional arguments, and (optionally) assign it to a variable." ... | 2,520 | 630 | {
"source": "stackexchange-archive.org",
"license": "CC BY-SA 4.0",
"dump_version": "2021-12-07",
"extraction_date": "2026-07-02T12:57:40Z",
"parser_version": "stackexchange-streaming-v1.0",
"site_name": "unix.stackexchange.com",
"original_7z_url": "https://archive.org/download/stack-exchange-2021-12-07/u... |
612,143 | unix.stackexchange.com | Get field and nested field at the same time using jq | <p>I am trying to get two attributes I need from the JIRA API. Given the following input to JQ:</p>
<pre><code>{
"expand": "names,schema",
"startAt": 0,
"maxResults": 50,
"total": 1,
"issues": [
{
"expand": "operations,versio... | I am trying to get two attributes I need from the JIRA API. Given the following input to JQ: ``` { "expand": "names,schema", "startAt": 0, "maxResults": 50, "total": 1, "issues": [ { "expand": "operations,versionedRepresentations,editmeta,changelog,renderedFields", "id": "73270", "key": "RM-111", "fields": { "statuscat... | 5 | 4,236 | 1 | 0 | 1 | [
"<json><jq>"
] | 2020-09-30T09:37:53.763 | 2021-03-01T08:32:40.580 | 163,478 | 612,148 | [
{
"id": 612148,
"body": "<p>As a list of tab-separated values: Create an array of the wanted values for each <code>issue[]</code> and pass it to <code>@tsv</code>.</p>\n<pre class=\"lang-none prettyprint-override\"><code>$ jq -r '.issues[] | [ .key, .fields.summary ] | @tsv' file.json\nRM-111 6.6.0\n</code... | As a list of tab-separated values: Create an array of the wanted values for each `issue[]` and pass it to `@tsv`. ``` $ jq -r '.issues[] | [ .key, .fields.summary ] | @tsv' file.json RM-111 6.6.0 ``` As a string with the two values separated by a space: Create a double quoted string for each `issue[]` and use `\(...)` ... | # Get field and nested field at the same time using jq
**Tags:** <json><jq>
**Question (score 5):**
I am trying to get two attributes I need from the JIRA API. Given the following input to JQ: ``` { "expand": "names,schema", "startAt": 0, "maxResults": 50, "total": 1, "issues": [ { "expand": "operations,versionedRep... | 1,946 | 486 | {
"source": "stackexchange-archive.org",
"license": "CC BY-SA 4.0",
"dump_version": "2021-12-07",
"extraction_date": "2026-07-02T12:57:40Z",
"parser_version": "stackexchange-streaming-v1.0",
"site_name": "unix.stackexchange.com",
"original_7z_url": "https://archive.org/download/stack-exchange-2021-12-07/u... |
612,322 | unix.stackexchange.com | The old ticks vs parentheses issue: confused | <p>Since being corrected many years ago, I switched from backticks to $() for command expansion.</p>
<p>But I still prefer the backticks. It is fewer keystrokes and does not involve the <kbd>Shift</kbd> key.</p>
<p>I understand that the parentheses are preferable because it is less prone to the errors that backticks is... | Since being corrected many years ago, I switched from backticks to $() for command expansion. But I still prefer the backticks. It is fewer keystrokes and does not involve the Shift key. I understand that the parentheses are preferable because it is less prone to the errors that backticks is prone to, but what is the r... | 23 | 2,135 | 2 | 10 | 5 | [
"<bash><shell><command-substitution>"
] | 2020-10-01T08:48:08.310 | 2020-10-03T20:38:07.943 | 251,630 | null | [
{
"id": 612323,
"body": "<p><a href=\"http://mywiki.wooledge.org/BashFAQ/082\" rel=\"noreferrer\">The Bash FAQ gives a number of reasons</a> to <em>prefer</em> parentheses to backticks, but there isn’t a universal rule that you <em>shouldn’t ever</em> use backticks.</p>\n<p>The main reason to prefer parenth... | The Bash FAQ gives a number of reasons (http://mywiki.wooledge.org/BashFAQ/082) to prefer parentheses to backticks, but there isn’t a universal rule that you shouldn’t ever use backticks. The main reason to prefer parentheses in my view is that parsing inside `$()` is consistent with parsing performed outside, which is... | # The old ticks vs parentheses issue: confused
**Tags:** <bash><shell><command-substitution>
**Question (score 23):**
Since being corrected many years ago, I switched from backticks to $() for command expansion. But I still prefer the backticks. It is fewer keystrokes and does not involve the Shift key. I understand... | 3,848 | 962 | {
"source": "stackexchange-archive.org",
"license": "CC BY-SA 4.0",
"dump_version": "2021-12-07",
"extraction_date": "2026-07-02T12:57:40Z",
"parser_version": "stackexchange-streaming-v1.0",
"site_name": "unix.stackexchange.com",
"original_7z_url": "https://archive.org/download/stack-exchange-2021-12-07/u... |
612,325 | unix.stackexchange.com | Opening two Chrome windows on Fedora 32 is very slow | <p>I am running a Fedora 32 on my XPS 13 laptop. I use Chrome as my browser, and I have 2 profiles - work and personal. When I open a new profile, it opens a new Chrome window. However, both windows lag significantly. Opening a new tab takes about 10 seconds, scrolling is very slow, etc. The number of tabs open is insi... | I am running a Fedora 32 on my XPS 13 laptop. I use Chrome as my browser, and I have 2 profiles - work and personal. When I open a new profile, it opens a new Chrome window. However, both windows lag significantly. Opening a new tab takes about 10 seconds, scrolling is very slow, etc. The number of tabs open is insigni... | 8 | 1,167 | 2 | 6 | 3 | [
"<fedora><performance><chrome>"
] | 2020-10-01T09:21:48.147 | 2021-01-23T18:26:31.337 | 206,318 | null | [
{
"id": 622787,
"body": "<p>It is some sort of problem with wayland. <a href=\"https://support.google.com/chrome/thread/69471681?hl=en\" rel=\"noreferrer\">A lot of people</a> having same issue. I found <a href=\"https://www.reddit.com/r/swaywm/comments/ipkfbx/chromechromium_850418383_regression_workaround/... | It is some sort of problem with wayland. A lot of people (https://support.google.com/chrome/thread/69471681?hl=en) having same issue. I found this workaround (https://www.reddit.com/r/swaywm/comments/ipkfbx/chromechromium_850418383_regression_workaround/). Just start chrome with additional parameters: ``` google-chrome... | # Opening two Chrome windows on Fedora 32 is very slow
**Tags:** <fedora><performance><chrome>
**Question (score 8):**
I am running a Fedora 32 on my XPS 13 laptop. I use Chrome as my browser, and I have 2 profiles - work and personal. When I open a new profile, it opens a new Chrome window. However, both windows la... | 3,957 | 989 | {
"source": "stackexchange-archive.org",
"license": "CC BY-SA 4.0",
"dump_version": "2021-12-07",
"extraction_date": "2026-07-02T12:57:40Z",
"parser_version": "stackexchange-streaming-v1.0",
"site_name": "unix.stackexchange.com",
"original_7z_url": "https://archive.org/download/stack-exchange-2021-12-07/u... |
612,333 | unix.stackexchange.com | How to retrieve ssh password with a working ssh key | <p>I always login a server with a ssh key, so I am not sure what my actual password was anymore. I would need to guess a couple of times. However the server has fail2ban and I don't want to trigger that. <strike>Is there any way to check which of my passwords corresponds to the ssh key which is accepted by the server? ... | I always login a server with a ssh key, so I am not sure what my actual password was anymore. I would need to guess a couple of times. However the server has fail2ban and I don't want to trigger that. Is there any way to check which of my passwords corresponds to the ssh key which is accepted by the server? Is there an... | 6 | 3,601 | 2 | 0 | 1 | [
"<ssh><password><authentication>"
] | 2020-10-01T11:08:52.983 | 2020-10-02T08:22:21.907 | 224,357 | 612,334 | [
{
"id": 612334,
"body": "<p>No, there is no relation between an account password and the ssh key.</p>\n<p>You can logon to an account with ssh with a key even if it has no password.</p>\n<hr />\n<p>For the updated question, yes, type:</p>\n<pre><code>su YOURUSERNAME\n</code></pre>\n<p>then try if you rememb... | No, there is no relation between an account password and the ssh key. You can logon to an account with ssh with a key even if it has no password. For the updated question, yes, type: ``` su YOURUSERNAME ``` then try if you remember your password | # How to retrieve ssh password with a working ssh key
**Tags:** <ssh><password><authentication>
**Question (score 6):**
I always login a server with a ssh key, so I am not sure what my actual password was anymore. I would need to guess a couple of times. However the server has fail2ban and I don't want to trigger th... | 1,628 | 407 | {
"source": "stackexchange-archive.org",
"license": "CC BY-SA 4.0",
"dump_version": "2021-12-07",
"extraction_date": "2026-07-02T12:57:40Z",
"parser_version": "stackexchange-streaming-v1.0",
"site_name": "unix.stackexchange.com",
"original_7z_url": "https://archive.org/download/stack-exchange-2021-12-07/u... |
612,352 | unix.stackexchange.com | How to run windows executables from terminal without the explicitly specifying the .exe extension? | <p>As the title says most of the question, how can we run windows executables without specifying the explicit <code>.exe</code> suffix at the end.</p>
<p><a href="https://i.stack.imgur.com/omqxf.png" rel="noreferrer"><img src="https://i.stack.imgur.com/omqxf.png" alt="enter image description here" /></a></p>
<p>For exa... | As the title says most of the question, how can we run windows executables without specifying the explicit `.exe` suffix at the end. (https://i.stack.imgur.com/omqxf.png) For example reducing the call like `explorer.exe .` to `explorer .`, or `notepad.exe file` to `notepad file`, or `docker.exe ps` to `docker ps`, etc.... | 7 | 2,517 | 6 | 1 | 4 | [
"<shell><zsh><windows><oh-my-zsh><windows-subsystem-for-linux>"
] | 2020-10-01T12:43:46.877 | 2020-10-01T14:33:29.793 | 259,021 | 612,531 | [
{
"id": 612370,
"body": "<p>You have three options.</p>\n<ol>\n<li><p>Always type the <code>.exe</code>. Command completion might help, assuming your shell has it. But this is what you are trying to avoid.</p>\n</li>\n<li><p>The alias solution already pointed out by others.</p>\n</li>\n<li><p>Make symboli... | You have three options. - Always type the `.exe`. Command completion might help, assuming your shell has it. But this is what you are trying to avoid. - The alias solution already pointed out by others. - Make symbolic links without the .exe to the Windows executables. These should be placed in a directory (on a Unix/L... | # How to run windows executables from terminal without the explicitly specifying the .exe extension?
**Tags:** <shell><zsh><windows><oh-my-zsh><windows-subsystem-for-linux>
**Question (score 7):**
As the title says most of the question, how can we run windows executables without specifying the explicit `.exe` suffix... | 6,728 | 1,682 | {
"source": "stackexchange-archive.org",
"license": "CC BY-SA 4.0",
"dump_version": "2021-12-07",
"extraction_date": "2026-07-02T12:57:40Z",
"parser_version": "stackexchange-streaming-v1.0",
"site_name": "unix.stackexchange.com",
"original_7z_url": "https://archive.org/download/stack-exchange-2021-12-07/u... |
612,398 | unix.stackexchange.com | What are the main differences between GuixSD and NixOS? | <p>Guix is based on Nix. I know that Guix uses Scheme and has only free software in repos.</p>
<p>What are the main differences between them?</p>
| Guix is based on Nix. I know that Guix uses Scheme and has only free software in repos. What are the main differences between them? | 5 | 2,511 | 1 | 1 | 1 | [
"<nixos><guixsd>"
] | 2020-10-01T16:54:26.450 | 2021-01-23T21:34:22.033 | 387,339 | 630,620 | [
{
"id": 630620,
"body": "<p>This is a rather broad question, and as a guix user i might perhaps not have\nthe whole picture, but the primary differences are, to my understanding:</p>\n<ol>\n<li>Guix does not package any proprietary software in\nthe official repo, nix however does.</li>\n<li>While nix use s... | This is a rather broad question, and as a guix user i might perhaps not have the whole picture, but the primary differences are, to my understanding: - Guix does not package any proprietary software in the official repo, nix however does. - While nix use systemd, guix use GNU Shepherd. - Nix configuration is in a domai... | # What are the main differences between GuixSD and NixOS?
**Tags:** <nixos><guixsd>
**Question (score 5):**
Guix is based on Nix. I know that Guix uses Scheme and has only free software in repos. What are the main differences between them?
### Answer (score 8 · accepted)
This is a rather broad question, and as a gu... | 1,258 | 314 | {
"source": "stackexchange-archive.org",
"license": "CC BY-SA 4.0",
"dump_version": "2021-12-07",
"extraction_date": "2026-07-02T12:57:40Z",
"parser_version": "stackexchange-streaming-v1.0",
"site_name": "unix.stackexchange.com",
"original_7z_url": "https://archive.org/download/stack-exchange-2021-12-07/u... |
612,416 | unix.stackexchange.com | Why does /etc/resolv.conf point at 127.0.0.53? | <p>I tried to check what my DNS resolver is and I noticed this:</p>
<pre><code>user@ubuntu:~$ cat /etc/resolv.conf
nameserver 127.0.0.53
options edns0
</code></pre>
<p>I was expecting <code>192.168.1.1</code>, which is my default gateway, my router.</p>
<p>I don't understand why it points at <code>127.0.0.53</code>. ... | I tried to check what my DNS resolver is and I noticed this: ``` user@ubuntu:~$ cat /etc/resolv.conf nameserver 127.0.0.53 options edns0 ``` I was expecting `192.168.1.1`, which is my default gateway, my router. I don't understand why it points at `127.0.0.53`. When I hit that ip, apache2 serves me its contents. Could ... | 43 | 42,539 | 2 | 2 | 11 | [
"<linux><dns><resolv.conf>"
] | 2020-10-01T18:35:08.873 | 2020-10-01T18:52:38.283 | 433,400 | 612,434 | [
{
"id": 612434,
"body": "<p>You are likely running <code>systemd-resolved</code> as a service.</p>\n<p><code>systemd-resolved</code> generates two configuration files on the fly, for optional use by DNS client libraries (such as the BIND DNS client library in C libraries):</p>\n<ul>\n<li><code>/run/systemd/... | You are likely running `systemd-resolved` as a service. `systemd-resolved` generates two configuration files on the fly, for optional use by DNS client libraries (such as the BIND DNS client library in C libraries): - `/run/systemd/resolve/stub-resolv.conf` tells DNS client libraries to send their queries to 127.0.0.53... | # Why does /etc/resolv.conf point at 127.0.0.53?
**Tags:** <linux><dns><resolv.conf>
**Question (score 43):**
I tried to check what my DNS resolver is and I noticed this: ``` user@ubuntu:~$ cat /etc/resolv.conf nameserver 127.0.0.53 options edns0 ``` I was expecting `192.168.1.1`, which is my default gateway, my rou... | 5,498 | 1,374 | {
"source": "stackexchange-archive.org",
"license": "CC BY-SA 4.0",
"dump_version": "2021-12-07",
"extraction_date": "2026-07-02T12:57:40Z",
"parser_version": "stackexchange-streaming-v1.0",
"site_name": "unix.stackexchange.com",
"original_7z_url": "https://archive.org/download/stack-exchange-2021-12-07/u... |
612,611 | unix.stackexchange.com | Can I make cd be local to a function? | <p>Is it possible to make a function like</p>
<pre><code>function doStuffAt {
cd $1
# do stuff
}
</code></pre>
<p>but make it so invoking that function doesn't actually change my pwd, it just changes it for duration of the function? I know I can save the pwd and set it back at the end, but I'm hoping there's a ... | Is it possible to make a function like ``` function doStuffAt { cd $1 # do stuff } ``` but make it so invoking that function doesn't actually change my pwd, it just changes it for duration of the function? I know I can save the pwd and set it back at the end, but I'm hoping there's a way to just make it happen locally ... | 27 | 2,882 | 5 | 3 | 1 | [
"<bash><shell-script><shell-builtin>"
] | 2020-10-02T17:16:43.220 | 2020-12-28T12:07:02.393 | 433,825 | 612,614 | [
{
"id": 612614,
"body": "<p>Yes. Just make the function run its commands in a <code>( )</code> subshell instead of a <code>{ }</code> group command:</p>\n<pre class=\"lang-bsh prettyprint-override\"><code>doStuffAt() (\n cd -- "$1" || exit # the subshell if cd failed.\n # do stuff\n)... | Yes. Just make the function run its commands in a `( )` subshell instead of a `{ }` group command: ``` doStuffAt() ( cd -- "$1" || exit # the subshell if cd failed. # do stuff ) ``` The parentheses (`( )`) open a new subshell that will inherit the environment of its parent. The subshell will exit as soon as the command... | # Can I make cd be local to a function?
**Tags:** <bash><shell-script><shell-builtin>
**Question (score 27):**
Is it possible to make a function like ``` function doStuffAt { cd $1 # do stuff } ``` but make it so invoking that function doesn't actually change my pwd, it just changes it for duration of the function? ... | 6,938 | 1,734 | {
"source": "stackexchange-archive.org",
"license": "CC BY-SA 4.0",
"dump_version": "2021-12-07",
"extraction_date": "2026-07-02T12:57:40Z",
"parser_version": "stackexchange-streaming-v1.0",
"site_name": "unix.stackexchange.com",
"original_7z_url": "https://archive.org/download/stack-exchange-2021-12-07/u... |
612,905 | unix.stackexchange.com | How portable is a gzip file over 4 GB in size? | <p>To backup a snapshot of my work, I run a command like <code>tar -czf work.tgz work</code> to create a gzipped tar file, which I can then drop in cloud storage. However, I have just noticed that gzip has a 4 GB size limit, and my <code>work.tgz</code> file is more than 4 GB.</p>
<p>Despite that, if I create a gzip ta... | To backup a snapshot of my work, I run a command like `tar -czf work.tgz work` to create a gzipped tar file, which I can then drop in cloud storage. However, I have just noticed that gzip has a 4 GB size limit, and my `work.tgz` file is more than 4 GB. Despite that, if I create a gzip tar file on my current computer (r... | 10 | 2,140 | 2 | 14 | 0 | [
"<files><tar><gzip><portability>"
] | 2020-10-05T01:09:53.337 | 2020-10-08T11:26:59.453 | 435,807 | 612,916 | [
{
"id": 612916,
"body": "<blockquote>\n<p>I have just noticed that gzip has a 4 GB size limit</p>\n</blockquote>\n<p>More accurately, the <code>gzip</code> format can’t correctly store uncompressed file <em>sizes</em> over 4GiB. The result is that <code>gzip -l</code> won’t show the right size for any compr... | I have just noticed that gzip has a 4 GB size limit More accurately, the `gzip` format can’t correctly store uncompressed file sizes over 4GiB. The result is that `gzip -l` won’t show the right size for any compressed file whose original size is over 4GiB. Apart from that, there is no limit due to `gzip` itself, and `g... | # How portable is a gzip file over 4 GB in size?
**Tags:** <files><tar><gzip><portability>
**Question (score 10):**
To backup a snapshot of my work, I run a command like `tar -czf work.tgz work` to create a gzipped tar file, which I can then drop in cloud storage. However, I have just noticed that gzip has a 4 GB si... | 2,557 | 639 | {
"source": "stackexchange-archive.org",
"license": "CC BY-SA 4.0",
"dump_version": "2021-12-07",
"extraction_date": "2026-07-02T12:57:40Z",
"parser_version": "stackexchange-streaming-v1.0",
"site_name": "unix.stackexchange.com",
"original_7z_url": "https://archive.org/download/stack-exchange-2021-12-07/u... |
612,943 | unix.stackexchange.com | How to make `top` only display a group of processes matching a specific pattern? | <p>I want to show all processes whose command line includes <code>.*git.*</code> using <code>top</code>.</p>
<p>I've considered the following command: <code>top -p $(pgrep -d',' -f '.*git.*')</code></p>
<p>However, the above command has several caveats:</p>
<ul>
<li>Only processes that exist while <code>top</code> is e... | I want to show all processes whose command line includes `.*git.*` using `top`. I've considered the following command: `top -p $(pgrep -d',' -f '.*git.*')` However, the above command has several caveats: - Only processes that exist while `top` is executed will be included in `top`'s output (new `.*git.*`s are not inclu... | 6 | 341 | 1 | 6 | 0 | [
"<bash><debian><shell><process><top>"
] | 2020-10-05T08:48:48.633 | 2020-10-05T09:30:10.350 | 128,739 | 612,948 | [
{
"id": 612948,
"body": "<p>You can do this in <code>top</code> using “filtering in a window”: start <code>top</code>, then press <kbd>O</kbd>, and enter</p>\n<pre><code>COMMAND=git\n</code></pre>\n<p>This will filter processes, matching the <code>COMMAND</code> column and keeping only processes whose visib... | You can do this in `top` using “filtering in a window”: start `top`, then press O, and enter ``` COMMAND=git ``` This will filter processes, matching the `COMMAND` column and keeping only processes whose visible value in that column contains `git`. When filtering on the `COMMAND` column, the filter applies to the curre... | # How to make `top` only display a group of processes matching a specific pattern?
**Tags:** <bash><debian><shell><process><top>
**Question (score 6):**
I want to show all processes whose command line includes `.*git.*` using `top`. I've considered the following command: `top -p $(pgrep -d',' -f '.*git.*')` However,... | 1,864 | 466 | {
"source": "stackexchange-archive.org",
"license": "CC BY-SA 4.0",
"dump_version": "2021-12-07",
"extraction_date": "2026-07-02T12:57:40Z",
"parser_version": "stackexchange-streaming-v1.0",
"site_name": "unix.stackexchange.com",
"original_7z_url": "https://archive.org/download/stack-exchange-2021-12-07/u... |
613,008 | unix.stackexchange.com | In bash, how is it that a file redirected for input can be written to, and can it be prevented? | <p>I thought I had a good handle on bash file redirection, and generally I try to avoid "<a href="https://en.wikipedia.org/wiki/Cat_(Unix)#Useless_use_of_cat" rel="noreferrer">useless use of cat</a>", but I experienced some unexpected behaviour with a script and I would like to understand why it occurs.</p>
<... | I thought I had a good handle on bash file redirection, and generally I try to avoid "useless use of cat (https://en.wikipedia.org/wiki/Cat_(Unix)#Useless_use_of_cat)", but I experienced some unexpected behaviour with a script and I would like to understand why it occurs. Within a bash script, I execute: ``` somecomman... | 23 | 1,280 | 1 | 14 | 7 | [
"<bash><io-redirection>"
] | 2020-10-05T15:10:55.580 | 2020-10-06T08:36:14.580 | 385,230 | 613,013 | [
{
"id": 613013,
"body": "<p>That's due to the way <code>/dev/stdin</code> (actually <code>/proc/self/fd/0</code>) is implemented on Linux (and Cygwin, but generally not other systems).</p>\n<p>On Linux opening <code>/dev/stdin</code> is not like doing a <code>dup(0)</code>, it just reopens the same file as ... | That's due to the way `/dev/stdin` (actually `/proc/self/fd/0`) is implemented on Linux (and Cygwin, but generally not other systems). On Linux opening `/dev/stdin` is not like doing a `dup(0)`, it just reopens the same file as open on fd 0 anew. It doesn't share the open file description that fd 0 refers to (with the ... | # In bash, how is it that a file redirected for input can be written to, and can it be prevented?
**Tags:** <bash><io-redirection>
**Question (score 23):**
I thought I had a good handle on bash file redirection, and generally I try to avoid "useless use of cat (https://en.wikipedia.org/wiki/Cat_(Unix)#Useless_use_of... | 3,706 | 926 | {
"source": "stackexchange-archive.org",
"license": "CC BY-SA 4.0",
"dump_version": "2021-12-07",
"extraction_date": "2026-07-02T12:57:40Z",
"parser_version": "stackexchange-streaming-v1.0",
"site_name": "unix.stackexchange.com",
"original_7z_url": "https://archive.org/download/stack-exchange-2021-12-07/u... |
613,231 | unix.stackexchange.com | What's the default file for `hostname`? | <p>Heyo! I'm currently working on a non-lfs system from scratch with busybox as the star. Now, my login says:</p>
<pre><code>(none) login:
</code></pre>
<p>Hence, my hostname is broken. <code>hostname</code> brings me <code>(none)</code> too.</p>
<p>The guide I was following told me to throw the hostname to <code>/etc/... | Heyo! I'm currently working on a non-lfs system from scratch with busybox as the star. Now, my login says: ``` (none) login: ``` Hence, my hostname is broken. `hostname` brings me `(none)` too. The guide I was following told me to throw the hostname to `/etc/HOSTNAME`. I've also tried `/etc/hostname`. No matter what I ... | 14 | 2,569 | 3 | 4 | 1 | [
"<linux><hostname>"
] | 2020-10-06T20:37:26.970 | 2020-11-01T23:35:23.110 | 382,366 | 613,260 | [
{
"id": 613260,
"body": "<p>The <code>hostname</code> commands in common toolsets, including BusyBox, do not fall back to files when querying the hostname.\nThey report solely what the kernel returns to them as the hostname from a system call, which the kernel initializes to a string such as "(none)&qu... | The `hostname` commands in common toolsets, including BusyBox, do not fall back to files when querying the hostname. They report solely what the kernel returns to them as the hostname from a system call, which the kernel initializes to a string such as "(none)", changeable by reconfiguring and rebuilding the kernel. (I... | # What's the default file for `hostname`?
**Tags:** <linux><hostname>
**Question (score 14):**
Heyo! I'm currently working on a non-lfs system from scratch with busybox as the star. Now, my login says: ``` (none) login: ``` Hence, my hostname is broken. `hostname` brings me `(none)` too. The guide I was following to... | 4,932 | 1,233 | {
"source": "stackexchange-archive.org",
"license": "CC BY-SA 4.0",
"dump_version": "2021-12-07",
"extraction_date": "2026-07-02T12:57:40Z",
"parser_version": "stackexchange-streaming-v1.0",
"site_name": "unix.stackexchange.com",
"original_7z_url": "https://archive.org/download/stack-exchange-2021-12-07/u... |
613,331 | unix.stackexchange.com | How to extract a value from a JSON file containing an encoded JSON object | <p>The command <code>aws s3api get-bucket-policy --bucket <i>bucketname</i></code>
outputs:</p>
<pre><code>{
"Policy": "{\"Version\":\"2012-10-17\",\"Id\":\"S3SecureTransportPolicy\",\"Statement\":[{\"Sid\":\"ForceSSLOnlyAccess\",\... | The command `aws s3api get-bucket-policy --bucket bucketname` outputs: ``` { "Policy": "{\"Version\":\"2012-10-17\",\"Id\":\"S3SecureTransportPolicy\",\"Statement\":[{\"Sid\":\"ForceSSLOnlyAccess\",\"Effect\":\"Deny\",\"Principal\":{\"AWS\":\"*\"},\"Action\":\"s3:*\",\"Resource\":\"arn:aws:s3:::amn/*\",\"Condition\":{\... | 5 | 711 | 2 | 0 | 1 | [
"<json><aws><jq>"
] | 2020-10-07T11:00:38.377 | 2020-10-10T03:10:46.887 | 436,187 | null | [
{
"id": 613337,
"body": "<p>The JSON document that you get from your command seems to contain another encoded JSON document. It's from this encoded document you appear to want to get the data.</p>\n<p>To get at the internal document, we may use <code>jq</code>:</p>\n<pre><code>aws ... |\njq -r '.Policy'\n</... | The JSON document that you get from your command seems to contain another encoded JSON document. It's from this encoded document you appear to want to get the data. To get at the internal document, we may use `jq`: ``` aws ... | jq -r '.Policy' ``` To get the value of the `Effect` key from the bit that contains that `a... | # How to extract a value from a JSON file containing an encoded JSON object
**Tags:** <json><aws><jq>
**Question (score 5):**
The command `aws s3api get-bucket-policy --bucket bucketname` outputs: ``` { "Policy": "{\"Version\":\"2012-10-17\",\"Id\":\"S3SecureTransportPolicy\",\"Statement\":[{\"Sid\":\"ForceSSLOnlyAc... | 4,331 | 1,082 | {
"source": "stackexchange-archive.org",
"license": "CC BY-SA 4.0",
"dump_version": "2021-12-07",
"extraction_date": "2026-07-02T12:57:40Z",
"parser_version": "stackexchange-streaming-v1.0",
"site_name": "unix.stackexchange.com",
"original_7z_url": "https://archive.org/download/stack-exchange-2021-12-07/u... |
613,427 | unix.stackexchange.com | In a remote shell, how can I find out from which computer I logged into the remote machine? | <p>In a remote shell, how can I find the domain name of the computer from which I logged into the remote machine?</p>
<p>Example: My local machine is <code>mi.pona.com</code>. On this machine I run</p>
<pre><code>ssh toki@sina.pona.com
</code></pre>
<p>to login into the remote machine <code>sina.pona.com</code>. In the... | In a remote shell, how can I find the domain name of the computer from which I logged into the remote machine? Example: My local machine is `mi.pona.com`. On this machine I run ``` ssh toki@sina.pona.com ``` to login into the remote machine `sina.pona.com`. In the shell which opens (running on the remote machine) I wan... | 7 | 1,234 | 3 | 2 | 1 | [
"<ssh><remote><hostname>"
] | 2020-10-07T23:31:53.167 | 2020-10-08T00:31:20.860 | 45,940 | 613,432 | [
{
"id": 613438,
"body": "<p>ssh always sets the <code>SSH_CONNECTION</code> environment variable in the remote shell to a value containing the client's and server's host and port.</p>\n<p>This also works from non-interactive shells and on machines which do not have utmp/systemd/whatever (e.g. on your router... | ssh always sets the `SSH_CONNECTION` environment variable in the remote shell to a value containing the client's and server's host and port. This also works from non-interactive shells and on machines which do not have utmp/systemd/whatever (e.g. on your router or camera). ``` ssh root@unq 'echo $SSH_CONNECTION' 192.16... | # In a remote shell, how can I find out from which computer I logged into the remote machine?
**Tags:** <ssh><remote><hostname>
**Question (score 7):**
In a remote shell, how can I find the domain name of the computer from which I logged into the remote machine? Example: My local machine is `mi.pona.com`. On this ma... | 1,721 | 430 | {
"source": "stackexchange-archive.org",
"license": "CC BY-SA 4.0",
"dump_version": "2021-12-07",
"extraction_date": "2026-07-02T12:57:40Z",
"parser_version": "stackexchange-streaming-v1.0",
"site_name": "unix.stackexchange.com",
"original_7z_url": "https://archive.org/download/stack-exchange-2021-12-07/u... |
613,613 | unix.stackexchange.com | Headphone jack not reliably detecting on Ubuntu 20.04 | <p>The issue that I'm having is that headphones plugged into the 3.5mm jack on the front of my desktop computer are not always detected. I'm running Ubuntu 20.04 on a custom built computer with a B450 Tomahawk motherboard. I'm certain that the issue is with Ubuntu 20.04 because the issue was not occurring (as far as I'... | The issue that I'm having is that headphones plugged into the 3.5mm jack on the front of my desktop computer are not always detected. I'm running Ubuntu 20.04 on a custom built computer with a B450 Tomahawk motherboard. I'm certain that the issue is with Ubuntu 20.04 because the issue was not occurring (as far as I'm a... | 13 | 14,363 | 3 | 0 | 4 | [
"<ubuntu><audio><pulseaudio>"
] | 2020-10-08T21:32:12.807 | 2021-11-20T11:28:34.953 | 397,520 | null | [
{
"id": 629511,
"body": "<p>Open your terminal and run these</p>\n<pre><code>pulseaudio --kill \npulseaudio --start\n</code></pre>\n<p>This solved my problem in Ubuntu 20.04. But unfortunately there should be automatic detection, which is not working. Slightly disappointed</p>\n",
"body_md": "Open your ... | Open your terminal and run these ``` pulseaudio --kill pulseaudio --start ``` This solved my problem in Ubuntu 20.04. But unfortunately there should be automatic detection, which is not working. Slightly disappointed | # Headphone jack not reliably detecting on Ubuntu 20.04
**Tags:** <ubuntu><audio><pulseaudio>
**Question (score 13):**
The issue that I'm having is that headphones plugged into the 3.5mm jack on the front of my desktop computer are not always detected. I'm running Ubuntu 20.04 on a custom built computer with a B450 ... | 1,692 | 423 | {
"source": "stackexchange-archive.org",
"license": "CC BY-SA 4.0",
"dump_version": "2021-12-07",
"extraction_date": "2026-07-02T12:57:40Z",
"parser_version": "stackexchange-streaming-v1.0",
"site_name": "unix.stackexchange.com",
"original_7z_url": "https://archive.org/download/stack-exchange-2021-12-07/u... |
613,779 | unix.stackexchange.com | How to sort a stream of json objects by field value using jq | <p>I'm starting with json that looks like this:</p>
<pre><code>{
"object": "list",
"data": [
{
"id": "in_1HW85aFGUwFHXzvl8wJbW7V7",
"object": "invoice",
"account_country": "US",
"customer_name&... | I'm starting with json that looks like this: ``` { "object": "list", "data": [ { "id": "in_1HW85aFGUwFHXzvl8wJbW7V7", "object": "invoice", "account_country": "US", "customer_name": "clientOne", "date": 1601244686, "livemode": true, "metadata": {}, "paid": true, "status": "paid", "total": 49500 }, { "id": "in_1HJlIZFGUw... | 8 | 7,388 | 1 | 0 | 0 | [
"<json><jq>"
] | 2020-10-09T22:13:26.610 | 2021-02-08T01:10:17.950 | 115,900 | 613,784 | [
{
"id": 613784,
"body": "<p>from <code>man jq </code></p>\n<blockquote>\n<p>sort, sort_by(path_expression)\nThe sort functions sorts its input, which must be an array.</p>\n</blockquote>\n<p>In general and invoking a separate <code>jq</code> command, you have to use <code>-s</code>, <code>--slurp</cod... | from `man jq ` sort, sort_by(path_expression) The sort functions sorts its input, which must be an array. In general and invoking a separate `jq` command, you have to use `-s`, `--slurp` that will make these sequential objects an array, and then you can sort it by a key. ``` ... | jq -s 'sort_by(.date)' ``` Now, if you... | # How to sort a stream of json objects by field value using jq
**Tags:** <json><jq>
**Question (score 8):**
I'm starting with json that looks like this: ``` { "object": "list", "data": [ { "id": "in_1HW85aFGUwFHXzvl8wJbW7V7", "object": "invoice", "account_country": "US", "customer_name": "clientOne", "date": 1601244... | 3,040 | 760 | {
"source": "stackexchange-archive.org",
"license": "CC BY-SA 4.0",
"dump_version": "2021-12-07",
"extraction_date": "2026-07-02T12:57:40Z",
"parser_version": "stackexchange-streaming-v1.0",
"site_name": "unix.stackexchange.com",
"original_7z_url": "https://archive.org/download/stack-exchange-2021-12-07/u... |
613,839 | unix.stackexchange.com | help understanding gpg --list--keys output | <p>when I run <code>gpg --list-keys</code> I get the following output.</p>
<pre><code>/home/yax/.gnupg/pubring.kbx
----------------------------
pub rsa2048 2020-10-09 [SC]
4424C645C99A4C29E540C26AAD7DB850AD9CFFAB
uid [ultimate] yaxley peaks <epiclycoolgaemer@gmail.com>
sub rsa2048 2020-10-09 ... | when I run `gpg --list-keys` I get the following output. ``` /home/yax/.gnupg/pubring.kbx ---------------------------- pub rsa2048 2020-10-09 [SC] 4424C645C99A4C29E540C26AAD7DB850AD9CFFAB uid [ultimate] yaxley peaks sub rsa2048 2020-10-09 [E] ``` what is my actual key in this block of text? How do i get my key id? what... | 5 | 3,915 | 2 | 2 | 0 | [
"<gpg>"
] | 2020-10-10T12:20:53.257 | 2020-10-10T13:12:10.127 | 424,473 | 613,909 | [
{
"id": 613909,
"body": "<blockquote>\n<p>what is my actual key in this block of text?</p>\n</blockquote>\n<p>It's not shown. Since this is, as you (correctly) said, an RSA 2048-bit key, your actual public key (which is what <code>--list-keys</code> shows) in hex would be over 500 characters -- about 7 full... | what is my actual key in this block of text? It's not shown. Since this is, as you (correctly) said, an RSA 2048-bit key, your actual public key (which is what `--list-keys` shows) in hex would be over 500 characters -- about 7 full lines on a typical terminal. Your private key, which for hysterical raisins PGP and GPG... | # help understanding gpg --list--keys output
**Tags:** <gpg>
**Question (score 5):**
when I run `gpg --list-keys` I get the following output. ``` /home/yax/.gnupg/pubring.kbx ---------------------------- pub rsa2048 2020-10-09 [SC] 4424C645C99A4C29E540C26AAD7DB850AD9CFFAB uid [ultimate] yaxley peaks sub rsa2048 2020... | 2,328 | 582 | {
"source": "stackexchange-archive.org",
"license": "CC BY-SA 4.0",
"dump_version": "2021-12-07",
"extraction_date": "2026-07-02T12:57:40Z",
"parser_version": "stackexchange-streaming-v1.0",
"site_name": "unix.stackexchange.com",
"original_7z_url": "https://archive.org/download/stack-exchange-2021-12-07/u... |
613,843 | unix.stackexchange.com | Why are end-of-file and end-of-input-signal treated differently by sha256sum? | <p>I was trying to compute sha256 for a simple string, namely "abc". I found out that using <strong>sha256sum</strong> utility like this:</p>
<pre><code>sha256sum file_with_string
</code></pre>
<p>gives results identical to:</p>
<pre><code>sha256sum # enter, to read input from stdin
abc
^D
</code></pre>
<p>na... | I was trying to compute sha256 for a simple string, namely "abc". I found out that using sha256sum utility like this: ``` sha256sum file_with_string ``` gives results identical to: ``` sha256sum # enter, to read input from stdin abc ^D ``` namely: ``` edeaaff3f1774ad2888673770c6d64097e391bc362d7d6fb34982ddf0efd18cb ```... | 8 | 2,323 | 2 | 12 | 1 | [
"<bash><shell><newlines><hashsum>"
] | 2020-10-10T13:13:45.793 | 2020-10-10T13:25:23.880 | 398,918 | 613,853 | [
{
"id": 613853,
"body": "<p>The difference is the newline. First, let's just collect the sha256sums of <code>abc</code> and <code>abc\\n</code>:</p>\n<pre><code>$ printf 'abc\\n' | sha256sum \nedeaaff3f1774ad2888673770c6d64097e391bc362d7d6fb34982ddf0efd18cb -\n$ printf 'abc' | sha256sum \nba7816bf8f01cfea4... | The difference is the newline. First, let's just collect the sha256sums of `abc` and `abc\n`: ``` $ printf 'abc\n' | sha256sum edeaaff3f1774ad2888673770c6d64097e391bc362d7d6fb34982ddf0efd18cb - $ printf 'abc' | sha256sum ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad - ``` So, the `ba...ad` sum is for... | # Why are end-of-file and end-of-input-signal treated differently by sha256sum?
**Tags:** <bash><shell><newlines><hashsum>
**Question (score 8):**
I was trying to compute sha256 for a simple string, namely "abc". I found out that using sha256sum utility like this: ``` sha256sum file_with_string ``` gives results ide... | 3,649 | 912 | {
"source": "stackexchange-archive.org",
"license": "CC BY-SA 4.0",
"dump_version": "2021-12-07",
"extraction_date": "2026-07-02T12:57:40Z",
"parser_version": "stackexchange-streaming-v1.0",
"site_name": "unix.stackexchange.com",
"original_7z_url": "https://archive.org/download/stack-exchange-2021-12-07/u... |
614,104 | unix.stackexchange.com | How many users can be member of a group in Linux Debian 10 x64? | <p>I know Linux has some limitations for the number of groups a user can be part of. I found out that it is 16 groups for each user, and depends on the Linux kernel. However, is there any restriction for the number of users that can be part of a single group? For example, if I create a "book" group in Debian ... | I know Linux has some limitations for the number of groups a user can be part of. I found out that it is 16 groups for each user, and depends on the Linux kernel. However, is there any restriction for the number of users that can be part of a single group? For example, if I create a "book" group in Debian 10, how many ... | 8 | 1,433 | 1 | 0 | 0 | [
"<debian><linux-kernel><users><group>"
] | 2020-10-12T10:50:06.673 | 2020-10-16T01:34:21.493 | 405,668 | 614,111 | [
{
"id": 614111,
"body": "<p>The 16-group limit isn’t related to the kernel, but to NFS. On Linux, since kernel 2.6.3, processes can have up to 65,536 supplementary groups.</p>\n<p>Going in the other direction, there isn’t any limit on the number of users in a group set by the kernel or the C library, apart ... | The 16-group limit isn’t related to the kernel, but to NFS. On Linux, since kernel 2.6.3, processes can have up to 65,536 supplementary groups. Going in the other direction, there isn’t any limit on the number of users in a group set by the kernel or the C library, apart from the limit imposed by the maximum group iden... | # How many users can be member of a group in Linux Debian 10 x64?
**Tags:** <debian><linux-kernel><users><group>
**Question (score 8):**
I know Linux has some limitations for the number of groups a user can be part of. I found out that it is 16 groups for each user, and depends on the Linux kernel. However, is there... | 1,853 | 463 | {
"source": "stackexchange-archive.org",
"license": "CC BY-SA 4.0",
"dump_version": "2021-12-07",
"extraction_date": "2026-07-02T12:57:40Z",
"parser_version": "stackexchange-streaming-v1.0",
"site_name": "unix.stackexchange.com",
"original_7z_url": "https://archive.org/download/stack-exchange-2021-12-07/u... |
614,154 | unix.stackexchange.com | "Useless" use of 'cat' increases performance. Why? | <p>The files 1..64 are each 160 MBytes and stored in a RAM disk.</p>
<p>Generated by:</p>
<pre><code>seq 120 | parallel -k 'seq {}0000000 {}9999999 | fmt -30' | head -c 10G > 10G
parallel --pipepart --block -1 -a 10G 'cat > {#}'
</code></pre>
<p><code>nocat</code>:</p>
<pre><code>#!/bin/bash
export LC_ALL=C
sort... | The files 1..64 are each 160 MBytes and stored in a RAM disk. Generated by: ``` seq 120 | parallel -k 'seq {}0000000 {}9999999 | fmt -30' | head -c 10G > 10G parallel --pipepart --block -1 -a 10G 'cat > {#}' ``` `nocat`: ``` #!/bin/bash export LC_ALL=C sort -m \ Edit Does `cat` group input in bigger chunks? And/or does... | 8 | 580 | 2 | 9 | 3 | [
"<performance>"
] | 2020-10-12T15:42:10.890 | 2020-10-13T19:41:58.373 | 2,972 | null | [
{
"id": 614200,
"body": "<p>This is by no means a "useless use of cat".</p>\n<pre><code>some_command | cat | some_command\n</code></pre>\n<p>This isn't a traditional "useless use of cat" which are usually derived from ignorance of the shell. Instead this appears to be a deliberate attem... | This is by no means a "useless use of cat". ``` some_command | cat | some_command ``` This isn't a traditional "useless use of cat" which are usually derived from ignorance of the shell. Instead this appears to be a deliberate attempt to do something using the dynamics of cat. In this case I believe it's caching. My Se... | # "Useless" use of 'cat' increases performance. Why?
**Tags:** <performance>
**Question (score 8):**
The files 1..64 are each 160 MBytes and stored in a RAM disk. Generated by: ``` seq 120 | parallel -k 'seq {}0000000 {}9999999 | fmt -30' | head -c 10G > 10G parallel --pipepart --block -1 -a 10G 'cat > {#}' ``` `noc... | 5,738 | 1,434 | {
"source": "stackexchange-archive.org",
"license": "CC BY-SA 4.0",
"dump_version": "2021-12-07",
"extraction_date": "2026-07-02T12:57:40Z",
"parser_version": "stackexchange-streaming-v1.0",
"site_name": "unix.stackexchange.com",
"original_7z_url": "https://archive.org/download/stack-exchange-2021-12-07/u... |
614,329 | unix.stackexchange.com | Does Debian actually have a written policy to start services on installation? | <p>Debian packages usually start services right after installing them. This is a well-known phenomenon, given <a href="https://cowboyprogrammer.org/2016/10/dont-start-service-on-install-of-debian-package/" rel="noreferrer">tens</a> <a href="https://unix.stackexchange.com/questions/484092/prevent-debian-from-auto-enabli... | Debian packages usually start services right after installing them. This is a well-known phenomenon, given tens (https://cowboyprogrammer.org/2016/10/dont-start-service-on-install-of-debian-package/) of (https://unix.stackexchange.com/questions/484092/prevent-debian-from-auto-enabling-systemd-services-at-package-post-i... | 13 | 1,035 | 1 | 0 | 0 | [
"<debian><services>"
] | 2020-10-13T14:47:40.650 | 2020-10-14T07:24:08.063 | 8,088 | 614,330 | [
{
"id": 614330,
"body": "<p>This is addressed in <a href=\"https://www.debian.org/doc/debian-policy/ch-opersys.html#managing-the-links\" rel=\"noreferrer\">the “Managing the links” section of Policy</a>, which described how links to services should be handled:</p>\n<blockquote>\n<p>The default behaviour is ... | This is addressed in the “Managing the links” section of Policy (https://www.debian.org/doc/debian-policy/ch-opersys.html#managing-the-links), which described how links to services should be handled: The default behaviour is to enable autostarting your package’s daemon. Here I’m reading “autostarting” in a wide sense; ... | # Does Debian actually have a written policy to start services on installation?
**Tags:** <debian><services>
**Question (score 13):**
Debian packages usually start services right after installing them. This is a well-known phenomenon, given tens (https://cowboyprogrammer.org/2016/10/dont-start-service-on-install-of-... | 3,320 | 830 | {
"source": "stackexchange-archive.org",
"license": "CC BY-SA 4.0",
"dump_version": "2021-12-07",
"extraction_date": "2026-07-02T12:57:40Z",
"parser_version": "stackexchange-streaming-v1.0",
"site_name": "unix.stackexchange.com",
"original_7z_url": "https://archive.org/download/stack-exchange-2021-12-07/u... |
614,568 | unix.stackexchange.com | Is is possible to export all variables obtained from sourcing a file? | <p>Say I have a file called <code>variables.sh</code> that sets two variables.</p>
<pre><code>foo=bar
bar=foo
</code></pre>
<p>If I <code>source</code> this file I can use these variables in the current shell, but if I want to use it in a second shell script I would have to export them instead, so the file would have t... | Say I have a file called `variables.sh` that sets two variables. ``` foo=bar bar=foo ``` If I `source` this file I can use these variables in the current shell, but if I want to use it in a second shell script I would have to export them instead, so the file would have to look like this: ``` export foo=bar export bar=f... | 6 | 451 | 1 | 1 | 0 | [
"<bash><environment-variables>"
] | 2020-10-14T22:32:52.903 | 2020-10-14T22:57:24.020 | 79,979 | 614,573 | [
{
"id": 614573,
"body": "<blockquote>\n<p>if I want to use it in a second shell script I would have to export them instead, so the file would have to look like this:</p>\n</blockquote>\n<p>You could source the second file, or have it source <code>variables.sh</code>. There are multiple ways to do what you w... | if I want to use it in a second shell script I would have to export them instead, so the file would have to look like this: You could source the second file, or have it source `variables.sh`. There are multiple ways to do what you wask, such as doing an eval over the result of processing the file, but the cleanest way ... | # Is is possible to export all variables obtained from sourcing a file?
**Tags:** <bash><environment-variables>
**Question (score 6):**
Say I have a file called `variables.sh` that sets two variables. ``` foo=bar bar=foo ``` If I `source` this file I can use these variables in the current shell, but if I want to use... | 1,399 | 349 | {
"source": "stackexchange-archive.org",
"license": "CC BY-SA 4.0",
"dump_version": "2021-12-07",
"extraction_date": "2026-07-02T12:57:40Z",
"parser_version": "stackexchange-streaming-v1.0",
"site_name": "unix.stackexchange.com",
"original_7z_url": "https://archive.org/download/stack-exchange-2021-12-07/u... |
614,672 | unix.stackexchange.com | Arithmetic on values with memory size units | <p>Let’s say I have a bunch of numbers representing quantities of memory, written in the form <code>86k</code> or <code>320m</code> or <code>1.7g</code> for instance. How can I compute their sum in command line, and get back a human-readable result?</p>
<p>Being able to compute subtractions would be nice too. The perfe... | Let’s say I have a bunch of numbers representing quantities of memory, written in the form `86k` or `320m` or `1.7g` for instance. How can I compute their sum in command line, and get back a human-readable result? Being able to compute subtractions would be nice too. The perfect tool would handle several sets of notati... | 9 | 517 | 4 | 0 | 2 | [
"<shell><arithmetic>"
] | 2020-10-15T12:42:28.850 | 2020-10-15T16:25:34.333 | 288,527 | 614,690 | [
{
"id": 614690,
"body": "<p>A little self promotion: we wrote a library called <a href=\"https://github.com/storaged-project/libbytesize\" rel=\"noreferrer\">libbytesize</a> to do these calculations in C and Python and it also has a commandline tool called <a href=\"https://storageapis.wordpress.com/2019/08... | A little self promotion: we wrote a library called libbytesize (https://github.com/storaged-project/libbytesize) to do these calculations in C and Python and it also has a commandline tool called bscalc (https://storageapis.wordpress.com/2019/08/04/bscalc-storage-size-calculator/) ``` $ bscalc "5 * (100 GiB + 80 MiB) +... | # Arithmetic on values with memory size units
**Tags:** <shell><arithmetic>
**Question (score 9):**
Let’s say I have a bunch of numbers representing quantities of memory, written in the form `86k` or `320m` or `1.7g` for instance. How can I compute their sum in command line, and get back a human-readable result? Bei... | 9,462 | 2,365 | {
"source": "stackexchange-archive.org",
"license": "CC BY-SA 4.0",
"dump_version": "2021-12-07",
"extraction_date": "2026-07-02T12:57:40Z",
"parser_version": "stackexchange-streaming-v1.0",
"site_name": "unix.stackexchange.com",
"original_7z_url": "https://archive.org/download/stack-exchange-2021-12-07/u... |
614,741 | unix.stackexchange.com | Why does `dd` have `swab` functionality | <p>The manpage for <code>dd</code> notes an option <code>swab</code></p>
<pre><code>swab swap every pair of input bytes
</code></pre>
<p>Why?</p>
<hr />
<p>Don't ask me what I'm trying to do -- I'm not doing anything in particular, I'm just scratching my head. If were going to offer swaps, why not do it for all wor... | The manpage for `dd` notes an option `swab` ``` swab swap every pair of input bytes ``` Why? Don't ask me what I'm trying to do -- I'm not doing anything in particular, I'm just scratching my head. If were going to offer swaps, why not do it for all word sizes? Not that I need that, but if we're just swapping 2 neighbo... | 11 | 1,271 | 1 | 0 | 0 | [
"<dd><history>"
] | 2020-10-15T20:11:45.217 | 2020-10-18T13:49:45.297 | 47,663 | 614,747 | [
{
"id": 614747,
"body": "<p>Because that was its original purpose. In the words of <a href=\"https://en.wikipedia.org/wiki/Douglas_McIlroy\" rel=\"noreferrer\">Douglas McIlroy</a>, who was the head of the team that created Unix, in <a href=\"https://www.cs.dartmouth.edu/%7Edoug/reader.pdf\" rel=\"noreferrer... | Because that was its original purpose. In the words of Douglas McIlroy (https://en.wikipedia.org/wiki/Douglas_McIlroy), who was the head of the team that created Unix, in A Research UNIX Reader: Annotated Excerpts from the Programmer’s Manual, 1971-1986 (https://www.cs.dartmouth.edu/%7Edoug/reader.pdf): DD (v5 page 74)... | # Why does `dd` have `swab` functionality
**Tags:** <dd><history>
**Question (score 11):**
The manpage for `dd` notes an option `swab` ``` swab swap every pair of input bytes ``` Why? Don't ask me what I'm trying to do -- I'm not doing anything in particular, I'm just scratching my head. If were going to offer swaps... | 3,166 | 791 | {
"source": "stackexchange-archive.org",
"license": "CC BY-SA 4.0",
"dump_version": "2021-12-07",
"extraction_date": "2026-07-02T12:57:40Z",
"parser_version": "stackexchange-streaming-v1.0",
"site_name": "unix.stackexchange.com",
"original_7z_url": "https://archive.org/download/stack-exchange-2021-12-07/u... |
614,808 | unix.stackexchange.com | Why is there no mktemp command in POSIX? | <p>One of the most common things shell scripts need to do is to create and manipulate temporary files. Doing so safely is a pain, since you need to avoid name clashes, avoid race conditions, make sure the file has the correct permissions, etc. (See the <a href="https://www.gnu.org/software/coreutils/manual/html_node/... | One of the most common things shell scripts need to do is to create and manipulate temporary files. Doing so safely is a pain, since you need to avoid name clashes, avoid race conditions, make sure the file has the correct permissions, etc. (See the GNU Coreutils manual (https://www.gnu.org/software/coreutils/manual/ht... | 18 | 1,454 | 2 | 3 | 2 | [
"<shell-script><posix><mktemp>"
] | 2020-10-16T09:17:35.363 | 2020-10-16T09:22:46.917 | 37,849 | null | [
{
"id": 614823,
"body": "<p>That comes up regularly on the Austin Group mailing list, and I'm not under the impression the Open Group would be opposed to specifying it. It just needs someone to propose something. See for instance this message from Eric Blake (Red Hat, sits on the weekly POSIX meeting) from ... | That comes up regularly on the Austin Group mailing list, and I'm not under the impression the Open Group would be opposed to specifying it. It just needs someone to propose something. See for instance this message from Eric Blake (Red Hat, sits on the weekly POSIX meeting) from 2011 (here copied from gmane): ``` Date:... | # Why is there no mktemp command in POSIX?
**Tags:** <shell-script><posix><mktemp>
**Question (score 18):**
One of the most common things shell scripts need to do is to create and manipulate temporary files. Doing so safely is a pain, since you need to avoid name clashes, avoid race conditions, make sure the file ha... | 6,574 | 1,643 | {
"source": "stackexchange-archive.org",
"license": "CC BY-SA 4.0",
"dump_version": "2021-12-07",
"extraction_date": "2026-07-02T12:57:40Z",
"parser_version": "stackexchange-streaming-v1.0",
"site_name": "unix.stackexchange.com",
"original_7z_url": "https://archive.org/download/stack-exchange-2021-12-07/u... |
614,936 | unix.stackexchange.com | Press SPACE to continue (not ENTER) | <p>I know this question has been already asked & answered, but the solution I found listens for space <strong>and enter</strong>:</p>
<pre class="lang-bsh prettyprint-override"><code>while [ "$key" != '' ]; do
read -n1 -s -r key
done
</code></pre>
<p>Is there a way (in <strong>bash</strong>) to ma... | I know this question has been already asked & answered, but the solution I found listens for space and enter: ``` while [ "$key" != '' ]; do read -n1 -s -r key done ``` Is there a way (in bash) to make a script that will wait only for the space bar? | 9 | 1,329 | 1 | 1 | 1 | [
"<bash><shell-script><read><wait>"
] | 2020-10-17T07:03:01.227 | 2020-10-17T07:17:49.587 | 420,387 | 614,937 | [
{
"id": 614937,
"body": "<p>I suggest to use only <code>read -d ' ' key</code>.</p>\n<blockquote>\n<p><code>-d delim</code>: continue until the first character of DELIM is read, rather\nthan newline</p>\n</blockquote>\n<hr />\n<p>See: <code>help read</code></p>\n",
"body_md": "I suggest to use only `r... | I suggest to use only `read -d ' ' key`. `-d delim`: continue until the first character of DELIM is read, rather than newline See: `help read` | # Press SPACE to continue (not ENTER)
**Tags:** <bash><shell-script><read><wait>
**Question (score 9):**
I know this question has been already asked & answered, but the solution I found listens for space and enter: ``` while [ "$key" != '' ]; do read -n1 -s -r key done ``` Is there a way (in bash) to make a script t... | 534 | 133 | {
"source": "stackexchange-archive.org",
"license": "CC BY-SA 4.0",
"dump_version": "2021-12-07",
"extraction_date": "2026-07-02T12:57:40Z",
"parser_version": "stackexchange-streaming-v1.0",
"site_name": "unix.stackexchange.com",
"original_7z_url": "https://archive.org/download/stack-exchange-2021-12-07/u... |
614,950 | unix.stackexchange.com | Python programs suddenly get killed | <p>I'm running some python programs that are quite heavy. I've been running this script for several weeks now, but in the past couple of days, the program gets killed with the message:</p>
<pre><code>Killed
</code></pre>
<p>I tried <a href="https://askubuntu.com/questions/1075505/how-do-i-increase-swapfile-in-ubuntu-18... | I'm running some python programs that are quite heavy. I've been running this script for several weeks now, but in the past couple of days, the program gets killed with the message: ``` Killed ``` I tried creating a new swap file (https://askubuntu.com/questions/1075505/how-do-i-increase-swapfile-in-ubuntu-18-04) with ... | 10 | 11,370 | 3 | 2 | 0 | [
"<python><ram><out-of-memory><memory-leaks>"
] | 2020-10-17T11:32:50.640 | 2020-10-17T11:47:49.580 | 398,409 | null | [
{
"id": 614954,
"body": "<p>There's nothing to be done here, I'm afraid. The process is being killed by the OOM killer (Out Of Memory Killer), which is a process of the operating system, whose job it is to kill jobs that are taking up too much memory before they crash your machine. This is a good thing. Wit... | There's nothing to be done here, I'm afraid. The process is being killed by the OOM killer (Out Of Memory Killer), which is a process of the operating system, whose job it is to kill jobs that are taking up too much memory before they crash your machine. This is a good thing. Without it, your machine would simply becom... | # Python programs suddenly get killed
**Tags:** <python><ram><out-of-memory><memory-leaks>
**Question (score 10):**
I'm running some python programs that are quite heavy. I've been running this script for several weeks now, but in the past couple of days, the program gets killed with the message: ``` Killed ``` I tr... | 2,007 | 501 | {
"source": "stackexchange-archive.org",
"license": "CC BY-SA 4.0",
"dump_version": "2021-12-07",
"extraction_date": "2026-07-02T12:57:40Z",
"parser_version": "stackexchange-streaming-v1.0",
"site_name": "unix.stackexchange.com",
"original_7z_url": "https://archive.org/download/stack-exchange-2021-12-07/u... |
615,012 | unix.stackexchange.com | How is allowing login for a sudo group member safer than allowing root login? | <p>I recently read that it's a good idea to disable root login, e.g. by setting the root user's shell to /sbin/nologin instead of /bin/bash, and to use a non-root user with sudo rights.</p>
<p>I did this now on a server of mine where logs were showing a large amount of login attempts. So instead of root, I now login as... | I recently read that it's a good idea to disable root login, e.g. by setting the root user's shell to /sbin/nologin instead of /bin/bash, and to use a non-root user with sudo rights. I did this now on a server of mine where logs were showing a large amount of login attempts. So instead of root, I now login as a non-roo... | 17 | 2,322 | 7 | 3 | 4 | [
"<sudo><root><non-root-user>"
] | 2020-10-17T18:52:42.333 | 2020-10-20T11:16:30.033 | 437,784 | 615,043 | [
{
"id": 615043,
"body": "<p><code>sudo</code> improves safety/security by providing <em>accountability</em>, and <em>privilege separation</em>.</p>\n<p>Imagine a system that has more than one person performing administrative tasks. If a <code>root</code> login account is enabled, the system will have no rec... | `sudo` improves safety/security by providing accountability, and privilege separation. Imagine a system that has more than one person performing administrative tasks. If a `root` login account is enabled, the system will have no record/log of which person performed a particular action. This is because the logs will onl... | # How is allowing login for a sudo group member safer than allowing root login?
**Tags:** <sudo><root><non-root-user>
**Question (score 17):**
I recently read that it's a good idea to disable root login, e.g. by setting the root user's shell to /sbin/nologin instead of /bin/bash, and to use a non-root user with sudo... | 5,108 | 1,277 | {
"source": "stackexchange-archive.org",
"license": "CC BY-SA 4.0",
"dump_version": "2021-12-07",
"extraction_date": "2026-07-02T12:57:40Z",
"parser_version": "stackexchange-streaming-v1.0",
"site_name": "unix.stackexchange.com",
"original_7z_url": "https://archive.org/download/stack-exchange-2021-12-07/u... |
615,026 | unix.stackexchange.com | What does the recommendation to use `set` for setting shell options in Google's Shell Style Guide mean? | <p><a href="https://google.github.io/styleguide/shellguide.html#which-shell-to-use" rel="noreferrer">From Google's Shell Style Guide</a>:</p>
<blockquote>
<p>Bash is the only shell scripting language permitted for executables.</p>
<p>Executables must start with <code>#!/bin/bash</code> and a minimum number of flags. Us... | From Google's Shell Style Guide (https://google.github.io/styleguide/shellguide.html#which-shell-to-use): Bash is the only shell scripting language permitted for executables. Executables must start with `#!/bin/bash` and a minimum number of flags. Use `set` to set shell options so that calling your script as `bash scri... | 12 | 1,100 | 1 | 2 | 2 | [
"<bash><shell-script>"
] | 2020-10-17T20:25:22.310 | 2020-10-18T09:04:16.167 | 186,666 | 615,027 | [
{
"id": 615027,
"body": "<p>The "and a minimum number of flags" refers to flags set in the hashbang line. They'd be read when the script is started as <code>./somescript</code>, and the kernel reads the hashbang line, building a new argument list from the path and options found there. But this doe... | The "and a minimum number of flags" refers to flags set in the hashbang line. They'd be read when the script is started as `./somescript`, and the kernel reads the hashbang line, building a new argument list from the path and options found there. But this does not happen if the script is started as `bash somescript`, a... | # What does the recommendation to use `set` for setting shell options in Google's Shell Style Guide mean?
**Tags:** <bash><shell-script>
**Question (score 12):**
From Google's Shell Style Guide (https://google.github.io/styleguide/shellguide.html#which-shell-to-use): Bash is the only shell scripting language permitt... | 1,705 | 426 | {
"source": "stackexchange-archive.org",
"license": "CC BY-SA 4.0",
"dump_version": "2021-12-07",
"extraction_date": "2026-07-02T12:57:40Z",
"parser_version": "stackexchange-streaming-v1.0",
"site_name": "unix.stackexchange.com",
"original_7z_url": "https://archive.org/download/stack-exchange-2021-12-07/u... |
615,263 | unix.stackexchange.com | cannot run in framebuffer mode. Please specify busIDs | <p>from my previous question <a href="https://unix.stackexchange.com/questions/615080/empty-screen-after-booting-from-live-persistent-usb?noredirect=1#comment1150102_615080">empty screen after booting from live persistent usb</a>, I am able after boot to access all files and folders, but the X-server is unable to load ... | from my previous question empty screen after booting from live persistent usb (https://unix.stackexchange.com/questions/615080/empty-screen-after-booting-from-live-persistent-usb?noredirect=1#comment1150102_615080), I am able after boot to access all files and folders, but the X-server is unable to load (so I get only ... | 5 | 4,541 | 2 | 0 | 0 | [
"<boot><live-usb><x-server><framebuffer>"
] | 2020-10-19T14:53:42.643 | 2021-06-24T06:29:21.380 | 419,132 | null | [
{
"id": 629555,
"body": "<p>I also faced this problem and solved it by installing a more recent kernel from backports. You can create a new file containing the line <code>deb http://deb.debian.org/debian/ buster-backports main contrib non-free</code> in <code>/etc/apt/sources.list.d/</code> for enabling bac... | I also faced this problem and solved it by installing a more recent kernel from backports. You can create a new file containing the line `deb http://deb.debian.org/debian/ buster-backports main contrib non-free` in `/etc/apt/sources.list.d/` for enabling backports in `apt` if you are using Debian Buster. The `contrib` ... | # cannot run in framebuffer mode. Please specify busIDs
**Tags:** <boot><live-usb><x-server><framebuffer>
**Question (score 5):**
from my previous question empty screen after booting from live persistent usb (https://unix.stackexchange.com/questions/615080/empty-screen-after-booting-from-live-persistent-usb?noredire... | 1,734 | 433 | {
"source": "stackexchange-archive.org",
"license": "CC BY-SA 4.0",
"dump_version": "2021-12-07",
"extraction_date": "2026-07-02T12:57:40Z",
"parser_version": "stackexchange-streaming-v1.0",
"site_name": "unix.stackexchange.com",
"original_7z_url": "https://archive.org/download/stack-exchange-2021-12-07/u... |
615,419 | unix.stackexchange.com | Are compiled shell scripts better for performance? | <p>After some googling, I found a way to compile BASH scripts to binary executables (using <code>shc</code>).</p>
<p>I know that shell is an interpreted language, but what does this compiler do? Will it improve the performance of my script in any way?</p>
| After some googling, I found a way to compile BASH scripts to binary executables (using `shc`). I know that shell is an interpreted language, but what does this compiler do? Will it improve the performance of my script in any way? | 21 | 3,828 | 3 | 4 | 2 | [
"<shell><compiling><performance><compiler>"
] | 2020-10-20T08:00:59.177 | 2020-10-21T20:47:33.593 | 420,387 | 615,424 | [
{
"id": 615424,
"body": "<p>To answer the question in your title, compiled shell scripts could be better for performance — if the result of the compilation represented the result of the interpretation, without having to re-interpret the commands in the script over and over. See for instance <a href=\"https:... | To answer the question in your title, compiled shell scripts could be better for performance — if the result of the compilation represented the result of the interpretation, without having to re-interpret the commands in the script over and over. See for instance `ksh93`'s `shcomp` (https://manpages.debian.org/unstable... | # Are compiled shell scripts better for performance?
**Tags:** <shell><compiling><performance><compiler>
**Question (score 21):**
After some googling, I found a way to compile BASH scripts to binary executables (using `shc`). I know that shell is an interpreted language, but what does this compiler do? Will it impro... | 3,093 | 773 | {
"source": "stackexchange-archive.org",
"license": "CC BY-SA 4.0",
"dump_version": "2021-12-07",
"extraction_date": "2026-07-02T12:57:40Z",
"parser_version": "stackexchange-streaming-v1.0",
"site_name": "unix.stackexchange.com",
"original_7z_url": "https://archive.org/download/stack-exchange-2021-12-07/u... |
615,485 | unix.stackexchange.com | Is there a command to write text to a file without redirection, pipe or function? | <p>Pipes and redirection are two of the most powerful functions in Linux, and I love them.</p>
<p>However, I'm stuck with a situation where I need to write a fixed piece of text to a file without using a pipe, redirection or a function.</p>
<p>I'm using Bash in case that makes a difference.</p>
<h2>First: Why?</h2>
<p>... | Pipes and redirection are two of the most powerful functions in Linux, and I love them. However, I'm stuck with a situation where I need to write a fixed piece of text to a file without using a pipe, redirection or a function. I'm using Bash in case that makes a difference. ## First: Why? I'll explain why, in case ther... | 16 | 2,263 | 4 | 9 | 2 | [
"<shell-script><quoting><yad>"
] | 2020-10-20T13:39:54.210 | 2020-10-20T15:16:57.537 | 41,226 | 615,501 | [
{
"id": 615501,
"body": "<p>This is a bit of an <a href=\"https://en.wikipedia.org/wiki/XY_problem\" rel=\"noreferrer\">XY problem</a> but fortunately you've explained your real problem so it's possible to give a meaningful answer.</p>\n<p>Sure, there are commands that can write text to a file without relyi... | This is a bit of an XY problem (https://en.wikipedia.org/wiki/XY_problem) but fortunately you've explained your real problem so it's possible to give a meaningful answer. Sure, there are commands that can write text to a file without relying on their environment to open the file. For example, `sh` can do that: pass it ... | # Is there a command to write text to a file without redirection, pipe or function?
**Tags:** <shell-script><quoting><yad>
**Question (score 16):**
Pipes and redirection are two of the most powerful functions in Linux, and I love them. However, I'm stuck with a situation where I need to write a fixed piece of text t... | 6,215 | 1,553 | {
"source": "stackexchange-archive.org",
"license": "CC BY-SA 4.0",
"dump_version": "2021-12-07",
"extraction_date": "2026-07-02T12:57:40Z",
"parser_version": "stackexchange-streaming-v1.0",
"site_name": "unix.stackexchange.com",
"original_7z_url": "https://archive.org/download/stack-exchange-2021-12-07/u... |
615,494 | unix.stackexchange.com | How to expand IP Address in dash format? | <p>Sample data</p>
<pre><code>10.1.1.1-10.1.1.3
10.100.100.11-10.100.100.15
</code></pre>
<p>Is there any available trick in Linux to expand this ip to the following format?</p>
<pre><code>10.1.1.1
10.1.1.2
10.1.1.3
10.100.100.11
10.100.100.12
10.100.100.13
10.100.100.14
10.100.100.15
</code></pre>
<p>I know there are... | Sample data ``` 10.1.1.1-10.1.1.3 10.100.100.11-10.100.100.15 ``` Is there any available trick in Linux to expand this ip to the following format? ``` 10.1.1.1 10.1.1.2 10.1.1.3 10.100.100.11 10.100.100.12 10.100.100.13 10.100.100.14 10.100.100.15 ``` I know there are online tools such as https://techzoom.net/lab/ip-ad... | 5 | 569 | 3 | 5 | 0 | [
"<shell-script>"
] | 2020-10-20T14:57:50.373 | 2020-10-20T15:58:15.047 | 409,008 | null | [
{
"id": 615513,
"body": "<p>With <code>perl</code>s <code>Net::IP</code> module (<code>libnet-ip-perl</code> package in Debian based systems):</p>\n<pre><code>perl -MNet::IP -lne '\n print $an_empty_line unless $. == 1;\n my $ip = Net::IP->new($_);\n do {print $ip->ip} while (++$ip)' < file-with... | With `perl`s `Net::IP` module (`libnet-ip-perl` package in Debian based systems): ``` perl -MNet::IP -lne ' print $an_empty_line unless $. == 1; my $ip = Net::IP->new($_); do {print $ip->ip} while (++$ip)' < file-with-ip-ranges ``` | # How to expand IP Address in dash format?
**Tags:** <shell-script>
**Question (score 5):**
Sample data ``` 10.1.1.1-10.1.1.3 10.100.100.11-10.100.100.15 ``` Is there any available trick in Linux to expand this ip to the following format? ``` 10.1.1.1 10.1.1.2 10.1.1.3 10.100.100.11 10.100.100.12 10.100.100.13 10.10... | 1,399 | 349 | {
"source": "stackexchange-archive.org",
"license": "CC BY-SA 4.0",
"dump_version": "2021-12-07",
"extraction_date": "2026-07-02T12:57:40Z",
"parser_version": "stackexchange-streaming-v1.0",
"site_name": "unix.stackexchange.com",
"original_7z_url": "https://archive.org/download/stack-exchange-2021-12-07/u... |
615,505 | unix.stackexchange.com | Convert "10.1.1.1-10.1.1.3" format to "10.1.1.1-3" | <p>I know this is possible, probably by using <code>awk</code>, but I can't think the solution for now.</p>
<p>How do I convert IP format from</p>
<pre class="lang-none prettyprint-override"><code>10.1.1.1-10.1.1.3
10.100.100.11-10.100.100.31
</code></pre>
<p>to</p>
<pre class="lang-none prettyprint-override"><code>10.... | I know this is possible, probably by using `awk`, but I can't think the solution for now. How do I convert IP format from ``` 10.1.1.1-10.1.1.3 10.100.100.11-10.100.100.31 ``` to ``` 10.1.1.1-3 10.100.100.11-31 ``` Here is my attempt with `cut`, but didn't really work as expected. ``` wolf@linux:~$ echo 10.1.1.1-10.1.1... | 5 | 542 | 5 | 1 | 0 | [
"<text-processing><awk><cut>"
] | 2020-10-20T15:39:36.987 | 2020-10-20T15:40:46.170 | 409,008 | null | [
{
"id": 615508,
"body": "<p>Here’s a generic solution using AWK, adapting to the number of common components:</p>\n<pre class=\"lang-c prettyprint-override\"><code>BEGIN {\n FS = "-"\n}\n\nNF == 2 {\n split($1, start, /\\./)\n split($2, end, /\\./)\n printf $1\n for (i = 1; i <= ... | Here’s a generic solution using AWK, adapting to the number of common components: ``` BEGIN { FS = "-" } NF == 2 { split($1, start, /\./) split($2, end, /\./) printf $1 for (i = 1; i i ? "." : "-"), end[j] print "" next } } print "" } ``` This will also handle cases like `1.2.3.4-1.2.5.6`, printing the correct range: `... | # Convert "10.1.1.1-10.1.1.3" format to "10.1.1.1-3"
**Tags:** <text-processing><awk><cut>
**Question (score 5):**
I know this is possible, probably by using `awk`, but I can't think the solution for now. How do I convert IP format from ``` 10.1.1.1-10.1.1.3 10.100.100.11-10.100.100.31 ``` to ``` 10.1.1.1-3 10.100.1... | 1,711 | 427 | {
"source": "stackexchange-archive.org",
"license": "CC BY-SA 4.0",
"dump_version": "2021-12-07",
"extraction_date": "2026-07-02T12:57:40Z",
"parser_version": "stackexchange-streaming-v1.0",
"site_name": "unix.stackexchange.com",
"original_7z_url": "https://archive.org/download/stack-exchange-2021-12-07/u... |
615,525 | unix.stackexchange.com | When moving files between two external drives, are they temporarily written to the internal hdd of the computer? | <p>While moving a big chunk of data between two external USB drives, I notice my laptop is slowed down. It was my understanding that the files are not written to any intermediate location (such as /tmp or similar) unless there is a shortage of free RAM. Am I wrong?</p>
| While moving a big chunk of data between two external USB drives, I notice my laptop is slowed down. It was my understanding that the files are not written to any intermediate location (such as /tmp or similar) unless there is a shortage of free RAM. Am I wrong? | 9 | 1,382 | 3 | 2 | 0 | [
"<performance><file-copy><mv>"
] | 2020-10-20T17:16:31.190 | 2020-10-21T20:05:49.253 | 104,233 | 615,528 | [
{
"id": 615528,
"body": "<p>If you have a copy such as this, or its GUI equivalent,</p>\n<pre><code>cp -a /media/external/disk1/. /media/external/disk2/\n</code></pre>\n<p>the data is read from the first disk's filesystem and written directly to the second. There is no intermediate write to another storage ... | If you have a copy such as this, or its GUI equivalent, ``` cp -a /media/external/disk1/. /media/external/disk2/ ``` the data is read from the first disk's filesystem and written directly to the second. There is no intermediate write to another storage location. If you are seeing slow speeds it may be that the two disk... | # When moving files between two external drives, are they temporarily written to the internal hdd of the computer?
**Tags:** <performance><file-copy><mv>
**Question (score 9):**
While moving a big chunk of data between two external USB drives, I notice my laptop is slowed down. It was my understanding that the files... | 1,384 | 346 | {
"source": "stackexchange-archive.org",
"license": "CC BY-SA 4.0",
"dump_version": "2021-12-07",
"extraction_date": "2026-07-02T12:57:40Z",
"parser_version": "stackexchange-streaming-v1.0",
"site_name": "unix.stackexchange.com",
"original_7z_url": "https://archive.org/download/stack-exchange-2021-12-07/u... |
615,661 | unix.stackexchange.com | find -exec: add arguments between {} and + | <p>I want to use find to locate files, then copy those to a directory, so I tried:</p>
<pre class="lang-bsh prettyprint-override"><code>find . -name '*.png' -exec cp {} /tmp/dest +
</code></pre>
<p>However, this fails with</p>
<pre><code>find: missing argument to `-exec'
</code></pre>
<p>When I replace the <code>+</cod... | I want to use find to locate files, then copy those to a directory, so I tried: ``` find . -name '*.png' -exec cp {} /tmp/dest + ``` However, this fails with ``` find: missing argument to `-exec' ``` When I replace the `+` by a `;` it works, but invokes cp for every file individually. How can I add a trailing argument ... | 8 | 342 | 1 | 8 | 0 | [
"<find><arguments>"
] | 2020-10-21T12:15:54.360 | 2020-10-22T08:18:34.023 | 15,654 | 615,662 | [
{
"id": 615662,
"body": "<p>No, if you're using <code>-exec ... {} +</code>, there may be nothing between <code>{}</code> and <code>+</code> apart from whitespace. There is no way around that.</p>\n<p>From the POSIX standard specification of <a href=\"https://pubs.opengroup.org/onlinepubs/9699919799/utiliti... | No, if you're using `-exec ... {} +`, there may be nothing between `{}` and `+` apart from whitespace. There is no way around that. From the POSIX standard specification of the `find` command (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/find.html): `-exec utility_name [argument ...] ;` `-exec utility_nam... | # find -exec: add arguments between {} and +
**Tags:** <find><arguments>
**Question (score 8):**
I want to use find to locate files, then copy those to a directory, so I tried: ``` find . -name '*.png' -exec cp {} /tmp/dest + ``` However, this fails with ``` find: missing argument to `-exec' ``` When I replace the `... | 2,852 | 713 | {
"source": "stackexchange-archive.org",
"license": "CC BY-SA 4.0",
"dump_version": "2021-12-07",
"extraction_date": "2026-07-02T12:57:40Z",
"parser_version": "stackexchange-streaming-v1.0",
"site_name": "unix.stackexchange.com",
"original_7z_url": "https://archive.org/download/stack-exchange-2021-12-07/u... |
615,676 | unix.stackexchange.com | 0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded. How can I upgrade that 1 package, or at least know which is? | <p>I have tried many different solutions found around this and other websites, such as</p>
<pre><code>sudo apt update && sudo apt upgrade
sudo apt list --upgradeable
sudo apt full-upgrade
sudo apt dist-upgrade
</code></pre>
<p>and no information nor update of the package is displayed. I also tried</p>
<pre><co... | I have tried many different solutions found around this and other websites, such as ``` sudo apt update && sudo apt upgrade sudo apt list --upgradeable sudo apt full-upgrade sudo apt dist-upgrade ``` and no information nor update of the package is displayed. I also tried ``` aptitude update ``` and checked the log and ... | 5 | 11,711 | 3 | 0 | 1 | [
"<linux-mint><apt><package-management><synaptic>"
] | 2020-10-21T13:33:21.867 | 2020-10-21T15:05:11.723 | 438,349 | 615,681 | [
{
"id": 615681,
"body": "<p><code>apt upgrade</code> will tell you what it would like to do, including package upgrades; and this will include a list of packages it won’t upgrade:</p>\n<pre><code>$ sudo apt upgrade -o APT::Get::Show-Upgraded=true\nThe following packages were automatically installed and are ... | `apt upgrade` will tell you what it would like to do, including package upgrades; and this will include a list of packages it won’t upgrade: ``` $ sudo apt upgrade -o APT::Get::Show-Upgraded=true The following packages were automatically installed and are no longer required: [any packages which could be auto-removed] U... | # 0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded. How can I upgrade that 1 package, or at least know which is?
**Tags:** <linux-mint><apt><package-management><synaptic>
**Question (score 5):**
I have tried many different solutions found around this and other websites, such as ``` sudo apt update && su... | 3,177 | 794 | {
"source": "stackexchange-archive.org",
"license": "CC BY-SA 4.0",
"dump_version": "2021-12-07",
"extraction_date": "2026-07-02T12:57:40Z",
"parser_version": "stackexchange-streaming-v1.0",
"site_name": "unix.stackexchange.com",
"original_7z_url": "https://archive.org/download/stack-exchange-2021-12-07/u... |
615,779 | unix.stackexchange.com | sort directories by last modified content (recursive) | <p>I have a bunch of directories at the same level and would like to sort them according to the last modified date of the content (recursive) inside them.
However, in nautilus, it looks like the directories' "last modified date" are only updated if new files are created inside.</p>
<p>Is there anyway to show ... | I have a bunch of directories at the same level and would like to sort them according to the last modified date of the content (recursive) inside them. However, in nautilus, it looks like the directories' "last modified date" are only updated if new files are created inside. Is there anyway to show the recursive "last ... | 6 | 615 | 2 | 2 | 0 | [
"<bash><directory><timestamps><nautilus>"
] | 2020-10-22T01:40:01.237 | 2020-10-23T14:45:02.227 | 319,441 | 615,791 | [
{
"id": 615791,
"body": "<p>The last modification time of a directory (think like <em>phone directory</em>, not <em>folder</em>) is the time it was last modified, like when an entry was removed, added or edited in that directory.</p>\n<p>To find out the newest regular file recursively in it, you would need ... | The last modification time of a directory (think like phone directory, not folder) is the time it was last modified, like when an entry was removed, added or edited in that directory. To find out the newest regular file recursively in it, you would need to read the contents of that directory and every directory within ... | # sort directories by last modified content (recursive)
**Tags:** <bash><directory><timestamps><nautilus>
**Question (score 6):**
I have a bunch of directories at the same level and would like to sort them according to the last modified date of the content (recursive) inside them. However, in nautilus, it looks like... | 5,993 | 1,498 | {
"source": "stackexchange-archive.org",
"license": "CC BY-SA 4.0",
"dump_version": "2021-12-07",
"extraction_date": "2026-07-02T12:57:40Z",
"parser_version": "stackexchange-streaming-v1.0",
"site_name": "unix.stackexchange.com",
"original_7z_url": "https://archive.org/download/stack-exchange-2021-12-07/u... |
615,928 | unix.stackexchange.com | Replace all characters except the first four characters | <p>I want to pipe in a command to sed like so:</p>
<pre><code>md5sum input.txt | sed 's/^\(....\).*/\1/;q'
</code></pre>
<p>This works by only outputting the first 4 characters of the checksum. However, I want to output the first 4 characters, but also have an x in the place of every other characters (redacting info). ... | I want to pipe in a command to sed like so: ``` md5sum input.txt | sed 's/^\(....\).*/\1/;q' ``` This works by only outputting the first 4 characters of the checksum. However, I want to output the first 4 characters, but also have an x in the place of every other characters (redacting info). I'm so lost now. | 5 | 874 | 7 | 1 | 1 | [
"<linux><text-processing><sed>"
] | 2020-10-23T00:49:58.540 | 2020-10-23T06:58:01.913 | 438,584 | 615,930 | [
{
"id": 615930,
"body": "<p>With GNU Sed,</p>\n<pre><code>md5sum input.txt | sed 's/./x/5g'\n</code></pre>\n<p>This simply skips substituting the 4 first characters of the string and performs the substitution for all other characters.</p>\n<p>A POSIX alternative with Awk (although there is probably somethin... | With GNU Sed, ``` md5sum input.txt | sed 's/./x/5g' ``` This simply skips substituting the 4 first characters of the string and performs the substitution for all other characters. A POSIX alternative with Awk (although there is probably something simpler), ``` md5sum xad | awk '{ four=substr($0, 1, 4) rest=substr($0, 5... | # Replace all characters except the first four characters
**Tags:** <linux><text-processing><sed>
**Question (score 5):**
I want to pipe in a command to sed like so: ``` md5sum input.txt | sed 's/^\(....\).*/\1/;q' ``` This works by only outputting the first 4 characters of the checksum. However, I want to output th... | 1,946 | 486 | {
"source": "stackexchange-archive.org",
"license": "CC BY-SA 4.0",
"dump_version": "2021-12-07",
"extraction_date": "2026-07-02T12:57:40Z",
"parser_version": "stackexchange-streaming-v1.0",
"site_name": "unix.stackexchange.com",
"original_7z_url": "https://archive.org/download/stack-exchange-2021-12-07/u... |
615,967 | unix.stackexchange.com | "tail -s N" does not sleep for N seconds before updating | <p>The manual for GNU <code>tail</code> says</p>
<blockquote>
<p><code>-s</code>, <code>--sleep-interval=N</code></p>
<p>with <code>-f</code>, sleep for approximately <code>N</code> seconds (default <code>1.0</code>) between iterations; with <code>inotify</code> and <code>--pid=P</code>, check process <code>P</code> at... | The manual for GNU `tail` says `-s`, `--sleep-interval=N` with `-f`, sleep for approximately `N` seconds (default `1.0`) between iterations; with `inotify` and `--pid=P`, check process `P` at least once every `N` seconds But when I write `tail --sleep-interval=10 -F file_name` it does not sleep for 10 seconds, it updat... | 5 | 445 | 1 | 1 | 1 | [
"<tail>"
] | 2020-10-23T07:41:42.410 | 2020-10-23T07:46:35.833 | 423,900 | 615,970 | [
{
"id": 615970,
"body": "<p><a href=\"https://www.gnu.org/software/coreutils/manual/html_node/tail-invocation.html\" rel=\"noreferrer\">The full manual</a> describes <code>-s</code> as</p>\n<blockquote>\n<p>Change the number of seconds to wait between iterations (the default is 1.0). During one iteration, e... | The full manual (https://www.gnu.org/software/coreutils/manual/html_node/tail-invocation.html) describes `-s` as Change the number of seconds to wait between iterations (the default is 1.0). During one iteration, every specified file is checked to see if it has changed size. When `tail` uses inotify, this polling-relat... | # "tail -s N" does not sleep for N seconds before updating
**Tags:** <tail>
**Question (score 5):**
The manual for GNU `tail` says `-s`, `--sleep-interval=N` with `-f`, sleep for approximately `N` seconds (default `1.0`) between iterations; with `inotify` and `--pid=P`, check process `P` at least once every `N` seco... | 1,825 | 456 | {
"source": "stackexchange-archive.org",
"license": "CC BY-SA 4.0",
"dump_version": "2021-12-07",
"extraction_date": "2026-07-02T12:57:40Z",
"parser_version": "stackexchange-streaming-v1.0",
"site_name": "unix.stackexchange.com",
"original_7z_url": "https://archive.org/download/stack-exchange-2021-12-07/u... |
616,157 | unix.stackexchange.com | iproute2: How to display the TYPE of a network devices? | <p>With <a href="https://en.wikipedia.org/wiki/Iproute2" rel="nofollow noreferrer">iproute2</a> userspace tools one can display the network devices using the <a href="https://linux.die.net/man/8/ip" rel="nofollow noreferrer">ip</a> commands verb <code>link show</code>( sometimes shortened to <code>l sh</code> ).</p>
<p... | With iproute2 (https://en.wikipedia.org/wiki/Iproute2) userspace tools one can display the network devices using the ip (https://linux.die.net/man/8/ip) commands verb `link show`( sometimes shortened to `l sh` ). The output generate does not display the TYPE of link/interface device. ``` root@box:/# ip link show 1: lo:... | 7 | 497 | 2 | 0 | 0 | [
"<iproute>"
] | 2020-10-24T07:59:51.143 | 2020-10-24T16:34:41.060 | 383,594 | 616,162 | [
{
"id": 616162,
"body": "<p>The interface type information, being rarely used, is normally <em>displayed</em> only by adding the <a href=\"https://manpages.debian.org/iproute2/ip.8\" rel=\"noreferrer\"><code>-details</code></a> option to <a href=\"https://manpages.debian.org/iproute2/ip.8\" rel=\"noreferrer... | The interface type information, being rarely used, is normally displayed only by adding the `-details` (https://manpages.debian.org/iproute2/ip.8) option to `ip` (https://manpages.debian.org/iproute2/ip.8): `-d`, `-details` Output more detailed information. So `ip -details link show` would display this information for ... | # iproute2: How to display the TYPE of a network devices?
**Tags:** <iproute>
**Question (score 7):**
With iproute2 (https://en.wikipedia.org/wiki/Iproute2) userspace tools one can display the network devices using the ip (https://linux.die.net/man/8/ip) commands verb `link show`( sometimes shortened to `l sh` ). Th... | 5,693 | 1,423 | {
"source": "stackexchange-archive.org",
"license": "CC BY-SA 4.0",
"dump_version": "2021-12-07",
"extraction_date": "2026-07-02T12:57:40Z",
"parser_version": "stackexchange-streaming-v1.0",
"site_name": "unix.stackexchange.com",
"original_7z_url": "https://archive.org/download/stack-exchange-2021-12-07/u... |
616,286 | unix.stackexchange.com | How to add a specific character after every one character? | <p>I have a number -> 12345</p>
<p>I want output in below format</p>
<pre><code>1+2+3+4+5
</code></pre>
<hr />
<pre><code>echo `cat fl.txt | paste -s -d ''`
</code></pre>
<p>gives only <code>12345</code>.</p>
<p>But when I add this + at the below command it gives same <code>12345</code>.</p>
<pre><code>echo `cat fl.... | I have a number -> 12345 I want output in below format ``` 1+2+3+4+5 ``` ``` echo `cat fl.txt | paste -s -d ''` ``` gives only `12345`. But when I add this + at the below command it gives same `12345`. ``` echo `cat fl.txt | paste -s -d '' | tr -s '' '+'` ``` | 6 | 1,107 | 6 | 3 | 2 | [
"<text-processing>"
] | 2020-10-25T10:11:41.273 | 2020-10-26T18:25:31.107 | 438,875 | null | [
{
"id": 616333,
"body": "<p>With GNU sed, you can also do:</p>\n<pre><code>sed 's/./+&/2g'\n</code></pre>\n",
"body_md": "With GNU sed, you can also do: ``` sed 's/./+&/2g' ```",
"score": 9,
"creation_date": "2020-10-25T17:20:18.250",
"user_id": 72456,
"is_accepted": false
},
{
... | With GNU sed, you can also do: ``` sed 's/./+&/2g' ``` | # How to add a specific character after every one character?
**Tags:** <text-processing>
**Question (score 6):**
I have a number -> 12345 I want output in below format ``` 1+2+3+4+5 ``` ``` echo `cat fl.txt | paste -s -d ''` ``` gives only `12345`. But when I add this + at the below command it gives same `12345`. ``... | 1,344 | 336 | {
"source": "stackexchange-archive.org",
"license": "CC BY-SA 4.0",
"dump_version": "2021-12-07",
"extraction_date": "2026-07-02T12:57:40Z",
"parser_version": "stackexchange-streaming-v1.0",
"site_name": "unix.stackexchange.com",
"original_7z_url": "https://archive.org/download/stack-exchange-2021-12-07/u... |
616,330 | unix.stackexchange.com | Why doesn't changing a file's name change its checksum? | <p>As far as I know changing even a bit of a file, will change the whole checksum result, but when I change a file's name this does not affect its checksum (I've tried SHA-1, SHA-256 and MD5).</p>
<p>Why? file name is not a part of file data? does it depend on file system?</p>
| As far as I know changing even a bit of a file, will change the whole checksum result, but when I change a file's name this does not affect its checksum (I've tried SHA-1, SHA-256 and MD5). Why? file name is not a part of file data? does it depend on file system? | 10 | 6,957 | 5 | 7 | 0 | [
"<filesystems><checksum>"
] | 2020-10-25T16:42:27.797 | 2020-10-26T07:15:21.283 | 378,964 | 616,337 | [
{
"id": 616337,
"body": "<p>The name of a file is a string in a directory entry, and a number of other meta data (file type, permissions, ownership, timestamps etc.) is stored in the inode. The filename is therefore not part of what constitutes the actual data of the file. In fact, a single file may have ... | The name of a file is a string in a directory entry, and a number of other meta data (file type, permissions, ownership, timestamps etc.) is stored in the inode. The filename is therefore not part of what constitutes the actual data of the file. In fact, a single file may have any number of names (hard links) in the fi... | # Why doesn't changing a file's name change its checksum?
**Tags:** <filesystems><checksum>
**Question (score 10):**
As far as I know changing even a bit of a file, will change the whole checksum result, but when I change a file's name this does not affect its checksum (I've tried SHA-1, SHA-256 and MD5). Why? file ... | 5,380 | 1,345 | {
"source": "stackexchange-archive.org",
"license": "CC BY-SA 4.0",
"dump_version": "2021-12-07",
"extraction_date": "2026-07-02T12:57:40Z",
"parser_version": "stackexchange-streaming-v1.0",
"site_name": "unix.stackexchange.com",
"original_7z_url": "https://archive.org/download/stack-exchange-2021-12-07/u... |
616,371 | unix.stackexchange.com | Backlight control not working on Lenovo IdeaPad Gaming 3 with Renoir / AMDGPU | <p>The brightness (LCD backlight) controls on a Lenovo IdeaPad Gaming 3 (15ARH05, LCD display, AMD Renoir CPU Ryzen 5 4600H, discrete NVIDIA GeForce 1650 Ti Mobile) are not working:</p>
<ul>
<li><code>Fn</code> keys show the brightness slider on the display moving.</li>
<li><code>/sys/class/backlight/amdgpu_bl0/brightn... | The brightness (LCD backlight) controls on a Lenovo IdeaPad Gaming 3 (15ARH05, LCD display, AMD Renoir CPU Ryzen 5 4600H, discrete NVIDIA GeForce 1650 Ti Mobile) are not working: - `Fn` keys show the brightness slider on the display moving. - `/sys/class/backlight/amdgpu_bl0/brightness` changes accordingly from 0 to 25... | 6 | 3,709 | 1 | 6 | 0 | [
"<amd-graphics><brightness><backlight>"
] | 2020-10-26T00:01:47.513 | 2021-03-23T15:43:54.153 | 169,190 | 637,154 | [
{
"id": 637154,
"body": "<p>Kernels 5.11.7, 5.12-rc3, and later allow the kernel parameter <a href=\"https://gitlab.freedesktop.org/agd5f/linux/-/commit/fef0bfcacd7da46a6c86d425a72eca711d5215bd\" rel=\"nofollow noreferrer\"><code>amdgpu.backlight=0</code></a> to be passed at boot to fix this issue for Lenov... | Kernels 5.11.7, 5.12-rc3, and later allow the kernel parameter `amdgpu.backlight=0` (https://gitlab.freedesktop.org/agd5f/linux/-/commit/fef0bfcacd7da46a6c86d425a72eca711d5215bd) to be passed at boot to fix this issue for Lenovo IdeaPad Gaming 3, Lenovo Legion 5 and possibly other laptops. For Debian-based distribution... | # Backlight control not working on Lenovo IdeaPad Gaming 3 with Renoir / AMDGPU
**Tags:** <amd-graphics><brightness><backlight>
**Question (score 6):**
The brightness (LCD backlight) controls on a Lenovo IdeaPad Gaming 3 (15ARH05, LCD display, AMD Renoir CPU Ryzen 5 4600H, discrete NVIDIA GeForce 1650 Ti Mobile) are... | 3,475 | 868 | {
"source": "stackexchange-archive.org",
"license": "CC BY-SA 4.0",
"dump_version": "2021-12-07",
"extraction_date": "2026-07-02T12:57:40Z",
"parser_version": "stackexchange-streaming-v1.0",
"site_name": "unix.stackexchange.com",
"original_7z_url": "https://archive.org/download/stack-exchange-2021-12-07/u... |
616,398 | unix.stackexchange.com | Is there a command to get builtin commands on zsh? | <p>Is there a command to get builtin commands on zsh? For example, it is possible to get all builtin commands with the <code>compgen -b</code> command in the bash shell.</p>
| Is there a command to get builtin commands on zsh? For example, it is possible to get all builtin commands with the `compgen -b` command in the bash shell. | 7 | 496 | 1 | 0 | 0 | [
"<zsh><shell-builtin><compgen>"
] | 2020-10-26T06:01:11.057 | 2020-10-26T07:17:19.333 | 364,572 | 616,400 | [
{
"id": 616400,
"body": "<p>See <code>info zsh builtins</code>:</p>\n<blockquote>\n<p><code>builtins</code><br />\nThis associative array gives information about the builtin commands\ncurrently enabled. The keys are the names of the builtin commands\nand the values are either 'undefined' for builtin comman... | See `info zsh builtins`: `builtins` This associative array gives information about the builtin commands currently enabled. The keys are the names of the builtin commands and the values are either 'undefined' for builtin commands that will automatically be loaded from a module if invoked or 'defined' for builtin command... | # Is there a command to get builtin commands on zsh?
**Tags:** <zsh><shell-builtin><compgen>
**Question (score 7):**
Is there a command to get builtin commands on zsh? For example, it is possible to get all builtin commands with the `compgen -b` command in the bash shell.
### Answer (score 7 · accepted)
See `info z... | 1,171 | 292 | {
"source": "stackexchange-archive.org",
"license": "CC BY-SA 4.0",
"dump_version": "2021-12-07",
"extraction_date": "2026-07-02T12:57:40Z",
"parser_version": "stackexchange-streaming-v1.0",
"site_name": "unix.stackexchange.com",
"original_7z_url": "https://archive.org/download/stack-exchange-2021-12-07/u... |
616,527 | unix.stackexchange.com | Creating a new user breaking existing permissions | <p>I have a machine running Ubuntu with a SSH config file in <code>~/.ssh/config</code> with the following permissions (default when creating a new file)</p>
<pre><code>-rw-rw-r-- 1 dev dev 75 Oct 26 20:13 config
</code></pre>
<p>After creating a new user (test) with the same primary group (dev) as the existing user... | I have a machine running Ubuntu with a SSH config file in `~/.ssh/config` with the following permissions (default when creating a new file) ``` -rw-rw-r-- 1 dev dev 75 Oct 26 20:13 config ``` After creating a new user (test) with the same primary group (dev) as the existing user (dev), I am no longer able to git clone ... | 7 | 795 | 2 | 1 | 0 | [
"<ssh><users><git><chmod>"
] | 2020-10-26T20:53:05.750 | 2020-10-28T05:00:59.537 | 439,088 | 616,534 | [
{
"id": 616534,
"body": "<p>In the openssh-7.6p1 source code file <a href=\"https://salsa.debian.org/ssh-team/openssh/-/blob/debian/1%257.6p1-1/readconf.c#L1764\" rel=\"nofollow noreferrer\"><code>readconf.c</code></a> we can see that the permission checking is delegated to a function <code>secure_permissio... | In the openssh-7.6p1 source code file `readconf.c` (https://salsa.debian.org/ssh-team/openssh/-/blob/debian/1%257.6p1-1/readconf.c#L1764) we can see that the permission checking is delegated to a function `secure_permissions`: ``` if (flags & SSHCONF_CHECKPERM) { struct stat sb; if (fstat(fileno(f), &sb) == -1) fatal("... | # Creating a new user breaking existing permissions
**Tags:** <ssh><users><git><chmod>
**Question (score 7):**
I have a machine running Ubuntu with a SSH config file in `~/.ssh/config` with the following permissions (default when creating a new file) ``` -rw-rw-r-- 1 dev dev 75 Oct 26 20:13 config ``` After creating... | 3,206 | 801 | {
"source": "stackexchange-archive.org",
"license": "CC BY-SA 4.0",
"dump_version": "2021-12-07",
"extraction_date": "2026-07-02T12:57:40Z",
"parser_version": "stackexchange-streaming-v1.0",
"site_name": "unix.stackexchange.com",
"original_7z_url": "https://archive.org/download/stack-exchange-2021-12-07/u... |
616,685 | unix.stackexchange.com | How did /var/lib get its name? | <p>The <a href="https://refspecs.linuxfoundation.org/FHS_3.0/fhs/ch05s08.html" rel="noreferrer">Linux Filesystem Hierarchy Standard</a> says that <code>/var/lib</code> "holds state information pertaining to an application or the system."</p>
<p>FreeBSD doesn't mention <code>/var/lib</code> in <a href="https:/... | The Linux Filesystem Hierarchy Standard (https://refspecs.linuxfoundation.org/FHS_3.0/fhs/ch05s08.html) says that `/var/lib` "holds state information pertaining to an application or the system." FreeBSD doesn't mention `/var/lib` in `hier(7)` (https://www.freebsd.org/cgi/man.cgi?query=hier&apropos=0&sektion=0&manpath=F... | 8 | 582 | 1 | 0 | 0 | [
"<linux><history>"
] | 2020-10-27T18:23:58.273 | 2020-10-27T18:53:34.563 | 206,286 | 616,690 | [
{
"id": 616690,
"body": "<p>The <a href=\"https://refspecs.linuxfoundation.org/FHS_3.0/fhs/ch05.html#purpose31\" rel=\"noreferrer\">LHFS</a> also says about <code>/var</code> as a whole:</p>\n<blockquote>\n<p><code>/var</code> is specified here in order to make it possible to mount <code>/usr</code> read-on... | The LHFS (https://refspecs.linuxfoundation.org/FHS_3.0/fhs/ch05.html#purpose31) also says about `/var` as a whole: `/var` is specified here in order to make it possible to mount `/usr` read-only. Everything that once went into `/usr` that is written to during system operation (as opposed to installation and software ma... | # How did /var/lib get its name?
**Tags:** <linux><history>
**Question (score 8):**
The Linux Filesystem Hierarchy Standard (https://refspecs.linuxfoundation.org/FHS_3.0/fhs/ch05s08.html) says that `/var/lib` "holds state information pertaining to an application or the system." FreeBSD doesn't mention `/var/lib` in ... | 1,694 | 423 | {
"source": "stackexchange-archive.org",
"license": "CC BY-SA 4.0",
"dump_version": "2021-12-07",
"extraction_date": "2026-07-02T12:57:40Z",
"parser_version": "stackexchange-streaming-v1.0",
"site_name": "unix.stackexchange.com",
"original_7z_url": "https://archive.org/download/stack-exchange-2021-12-07/u... |
616,787 | unix.stackexchange.com | Getting the error: bash: ./program: cannot execute binary file: Exec format error | <p>When I run the command</p>
<pre class="lang-bsh prettyprint-override"><code>./program
</code></pre>
<p>I get the error:</p>
<pre class="lang-bsh prettyprint-override"><code>bash: ./program: cannot execute binary file: Exec format error
</code></pre>
<p>When I run <code>uname -a</code> I get:</p>
<pre class="lang-bs... | When I run the command ``` ./program ``` I get the error: ``` bash: ./program: cannot execute binary file: Exec format error ``` When I run `uname -a` I get: ``` 4.4.0-21-generic #37-Ubuntu SMP Mon Apr 18 18:34:49 UTC 2016 i686 i686 i686 GNU/Linux ``` Also I checked the information about the program that I was trying t... | 8 | 35,472 | 2 | 0 | 2 | [
"<linux><bash><ubuntu>"
] | 2020-10-28T08:45:15.827 | 2020-10-28T09:48:30.117 | 439,346 | 616,796 | [
{
"id": 616796,
"body": "<p>You have a 64-bit x86 CPU (indicated by the <code>lm</code> flag in <code>/proc/cpuinfo</code>), but you’re running a 32-bit kernel. The program you’re trying to run requires a 64-bit runtime, so it won’t work as-is.</p>\n<p>If you can find a 32-bit build of the program (or build... | You have a 64-bit x86 CPU (indicated by the `lm` flag in `/proc/cpuinfo`), but you’re running a 32-bit kernel. The program you’re trying to run requires a 64-bit runtime, so it won’t work as-is. If you can find a 32-bit build of the program (or build it yourself), use that. Alternatively, you can install a 64-bit kerne... | # Getting the error: bash: ./program: cannot execute binary file: Exec format error
**Tags:** <linux><bash><ubuntu>
**Question (score 8):**
When I run the command ``` ./program ``` I get the error: ``` bash: ./program: cannot execute binary file: Exec format error ``` When I run `uname -a` I get: ``` 4.4.0-21-generi... | 2,174 | 543 | {
"source": "stackexchange-archive.org",
"license": "CC BY-SA 4.0",
"dump_version": "2021-12-07",
"extraction_date": "2026-07-02T12:57:40Z",
"parser_version": "stackexchange-streaming-v1.0",
"site_name": "unix.stackexchange.com",
"original_7z_url": "https://archive.org/download/stack-exchange-2021-12-07/u... |
616,886 | unix.stackexchange.com | Is an LVM cache a security leak when using LUKS on LVM? | <p>I have two hard drives in a volume group with LVM. All volumes in that volume group hold LUKS containers. If I add an SSD as an LVM cache to that volume group, is all data on the cache device encrypted?</p>
<p><em>Bonus points for tools that confirm the cache's content.</em></p>
| I have two hard drives in a volume group with LVM. All volumes in that volume group hold LUKS containers. If I add an SSD as an LVM cache to that volume group, is all data on the cache device encrypted? Bonus points for tools that confirm the cache's content. | 5 | 353 | 2 | 0 | 0 | [
"<lvm><luks>"
] | 2020-10-28T15:54:44.093 | 2020-10-28T17:34:13.163 | 57,570 | 616,903 | [
{
"id": 616904,
"body": "<p>Since you are caching the LUKS-container, your cache is also encrypted, yes.</p>\n<p>I'm using a different setup, where my pv (the acual one and the one used as cache) is on top of luks.</p>\n<p>Unencrypted LVM without cache:</p>\n<pre><code>[Disk 1 ]\n[PV Data ]\n[VG ]\n[L... | Since you are caching the LUKS-container, your cache is also encrypted, yes. I'm using a different setup, where my pv (the acual one and the one used as cache) is on top of luks. Unencrypted LVM without cache: ``` [Disk 1 ] [PV Data ] [VG ] [LV ] [Filesyst] ``` Unencrypted with LVM cache: ``` [Disk 1 ] [Disk 2 ] [PV Da... | # Is an LVM cache a security leak when using LUKS on LVM?
**Tags:** <lvm><luks>
**Question (score 5):**
I have two hard drives in a volume group with LVM. All volumes in that volume group hold LUKS containers. If I add an SSD as an LVM cache to that volume group, is all data on the cache device encrypted? Bonus poin... | 2,101 | 525 | {
"source": "stackexchange-archive.org",
"license": "CC BY-SA 4.0",
"dump_version": "2021-12-07",
"extraction_date": "2026-07-02T12:57:40Z",
"parser_version": "stackexchange-streaming-v1.0",
"site_name": "unix.stackexchange.com",
"original_7z_url": "https://archive.org/download/stack-exchange-2021-12-07/u... |
616,973 | unix.stackexchange.com | Use high-quality codec and microphone simultaneously with Bluetooth headset | <p>I have various Bluetooth headsets, and when I use these with Android and ChromeOS, I get decent bidirectional audio quality for calls and video chats.</p>
<p>Unfortunately, when I use them on my arch Linux laptop (with PulseAudio 13.99.2+13+g7f4d7fcf5-1, bluez 5.55-1, and pulseaudio-modules-bt 1.4-3), I have a choic... | I have various Bluetooth headsets, and when I use these with Android and ChromeOS, I get decent bidirectional audio quality for calls and video chats. Unfortunately, when I use them on my arch Linux laptop (with PulseAudio 13.99.2+13+g7f4d7fcf5-1, bluez 5.55-1, and pulseaudio-modules-bt 1.4-3), I have a choice (under t... | 21 | 17,977 | 3 | 7 | 8 | [
"<linux><arch-linux><pulseaudio><bluetooth>"
] | 2020-10-29T06:18:26.347 | 2021-02-13T09:59:12.333 | 121,912 | null | [
{
"id": 631014,
"body": "<p>Based on this answer <a href=\"https://askubuntu.com/a/1250010/35326\">https://askubuntu.com/a/1250010/35326</a> it looks like A2DP bi-directional audio will not work until Linux kernel and PulseAudio are improved to support this.</p>\n",
"body_md": "Based on this answer http... | Based on this answer https://askubuntu.com/a/1250010/35326 (https://askubuntu.com/a/1250010/35326) it looks like A2DP bi-directional audio will not work until Linux kernel and PulseAudio are improved to support this. | # Use high-quality codec and microphone simultaneously with Bluetooth headset
**Tags:** <linux><arch-linux><pulseaudio><bluetooth>
**Question (score 21):**
I have various Bluetooth headsets, and when I use these with Android and ChromeOS, I get decent bidirectional audio quality for calls and video chats. Unfortunat... | 4,567 | 1,141 | {
"source": "stackexchange-archive.org",
"license": "CC BY-SA 4.0",
"dump_version": "2021-12-07",
"extraction_date": "2026-07-02T12:57:40Z",
"parser_version": "stackexchange-streaming-v1.0",
"site_name": "unix.stackexchange.com",
"original_7z_url": "https://archive.org/download/stack-exchange-2021-12-07/u... |
617,259 | unix.stackexchange.com | yay error: gpg: keyserver receive failed: No name | <p>I am trying to install spotify using yay on Arch linux. But when I run <code>yay -S spotify</code> this happens:</p>
<pre class="lang-bsh prettyprint-override"><code>john@arch-thinkpad ~> yay -S spotify
:: There are 5 providers available for spotify:
:: Repository AUR
1) spotify 2) spotify-dev 3) spotify-lega... | I am trying to install spotify using yay on Arch linux. But when I run `yay -S spotify` this happens: ``` john@arch-thinkpad ~> yay -S spotify :: There are 5 providers available for spotify: :: Repository AUR 1) spotify 2) spotify-dev 3) spotify-legacy 4) spotify094 5) spotio Enter a number (default=1): 1 :: Checking f... | 7 | 8,719 | 1 | 0 | 0 | [
"<arch-linux><package-management><gpg><pacman>"
] | 2020-10-30T22:52:17.943 | 2021-11-20T21:25:03.310 | 429,595 | 617,320 | [
{
"id": 617320,
"body": "<p>It was solved by manually adding gpg key by this command:</p>\n<pre><code>gpg --keyserver keyserver.ubuntu.com --recv-key <key name>\n</code></pre>\n<p>and running installation again:</p>\n<pre><code>yay -S spotify\n</code></pre>\n",
"body_md": "It was solved by manuall... | It was solved by manually adding gpg key by this command: ``` gpg --keyserver keyserver.ubuntu.com --recv-key ``` and running installation again: ``` yay -S spotify ``` | # yay error: gpg: keyserver receive failed: No name
**Tags:** <arch-linux><package-management><gpg><pacman>
**Question (score 7):**
I am trying to install spotify using yay on Arch linux. But when I run `yay -S spotify` this happens: ``` john@arch-thinkpad ~> yay -S spotify :: There are 5 providers available for spo... | 1,343 | 335 | {
"source": "stackexchange-archive.org",
"license": "CC BY-SA 4.0",
"dump_version": "2021-12-07",
"extraction_date": "2026-07-02T12:57:40Z",
"parser_version": "stackexchange-streaming-v1.0",
"site_name": "unix.stackexchange.com",
"original_7z_url": "https://archive.org/download/stack-exchange-2021-12-07/u... |
617,263 | unix.stackexchange.com | Use AWK to read duplicates in a column | <p>I am looking to compare the times that each user (IP address), that has visited my site, took to view a series of pages, to identify non-human activity on the website, and thus exclude the IP addresses from my analytics.</p>
<p><em>I would like to use awk (I am using GAWK) where possible, simply because I am learnin... | I am looking to compare the times that each user (IP address), that has visited my site, took to view a series of pages, to identify non-human activity on the website, and thus exclude the IP addresses from my analytics. I would like to use awk (I am using GAWK) where possible, simply because I am learning it and want ... | 9 | 314 | 6 | 1 | 0 | [
"<awk><logs>"
] | 2020-10-30T23:39:01.863 | 2020-11-04T20:03:02.150 | 439,791 | 617,453 | [
{
"id": 617453,
"body": "<p>Using GNU awk for mktime():</p>\n<pre><code>$ cat tst.awk\nBEGIN { FS = "|" }\n(++count[$2]) ~ /^[15]$/ {\n split($1,t,"[/:]")\n monthNr = (index("JanFebMarAprMayJunJulAugSepOctNovDec",t[2])+2)/3\n currSecs = mktime(t[3] " " monthN... | Using GNU awk for mktime(): ``` $ cat tst.awk BEGIN { FS = "|" } (++count[$2]) ~ /^[15]$/ { split($1,t,"[/:]") monthNr = (index("JanFebMarAprMayJunJulAugSepOctNovDec",t[2])+2)/3 currSecs = mktime(t[3] " " monthNr " " t[1] " " t[4] " " t[5] " " t[6]) if ( count[$2] == 1 ) { firstSecs[$2] = currSecs } else if ( (currSecs... | # Use AWK to read duplicates in a column
**Tags:** <awk><logs>
**Question (score 9):**
I am looking to compare the times that each user (IP address), that has visited my site, took to view a series of pages, to identify non-human activity on the website, and thus exclude the IP addresses from my analytics. I would l... | 4,912 | 1,228 | {
"source": "stackexchange-archive.org",
"license": "CC BY-SA 4.0",
"dump_version": "2021-12-07",
"extraction_date": "2026-07-02T12:57:40Z",
"parser_version": "stackexchange-streaming-v1.0",
"site_name": "unix.stackexchange.com",
"original_7z_url": "https://archive.org/download/stack-exchange-2021-12-07/u... |
617,438 | unix.stackexchange.com | How to find directory in directory? | <p>How can I find a directory with a certain name but only if it is in another directory with a certain name? For example when I have the following directory structure</p>
<pre><code>a
├── b
│ └── e
├── c
│ └── e
└── d
</code></pre>
<p>I'd like to find the directory 'e', but only when it is located in a directory c... | How can I find a directory with a certain name but only if it is in another directory with a certain name? For example when I have the following directory structure ``` a ├── b │ └── e ├── c │ └── e └── d ``` I'd like to find the directory 'e', but only when it is located in a directory called 'c'. If possible with the... | 5 | 2,111 | 4 | 0 | 0 | [
"<bash><find>"
] | 2020-11-01T11:49:26.870 | 2020-11-01T12:20:09.263 | 117,750 | 617,439 | [
{
"id": 617439,
"body": "<p>Use GNU <code>find</code> with <code>-path</code> that searches the entire path for a match:</p>\n<pre><code>$ find . -path '*/c/e'\n./a/c/e\n</code></pre>\n<p>That will match any file or directory called <code>e</code> which is in a directory called <code>c</code>.</p>\n<p>Alter... | Use GNU `find` with `-path` that searches the entire path for a match: ``` $ find . -path '*/c/e' ./a/c/e ``` That will match any file or directory called `e` which is in a directory called `c`. Alternatively, if you don't have GNU `find` or any other that supports `-path`, you can do: ``` $ find . -type d -name c -exe... | # How to find directory in directory?
**Tags:** <bash><find>
**Question (score 5):**
How can I find a directory with a certain name but only if it is in another directory with a certain name? For example when I have the following directory structure ``` a ├── b │ └── e ├── c │ └── e └── d ``` I'd like to find the di... | 1,268 | 317 | {
"source": "stackexchange-archive.org",
"license": "CC BY-SA 4.0",
"dump_version": "2021-12-07",
"extraction_date": "2026-07-02T12:57:40Z",
"parser_version": "stackexchange-streaming-v1.0",
"site_name": "unix.stackexchange.com",
"original_7z_url": "https://archive.org/download/stack-exchange-2021-12-07/u... |
617,811 | unix.stackexchange.com | how to append public keys to remote host instead of copy it | <p>I used in my bash script the follwing cli , in order to send the public key to remote machine</p>
<pre><code>sshpass -p $pass scp /root/.ssh/authorized_keys root@$remote_host:~/.ssh/authorized_keys
</code></pre>
<p>but since we want to append the public keyes from other host then I am searching the approach top app... | I used in my bash script the follwing cli , in order to send the public key to remote machine ``` sshpass -p $pass scp /root/.ssh/authorized_keys root@$remote_host:~/.ssh/authorized_keys ``` but since we want to append the public keyes from other host then I am searching the approach top append in bash I know that the ... | 6 | 1,402 | 2 | 0 | 1 | [
"<ssh><scp><key-authentication><ssh-keygen>"
] | 2020-11-03T14:56:07.727 | 2020-11-03T15:33:22.630 | null | 617,812 | [
{
"id": 617813,
"body": "<p>You can also use <code>ssh-copy-id</code>, which is a tool to do exactly what you want: add one or more keys to the authorized_keys of a remote system.</p>\n",
"body_md": "You can also use `ssh-copy-id`, which is a tool to do exactly what you want: add one or more keys to the... | You can also use `ssh-copy-id`, which is a tool to do exactly what you want: add one or more keys to the authorized_keys of a remote system. | # how to append public keys to remote host instead of copy it
**Tags:** <ssh><scp><key-authentication><ssh-keygen>
**Question (score 6):**
I used in my bash script the follwing cli , in order to send the public key to remote machine ``` sshpass -p $pass scp /root/.ssh/authorized_keys root@$remote_host:~/.ssh/authori... | 1,109 | 277 | {
"source": "stackexchange-archive.org",
"license": "CC BY-SA 4.0",
"dump_version": "2021-12-07",
"extraction_date": "2026-07-02T12:57:40Z",
"parser_version": "stackexchange-streaming-v1.0",
"site_name": "unix.stackexchange.com",
"original_7z_url": "https://archive.org/download/stack-exchange-2021-12-07/u... |
617,898 | unix.stackexchange.com | Restoring a very old hard drive | <p>I have an old SATA <a href="https://www.seagate.com/staticfiles/maxtor/en_us/documentation/data_sheets/diamondmax_plus_9_data_sheet.pdf" rel="nofollow noreferrer">harddrive</a> with important footage on it. 15 years ago this harddrive "died" on a Windows OS. I saved the HD. Now I am going to plug it bac... | I have an old SATA harddrive (https://www.seagate.com/staticfiles/maxtor/en_us/documentation/data_sheets/diamondmax_plus_9_data_sheet.pdf) with important footage on it. 15 years ago this harddrive "died" on a Windows OS. I saved the HD. Now I am going to plug it back into my Linux OS to see if the drive picks up in `ls... | 9 | 2,232 | 3 | 3 | 3 | [
"<centos><hard-disk><backup><hardware><sata>"
] | 2020-11-04T04:33:14.087 | 2021-03-02T00:39:02.527 | 328,062 | null | [
{
"id": 617906,
"body": "<p>I did something like that just a few weeks ago -- I got everything from a disk that had been sitting in storage for over 10 years! I had no intention of restoring the hard disk itself, I just wanted to get all the files from it, and put them onto my current disks. Fot that, I was... | I did something like that just a few weeks ago -- I got everything from a disk that had been sitting in storage for over 10 years! I had no intention of restoring the hard disk itself, I just wanted to get all the files from it, and put them onto my current disks. Fot that, I was hoping that the disk -- once plugged in... | # Restoring a very old hard drive
**Tags:** <centos><hard-disk><backup><hardware><sata>
**Question (score 9):**
I have an old SATA harddrive (https://www.seagate.com/staticfiles/maxtor/en_us/documentation/data_sheets/diamondmax_plus_9_data_sheet.pdf) with important footage on it. 15 years ago this harddrive "died" o... | 4,087 | 1,021 | {
"source": "stackexchange-archive.org",
"license": "CC BY-SA 4.0",
"dump_version": "2021-12-07",
"extraction_date": "2026-07-02T12:57:40Z",
"parser_version": "stackexchange-streaming-v1.0",
"site_name": "unix.stackexchange.com",
"original_7z_url": "https://archive.org/download/stack-exchange-2021-12-07/u... |
617,899 | unix.stackexchange.com | Piping awk's print/printf output into a shell command makes that statement run after all other unrelated print/printf statements | <p>Given this <code>awk</code> script:</p>
<pre><code>END {
print "Y" | "cat"
print "X"
print "X"
}
# Output:
# X
# X
# Y
</code></pre>
<p>Why isn't Y printed first given that it's supposed to run before the other statements?</p>
| Given this `awk` script: ``` END { print "Y" | "cat" print "X" print "X" } # Output: # X # X # Y ``` Why isn't Y printed first given that it's supposed to run before the other statements? | 5 | 723 | 2 | 0 | 0 | [
"<awk><pipe>"
] | 2020-11-04T04:38:32.433 | 2020-11-04T12:54:59.407 | 396,319 | 617,900 | [
{
"id": 617900,
"body": "<p>If you want the <code>cat</code> process to terminate (and the <code>Y</code> to be printed) before the <code>X</code>s, then just call <code>close("cat")</code> after the <code>print "Y" | "cat"</code>.</p>\n<p>All the rest is explained in the manpa... | If you want the `cat` process to terminate (and the `Y` to be printed) before the `X`s, then just call `close("cat")` after the `print "Y" | "cat"`. All the rest is explained in the manpage, which you better read. Why isn't Y printed first given that it's supposed to run before the other statements? The `cat` is not su... | # Piping awk's print/printf output into a shell command makes that statement run after all other unrelated print/printf statements
**Tags:** <awk><pipe>
**Question (score 5):**
Given this `awk` script: ``` END { print "Y" | "cat" print "X" print "X" } # Output: # X # X # Y ``` Why isn't Y printed first given that it... | 3,883 | 970 | {
"source": "stackexchange-archive.org",
"license": "CC BY-SA 4.0",
"dump_version": "2021-12-07",
"extraction_date": "2026-07-02T12:57:40Z",
"parser_version": "stackexchange-streaming-v1.0",
"site_name": "unix.stackexchange.com",
"original_7z_url": "https://archive.org/download/stack-exchange-2021-12-07/u... |
617,912 | unix.stackexchange.com | Unable to install snapd on CentOS 7 due to dependency error | <p>I'm not a Linux Admin but need help in getting snapd installed.</p>
<p>Below is my system details.</p>
<pre><code>[root@vultr nginx]# hostnamectl
Static hostname: vultr.guest
Icon name: computer-vm
Chassis: vm
Machine ID: 906711fa42644844bc1f9fde4d4y2a68
Boot ID: 2b3e8d969ff... | I'm not a Linux Admin but need help in getting snapd installed. Below is my system details. ``` [root@vultr nginx]# hostnamectl Static hostname: vultr.guest Icon name: computer-vm Chassis: vm Machine ID: 906711fa42644844bc1f9fde4d4y2a68 Boot ID: 2b3e8d969ff540ae850f504cefy215ef Virtualization: kvm Operating System: Cen... | 5 | 4,340 | 4 | 2 | 1 | [
"<centos><yum><dependencies>"
] | 2020-11-04T07:14:32.737 | 2021-01-09T14:31:50.520 | 392,596 | null | [
{
"id": 619853,
"body": "<p>Try to reinstall <em><strong>selinux-policy</strong></em> and <em><strong>selinux-policy-targeted</strong></em> directly from a local/remote path, for example:</p>\n<pre><code>$ sudo yum remove selinux-policy-base\n\nRemoved:\n selinux-policy-minimum.noarch 0:3.13.1-268.el7\n s... | Try to reinstall selinux-policy and selinux-policy-targeted directly from a local/remote path, for example: ``` $ sudo yum remove selinux-policy-base Removed: selinux-policy-minimum.noarch 0:3.13.1-268.el7 selinux-policy-targeted.noarch 0:3.13.1-268.el7 $ sudo yum install \ http://mirror.centos.org/centos/7/updates/x86... | # Unable to install snapd on CentOS 7 due to dependency error
**Tags:** <centos><yum><dependencies>
**Question (score 5):**
I'm not a Linux Admin but need help in getting snapd installed. Below is my system details. ``` [root@vultr nginx]# hostnamectl Static hostname: vultr.guest Icon name: computer-vm Chassis: vm M... | 5,030 | 1,257 | {
"source": "stackexchange-archive.org",
"license": "CC BY-SA 4.0",
"dump_version": "2021-12-07",
"extraction_date": "2026-07-02T12:57:40Z",
"parser_version": "stackexchange-streaming-v1.0",
"site_name": "unix.stackexchange.com",
"original_7z_url": "https://archive.org/download/stack-exchange-2021-12-07/u... |
618,128 | unix.stackexchange.com | How to remove unique strings from a textfile? | <p>Sorry guys I had to edit my example, because I didn't express my query properly.
Let's say I have the .txt file:</p>
<pre><code>Happy sad
Happy sad
Happy sad
Sad happy
Happy sad
Happy sad
Mad sad
Mad happy
Mad happy
</code></pre>
<p>And I want to delete any string that is unique. Leaving the file with:</p>
<pre><cod... | Sorry guys I had to edit my example, because I didn't express my query properly. Let's say I have the .txt file: ``` Happy sad Happy sad Happy sad Sad happy Happy sad Happy sad Mad sad Mad happy Mad happy ``` And I want to delete any string that is unique. Leaving the file with: ``` Happy sad Happy sad Happy sad Happy ... | 6 | 720 | 4 | 2 | 3 | [
"<text-processing><sort>"
] | 2020-11-05T10:42:38.897 | 2020-11-05T13:15:21.330 | 439,848 | 618,131 | [
{
"id": 618131,
"body": "<p>Using <code>awk</code>:</p>\n<pre class=\"lang-none prettyprint-override\"><code>$ awk 'seen[$0]++; seen[$0] == 2' file\nHappy sad\nHappy sad\nHappy sad\nHappy sad\nHappy sad\nMad happy\nMad happy\n</code></pre>\n<p>This uses the text of each line as the key into the associative ... | Using `awk`: ``` $ awk 'seen[$0]++; seen[$0] == 2' file Happy sad Happy sad Happy sad Happy sad Happy sad Mad happy Mad happy ``` This uses the text of each line as the key into the associative array `seen`. The first `seen[$0]++` will cause a line that has been seen before to be printed since the value associated with... | # How to remove unique strings from a textfile?
**Tags:** <text-processing><sort>
**Question (score 6):**
Sorry guys I had to edit my example, because I didn't express my query properly. Let's say I have the .txt file: ``` Happy sad Happy sad Happy sad Sad happy Happy sad Happy sad Mad sad Mad happy Mad happy ``` An... | 2,163 | 540 | {
"source": "stackexchange-archive.org",
"license": "CC BY-SA 4.0",
"dump_version": "2021-12-07",
"extraction_date": "2026-07-02T12:57:40Z",
"parser_version": "stackexchange-streaming-v1.0",
"site_name": "unix.stackexchange.com",
"original_7z_url": "https://archive.org/download/stack-exchange-2021-12-07/u... |
618,182 | unix.stackexchange.com | cat a remote file from sftp | <p>I'm in an SFTP session and navigated to a deep directory. I did <code>ls -l</code>, saw a small file, and want to just read it. I would prefer to do it while I'm still in SFTP, rather than starting up a new terminal, doing SSH, navigating to that deep directory, and then reading it, then going back to SFTP to contin... | I'm in an SFTP session and navigated to a deep directory. I did `ls -l`, saw a small file, and want to just read it. I would prefer to do it while I'm still in SFTP, rather than starting up a new terminal, doing SSH, navigating to that deep directory, and then reading it, then going back to SFTP to continue. Is there a... | 5 | 3,065 | 2 | 2 | 0 | [
"<sftp>"
] | 2020-11-05T16:19:15.457 | 2020-11-05T19:47:20.040 | 440,131 | 618,215 | [
{
"id": 618215,
"body": "<p>Having cat in sftp would mean that the contents of the file will still have to travel through the network, to your local machine, to be displayed for your eyes, which is basically, you get ther file. You don't have to "come out of SFTP", as sftp has <code>!command</code... | Having cat in sftp would mean that the contents of the file will still have to travel through the network, to your local machine, to be displayed for your eyes, which is basically, you get ther file. You don't have to "come out of SFTP", as sftp has `!command`. So, you can do: ``` sftp> get file sftp> !cat file ``` | # cat a remote file from sftp
**Tags:** <sftp>
**Question (score 5):**
I'm in an SFTP session and navigated to a deep directory. I did `ls -l`, saw a small file, and want to just read it. I would prefer to do it while I'm still in SFTP, rather than starting up a new terminal, doing SSH, navigating to that deep direc... | 1,534 | 383 | {
"source": "stackexchange-archive.org",
"license": "CC BY-SA 4.0",
"dump_version": "2021-12-07",
"extraction_date": "2026-07-02T12:57:40Z",
"parser_version": "stackexchange-streaming-v1.0",
"site_name": "unix.stackexchange.com",
"original_7z_url": "https://archive.org/download/stack-exchange-2021-12-07/u... |
618,576 | unix.stackexchange.com | Fedora 33: Use custom DNS addresses | <p>In Fedora 32, I used to edit <code>/etc/resolv.conf</code> in order to modify DNS addresses:</p>
<pre><code>nameserver [IP1]
nameserver [IP2]
</code></pre>
<p>But In Fedora 33 this file has been changed and it has a warning saying <code>Do not edit</code>:</p>
<pre><code># This file is managed by man:systemd-resolve... | In Fedora 32, I used to edit `/etc/resolv.conf` in order to modify DNS addresses: ``` nameserver [IP1] nameserver [IP2] ``` But In Fedora 33 this file has been changed and it has a warning saying `Do not edit`: ``` # This file is managed by man:systemd-resolved(8). Do not edit. # # This is a dynamic resolv.conf file fo... | 6 | 3,257 | 1 | 0 | 1 | [
"<fedora><dns><resolv.conf>"
] | 2020-11-08T06:06:10.947 | 2020-11-08T08:06:59.923 | 68,594 | 618,585 | [
{
"id": 618585,
"body": "<pre class=\"lang-none prettyprint-override\"><code>resolvectl dns\nGlobal:\nLink 2 (enp2s0):\nLink 3 (wlp1s0): 192.168.43.63\n</code></pre>\n<pre class=\"lang-none prettyprint-override\"><code>sudo resolvectl dns wlp1s0 8.8.8.8 4.4.4.4\n</code></pre>\n<pre class=\"lang-none prettyp... | ``` resolvectl dns Global: Link 2 (enp2s0): Link 3 (wlp1s0): 192.168.43.63 ``` ``` sudo resolvectl dns wlp1s0 8.8.8.8 4.4.4.4 ``` ``` resolvectl dns Global: Link 2 (enp2s0): Link 3 (wlp1s0): 8.8.8.8 4.4.4.4 ``` | # Fedora 33: Use custom DNS addresses
**Tags:** <fedora><dns><resolv.conf>
**Question (score 6):**
In Fedora 32, I used to edit `/etc/resolv.conf` in order to modify DNS addresses: ``` nameserver [IP1] nameserver [IP2] ``` But In Fedora 33 this file has been changed and it has a warning saying `Do not edit`: ``` # T... | 1,356 | 339 | {
"source": "stackexchange-archive.org",
"license": "CC BY-SA 4.0",
"dump_version": "2021-12-07",
"extraction_date": "2026-07-02T12:57:40Z",
"parser_version": "stackexchange-streaming-v1.0",
"site_name": "unix.stackexchange.com",
"original_7z_url": "https://archive.org/download/stack-exchange-2021-12-07/u... |
618,599 | unix.stackexchange.com | How to find non repetitive letter from a given string | <p>I have a string <code>aaabefhhhhhthkkd</code> from which I just need to extract non repetitive letters as output, preserving the order.</p>
<p>The string may contain upper case or lower case letters.</p>
<p><strong>Input:</strong></p>
<pre><code>aaabefhhhhhthkkd
</code></pre>
<p><strong>Output:</strong></p>
<pre><co... | I have a string `aaabefhhhhhthkkd` from which I just need to extract non repetitive letters as output, preserving the order. The string may contain upper case or lower case letters. Input: ``` aaabefhhhhhthkkd ``` Output: ``` beftd ``` How this logic need to be defined so that I get the above required output? I tried t... | 5 | 978 | 11 | 1 | 3 | [
"<text-processing>"
] | 2020-11-08T11:04:09.383 | 2020-11-09T04:46:03.070 | 439,926 | 618,611 | [
{
"id": 618607,
"body": "<p><code>uniq</code> only works on adjacent duplicates - so if you want to use that, you'd need to sort your input first, for example:</p>\n<pre><code>fold -w1 | sort | uniq -u | paste -sd ''\n</code></pre>\n<ul>\n<li><code>fold -w1</code> does the same as your <code>sed 's/./&\... | `uniq` only works on adjacent duplicates - so if you want to use that, you'd need to sort your input first, for example: ``` fold -w1 | sort | uniq -u | paste -sd '' ``` - `fold -w1` does the same as your `sed 's/./&\n/g'` but without introducing an extra spurious newline - `sort` to make duplicate characters adjacent ... | # How to find non repetitive letter from a given string
**Tags:** <text-processing>
**Question (score 5):**
I have a string `aaabefhhhhhthkkd` from which I just need to extract non repetitive letters as output, preserving the order. The string may contain upper case or lower case letters. Input: ``` aaabefhhhhhthkkd... | 5,507 | 1,376 | {
"source": "stackexchange-archive.org",
"license": "CC BY-SA 4.0",
"dump_version": "2021-12-07",
"extraction_date": "2026-07-02T12:57:40Z",
"parser_version": "stackexchange-streaming-v1.0",
"site_name": "unix.stackexchange.com",
"original_7z_url": "https://archive.org/download/stack-exchange-2021-12-07/u... |
618,665 | unix.stackexchange.com | Why is there output of ping after it has been terminated? | <p>When a process breaks, as I know no output will be return anymore. But always after breaking <code>ping</code> command we have the statistics of the execution, and as I know it's part of the output.</p>
<pre class="lang-bsh prettyprint-override"><code>amirreza@time:~$ ping 4.2.2.4
PING 4.2.2.4 (4.2.2.4) 56(84) bytes... | When a process breaks, as I know no output will be return anymore. But always after breaking `ping` command we have the statistics of the execution, and as I know it's part of the output. ``` amirreza@time:~$ ping 4.2.2.4 PING 4.2.2.4 (4.2.2.4) 56(84) bytes of data. 64 bytes from 4.2.2.4: icmp_seq=1 ttl=51 time=95.8 ms... | 14 | 2,880 | 2 | 2 | 1 | [
"<process><ping><output>"
] | 2020-11-08T20:17:07.173 | 2020-11-11T09:52:18.373 | 378,964 | 618,668 | [
{
"id": 618668,
"body": "<p><kbd>Ctrl</kbd>+<kbd>C</kbd> makes the terminal send SIGINT to the foreground process group. A process that receives SIGINT can do anything, it can even ignore the signal. A common reaction to SIGINT is to exit gracefully, i.e. after cleaning up etc.</p>\n<p>Your <code>ping</code... | Ctrl+C makes the terminal send SIGINT to the foreground process group. A process that receives SIGINT can do anything, it can even ignore the signal. A common reaction to SIGINT is to exit gracefully, i.e. after cleaning up etc. Your `ping` is simply designed to print statistics upon SIGINT and then to exit. Other tool... | # Why is there output of ping after it has been terminated?
**Tags:** <process><ping><output>
**Question (score 14):**
When a process breaks, as I know no output will be return anymore. But always after breaking `ping` command we have the statistics of the execution, and as I know it's part of the output. ``` amirre... | 3,594 | 898 | {
"source": "stackexchange-archive.org",
"license": "CC BY-SA 4.0",
"dump_version": "2021-12-07",
"extraction_date": "2026-07-02T12:57:40Z",
"parser_version": "stackexchange-streaming-v1.0",
"site_name": "unix.stackexchange.com",
"original_7z_url": "https://archive.org/download/stack-exchange-2021-12-07/u... |
618,877 | unix.stackexchange.com | How can I add a new physical volume to extend an existing LUKS-encrypted lvm (volume group) and maintain encryption? | <h3>I want to extend my LUKS-encrypted lvm (volume group) with a new physical volume.</h3>
<p><a href="https://unix.stackexchange.com/questions/618871/do-i-maintain-encryption-when-extending-a-luks-encrypted-lvm-with-a-physical-vol">In my previous question</a> I was told - in respect to my actual setup - that I need to... | ### I want to extend my LUKS-encrypted lvm (volume group) with a new physical volume. In my previous question (https://unix.stackexchange.com/questions/618871/do-i-maintain-encryption-when-extending-a-luks-encrypted-lvm-with-a-physical-vol) I was told - in respect to my actual setup - that I need to encrypt the new phy... | 6 | 1,243 | 1 | 2 | 1 | [
"<lvm><luks>"
] | 2020-11-10T08:22:02.370 | 2020-11-10T17:52:11.480 | 243,440 | 618,880 | [
{
"id": 618880,
"body": "<p>You’ll need to set up encryption on the new physical device:</p>\n<pre><code>sudo cryptsetup luksFormat /dev/newdevice\n</code></pre>\n<p>(replacing <code>newdevice</code> as appropriate).</p>\n<p>Then open it:</p>\n<pre><code>sudo cryptsetup luksOpen /dev/newdevice newdevice_cry... | You’ll need to set up encryption on the new physical device: ``` sudo cryptsetup luksFormat /dev/newdevice ``` (replacing `newdevice` as appropriate). Then open it: ``` sudo cryptsetup luksOpen /dev/newdevice newdevice_crypt ``` You’ll need to add a matching line to `/etc/crypttab` so that it’s opened at boot. Once you... | # How can I add a new physical volume to extend an existing LUKS-encrypted lvm (volume group) and maintain encryption?
**Tags:** <lvm><luks>
**Question (score 6):**
### I want to extend my LUKS-encrypted lvm (volume group) with a new physical volume. In my previous question (https://unix.stackexchange.com/questions/... | 2,010 | 502 | {
"source": "stackexchange-archive.org",
"license": "CC BY-SA 4.0",
"dump_version": "2021-12-07",
"extraction_date": "2026-07-02T12:57:40Z",
"parser_version": "stackexchange-streaming-v1.0",
"site_name": "unix.stackexchange.com",
"original_7z_url": "https://archive.org/download/stack-exchange-2021-12-07/u... |
618,963 | unix.stackexchange.com | How do I match both upper and lower case letters using regex in bash? | <p>we set the following variables</p>
<pre><code>status=ok
echo $status
ok
</code></pre>
<p>now we want to verify if variables with regex will match</p>
<p>as the following</p>
<pre><code>[[ $status =~ [OK] ]] && echo "is the same"
[[ $status =~ OK ]] && echo "is the same"
[[ $stat... | we set the following variables ``` status=ok echo $status ok ``` now we want to verify if variables with regex will match as the following ``` [[ $status =~ [OK] ]] && echo "is the same" [[ $status =~ OK ]] && echo "is the same" [[ $status =~ "OK" ]] && echo "is the same" ``` but any of the above not print "is the same... | 8 | 4,690 | 3 | 0 | 0 | [
"<bash><regular-expression>"
] | 2020-11-10T19:00:59.340 | 2020-11-12T08:35:45.310 | null | 618,966 | [
{
"id": 618966,
"body": "<p><code>[OK]</code> Will match either character within the brackets, the brackets do not tell it to be case insensitive.</p>\n<p>You could do:</p>\n<pre><code>[[ "$status" =~ ^[Oo][Kk]$ ]]\n</code></pre>\n<p>or I would probably do the following:</p>\n<pre><code>[[ "$... | `[OK]` Will match either character within the brackets, the brackets do not tell it to be case insensitive. You could do: ``` [[ "$status" =~ ^[Oo][Kk]$ ]] ``` or I would probably do the following: ``` [[ "${status,,}" == ok ]] ``` The `,,` operator for parameter expansion will convert the entire variable to lowercase ... | # How do I match both upper and lower case letters using regex in bash?
**Tags:** <bash><regular-expression>
**Question (score 8):**
we set the following variables ``` status=ok echo $status ok ``` now we want to verify if variables with regex will match as the following ``` [[ $status =~ [OK] ]] && echo "is the sam... | 3,431 | 857 | {
"source": "stackexchange-archive.org",
"license": "CC BY-SA 4.0",
"dump_version": "2021-12-07",
"extraction_date": "2026-07-02T12:57:40Z",
"parser_version": "stackexchange-streaming-v1.0",
"site_name": "unix.stackexchange.com",
"original_7z_url": "https://archive.org/download/stack-exchange-2021-12-07/u... |
619,068 | unix.stackexchange.com | The difference between ip link down and physical link absence | <p>In Linux, is there any difference between <em><strong>after-<code>ip link down</code>-condition</strong></em> and <em><strong>real link absence</strong></em> (e.g. the switch's port burned down, or someone tripped over a wire).<br />
By difference I mean some signs in the system that can be used to distinguish these... | In Linux, is there any difference between after-`ip link down`-condition and real link absence (e.g. the switch's port burned down, or someone tripped over a wire). By difference I mean some signs in the system that can be used to distinguish these two conditions. E.g. will routing table be identical in these two cases... | 11 | 3,802 | 2 | 1 | 3 | [
"<linux><networking><network-interface><ethernet><iproute>"
] | 2020-11-11T12:09:42.973 | 2020-11-24T08:53:50.357 | 165,555 | 619,084 | [
{
"id": 619084,
"body": "<p>There are difference between an interface which is administratively <em>up</em> but disconnected or administratively <em>down</em>.</p>\n<h2>Disconnected</h2>\n<p>The interface gets a <em>carrier down</em> status. Its proper handling might depend on the driver for the interface a... | There are difference between an interface which is administratively up but disconnected or administratively down. ## Disconnected The interface gets a carrier down status. Its proper handling might depend on the driver for the interface and the kernel version. Normally it's available with `ip link show`. For example wi... | # The difference between ip link down and physical link absence
**Tags:** <linux><networking><network-interface><ethernet><iproute>
**Question (score 11):**
In Linux, is there any difference between after-`ip link down`-condition and real link absence (e.g. the switch's port burned down, or someone tripped over a wi... | 6,201 | 1,550 | {
"source": "stackexchange-archive.org",
"license": "CC BY-SA 4.0",
"dump_version": "2021-12-07",
"extraction_date": "2026-07-02T12:57:40Z",
"parser_version": "stackexchange-streaming-v1.0",
"site_name": "unix.stackexchange.com",
"original_7z_url": "https://archive.org/download/stack-exchange-2021-12-07/u... |
619,397 | unix.stackexchange.com | Necessity of sudo while installing with dnf | <p>I'm using Fedora 33. I'm confused by probably a simple fact.</p>
<p>If I try to run a program which isn't installed, dnf will search repos and suggest to install it. If I answer yes, it will be installed and I'm able to use it normally.</p>
<p>If I were to try and install that software (<code>dnf install <package... | I'm using Fedora 33. I'm confused by probably a simple fact. If I try to run a program which isn't installed, dnf will search repos and suggest to install it. If I answer yes, it will be installed and I'm able to use it normally. If I were to try and install that software (`dnf install <package>`), I would be asked for... | 6 | 1,059 | 2 | 0 | 0 | [
"<sudo><root><dnf>"
] | 2020-11-13T05:24:01.957 | 2020-11-13T06:23:15.657 | 311,476 | 619,404 | [
{
"id": 619404,
"body": "<p>In the scenario you describe, "you" are not installing the package that is installed - the <a href=\"https://www.freedesktop.org/software/PackageKit/pk-intro.html\" rel=\"noreferrer\">PackageKit</a> service (which is already running as root) is doing the installation on... | In the scenario you describe, "you" are not installing the package that is installed - the PackageKit (https://www.freedesktop.org/software/PackageKit/pk-intro.html) service (which is already running as root) is doing the installation on your behalf. The PackageKit uses PolicyKit to determine who is or is not allowed t... | # Necessity of sudo while installing with dnf
**Tags:** <sudo><root><dnf>
**Question (score 6):**
I'm using Fedora 33. I'm confused by probably a simple fact. If I try to run a program which isn't installed, dnf will search repos and suggest to install it. If I answer yes, it will be installed and I'm able to use it... | 3,757 | 939 | {
"source": "stackexchange-archive.org",
"license": "CC BY-SA 4.0",
"dump_version": "2021-12-07",
"extraction_date": "2026-07-02T12:57:40Z",
"parser_version": "stackexchange-streaming-v1.0",
"site_name": "unix.stackexchange.com",
"original_7z_url": "https://archive.org/download/stack-exchange-2021-12-07/u... |
619,477 | unix.stackexchange.com | Is there a reasonble way to increase the file name limitation of 255 bytes? | <p>It seems that the file name length limitation is 255 "characters" on Windows (NTFS), but 255 "bytes" on Linux (ext4, BTRFS). I am not sure what text encoding those file systems use for file names, but if it is UTF-8, one Asian character, such as Japanese, could take 3 or more bytes. So, for Engli... | It seems that the file name length limitation is 255 "characters" on Windows (NTFS), but 255 "bytes" on Linux (ext4, BTRFS). I am not sure what text encoding those file systems use for file names, but if it is UTF-8, one Asian character, such as Japanese, could take 3 or more bytes. So, for English, 255 bytes means 255... | 6 | 836 | 2 | 0 | 1 | [
"<filesystems><filenames>"
] | 2020-11-13T14:59:56.873 | 2020-11-13T15:22:47.773 | 379,327 | 619,492 | [
{
"id": 619492,
"body": "<p>While glibc defines <code>#define FILENAME_MAX 4096</code> on Linux which limits path length to 4096 bytes there's a hard 255 bytes limit in Linux VFS which all filesystems must conform to. The said limit is defined in <code>/usr/include/linux/limits.h</code>:</p>\n<pre class=\"l... | While glibc defines `#define FILENAME_MAX 4096` on Linux which limits path length to 4096 bytes there's a hard 255 bytes limit in Linux VFS which all filesystems must conform to. The said limit is defined in `/usr/include/linux/limits.h`: ``` /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX... | # Is there a reasonble way to increase the file name limitation of 255 bytes?
**Tags:** <filesystems><filenames>
**Question (score 6):**
It seems that the file name length limitation is 255 "characters" on Windows (NTFS), but 255 "bytes" on Linux (ext4, BTRFS). I am not sure what text encoding those file systems use... | 2,935 | 733 | {
"source": "stackexchange-archive.org",
"license": "CC BY-SA 4.0",
"dump_version": "2021-12-07",
"extraction_date": "2026-07-02T12:57:40Z",
"parser_version": "stackexchange-streaming-v1.0",
"site_name": "unix.stackexchange.com",
"original_7z_url": "https://archive.org/download/stack-exchange-2021-12-07/u... |
619,625 | unix.stackexchange.com | To what extent does Linux support file names longer than 255 bytes? | <p>I <a href="https://unix.stackexchange.com/questions/619477/is-there-a-reasonble-way-to-increase-the-file-name-limitation-of-255-bytes">asked about Linux's 255-byte file name limitation</a> yesterday, and the answer was that it is a limitation that cannot/will not be easily changed. But I remembered that most Linux s... | I asked about Linux's 255-byte file name limitation (https://unix.stackexchange.com/questions/619477/is-there-a-reasonble-way-to-increase-the-file-name-limitation-of-255-bytes) yesterday, and the answer was that it is a limitation that cannot/will not be easily changed. But I remembered that most Linux supports NTFS, w... | 28 | 5,101 | 5 | 4 | 6 | [
"<filesystems>"
] | 2020-11-14T16:34:49.643 | 2020-11-16T13:11:08.200 | 379,327 | 619,646 | [
{
"id": 619646,
"body": "<p>The answer, as often, is “it depends”.</p>\n<p>Looking at the NTFS implementation in particular, it reports a maximum file name length of 255 to <a href=\"https://www.man7.org/linux/man-pages/man3/statvfs.3.html\" rel=\"noreferrer\"><code>statvfs</code></a> callers, so callers wh... | The answer, as often, is “it depends”. Looking at the NTFS implementation in particular, it reports a maximum file name length of 255 to `statvfs` (https://www.man7.org/linux/man-pages/man3/statvfs.3.html) callers, so callers which interpret that as a 255-byte limit might pre-emptively avoid file names which would be v... | # To what extent does Linux support file names longer than 255 bytes?
**Tags:** <filesystems>
**Question (score 28):**
I asked about Linux's 255-byte file name limitation (https://unix.stackexchange.com/questions/619477/is-there-a-reasonble-way-to-increase-the-file-name-limitation-of-255-bytes) yesterday, and the an... | 11,269 | 2,817 | {
"source": "stackexchange-archive.org",
"license": "CC BY-SA 4.0",
"dump_version": "2021-12-07",
"extraction_date": "2026-07-02T12:57:40Z",
"parser_version": "stackexchange-streaming-v1.0",
"site_name": "unix.stackexchange.com",
"original_7z_url": "https://archive.org/download/stack-exchange-2021-12-07/u... |
619,658 | unix.stackexchange.com | readlink -f and -e option description not clear | <pre><code>-f, --canonicalize
canonicalize by following every symlink in every component of the given name recursively; all but the last component must exist
-e, --canonicalize-existing
canonicalize by following every symlink in every component of the given name recursively, all components must exist
</code></pre>
<p>I... | ``` -f, --canonicalize canonicalize by following every symlink in every component of the given name recursively; all but the last component must exist -e, --canonicalize-existing canonicalize by following every symlink in every component of the given name recursively, all components must exist ``` I am not able to unde... | 5 | 266 | 2 | 6 | 0 | [
"<linux><symlink><readlink>"
] | 2020-11-14T22:17:13.027 | 2020-11-15T02:16:53.790 | 402,997 | 619,666 | [
{
"id": 619666,
"body": "<p>First component here means an element of the path.\nExample :</p>\n<pre><code>/home/user/.ssh => <component1>/<component2>/<component3>\n</code></pre>\n<p>1- Suppose we have a directories structure like this :</p>\n<pre><code>lols\n├── lol\n├── lol1 -> lol... | First component here means an element of the path. Example : ``` /home/user/.ssh => // ``` 1- Suppose we have a directories structure like this : ``` lols ├── lol ├── lol1 -> lol └── lol2 -> lol1 ``` And also the non-existent directory here will be lols/lol3 So you can compare the output of each command : ``` readlink ... | # readlink -f and -e option description not clear
**Tags:** <linux><symlink><readlink>
**Question (score 5):**
``` -f, --canonicalize canonicalize by following every symlink in every component of the given name recursively; all but the last component must exist -e, --canonicalize-existing canonicalize by following e... | 4,150 | 1,037 | {
"source": "stackexchange-archive.org",
"license": "CC BY-SA 4.0",
"dump_version": "2021-12-07",
"extraction_date": "2026-07-02T12:57:40Z",
"parser_version": "stackexchange-streaming-v1.0",
"site_name": "unix.stackexchange.com",
"original_7z_url": "https://archive.org/download/stack-exchange-2021-12-07/u... |
619,967 | unix.stackexchange.com | A set of paragraphs of 4 lines to manage with AWK | <p>I have a file composed of several paragraphs (more than 2000) of 4 lines.
For each paragraph, I need to match the content between brackets like the example below.</p>
<p>So for each paragraph,</p>
<ul>
<li>the entries are the first two lines.</li>
<li>for the third line, the current content between the brackets is r... | I have a file composed of several paragraphs (more than 2000) of 4 lines. For each paragraph, I need to match the content between brackets like the example below. So for each paragraph, - the entries are the first two lines. - for the third line, the current content between the brackets is replaced by the content betwe... | 5 | 211 | 6 | 0 | 0 | [
"<text-processing><awk><sed>"
] | 2020-11-16T19:42:27.953 | 2020-11-18T10:40:34.163 | 442,259 | 619,977 | [
{
"id": 619977,
"body": "<pre><code>awk -F[][] -vOFS= '++i==1 {a=$2} i==2 {b=$2} i==3 {$2="[" b "]"} i==4 {$2="[" a "]"} !NF {i=0} 1' input.txt\n</code></pre>\n<p>With square brackets as the field separators, your replacement sources/targets are in <code>$2</code>.</p... | ``` awk -F[][] -vOFS= '++i==1 {a=$2} i==2 {b=$2} i==3 {$2="[" b "]"} i==4 {$2="[" a "]"} !NF {i=0} 1' input.txt ``` With square brackets as the field separators, your replacement sources/targets are in `$2`. We increment `i` on each line, and reset it to zero between paragraphs. The value of `i` (1 though 4) tells us w... | # A set of paragraphs of 4 lines to manage with AWK
**Tags:** <text-processing><awk><sed>
**Question (score 5):**
I have a file composed of several paragraphs (more than 2000) of 4 lines. For each paragraph, I need to match the content between brackets like the example below. So for each paragraph, - the entries are... | 1,364 | 341 | {
"source": "stackexchange-archive.org",
"license": "CC BY-SA 4.0",
"dump_version": "2021-12-07",
"extraction_date": "2026-07-02T12:57:40Z",
"parser_version": "stackexchange-streaming-v1.0",
"site_name": "unix.stackexchange.com",
"original_7z_url": "https://archive.org/download/stack-exchange-2021-12-07/u... |
620,071 | unix.stackexchange.com | What is the point of uniq -u and what does it do? | <p><code>uniq</code> seems to do something different than <code>uniq -u</code>, even though the description for both is "only unique lines".</p>
<p>What's the difference here, what do they do?</p>
| `uniq` seems to do something different than `uniq -u`, even though the description for both is "only unique lines". What's the difference here, what do they do? | 14 | 2,181 | 3 | 2 | 1 | [
"<uniq>"
] | 2020-11-17T12:13:03.170 | 2020-11-17T12:27:00.237 | 442,348 | 620,073 | [
{
"id": 620073,
"body": "<p>This ought to be easy to test:</p>\n<pre class=\"lang-none prettyprint-override\"><code>$ cat file\n1\n2\n3\n3\n4\n4\n</code></pre>\n<pre class=\"lang-none prettyprint-override\"><code>$ uniq file\n1\n2\n3\n4\n</code></pre>\n<pre class=\"lang-none prettyprint-override\"><code>$ u... | This ought to be easy to test: ``` $ cat file 1 2 3 3 4 4 ``` ``` $ uniq file 1 2 3 4 ``` ``` $ uniq -u file 1 2 ``` In short, `uniq` with no options removes all but one instance of consecutively duplicated lines. The GNU `uniq` manual formulates that as With no options, matching lines are merged to the first occurrenc... | # What is the point of uniq -u and what does it do?
**Tags:** <uniq>
**Question (score 14):**
`uniq` seems to do something different than `uniq -u`, even though the description for both is "only unique lines". What's the difference here, what do they do?
### Answer (score 37 · accepted)
This ought to be easy to tes... | 3,811 | 952 | {
"source": "stackexchange-archive.org",
"license": "CC BY-SA 4.0",
"dump_version": "2021-12-07",
"extraction_date": "2026-07-02T12:57:40Z",
"parser_version": "stackexchange-streaming-v1.0",
"site_name": "unix.stackexchange.com",
"original_7z_url": "https://archive.org/download/stack-exchange-2021-12-07/u... |
620,586 | unix.stackexchange.com | Should I use 1,15 or */15 in crontab to run a command every 15 days? | <p>As I know crontab has those fields, starting by left to right.</p>
<pre><code>1 minutes 0-59
2 hours 0-23
3 days of month 0-31
4 month 1-12
5 day of the week 0-6
6 command
</code></pre>
<p>I want to run foo command every 15 days at 15:30
This is correct because run command 1 and 15 of the month
month has... | As I know crontab has those fields, starting by left to right. ``` 1 minutes 0-59 2 hours 0-23 3 days of month 0-31 4 month 1-12 5 day of the week 0-6 6 command ``` I want to run foo command every 15 days at 15:30 This is correct because run command 1 and 15 of the month month has 30 days(31 some) so is run every 15 da... | 11 | 1,672 | 1 | 5 | 1 | [
"<cron>"
] | 2020-11-20T05:50:13.587 | 2020-11-21T05:14:56.647 | 80,389 | 620,589 | [
{
"id": 620589,
"body": "<p>This syntax <code>30 15 */15 * *</code> is correct, but it is not doing the same with this <code>30 15 1,15 * *</code>.</p>\n<p>The latter will execute command at <code>1st</code> and <code>15th</code> of the month, as it has fixed comma separated values for the "day of mont... | This syntax `30 15 */15 * *` is correct, but it is not doing the same with this `30 15 1,15 * *`. The latter will execute command at `1st` and `15th` of the month, as it has fixed comma separated values for the "day of month" field. The `/` defines steps, that means `*/15` will execute every `15` days, starting from `1... | # Should I use 1,15 or */15 in crontab to run a command every 15 days?
**Tags:** <cron>
**Question (score 11):**
As I know crontab has those fields, starting by left to right. ``` 1 minutes 0-59 2 hours 0-23 3 days of month 0-31 4 month 1-12 5 day of the week 0-6 6 command ``` I want to run foo command every 15 days... | 1,734 | 433 | {
"source": "stackexchange-archive.org",
"license": "CC BY-SA 4.0",
"dump_version": "2021-12-07",
"extraction_date": "2026-07-02T12:57:40Z",
"parser_version": "stackexchange-streaming-v1.0",
"site_name": "unix.stackexchange.com",
"original_7z_url": "https://archive.org/download/stack-exchange-2021-12-07/u... |
620,602 | unix.stackexchange.com | Finetuning kernel for high swap environment | <p>I own an 8GB RAM Dell XPS13 9343; the amount of RAM is the biggest pain of this computer, it's soldered on mainboard. Despite the CPU supporting more RAM, even resoldering bigger ones with firmware modification is not an option due to the mainboard design. So make this computer still useful, I replaced M.2 SATA disk... | I own an 8GB RAM Dell XPS13 9343; the amount of RAM is the biggest pain of this computer, it's soldered on mainboard. Despite the CPU supporting more RAM, even resoldering bigger ones with firmware modification is not an option due to the mainboard design. So make this computer still useful, I replaced M.2 SATA disk wi... | 6 | 545 | 4 | 2 | 1 | [
"<ubuntu><swap><kernel-panic><kernel-parameters>"
] | 2020-11-20T08:26:41.587 | 2020-12-06T15:02:12.663 | 319,186 | null | [
{
"id": 620611,
"body": "<p>Swap will always be a very inefficient and there isn't really much you can do about that. There are two options you might try: <a href=\"https://wiki.gentoo.org/wiki/Zram\" rel=\"noreferrer\">zram</a> and <a href=\"https://wiki.archlinux.org/index.php/zswap\" rel=\"noreferrer\">z... | Swap will always be a very inefficient and there isn't really much you can do about that. There are two options you might try: zram (https://wiki.gentoo.org/wiki/Zram) and zswap (https://wiki.archlinux.org/index.php/zswap). Both use RAM to make swap a little more usable. Zram allows you to create a swap from your memor... | # Finetuning kernel for high swap environment
**Tags:** <ubuntu><swap><kernel-panic><kernel-parameters>
**Question (score 6):**
I own an 8GB RAM Dell XPS13 9343; the amount of RAM is the biggest pain of this computer, it's soldered on mainboard. Despite the CPU supporting more RAM, even resoldering bigger ones with ... | 3,484 | 871 | {
"source": "stackexchange-archive.org",
"license": "CC BY-SA 4.0",
"dump_version": "2021-12-07",
"extraction_date": "2026-07-02T12:57:40Z",
"parser_version": "stackexchange-streaming-v1.0",
"site_name": "unix.stackexchange.com",
"original_7z_url": "https://archive.org/download/stack-exchange-2021-12-07/u... |
620,825 | unix.stackexchange.com | How to extract multiple values from a file in a single pass? | <p>I have a huge log file (about 6GB) from a simulation. Among the millions of lines in that file, there are two lines that are frequently repeating for a given time:</p>
<pre><code>...
Max value of omega = 3.0355
Time = 0.000001
....
Max value of omega = 4.3644
Time = 0.000013
...
Max value of omega = 3.7319
Time = 0.... | I have a huge log file (about 6GB) from a simulation. Among the millions of lines in that file, there are two lines that are frequently repeating for a given time: ``` ... Max value of omega = 3.0355 Time = 0.000001 .... Max value of omega = 4.3644 Time = 0.000013 ... Max value of omega = 3.7319 Time = 0.000025 ... ...... | 6 | 1,396 | 6 | 0 | 0 | [
"<text-processing><awk><sed>"
] | 2020-11-21T13:36:20.333 | 2020-11-21T14:59:33.010 | 429,557 | 620,833 | [
{
"id": 620833,
"body": "<pre><code>sed -n '/^Max/ { s/^.*=\\s*//;h; };\n /^Time/{ s/^.*=\\s*//;G; s/\\n/ /;p; }' infile\n</code></pre>\n<ul>\n<li><p>match-run syntax <code>/.../{ ... }</code>:<br />\ncommands within <code>{...}</code> will only run on the lines that matched with regex/pattern within... | ``` sed -n '/^Max/ { s/^.*=\s*//;h; }; /^Time/{ s/^.*=\s*//;G; s/\n/ /;p; }' infile ``` - match-run syntax `/.../{ ... }`: commands within `{...}` will only run on the lines that matched with regex/pattern within `/.../`; - `s/^.*=\s*//`: deletes everything up-to last `=` and whitespaces `\s*` also if there was any. - ... | # How to extract multiple values from a file in a single pass?
**Tags:** <text-processing><awk><sed>
**Question (score 6):**
I have a huge log file (about 6GB) from a simulation. Among the millions of lines in that file, there are two lines that are frequently repeating for a given time: ``` ... Max value of omega =... | 2,926 | 731 | {
"source": "stackexchange-archive.org",
"license": "CC BY-SA 4.0",
"dump_version": "2021-12-07",
"extraction_date": "2026-07-02T12:57:40Z",
"parser_version": "stackexchange-streaming-v1.0",
"site_name": "unix.stackexchange.com",
"original_7z_url": "https://archive.org/download/stack-exchange-2021-12-07/u... |
620,944 | unix.stackexchange.com | Why do some Linux utilities output Unicode (when it is not expected)? | <p>While building a tool that reads command output I realized that some Linux utilities output Unicode characters when I didn't really expect them to do so. For instance, <code>find</code> uses <code>‘</code> (as opposed to the ASCII <code>'</code>) as a quote character in its error output:</p>
<pre><code>~ > find /... | While building a tool that reads command output I realized that some Linux utilities output Unicode characters when I didn't really expect them to do so. For instance, `find` uses `‘` (as opposed to the ASCII `'`) as a quote character in its error output: ``` ~ > find /root /root find: ‘/root’: Permission denied ``` Th... | 8 | 525 | 1 | 4 | 1 | [
"<locale><unicode><utilities>"
] | 2020-11-22T08:35:01.527 | 2020-11-24T08:54:40.277 | 443,083 | 620,950 | [
{
"id": 620950,
"body": "<p>It has everything to do with your system locale as it describes how utilities should output locale specific symbols and their combinations, e.g. <code>‘’</code> instead of <code>""</code>.</p>\n<p>If you don't want this, use a different locale, e.g. <code>C</code> which... | It has everything to do with your system locale as it describes how utilities should output locale specific symbols and their combinations, e.g. `‘’` instead of `""`. If you don't want this, use a different locale, e.g. `C` which is as standard and pristine as possible: ``` $ LC_CTYPE=C find /root /root find: '/root': ... | # Why do some Linux utilities output Unicode (when it is not expected)?
**Tags:** <locale><unicode><utilities>
**Question (score 8):**
While building a tool that reads command output I realized that some Linux utilities output Unicode characters when I didn't really expect them to do so. For instance, `find` uses `‘... | 1,247 | 311 | {
"source": "stackexchange-archive.org",
"license": "CC BY-SA 4.0",
"dump_version": "2021-12-07",
"extraction_date": "2026-07-02T12:57:40Z",
"parser_version": "stackexchange-streaming-v1.0",
"site_name": "unix.stackexchange.com",
"original_7z_url": "https://archive.org/download/stack-exchange-2021-12-07/u... |
621,004 | unix.stackexchange.com | Bash getopts, mandatory arguments | <p>I am working with a pretty simple bash script, but I am facing a problem which I can't resolve:</p>
<p>I have <code>myscript.sh</code> with three parameters, <code>-u</code>, <code>-h</code>, and <code>-p</code>.
Both <code>-u</code> and<code> -h</code> are mandatory, needed for the script to run.</p>
<p>What I woul... | I am working with a pretty simple bash script, but I am facing a problem which I can't resolve: I have `myscript.sh` with three parameters, `-u`, `-h`, and `-p`. Both `-u` and` -h` are mandatory, needed for the script to run. What I would like to do is, if `myscript.sh -u User1` and nothing more it should terminate wit... | 5 | 6,428 | 1 | 1 | 0 | [
"<bash><scripting><arguments><getopts>"
] | 2020-11-22T17:00:52.940 | 2020-11-22T17:46:54.300 | 439,108 | 621,007 | [
{
"id": 621007,
"body": "<p>Maybe something like this?</p>\n<pre class=\"lang-bsh prettyprint-override\"><code>#!/bin/bash\n\nunset host\nunset port\nunset user\n\nwhile getopts h:p:u: opt; do\n case $opt in\n h) host=$OPTARG ;;\n p) port=$OPTARG ;;\n u) u... | Maybe something like this? ``` #!/bin/bash unset host unset port unset user while getopts h:p:u: opt; do case $opt in h) host=$OPTARG ;; p) port=$OPTARG ;; u) user=$OPTARG ;; *) echo 'Error in command line parsing' >&2 exit 1 esac done shift "$(( OPTIND - 1 ))" if [ -z "$host" ] || [ -z "$user" ]; then echo 'Missing -h... | # Bash getopts, mandatory arguments
**Tags:** <bash><scripting><arguments><getopts>
**Question (score 5):**
I am working with a pretty simple bash script, but I am facing a problem which I can't resolve: I have `myscript.sh` with three parameters, `-u`, `-h`, and `-p`. Both `-u` and` -h` are mandatory, needed for th... | 2,269 | 567 | {
"source": "stackexchange-archive.org",
"license": "CC BY-SA 4.0",
"dump_version": "2021-12-07",
"extraction_date": "2026-07-02T12:57:40Z",
"parser_version": "stackexchange-streaming-v1.0",
"site_name": "unix.stackexchange.com",
"original_7z_url": "https://archive.org/download/stack-exchange-2021-12-07/u... |
621,124 | unix.stackexchange.com | How to pass all arguments of a function along to another command? | <p>Hello I have this in my <code>~/.bash_profile</code></p>
<pre><code>export GOPATH="$HOME/go_projects"
export GOBIN="$GOPATH/bin"
program(){
$GOBIN/program $1
}
</code></pre>
<p>so I'm able to do <code>program "-p hello_world -tSu"</code>. Is there any way to run the program and... | Hello I have this in my `~/.bash_profile` ``` export GOPATH="$HOME/go_projects" export GOBIN="$GOPATH/bin" program(){ $GOBIN/program $1 } ``` so I'm able to do `program "-p hello_world -tSu"`. Is there any way to run the program and custom flags without using the quotation marks? if I do just `program -p hello_world -t... | 5 | 3,593 | 2 | 6 | 1 | [
"<bash><function><parameter>"
] | 2020-11-23T12:21:30.900 | 2020-11-24T11:09:56.150 | 443,247 | 621,125 | [
{
"id": 621125,
"body": "<p>Within your <code>program</code> shell function, use <code>"$@"</code> to refer to the list of all command line arguments given to the function. With the quotes, each command line argument given to <code>program</code> would additionally be individually quoted (you gen... | Within your `program` shell function, use `"$@"` to refer to the list of all command line arguments given to the function. With the quotes, each command line argument given to `program` would additionally be individually quoted (you generally want this). ``` program () { "$GOBIN"/program "$@" } ``` You would then call ... | # How to pass all arguments of a function along to another command?
**Tags:** <bash><function><parameter>
**Question (score 5):**
Hello I have this in my `~/.bash_profile` ``` export GOPATH="$HOME/go_projects" export GOBIN="$GOPATH/bin" program(){ $GOBIN/program $1 } ``` so I'm able to do `program "-p hello_world -t... | 2,211 | 552 | {
"source": "stackexchange-archive.org",
"license": "CC BY-SA 4.0",
"dump_version": "2021-12-07",
"extraction_date": "2026-07-02T12:57:40Z",
"parser_version": "stackexchange-streaming-v1.0",
"site_name": "unix.stackexchange.com",
"original_7z_url": "https://archive.org/download/stack-exchange-2021-12-07/u... |
621,180 | unix.stackexchange.com | Where should small utility programs store their preferences? | <p>I have several utility programs that do not have their own directory and are just a single executable. Typically I put the binary in /usr/local/bin. A problem I have is how to manage preference settings.</p>
<p>One idea is to use environment variables and require the user to define such variables, for example, in th... | I have several utility programs that do not have their own directory and are just a single executable. Typically I put the binary in /usr/local/bin. A problem I have is how to manage preference settings. One idea is to use environment variables and require the user to define such variables, for example, in their bash.r... | 21 | 3,073 | 4 | 7 | 1 | [
"<file-management>"
] | 2020-11-23T18:26:00.993 | 2020-11-24T09:35:40.427 | 47,542 | 621,223 | [
{
"id": 621223,
"body": "<p>Small utilities for interactive desktop use would be expected to follow the <a href=\"https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html\" rel=\"noreferrer\">XDG Base Directory Specification</a> and keep their config files under</p>\n<pre><code>$XDG_CONF... | Small utilities for interactive desktop use would be expected to follow the XDG Base Directory Specification (https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html) and keep their config files under ``` $XDG_CONFIG_HOME ``` or (if that is empty or unset) default to ``` $HOME/.config ``` The pictu... | # Where should small utility programs store their preferences?
**Tags:** <file-management>
**Question (score 21):**
I have several utility programs that do not have their own directory and are just a single executable. Typically I put the binary in /usr/local/bin. A problem I have is how to manage preference setting... | 2,358 | 589 | {
"source": "stackexchange-archive.org",
"license": "CC BY-SA 4.0",
"dump_version": "2021-12-07",
"extraction_date": "2026-07-02T12:57:40Z",
"parser_version": "stackexchange-streaming-v1.0",
"site_name": "unix.stackexchange.com",
"original_7z_url": "https://archive.org/download/stack-exchange-2021-12-07/u... |
621,327 | unix.stackexchange.com | xargs | Use input as command | <p>I would have assumed that following examples work perfectly fine.</p>
<pre><code>$ which -a python python3 pip | xargs -I {} {} --version
No '{}' such file or folder
$ which -a python python3 pip | xargs -I _ _ --version
No '_' such file or folder
$ which -a python python3 pip | xargs -I py py --version
No 'py' such... | I would have assumed that following examples work perfectly fine. ``` $ which -a python python3 pip | xargs -I {} {} --version No '{}' such file or folder $ which -a python python3 pip | xargs -I _ _ --version No '_' such file or folder $ which -a python python3 pip | xargs -I py py --version No 'py' such file or folde... | 5 | 318 | 1 | 2 | 0 | [
"<shell><xargs><fish>"
] | 2020-11-24T15:56:51.523 | 2020-11-24T16:19:05.853 | 159,858 | 621,331 | [
{
"id": 621331,
"body": "<p>In <code>xargs -I replstr utility arguments</code>, <a href=\"https://pubs.opengroup.org/onlinepubs/9699919799.2018edition/utilities/xargs.html\" rel=\"noreferrer\">POSIX requires</a> that the <code>replstr</code> be only substituted in the <code>arguments</code>, not <code>utili... | In `xargs -I replstr utility arguments`, POSIX requires (https://pubs.opengroup.org/onlinepubs/9699919799.2018edition/utilities/xargs.html) that the `replstr` be only substituted in the `arguments`, not `utility`. GNU `xargs` is compliant in that regard (busybox `xargs` is not). To work around it, you can use `env` as ... | # xargs | Use input as command
**Tags:** <shell><xargs><fish>
**Question (score 5):**
I would have assumed that following examples work perfectly fine. ``` $ which -a python python3 pip | xargs -I {} {} --version No '{}' such file or folder $ which -a python python3 pip | xargs -I _ _ --version No '_' such file or f... | 2,569 | 642 | {
"source": "stackexchange-archive.org",
"license": "CC BY-SA 4.0",
"dump_version": "2021-12-07",
"extraction_date": "2026-07-02T12:57:40Z",
"parser_version": "stackexchange-streaming-v1.0",
"site_name": "unix.stackexchange.com",
"original_7z_url": "https://archive.org/download/stack-exchange-2021-12-07/u... |
621,336 | unix.stackexchange.com | Awk seems to be confused what $1 is | <p>I use awk a fair bit for parsing logs; I have never seen anything like this:
I have six file containing a number of lines; I want the ones containing "100", and to choose which columns to print</p>
<pre><code>me:~/tmp> grep 100 *.dl.tst
</code></pre>
<p>outputs what I expect:</p>
<pre><code>100 139M 1... | I use awk a fair bit for parsing logs; I have never seen anything like this: I have six file containing a number of lines; I want the ones containing "100", and to choose which columns to print ``` me:~/tmp> grep 100 *.dl.tst ``` outputs what I expect: ``` 100 139M 100 139M 0 0 6376k 0 0:00:22 0:00:22 --:--:-- 6539k 10... | 9 | 1,127 | 2 | 7 | 1 | [
"<awk>"
] | 2020-11-24T16:36:31.007 | 2020-11-24T16:53:11.593 | 428,183 | 621,340 | [
{
"id": 621340,
"body": "<p>Those files contain the output from <code>curl</code> downloading files, and <code>curl</code> updates its progress information during downloads by outputting a carriage return (commonly represented as <code>\\r</code>, the escape used to produce it in a number of contexts), whic... | Those files contain the output from `curl` downloading files, and `curl` updates its progress information during downloads by outputting a carriage return (commonly represented as `\r`, the escape used to produce it in a number of contexts), which causes the cursor to return to the start of the line. When you run `grep... | # Awk seems to be confused what $1 is
**Tags:** <awk>
**Question (score 9):**
I use awk a fair bit for parsing logs; I have never seen anything like this: I have six file containing a number of lines; I want the ones containing "100", and to choose which columns to print ``` me:~/tmp> grep 100 *.dl.tst ``` outputs w... | 4,570 | 1,142 | {
"source": "stackexchange-archive.org",
"license": "CC BY-SA 4.0",
"dump_version": "2021-12-07",
"extraction_date": "2026-07-02T12:57:40Z",
"parser_version": "stackexchange-streaming-v1.0",
"site_name": "unix.stackexchange.com",
"original_7z_url": "https://archive.org/download/stack-exchange-2021-12-07/u... |
621,523 | unix.stackexchange.com | How does Linux retain control of the CPU on a single-core machine? | <p>In <em><a href="https://unix.stackexchange.com/questions/111625/how-does-linux-kill-a-process">How does Linux “kill” a process?</a></em> it is explained that Linux kills a process by returning its memory to the pool.</p>
<p>On a single-core machine, how does it actually do this? It must require CPU time to kill a pr... | In How does Linux “kill” a process? (https://unix.stackexchange.com/questions/111625/how-does-linux-kill-a-process) it is explained that Linux kills a process by returning its memory to the pool. On a single-core machine, how does it actually do this? It must require CPU time to kill a process, and if that process is d... | 13 | 3,958 | 4 | 1 | 1 | [
"<linux><process>"
] | 2020-11-25T15:07:16.243 | 2020-11-27T09:33:45.990 | 134,585 | 621,529 | [
{
"id": 621529,
"body": "<p>The kernel gains control quite frequently in normal operations: whenever a process calls a system call, and whenever an interrupt occurs. Interrupts happen when hardware wants the CPU’s attention, or when the CPU wants the kernel’s attention, and one particular piece of hardware ... | The kernel gains control quite frequently in normal operations: whenever a process calls a system call, and whenever an interrupt occurs. Interrupts happen when hardware wants the CPU’s attention, or when the CPU wants the kernel’s attention, and one particular piece of hardware can be programmed to request attention p... | # How does Linux retain control of the CPU on a single-core machine?
**Tags:** <linux><process>
**Question (score 13):**
In How does Linux “kill” a process? (https://unix.stackexchange.com/questions/111625/how-does-linux-kill-a-process) it is explained that Linux kills a process by returning its memory to the pool. ... | 4,353 | 1,088 | {
"source": "stackexchange-archive.org",
"license": "CC BY-SA 4.0",
"dump_version": "2021-12-07",
"extraction_date": "2026-07-02T12:57:40Z",
"parser_version": "stackexchange-streaming-v1.0",
"site_name": "unix.stackexchange.com",
"original_7z_url": "https://archive.org/download/stack-exchange-2021-12-07/u... |
621,771 | unix.stackexchange.com | Fedora shows / mounted at the same location as home | <p>I have a fresh install of Fedora 33, with BTRFS.<br />
While installing it I created separate partitions for <code>/</code> and <code>/home</code>. But now the system (df, gparted) thinks that I have the same partition mounted in both:</p>
<pre><code>$ df -h
...
/dev/nvme0n1p2 850G 36G 814G 5% /
tmpfs ... | I have a fresh install of Fedora 33, with BTRFS. While installing it I created separate partitions for `/` and `/home`. But now the system (df, gparted) thinks that I have the same partition mounted in both: ``` $ df -h ... /dev/nvme0n1p2 850G 36G 814G 5% / tmpfs 32G 34M 32G 1% /tmp /dev/nvme0n1p2 850G 36G 814G 5% /hom... | 6 | 763 | 2 | 0 | 0 | [
"<fedora><partition><btrfs>"
] | 2020-11-27T11:32:50.310 | 2020-11-28T01:26:30.100 | 443,845 | 621,790 | [
{
"id": 621790,
"body": "<blockquote>\n<p>When I add a large file to /home, I see the used space increasing in both.</p>\n</blockquote>\n<p>This is how btrfs works. You have one partition formatted to btrfs and the filesystem itself is divided into multiple (in case of Fedora two) subvolumes. All the subvol... | When I add a large file to /home, I see the used space increasing in both. This is how btrfs works. You have one partition formatted to btrfs and the filesystem itself is divided into multiple (in case of Fedora two) subvolumes. All the subvolumes share the same space, that's why you see both `/` and `/home` having sam... | # Fedora shows / mounted at the same location as home
**Tags:** <fedora><partition><btrfs>
**Question (score 6):**
I have a fresh install of Fedora 33, with BTRFS. While installing it I created separate partitions for `/` and `/home`. But now the system (df, gparted) thinks that I have the same partition mounted in ... | 2,369 | 592 | {
"source": "stackexchange-archive.org",
"license": "CC BY-SA 4.0",
"dump_version": "2021-12-07",
"extraction_date": "2026-07-02T12:57:40Z",
"parser_version": "stackexchange-streaming-v1.0",
"site_name": "unix.stackexchange.com",
"original_7z_url": "https://archive.org/download/stack-exchange-2021-12-07/u... |
622,195 | unix.stackexchange.com | How do I use grep to find lines, in which any word occurs 3 times? | <p>I want to find the lines that contain any word three times. For this, I thought it would be best to use the <code>grep</code> command.</p>
<p>This was my attempt.</p>
<pre><code>grep '\(.*\)\{3\}' myfile.txt
</code></pre>
| I want to find the lines that contain any word three times. For this, I thought it would be best to use the `grep` command. This was my attempt. ``` grep '\(.*\)\{3\}' myfile.txt ``` | 5 | 1,091 | 5 | 3 | 1 | [
"<grep><regular-expression>"
] | 2020-11-30T12:46:36.037 | 2020-12-02T13:45:38.290 | 444,094 | 622,199 | [
{
"id": 622199,
"body": "<p>Using the standard word definition,</p>\n<ul>\n<li><p>GNU Grep, <strong>3 or more</strong> occurrences of <strong>any word</strong>.</p>\n<pre><code>grep -E '(\\W|^)(\\w+)\\W(.*\\<\\2\\>){2}' file\n</code></pre>\n</li>\n</ul>\n<hr />\n<ul>\n<li><p>GNU Grep, <strong>only 3</... | Using the standard word definition, - GNU Grep, 3 or more occurrences of any word. ``` grep -E '(\W|^)(\w+)\W(.*\){2}' file ``` - GNU Grep, only 3 occurrences of any word. ``` grep -E '(\W|^)(\w+)\W(.*\){2}' file | grep -Ev '(\W|^)(\w+)\W(.*\){3}' ``` - POSIX Awk, only 3 occurences of any word. ``` awk -F '[^_[:alnum:]... | # How do I use grep to find lines, in which any word occurs 3 times?
**Tags:** <grep><regular-expression>
**Question (score 5):**
I want to find the lines that contain any word three times. For this, I thought it would be best to use the `grep` command. This was my attempt. ``` grep '\(.*\)\{3\}' myfile.txt ```
###... | 3,586 | 896 | {
"source": "stackexchange-archive.org",
"license": "CC BY-SA 4.0",
"dump_version": "2021-12-07",
"extraction_date": "2026-07-02T12:57:40Z",
"parser_version": "stackexchange-streaming-v1.0",
"site_name": "unix.stackexchange.com",
"original_7z_url": "https://archive.org/download/stack-exchange-2021-12-07/u... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.