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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
634,152 | unix.stackexchange.com | What was the first file system in Linux distribution/s? | <p>What was the first file system in Linux distribution/s?<br>
The "parallel" to FAT (?) in Windows at the early nineties?</p>
<p>I want to know the name to read information about this; perhaps it was the same one utilized in Unix (<a href="https://en.wikipedia.org/wiki/Unix_filesystem#:%7E:text=In%20Unix%20a... | What was the first file system in Linux distribution/s? The "parallel" to FAT (?) in Windows at the early nineties? I want to know the name to read information about this; perhaps it was the same one utilized in Unix (Unix filesystem (https://en.wikipedia.org/wiki/Unix_filesystem#:%7E:text=In%20Unix%20and%20operating%2... | 11 | 505 | 1 | 0 | 1 | [
"<linux><filesystems><history>"
] | 2021-02-12T17:55:56.980 | 2021-02-12T18:26:59.847 | 455,844 | 634,153 | [
{
"id": 634153,
"body": "<p>Linux initially used <a href=\"https://en.wikipedia.org/wiki/MINIX_file_system\" rel=\"noreferrer\">the MINIX file system</a>, and very early distributions relied on that. <a href=\"https://en.wikipedia.org/wiki/Extended_file_system\" rel=\"noreferrer\">The extended file system</... | Linux initially used the MINIX file system (https://en.wikipedia.org/wiki/MINIX_file_system), and very early distributions relied on that. The extended file system (https://en.wikipedia.org/wiki/Extended_file_system) quickly took over, followed by Ext2 (https://en.wikipedia.org/wiki/Ext2) and xiafs (https://en.wikipedi... | # What was the first file system in Linux distribution/s?
**Tags:** <linux><filesystems><history>
**Question (score 11):**
What was the first file system in Linux distribution/s? The "parallel" to FAT (?) in Windows at the early nineties? I want to know the name to read information about this; perhaps it was the sam... | 1,068 | 267 | {
"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... |
634,315 | unix.stackexchange.com | Unzip thinks my zip file is a zip bomb | <p>I've been struggling with this for a couple days so I'm hoping someone on SE can help me.</p>
<p>I've downloaded a large file from Dropbox using wget (following command)</p>
<p><code>wget -O folder.zip https://www.dropbox.com/sh/.../.../dropboxfolder?dl=1</code></p>
<p>I'm sure it's a zip because 1), <code>file drop... | I've been struggling with this for a couple days so I'm hoping someone on SE can help me. I've downloaded a large file from Dropbox using wget (following command) `wget -O folder.zip https://www.dropbox.com/sh/.../.../dropboxfolder?dl=1` I'm sure it's a zip because 1), `file dropboxfolder.zip` yields `dropboxfolder.zip... | 8 | 9,319 | 4 | 4 | 1 | [
"<wget><zip><dropbox>"
] | 2021-02-13T18:20:57.153 | 2021-02-13T20:29:09.100 | 455,986 | null | [
{
"id": 657373,
"body": "<p>I had the exact same issue with <em>dropbox</em>, <em>wget</em> and <em>zip</em>.\nI used an alternative compressing tool and extracted the file with:</p>\n<pre><code>7z e file.zip\n</code></pre>\n",
"body_md": "I had the exact same issue with dropbox, wget and zip. I used an... | I had the exact same issue with dropbox, wget and zip. I used an alternative compressing tool and extracted the file with: ``` 7z e file.zip ``` | # Unzip thinks my zip file is a zip bomb
**Tags:** <wget><zip><dropbox>
**Question (score 8):**
I've been struggling with this for a couple days so I'm hoping someone on SE can help me. I've downloaded a large file from Dropbox using wget (following command) `wget -O folder.zip https://www.dropbox.com/sh/.../.../dro... | 1,576 | 394 | {
"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... |
634,364 | unix.stackexchange.com | grep output from long to wide | <p>I have a file of patterns and I want to return all the line numbers where the pattern was found, but in a wide format and not long/spread.
Example:</p>
<p>fileA.txt</p>
<pre><code>Germany
USA
UK
</code></pre>
<p>fileB.txt</p>
<pre><code>USA
USA
Italy
Germany
UK
UK
Canada
Canada
Germany
Australia
USA
</code></pre>
<p... | I have a file of patterns and I want to return all the line numbers where the pattern was found, but in a wide format and not long/spread. Example: fileA.txt ``` Germany USA UK ``` fileB.txt ``` USA USA Italy Germany UK UK Canada Canada Germany Australia USA ``` I have done something like this: ``` grep -nf fileA.txt f... | 6 | 608 | 5 | 2 | 0 | [
"<linux><text-processing><awk><grep>"
] | 2021-02-14T05:34:13.753 | 2021-02-14T17:03:24.157 | 361,114 | 634,373 | [
{
"id": 634373,
"body": "<p>Using GNU <code>datamash</code>:</p>\n<pre class=\"lang-none prettyprint-override\"><code>$ grep -n -x -F -f fileA.txt fileB.txt | datamash -s -t : -g 2 collapse 1\nGermany:4,9\nUK:5,6\nUSA:1,2,11\n</code></pre>\n<p>This first uses <code>grep</code> to get the lines from <code>fi... | Using GNU `datamash`: ``` $ grep -n -x -F -f fileA.txt fileB.txt | datamash -s -t : -g 2 collapse 1 Germany:4,9 UK:5,6 USA:1,2,11 ``` This first uses `grep` to get the lines from `fileB.txt` that exactly matches the lines in `fileA.txt`, and outputs the matching line numbers along with the lines themselves. I'm using `... | # grep output from long to wide
**Tags:** <linux><text-processing><awk><grep>
**Question (score 6):**
I have a file of patterns and I want to return all the line numbers where the pattern was found, but in a wide format and not long/spread. Example: fileA.txt ``` Germany USA UK ``` fileB.txt ``` USA USA Italy German... | 2,471 | 617 | {
"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... |
634,462 | unix.stackexchange.com | Repairing a failed Debian upgrade | <p>I was attempting to upgrade from debian 9 to 10 but the installation failed when attempting to install <code>systemd-sysv_241-7~deb10u6_amd64.deb</code>. I get the following error:</p>
<p>My attempts to run <code>apt --fix-broken install</code> have not been successful and lead to the same error below.</p>
<pre><co... | I was attempting to upgrade from debian 9 to 10 but the installation failed when attempting to install `systemd-sysv_241-7~deb10u6_amd64.deb`. I get the following error: My attempts to run `apt --fix-broken install` have not been successful and lead to the same error below. ``` (Reading database ... 59371 files and dir... | 6 | 948 | 2 | 0 | 0 | [
"<debian><systemd><upgrade><sysvinit>"
] | 2021-02-14T20:01:19.897 | 2021-02-15T05:38:10.063 | 390,903 | null | [
{
"id": 634465,
"body": "<p>I don't see how you could get more relevant information than you already have.\nThe error message says:</p>\n<blockquote>\n<p>trying to overwrite '/usr/share/man/man8/halt.8.gz', which is also in package sysvinit 2.88dsf-41+deb7u1</p>\n</blockquote>\n<p>this is basically it: two ... | I don't see how you could get more relevant information than you already have. The error message says: trying to overwrite '/usr/share/man/man8/halt.8.gz', which is also in package sysvinit 2.88dsf-41+deb7u1 this is basically it: two packages want to install the same file, and debian forbids this (as a single file cann... | # Repairing a failed Debian upgrade
**Tags:** <debian><systemd><upgrade><sysvinit>
**Question (score 6):**
I was attempting to upgrade from debian 9 to 10 but the installation failed when attempting to install `systemd-sysv_241-7~deb10u6_amd64.deb`. I get the following error: My attempts to run `apt --fix-broken ins... | 3,850 | 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... |
634,534 | unix.stackexchange.com | Set a key with spaces in an associative array in Zsh | <p>In Bash (4 or above), if I have an associative array <code>dict</code>, I can set its value like <code>dict[apple count]=1</code> and I would be able to access it with <code>${dict[apple count]}</code>. Does Zsh allow space in key names? <code>dict[apple count]=1</code> doesn’t work in Zsh, so I guess Zsh has differ... | In Bash (4 or above), if I have an associative array `dict`, I can set its value like `dict[apple count]=1` and I would be able to access it with `${dict[apple count]}`. Does Zsh allow space in key names? `dict[apple count]=1` doesn’t work in Zsh, so I guess Zsh has different syntax for this. `dict["apple count"]=1` do... | 6 | 386 | 2 | 0 | 0 | [
"<zsh><associative-array>"
] | 2021-02-15T07:45:53.030 | 2021-02-16T07:36:50.903 | 118,138 | null | [
{
"id": 634535,
"body": "<p>One (ugly) workaround is to use the syntax to “append elements to an ordinary array”, like</p>\n<pre class=\"lang-bsh prettyprint-override\"><code>dict+=('apple count' 1)\n</code></pre>\n<p>Zsh will maintain the property of associative arrays (as long as you declared it as one), ... | One (ugly) workaround is to use the syntax to “append elements to an ordinary array”, like ``` dict+=('apple count' 1) ``` Zsh will maintain the property of associative arrays (as long as you declared it as one), so it will update the value if `dict['apple count']` exists. A less ugly way since Zsh 5.5 is: ``` dict+=([... | # Set a key with spaces in an associative array in Zsh
**Tags:** <zsh><associative-array>
**Question (score 6):**
In Bash (4 or above), if I have an associative array `dict`, I can set its value like `dict[apple count]=1` and I would be able to access it with `${dict[apple count]}`. Does Zsh allow space in key names... | 1,368 | 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... |
634,710 | unix.stackexchange.com | What does it mean for a Linux distribution to be stable and how much does it matter for casual users? | <ul>
<li><p>What exactly is a "stable" Linux distribution and what are the (practical) consequences of using an "unstable" distribution?</p>
</li>
<li><p>Does it really matter for casual users (i.e. not sysadmins) ?</p>
</li>
</ul>
<p>I've read <a href="https://www.quora.com/What-does-unstable-mean-... | - What exactly is a "stable" Linux distribution and what are the (practical) consequences of using an "unstable" distribution? - Does it really matter for casual users (i.e. not sysadmins) ? I've read this (https://www.quora.com/What-does-unstable-mean-in-Linux-distributions) and this (https://dev.to/madza/which-linux-... | 29 | 4,888 | 5 | 3 | 3 | [
"<linux><debian><distributions><stability>"
] | 2021-02-16T07:34:28.593 | 2021-06-09T12:09:42.730 | 449,342 | 634,722 | [
{
"id": 634722,
"body": "<p>In the context of Debian specifically, and more generally when many distributions describe themselves, <strong>stability isn’t about day-to-day lack of crashes, it’s about the stability of the interfaces provided by the distribution</strong>, both programming interfaces and user ... | In the context of Debian specifically, and more generally when many distributions describe themselves, stability isn’t about day-to-day lack of crashes, it’s about the stability of the interfaces provided by the distribution, both programming interfaces and user interfaces. It’s better to think of stable v. development... | # What does it mean for a Linux distribution to be stable and how much does it matter for casual users?
**Tags:** <linux><debian><distributions><stability>
**Question (score 29):**
- What exactly is a "stable" Linux distribution and what are the (practical) consequences of using an "unstable" distribution? - Does it... | 11,727 | 2,931 | {
"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... |
634,809 | unix.stackexchange.com | Reformat timestamp in a pipe delimited file | <p>I have a pipe delimited file with date time in this format <code>yyyymmddhhmmss</code> as below.</p>
<pre><code>John|Doe|TEST|20210728120821|john@test.com
John|Davis|TEST|20210828120821|john@test.com
John|Smith|TEST|20210528120821|john@test.com
</code></pre>
<p>I am trying to convert the string in column 4 to <code>... | I have a pipe delimited file with date time in this format `yyyymmddhhmmss` as below. ``` John|Doe|TEST|20210728120821|john@test.com John|Davis|TEST|20210828120821|john@test.com John|Smith|TEST|20210528120821|john@test.com ``` I am trying to convert the string in column 4 to `yyyy-mm-dd hh:mm:ss` like this ``` John|Doe... | 5 | 305 | 4 | 1 | 0 | [
"<linux><shell-script><text-processing><awk><sed>"
] | 2021-02-16T15:41:36.223 | 2021-02-16T18:50:29.437 | 433,145 | 634,841 | [
{
"id": 634841,
"body": "<p>Those "timestamps" aren't seconds since the epoch as <code>strftime()</code> operates on, they're just dates+times with no separators between years, months, etc. You just need a simple text manipulation, not use of time functions.</p>\n<p>With GNU awk (which you're alre... | Those "timestamps" aren't seconds since the epoch as `strftime()` operates on, they're just dates+times with no separators between years, months, etc. You just need a simple text manipulation, not use of time functions. With GNU awk (which you're already using) for gensub(): ``` $ awk 'BEGIN{FS=OFS="|"} {$4=gensub(/(.{... | # Reformat timestamp in a pipe delimited file
**Tags:** <linux><shell-script><text-processing><awk><sed>
**Question (score 5):**
I have a pipe delimited file with date time in this format `yyyymmddhhmmss` as below. ``` John|Doe|TEST|20210728120821|john@test.com John|Davis|TEST|20210828120821|john@test.com John|Smith... | 2,603 | 650 | {
"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... |
634,832 | unix.stackexchange.com | Linux software raid1: What reasons might cause a read speed reduction? | <p>Configuring two PCIe NVMe SSDs as a raid1 Linux software raid instead of boosting read performance has roughly halved the read speed.</p>
<p>In similar Linux software raid1 setups (also SSDs) I have seen an increase in read performance, since now two mirrored block devices can be used for the reads.</p>
<p>What coul... | Configuring two PCIe NVMe SSDs as a raid1 Linux software raid instead of boosting read performance has roughly halved the read speed. In similar Linux software raid1 setups (also SSDs) I have seen an increase in read performance, since now two mirrored block devices can be used for the reads. What could be potential re... | 5 | 314 | 1 | 15 | 1 | [
"<performance><mdadm><software-raid>"
] | 2021-02-16T17:21:28.500 | 2021-02-28T19:45:28.767 | 24,394 | null | [
{
"id": 635760,
"body": "<p>(For those posting questions involving <code>fio</code>, I strongly recommend that you <a href=\"https://github.com/axboe/fio/blob/fio-3.25/REPORTING-BUGS#L13-L15\" rel=\"nofollow noreferrer\">clearly post the full job you are running and fio version number</a> because these thin... | (For those posting questions involving `fio`, I strongly recommend that you clearly post the full job you are running and fio version number (https://github.com/axboe/fio/blob/fio-3.25/REPORTING-BUGS#L13-L15) because these things can have a huge impact on whether you get a correct answer to your question) `fio` is repo... | # Linux software raid1: What reasons might cause a read speed reduction?
**Tags:** <performance><mdadm><software-raid>
**Question (score 5):**
Configuring two PCIe NVMe SSDs as a raid1 Linux software raid instead of boosting read performance has roughly halved the read speed. In similar Linux software raid1 setups (... | 12,720 | 3,180 | {
"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... |
635,132 | unix.stackexchange.com | Why do open file handles to deleted files seemingly fill up the hard drive | <p>So, to make a long story short, I wrote a (python) program which opened a lot of files, writes data in it, and then deleted the files, but didn't properly close the file handles.
After some time, this program halted due to lack of disk space.</p>
<p>Auto-complete in bash failed with <code>cannot create temp file for... | So, to make a long story short, I wrote a (python) program which opened a lot of files, writes data in it, and then deleted the files, but didn't properly close the file handles. After some time, this program halted due to lack of disk space. Auto-complete in bash failed with `cannot create temp file for here-document:... | 5 | 1,287 | 2 | 2 | 0 | [
"<filesystems><disk-usage>"
] | 2021-02-18T09:26:42.720 | 2021-02-18T10:14:49.590 | 90,771 | 635,134 | [
{
"id": 635134,
"body": "<p>Deleting a file in Unix simply removes a named reference to its data (hence the syscall name <code>unlink</code>/<code>unlinkat</code>, rather than <code>delete</code>). In order for the data itself to be freed, there must be no other references to it. References can be taken in ... | Deleting a file in Unix simply removes a named reference to its data (hence the syscall name `unlink`/`unlinkat`, rather than `delete`). In order for the data itself to be freed, there must be no other references to it. References can be taken in a few ways: - There must be no further references to this data on the fil... | # Why do open file handles to deleted files seemingly fill up the hard drive
**Tags:** <filesystems><disk-usage>
**Question (score 5):**
So, to make a long story short, I wrote a (python) program which opened a lot of files, writes data in it, and then deleted the files, but didn't properly close the file handles. A... | 4,378 | 1,094 | {
"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... |
635,365 | unix.stackexchange.com | Why does catting a symlinked file and redirecting the output to the original file make the latter file empty? | <p>Here's how to reproduce it:</p>
<pre class="lang-bsh prettyprint-override"><code>echo 'the original file' > orig
ln -s orig symb # now symb is symlinked to orig
cat symb > orig # this makes orig an EMPTY FILE, but why?
</code></pre>
<p><code>orig</code> becomes an empty file after the third command, but why?</... | Here's how to reproduce it: ``` echo 'the original file' > orig ln -s orig symb # now symb is symlinked to orig cat symb > orig # this makes orig an EMPTY FILE, but why? ``` `orig` becomes an empty file after the third command, but why? | 10 | 909 | 1 | 3 | 0 | [
"<symlink>"
] | 2021-02-19T13:53:23.673 | 2021-02-20T13:59:52.063 | 344,185 | 635,373 | [
{
"id": 635373,
"body": "<p>Symlinks are evaluated as you attempt to open a file. Under "normal" circumstances the result of opening a symbolic link is to open the file it references. So:</p>\n<pre><code>ln -s original_file my_symlink\ncat my_symlink > original_file\n</code></pre>\n<p>Is very s... | Symlinks are evaluated as you attempt to open a file. Under "normal" circumstances the result of opening a symbolic link is to open the file it references. So: ``` ln -s original_file my_symlink cat my_symlink > original_file ``` Is very similar to: ``` cat original_file > original_file ``` Why does it destroy the cont... | # Why does catting a symlinked file and redirecting the output to the original file make the latter file empty?
**Tags:** <symlink>
**Question (score 10):**
Here's how to reproduce it: ``` echo 'the original file' > orig ln -s orig symb # now symb is symlinked to orig cat symb > orig # this makes orig an EMPTY FILE,... | 1,049 | 262 | {
"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... |
635,646 | unix.stackexchange.com | Is it safe to boot computer that lost power while suspending to disk? | <p>I have computer with battery power supply that allows running the computer for approximately one minute after power loss. I want to trigger suspend-to-disk immediately after power loss so it can be resumed later. The initrd (default Devuan initrd) looks for suspend signature in the swap partition and resumes from it... | I have computer with battery power supply that allows running the computer for approximately one minute after power loss. I want to trigger suspend-to-disk immediately after power loss so it can be resumed later. The initrd (default Devuan initrd) looks for suspend signature in the swap partition and resumes from it wh... | 11 | 1,426 | 1 | 5 | 0 | [
"<linux><linux-kernel><suspend><corruption><ups>"
] | 2021-02-21T13:01:09.960 | 2021-02-24T15:58:24.940 | 194,408 | 635,648 | [
{
"id": 635648,
"body": "<p>If power is lost prior to explicitly entering S4 or S5 state (hereafter just referred to as "hibernation state" for simplicity), then the partially filled data in the swap partition will be ignored completely, because there's no hibernation state persisted. Swap partiti... | If power is lost prior to explicitly entering S4 or S5 state (hereafter just referred to as "hibernation state" for simplicity), then the partially filled data in the swap partition will be ignored completely, because there's no hibernation state persisted. Swap partitions and files are also volatile, and the data in i... | # Is it safe to boot computer that lost power while suspending to disk?
**Tags:** <linux><linux-kernel><suspend><corruption><ups>
**Question (score 11):**
I have computer with battery power supply that allows running the computer for approximately one minute after power loss. I want to trigger suspend-to-disk immedi... | 2,040 | 510 | {
"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... |
635,893 | unix.stackexchange.com | How to fix infinite bash loop (bashrc + bash_profile) when ssh-ing into an ec2 server? | <p>I mistakenly have source <code>.bash_profile</code> in the <code>bashrc</code> file and vice versa. Now when I tried to ssh into the machine (ec2), it will stuck at loading bash and get connection closed in a second. Is there a way I could fix it? Could I mount the disk to another ec2 instance to fix the bash files?... | I mistakenly have source `.bash_profile` in the `bashrc` file and vice versa. Now when I tried to ssh into the machine (ec2), it will stuck at loading bash and get connection closed in a second. Is there a way I could fix it? Could I mount the disk to another ec2 instance to fix the bash files? Update 1: I tried the fo... | 8 | 1,134 | 3 | 1 | 1 | [
"<bash><ssh><amazon-ec2>"
] | 2021-02-22T22:24:09.217 | 2021-05-03T17:00:36.120 | 312,016 | null | [
{
"id": 635895,
"body": "<p>In general, <code>~/.bashrc</code> is only sourced by interactive shells, and <code>~/.bash_profile</code> by login shells (<a href=\"https://unix.stackexchange.com/q/38175\">Difference between login shell and non-login shell?</a>). If you only send commands via Ssh, you get neit... | In general, `~/.bashrc` is only sourced by interactive shells, and `~/.bash_profile` by login shells (Difference between login shell and non-login shell? (https://unix.stackexchange.com/q/38175)). If you only send commands via Ssh, you get neither an interactive nor a login shell, so just renaming one of the files—say,... | # How to fix infinite bash loop (bashrc + bash_profile) when ssh-ing into an ec2 server?
**Tags:** <bash><ssh><amazon-ec2>
**Question (score 8):**
I mistakenly have source `.bash_profile` in the `bashrc` file and vice versa. Now when I tried to ssh into the machine (ec2), it will stuck at loading bash and get connec... | 6,037 | 1,509 | {
"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... |
636,167 | unix.stackexchange.com | What is the meaning of "Do not execute a remote command"? | <p>In the man page of ssh, it says:</p>
<pre><code>-N Do not execute a remote command. This is useful for just forwarding ports.
</code></pre>
<p>I don't understand what it means by "Do not execute a remote command."</p>
<p>Can someone explain it to me?</p>
| In the man page of ssh, it says: ``` -N Do not execute a remote command. This is useful for just forwarding ports. ``` I don't understand what it means by "Do not execute a remote command." Can someone explain it to me? | 10 | 1,817 | 2 | 0 | 2 | [
"<ssh>"
] | 2021-02-24T13:24:47.917 | 2021-03-08T00:22:51.777 | 457,749 | null | [
{
"id": 636172,
"body": "<p>Normally, the <code>ssh</code> program runs a command on a remote system (using the remote user's shell). For example, <code>ssh user@server ls -l /tmp</code> lists the content of the /tmp directory on <code>server</code>. When you leave the command out, as in <code>ssh user@serv... | Normally, the `ssh` program runs a command on a remote system (using the remote user's shell). For example, `ssh user@server ls -l /tmp` lists the content of the /tmp directory on `server`. When you leave the command out, as in `ssh user@server`, an interactive login session with the user's shell is launched. One of th... | # What is the meaning of "Do not execute a remote command"?
**Tags:** <ssh>
**Question (score 10):**
In the man page of ssh, it says: ``` -N Do not execute a remote command. This is useful for just forwarding ports. ``` I don't understand what it means by "Do not execute a remote command." Can someone explain it to ... | 1,770 | 442 | {
"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... |
636,186 | unix.stackexchange.com | Why does quoting not protect filenames that start with "-" against mis-interpretation? | <p>This might be a ridiculous post, but let's say we have a file called <code>-|h4k3r|-</code>, why doesn't this quoting work?</p>
<pre class="lang-bsh prettyprint-override"><code>cat '-|h4k3r|-'
</code></pre>
<p>I thought single quotes remove meaning of all special characters?</p>
<p>However this one works</p>
<pre cl... | This might be a ridiculous post, but let's say we have a file called `-|h4k3r|-`, why doesn't this quoting work? ``` cat '-|h4k3r|-' ``` I thought single quotes remove meaning of all special characters? However this one works ``` cat -- -\|h4k3r\|- ``` This one too: ``` cat "./-|h4k3r|-" ``` But I don't get why this do... | 5 | 412 | 2 | 1 | 0 | [
"<bash><quoting>"
] | 2021-02-24T14:54:56.943 | 2021-11-23T10:00:49.730 | 456,002 | 636,199 | [
{
"id": 636188,
"body": "<p>The reason is that while single quotes actually remove the meaning of special characters, this refers to <a href=\"https://www.gnu.org/software/bash/manual/html_node/Shell-Expansions.html\" rel=\"nofollow noreferrer\">variable expansion, globbing and word splitting</a> - i.e. tho... | The reason is that while single quotes actually remove the meaning of special characters, this refers to variable expansion, globbing and word splitting (https://www.gnu.org/software/bash/manual/html_node/Shell-Expansions.html) - i.e. those characters that are special to the shell and that are interpreted by the shell ... | # Why does quoting not protect filenames that start with "-" against mis-interpretation?
**Tags:** <bash><quoting>
**Question (score 5):**
This might be a ridiculous post, but let's say we have a file called `-|h4k3r|-`, why doesn't this quoting work? ``` cat '-|h4k3r|-' ``` I thought single quotes remove meaning of... | 4,484 | 1,121 | {
"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... |
636,324 | unix.stackexchange.com | Why is there a syntax error if I don't write 'if' in an END block of AWK? | <p>I'm learning AWK these days for text processing. But I'm very much confused about AWK syntax. I read on Wikipedia that the syntax follows this format:</p>
<pre><code>(conditions) {actions}
</code></pre>
<p>I assumed I can follow the same syntax in a BEGIN and END block. But I'm getting a syntax error when I run the ... | I'm learning AWK these days for text processing. But I'm very much confused about AWK syntax. I read on Wikipedia that the syntax follows this format: ``` (conditions) {actions} ``` I assumed I can follow the same syntax in a BEGIN and END block. But I'm getting a syntax error when I run the following script. ``` awk '... | 10 | 897 | 2 | 0 | 2 | [
"<awk>"
] | 2021-02-25T09:24:51.253 | 2021-02-26T08:34:20.007 | 247,138 | 636,328 | [
{
"id": 636328,
"body": "<p>AWK programs are a series of rules, and possibly functions. Rules are defined as a <a href=\"https://www.gnu.org/software/gawk/manual/html_node/Pattern-Overview.html\" rel=\"noreferrer\">pattern</a> (<code>(conditions)</code> in your format) followed by an <a href=\"https://www.g... | AWK programs are a series of rules, and possibly functions. Rules are defined as a pattern (https://www.gnu.org/software/gawk/manual/html_node/Pattern-Overview.html) (`(conditions)` in your format) followed by an action (https://www.gnu.org/software/gawk/manual/html_node/Action-Overview.html); either are optional. `BEG... | # Why is there a syntax error if I don't write 'if' in an END block of AWK?
**Tags:** <awk>
**Question (score 10):**
I'm learning AWK these days for text processing. But I'm very much confused about AWK syntax. I read on Wikipedia that the syntax follows this format: ``` (conditions) {actions} ``` I assumed I can fo... | 2,288 | 572 | {
"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... |
636,350 | unix.stackexchange.com | How can I by-pass a function if already executed? | <p>I have a function <code>prereq()</code> that may be invocated several times but should not actually be <em>executed</em> more than once on the same running thread of the script by selecting other options from the menu (each option on the menu will have <code>prereq()</code> as part of the code):</p>
<pre><code># Pre... | I have a function `prereq()` that may be invocated several times but should not actually be executed more than once on the same running thread of the script by selecting other options from the menu (each option on the menu will have `prereq()` as part of the code): ``` # Pre-requirements prereq () { echo echo "########... | 7 | 749 | 2 | 4 | 0 | [
"<shell-script><variable>"
] | 2021-02-25T12:56:51.790 | 2021-02-25T13:04:13.527 | 457,381 | 636,351 | [
{
"id": 636351,
"body": "<p>Since shell variables are global unless you declare them as <code>local</code> inside a function (a mean trap by the way), you can simply define a variable</p>\n<pre><code>prereq_done=0\n</code></pre>\n<p>on top of the script and then modify the <code>prereq()</code> function to ... | Since shell variables are global unless you declare them as `local` inside a function (a mean trap by the way), you can simply define a variable ``` prereq_done=0 ``` on top of the script and then modify the `prereq()` function to check for it at the beginning (exit if it is already set), and set it to 1 at the end: ``... | # How can I by-pass a function if already executed?
**Tags:** <shell-script><variable>
**Question (score 7):**
I have a function `prereq()` that may be invocated several times but should not actually be executed more than once on the same running thread of the script by selecting other options from the menu (each op... | 2,949 | 737 | {
"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... |
636,366 | unix.stackexchange.com | Bash expansion asymmetry when opening and creating files | <p>I have come upon the following example of asymmetry in a Bash regex that is confusing me. I would like to know what I am doing which is non-standard and causes this behaviour, or else what is the logic behind this behaviour which I am missing.</p>
<h3>Opening files</h3>
<p>Suppose I have a directory with a list of f... | I have come upon the following example of asymmetry in a Bash regex that is confusing me. I would like to know what I am doing which is non-standard and causes this behaviour, or else what is the logic behind this behaviour which I am missing. ### Opening files Suppose I have a directory with a list of files called `fi... | 6 | 387 | 1 | 4 | 0 | [
"<bash><files><wildcards><brace-expansion>"
] | 2021-02-25T14:35:24.147 | 2021-02-25T14:49:42.817 | 407,566 | 636,371 | [
{
"id": 636371,
"body": "<p>What you are using are not regular expressions, but a combination of <a href=\"https://www.gnu.org/software/bash/manual/html_node/Brace-Expansion.html\" rel=\"nofollow noreferrer\">brace expansion</a> and <a href=\"https://www.gnu.org/software/bash/manual/bash.html#Filename-Expan... | What you are using are not regular expressions, but a combination of brace expansion (https://www.gnu.org/software/bash/manual/html_node/Brace-Expansion.html) and filename expansion (a.k.a globbing) (https://www.gnu.org/software/bash/manual/bash.html#Filename-Expansion). That is important because while brace expansion ... | # Bash expansion asymmetry when opening and creating files
**Tags:** <bash><files><wildcards><brace-expansion>
**Question (score 6):**
I have come upon the following example of asymmetry in a Bash regex that is confusing me. I would like to know what I am doing which is non-standard and causes this behaviour, or els... | 5,043 | 1,260 | {
"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... |
636,573 | unix.stackexchange.com | Replace value in "key: value" statement, but only on first occurence of the key in the file | <p>I have a yml file</p>
<pre><code>spring:
datasource:
url: url
username:test
password: testpwd
api:
security:
username:foo
password: foopwd
</code></pre>
<p>I want to update only the first occurrence or username and password using the command line on a Linux machine so that it looks like this... | I have a yml file ``` spring: datasource: url: url username:test password: testpwd api: security: username:foo password: foopwd ``` I want to update only the first occurrence or username and password using the command line on a Linux machine so that it looks like this: ``` spring: datasource: url: url username:toto pas... | 5 | 1,070 | 5 | 1 | 0 | [
"<text-processing><sed><yaml>"
] | 2021-02-26T15:27:45.877 | 2021-02-27T00:24:08.230 | 458,065 | 636,581 | [
{
"id": 636585,
"body": "<p>Another <code>sed</code> alternative:</p>\n<pre><code>sed '1,/username/{/username/ s/:.*/:toto/};\n 1,/password/{/password/ s/:.*/:totopsw/}' infile\n</code></pre>\n<p><code>1,/regex/</code> start from the first line up-to first line that matched with given <em><code>regex</c... | Another `sed` alternative: ``` sed '1,/username/{/username/ s/:.*/:toto/}; 1,/password/{/password/ s/:.*/:totopsw/}' infile ``` `1,/regex/` start from the first line up-to first line that matched with given `regex` (here it's `username` string), change the "username"; doing the same for "password" part. | # Replace value in "key: value" statement, but only on first occurence of the key in the file
**Tags:** <text-processing><sed><yaml>
**Question (score 5):**
I have a yml file ``` spring: datasource: url: url username:test password: testpwd api: security: username:foo password: foopwd ``` I want to update only the fi... | 2,437 | 609 | {
"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... |
636,665 | unix.stackexchange.com | Nested for loop | <p>I am trying to list files in a nested zip as below.
It is not listing files in second level.</p>
<p>For example:</p>
<p><code>abc.zip</code> contains <code>test1.zip</code>, <code>test2.zip</code>, <code>test3.zip</code></p>
<p><code>pqr.zip</code> contains <code>test4.zip</code>, <code>test5.zip</code>, <code>test6... | I am trying to list files in a nested zip as below. It is not listing files in second level. For example: `abc.zip` contains `test1.zip`, `test2.zip`, `test3.zip` `pqr.zip` contains `test4.zip`, `test5.zip`, `test6.zip` ``` for f in *.zip do unzip -l ${f} for p in ${f} do unzip -l ${p} done done ``` | 6 | 243 | 3 | 1 | 0 | [
"<linux><shell-script>"
] | 2021-02-27T03:39:15.800 | 2021-02-27T22:54:57.437 | 336,218 | 636,666 | [
{
"id": 636699,
"body": "<p>With a combination of libarchive's <code>bsdtar</code> and GNU <code>tar</code>, you can list the contents of those nested archives without having to extract them on disk:</p>\n<pre><code>for f in *.zip; do\n bsdtar -cf - --include='*.zip' "@$f" | tar -xf - --to-comman... | With a combination of libarchive's `bsdtar` and GNU `tar`, you can list the contents of those nested archives without having to extract them on disk: ``` for f in *.zip; do bsdtar -cf - --include='*.zip' "@$f" | tar -xf - --to-command='bsdtar tvf -' done ``` GNU `tar` can pipe members of archives to commands upon extra... | # Nested for loop
**Tags:** <linux><shell-script>
**Question (score 6):**
I am trying to list files in a nested zip as below. It is not listing files in second level. For example: `abc.zip` contains `test1.zip`, `test2.zip`, `test3.zip` `pqr.zip` contains `test4.zip`, `test5.zip`, `test6.zip` ``` for f in *.zip do u... | 986 | 246 | {
"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... |
636,944 | unix.stackexchange.com | How to check if variable contains valid UTF-8 string without any control characters? | <p>How can I check in bash whether a variable contains a valid UTF-8 string without any special control characters (such as newline or backspace or carriage return etc.)?</p>
| How can I check in bash whether a variable contains a valid UTF-8 string without any special control characters (such as newline or backspace or carriage return etc.)? | 6 | 619 | 1 | 0 | 3 | [
"<bash><string>"
] | 2021-03-01T06:07:28.037 | 2021-03-01T20:44:49.863 | 355,172 | null | [
{
"id": 636948,
"body": "<p>Provided the locale uses UTF-8 as its character encoding (check with <code>locale charmap</code>):</p>\n<pre><code>[[ $string =~ ^[^[:cntrl:]]*$ ]]\n</code></pre>\n<p>should work except that at least on GNU systems, it fails to reject strings that contain the UTF-8 encoding of ch... | Provided the locale uses UTF-8 as its character encoding (check with `locale charmap`): ``` [[ $string =~ ^[^[:cntrl:]]*$ ]] ``` should work except that at least on GNU systems, it fails to reject strings that contain the UTF-8 encoding of characters with code points above 0x110000 (which are no longer valid in the cur... | # How to check if variable contains valid UTF-8 string without any control characters?
**Tags:** <bash><string>
**Question (score 6):**
How can I check in bash whether a variable contains a valid UTF-8 string without any special control characters (such as newline or backspace or carriage return etc.)?
### Answer (... | 2,521 | 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... |
637,002 | unix.stackexchange.com | How do I foreground a job in a script? | <p>I want to launch a test, then wait a little and then start a program, using a shell script:</p>
<pre class="lang-bsh prettyprint-override"><code>#!/bin/bash
sleep 3 & # test
sleep 1 # wait some
sleep 4 & # run program under test
fg 1 # <-- I want to put test back in "foreground", but ... | I want to launch a test, then wait a little and then start a program, using a shell script: ``` #!/bin/bash sleep 3 & # test sleep 1 # wait some sleep 4 & # run program under test fg 1 # <-- I want to put test back in "foreground", but yields "line 5: fg: no job control" ``` I presume I misunderstood what "foreground" ... | 12 | 1,300 | 2 | 0 | 0 | [
"<bash><shell-script><background-process>"
] | 2021-03-01T14:45:41.157 | 2021-03-01T15:04:14.677 | 73,741 | 637,004 | [
{
"id": 637004,
"body": "<p>You need to just enable job control in the shell with <code>set -m</code></p>\n<pre><code>#!/bin/bash\nset -m\nsleep 3 & # test\nsleep 1 # wait some\nsleep 4 & # run program under test\njobs\nfg %1\n</code></pre>\n<p>quoting from bash manual:</p>\n<blockquote>\n<p>-m... | You need to just enable job control in the shell with `set -m` ``` #!/bin/bash set -m sleep 3 & # test sleep 1 # wait some sleep 4 & # run program under test jobs fg %1 ``` quoting from bash manual: -m Monitor mode. Job control is enabled. This option is on by default for interactive shells on systems that support it (... | # How do I foreground a job in a script?
**Tags:** <bash><shell-script><background-process>
**Question (score 12):**
I want to launch a test, then wait a little and then start a program, using a shell script: ``` #!/bin/bash sleep 3 & # test sleep 1 # wait some sleep 4 & # run program under test fg 1 # <-- I want to... | 1,634 | 408 | {
"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... |
637,668 | unix.stackexchange.com | Can I have a single server listen on more than 65535 ports by attaching an IPv4 address | <p>I have a <em>number</em> of servers to SSH into, and some of them, being behind different NATs, may require an SSH tunnel. Right now I'm using a single VPS for that purpose. When that <em>number</em> reaches <a href="https://serverfault.com/questions/103626/what-is-the-maximum-port-number">65535 - 1023 = 64512</a>, ... | I have a number of servers to SSH into, and some of them, being behind different NATs, may require an SSH tunnel. Right now I'm using a single VPS for that purpose. When that number reaches 65535 - 1023 = 64512 (https://serverfault.com/questions/103626/what-is-the-maximum-port-number), and the VPS runs out of ports to ... | 12 | 1,878 | 4 | 13 | 2 | [
"<linux><debian><ssh-tunneling><tcp><tcp-ip>"
] | 2021-03-04T21:29:02.807 | 2021-03-05T08:42:56.483 | 163,265 | 637,783 | [
{
"id": 637689,
"body": "<p>The limit on listening ports is per address regardless of IPv4 or IPv6. The limitation comes from <a href=\"https://en.wikipedia.org/wiki/Transmission_Control_Protocol#TCP_segment_structure\" rel=\"noreferrer\">TCP</a> and <a href=\"https://en.wikipedia.org/wiki/User_Datagram_Pr... | The limit on listening ports is per address regardless of IPv4 or IPv6. The limitation comes from TCP (https://en.wikipedia.org/wiki/Transmission_Control_Protocol#TCP_segment_structure) and UDP (https://en.wikipedia.org/wiki/User_Datagram_Protocol#UDP_datagram_structure) packet headers which are two bytes and so port n... | # Can I have a single server listen on more than 65535 ports by attaching an IPv4 address
**Tags:** <linux><debian><ssh-tunneling><tcp><tcp-ip>
**Question (score 12):**
I have a number of servers to SSH into, and some of them, being behind different NATs, may require an SSH tunnel. Right now I'm using a single VPS f... | 4,810 | 1,202 | {
"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... |
637,828 | unix.stackexchange.com | What is ${@:$#} exactly? | <p>I tried to to run <code>echo ${@:$#}</code> and it echoes my current shell.</p>
<p>I found out that <code>echo ${#}</code> echoes 0.</p>
<p>I didn't find any resources about the results.</p>
<p>I am trying to understand that part so I can understand a docker script that I want to use. The script is:</p>
<pre><code>a... | I tried to to run `echo ${@:$#}` and it echoes my current shell. I found out that `echo ${#}` echoes 0. I didn't find any resources about the results. I am trying to understand that part so I can understand a docker script that I want to use. The script is: ``` alias enhance='function ne() { docker run --rm -v "$(pwd)/... | 14 | 1,353 | 1 | 2 | 2 | [
"<bash><shell-script><shell><arguments>"
] | 2021-03-06T00:30:22.283 | 2021-03-08T12:59:54.447 | 428,309 | 637,835 | [
{
"id": 637835,
"body": "<p><a href=\"https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_05_02\" rel=\"noreferrer\">In every POSIX compliant shell</a>,</p>\n<ul>\n<li><code>$#</code> is the number of arguments to the function or script, the number of positional parameters.</li>... | In every POSIX compliant shell (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_05_02), - `$#` is the number of arguments to the function or script, the number of positional parameters. - `$@` is the list of arguments to the function or script, the list `$1`, `$2`, etc. of positional pa... | # What is ${@:$#} exactly?
**Tags:** <bash><shell-script><shell><arguments>
**Question (score 14):**
I tried to to run `echo ${@:$#}` and it echoes my current shell. I found out that `echo ${#}` echoes 0. I didn't find any resources about the results. I am trying to understand that part so I can understand a docker ... | 1,472 | 368 | {
"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... |
637,837 | unix.stackexchange.com | Why did {} start appearing as äå in Terminal.app? | <p>I'm running CentOS 7.9 and today my terminal is showing weird characters. Some letters look fine, but some symbols appear as some non-English characters. For example I made a text file with the following contents:</p>
<pre><code>!@#$%^&*()_+{}
</code></pre>
<p>When I open this in <code>vi</code> or <code>nano<... | I'm running CentOS 7.9 and today my terminal is showing weird characters. Some letters look fine, but some symbols appear as some non-English characters. For example I made a text file with the following contents: ``` !@#$%^&*()_+{} ``` When I open this in `vi` or `nano` it looks correct just as I have written above. B... | 17 | 1,716 | 1 | 11 | 1 | [
"<centos><macos><character-encoding><terminal-emulator>"
] | 2021-03-06T02:09:00.180 | 2021-03-08T13:41:13.943 | 37,545 | 637,863 | [
{
"id": 637863,
"body": "<p>I can reproduce it with the <code>xterm</code> terminal emulator (version 366), if I do:</p>\n<pre><code>$ printf '\\e[?42h\\e(H'; cat chars.txt; printf '\\e(B\\e[?42l'\n!É#$%Ü&*()_+äå\n</code></pre>\n<p>Where:</p>\n<ul>\n<li><a href=\"https://invisible-island.net/xterm/ctlse... | I can reproduce it with the `xterm` terminal emulator (version 366), if I do: ``` $ printf '\e[?42h\e(H'; cat chars.txt; printf '\e(B\e[?42l' !É#$%Ü&*()_+äå ``` Where: - `\e[?42h` (https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h4-Functions-using-CSI-_-ordered-by-the-final-character-lparen-s-rparen:CSI-?-Pm-h:... | # Why did {} start appearing as äå in Terminal.app?
**Tags:** <centos><macos><character-encoding><terminal-emulator>
**Question (score 17):**
I'm running CentOS 7.9 and today my terminal is showing weird characters. Some letters look fine, but some symbols appear as some non-English characters. For example I made a ... | 6,129 | 1,532 | {
"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... |
637,893 | unix.stackexchange.com | How to increase LVM when using LUKS2 on Debian Buster | <p>I'm running Debian Buster on a ThinkPad T420 which is equipped with a 250 GB SSD. Since I needed more disk space I used Clonezilla to clone my current Debian installation from the internal 250 GB SSD to a new 500 GB SSD connected via an USB to SATA adapter. Afterwards I replaced the 250 GB SSD with the 500 GB SSD an... | I'm running Debian Buster on a ThinkPad T420 which is equipped with a 250 GB SSD. Since I needed more disk space I used Clonezilla to clone my current Debian installation from the internal 250 GB SSD to a new 500 GB SSD connected via an USB to SATA adapter. Afterwards I replaced the 250 GB SSD with the 500 GB SSD and u... | 5 | 217 | 1 | 0 | 1 | [
"<debian><lvm><luks><gparted><clonezilla>"
] | 2021-03-06T15:01:53.623 | 2021-03-06T23:42:40.420 | 152,196 | 637,899 | [
{
"id": 637899,
"body": "<p>it's like Russian dolls: disk -> MBR partition scheme -> extended partition container -> logical partition -> LUKS -> PV -> VG -> LV-> filesystem. So the root filesystem isn't <em>simply</em> on <code>/dev/sda5</code>.</p>\n<p>What you already did:</p>\n<u... | it's like Russian dolls: disk -> MBR partition scheme -> extended partition container -> logical partition -> LUKS -> PV -> VG -> LV-> filesystem. So the root filesystem isn't simply on `/dev/sda5`. What you already did: - enlarge disk - enlarge extended partition container (`/dev/sda2`) - enlarge partition (`/dev/sda5... | # How to increase LVM when using LUKS2 on Debian Buster
**Tags:** <debian><lvm><luks><gparted><clonezilla>
**Question (score 5):**
I'm running Debian Buster on a ThinkPad T420 which is equipped with a 250 GB SSD. Since I needed more disk space I used Clonezilla to clone my current Debian installation from the intern... | 3,644 | 911 | {
"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... |
637,904 | unix.stackexchange.com | bash regex multiple matches | <p>I have a nice little <code>bash</code> script which parses a message for a regular expression and does something with the capture groups:</p>
<pre><code>regex='\((Closes|Resolves):\s([0-9]+)\)'
msg='Fixed a problem (Closes: 1234), (Resolves: 5678)'
if [[ $msg =~ $regex ]] ; then
action="${BASH_REMATCH[1]}&qu... | I have a nice little `bash` script which parses a message for a regular expression and does something with the capture groups: ``` regex='\((Closes|Resolves):\s([0-9]+)\)' msg='Fixed a problem (Closes: 1234), (Resolves: 5678)' if [[ $msg =~ $regex ]] ; then action="${BASH_REMATCH[1]}" issue="${BASH_REMATCH[2]}" do_some... | 8 | 1,210 | 2 | 0 | 2 | [
"<bash><regular-expression>"
] | 2021-03-06T16:59:08.443 | 2021-03-07T09:43:50.477 | 272,848 | 637,905 | [
{
"id": 637905,
"body": "<p>It's not explicitly supported by built-in <code>bash</code> syntax, but it can be easily achieved with a little variable substitution and some recursion.</p>\n<pre><code>function do_something {\n echo $1 $2\n}\n\nfunction handlematches {\n regex='\\((Closes|Resolves):\\s([0-9]+... | It's not explicitly supported by built-in `bash` syntax, but it can be easily achieved with a little variable substitution and some recursion. ``` function do_something { echo $1 $2 } function handlematches { regex='\((Closes|Resolves):\s([0-9]+)\)' msg=$1 if [[ $msg =~ $regex ]] ; then action="${BASH_REMATCH[1]}" issu... | # bash regex multiple matches
**Tags:** <bash><regular-expression>
**Question (score 8):**
I have a nice little `bash` script which parses a message for a regular expression and does something with the capture groups: ``` regex='\((Closes|Resolves):\s([0-9]+)\)' msg='Fixed a problem (Closes: 1234), (Resolves: 5678)'... | 2,111 | 527 | {
"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... |
637,909 | unix.stackexchange.com | How to recover “deleted” files in Linux on an NTFS filesystem (files originally from macOS) | <p>My girlfriend has a external hard disk with 10 years+ of photos, documents and more. A lot of these files originate from her old iPhone 5 and her MacBook. The hard disk itself is NTFS Format. Since the disk is so old, it turns into a hazard of data loss (what an irony).</p>
<p>As we tried to upload all the files int... | My girlfriend has a external hard disk with 10 years+ of photos, documents and more. A lot of these files originate from her old iPhone 5 and her MacBook. The hard disk itself is NTFS Format. Since the disk is so old, it turns into a hazard of data loss (what an irony). As we tried to upload all the files into OneDrive... | 7 | 2,505 | 7 | 6 | 0 | [
"<mv><macintosh><ntfs><deleted-files>"
] | 2021-03-06T17:15:45.553 | 2021-03-07T11:17:06.900 | 459,450 | null | [
{
"id": 637961,
"body": "<p>As <a href=\"https://unix.stackexchange.com/a/637912/70346\">mentioned by terdon</a>, when writing to a "foreign" filesystem, Mac OS uses two filenames for each file. One with the actual contents and a second one with metadata that would have been stored in the resource... | As mentioned by terdon (https://unix.stackexchange.com/a/637912/70346), when writing to a "foreign" filesystem, Mac OS uses two filenames for each file. One with the actual contents and a second one with metadata that would have been stored in the resource fork. You renamed the metadata filename to the content filename... | # How to recover “deleted” files in Linux on an NTFS filesystem (files originally from macOS)
**Tags:** <mv><macintosh><ntfs><deleted-files>
**Question (score 7):**
My girlfriend has a external hard disk with 10 years+ of photos, documents and more. A lot of these files originate from her old iPhone 5 and her MacBoo... | 6,998 | 1,749 | {
"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... |
638,058 | unix.stackexchange.com | Adding a string to every column in a line- excluding the first column, variable line length, the string is contained in the first column of each line | <p>I have a file with multiple lines/rows, and each line contains a variable amount of columns:</p>
<pre><code>Name1 String111 String112
Name2 String121 String122 String123
Name3 String131 String132 String133 String134
</code></pre>
<p>And so on and so forth (no pattern as to what line has how many entries).
I would li... | I have a file with multiple lines/rows, and each line contains a variable amount of columns: ``` Name1 String111 String112 Name2 String121 String122 String123 Name3 String131 String132 String133 String134 ``` And so on and so forth (no pattern as to what line has how many entries). I would like to add the name in the f... | 5 | 351 | 3 | 0 | 0 | [
"<text-processing><awk><sed>"
] | 2021-03-07T18:43:13.577 | 2021-03-08T05:38:17.857 | 459,591 | 638,059 | [
{
"id": 638059,
"body": "<p>Just iterate over all fields starting with the second, and concatenate the first field to whatever you already have:</p>\n<pre><code>$ awk '{ for(i=2;i<=NF;i++){ $i = $1$i }}1' file\nName1 Name1String111 Name1String112\nName2 Name2String121 Name2String122 Name2String123\nName3... | Just iterate over all fields starting with the second, and concatenate the first field to whatever you already have: ``` $ awk '{ for(i=2;i<=NF;i++){ $i = $1$i }}1' file Name1 Name1String111 Name1String112 Name2 Name2String121 Name2String122 Name2String123 Name3 Name3String131 Name3String132 Name3String133 Name3String1... | # Adding a string to every column in a line- excluding the first column, variable line length, the string is contained in the first column of each line
**Tags:** <text-processing><awk><sed>
**Question (score 5):**
I have a file with multiple lines/rows, and each line contains a variable amount of columns: ``` Name1 ... | 2,904 | 726 | {
"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... |
638,090 | unix.stackexchange.com | modify one column but print all with awk | <p>I would like to modify $2 with the following code:</p>
<pre><code>cat file | awk '{printf "%.15f\n", $2 = 1-$2}' > new_file
</code></pre>
<p>The code does its job, it prints 15 decimals and calculates 1-n. However, it does not print the other columns. If I try to do that with the following code it does ... | I would like to modify $2 with the following code: ``` cat file | awk '{printf "%.15f\n", $2 = 1-$2}' > new_file ``` The code does its job, it prints 15 decimals and calculates 1-n. However, it does not print the other columns. If I try to do that with the following code it does print it, but to a different line: ``` c... | 5 | 282 | 3 | 0 | 0 | [
"<awk>"
] | 2021-03-07T23:48:41.103 | 2021-03-21T12:25:32.023 | 457,434 | 638,092 | [
{
"id": 638092,
"body": "<p>You can use <code>sprintf</code> to print the new value to a formatted string, and assign that as the new value of <code>$2</code>:</p>\n<pre class=\"lang-bsh prettyprint-override\"><code>$2 = sprintf("%.15f",1-$2)\n</code></pre>\n<p>Then it's just a matter of printing ... | You can use `sprintf` to print the new value to a formatted string, and assign that as the new value of `$2`: ``` $2 = sprintf("%.15f",1-$2) ``` Then it's just a matter of printing the whole (modified) record: ``` $ awk '{$2 = sprintf("%.15f",1-$2); print}' file 752566 0.116071428571429 1 rs3094315 0 752721 0.234126984... | # modify one column but print all with awk
**Tags:** <awk>
**Question (score 5):**
I would like to modify $2 with the following code: ``` cat file | awk '{printf "%.15f\n", $2 = 1-$2}' > new_file ``` The code does its job, it prints 15 decimals and calculates 1-n. However, it does not print the other columns. If I t... | 1,284 | 321 | {
"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... |
638,139 | unix.stackexchange.com | What's the difference between `declare foo` and `foo=` in Bash? | <p>What's the difference between <code>declare foo</code> and <code>foo=</code> in Bash?</p>
<p>If I print out the value of <code>foo</code>, then it's <code>foo</code> and <code>foo=""</code> for <code>declare foo</code> and <code>foo=</code>, respectively.</p>
<p>Are the values of <code>foo</code> and <code... | What's the difference between `declare foo` and `foo=` in Bash? If I print out the value of `foo`, then it's `foo` and `foo=""` for `declare foo` and `foo=`, respectively. Are the values of `foo` and `foo=""` equivalent? If not, how is it possible to differ between these values (both `-n` and `-z` for `[[ ... ]]` behav... | 6 | 540 | 1 | 2 | 2 | [
"<bash>"
] | 2021-03-08T09:13:33.957 | 2021-03-08T10:30:22.750 | 128,739 | 638,149 | [
{
"id": 638149,
"body": "<blockquote>\n<p>Are the values of foo and foo="" equivalent? If not, how is it possible to differ between these values</p>\n</blockquote>\n<p>No, the former is pretty much like an unset variable. You could use something like <code>declare -x foo</code> to set flags to a v... | Are the values of foo and foo="" equivalent? If not, how is it possible to differ between these values No, the former is pretty much like an unset variable. You could use something like `declare -x foo` to set flags to a variable without setting a value, e.g. here, to mark `foo` as exported in case it ever gets a value... | # What's the difference between `declare foo` and `foo=` in Bash?
**Tags:** <bash>
**Question (score 6):**
What's the difference between `declare foo` and `foo=` in Bash? If I print out the value of `foo`, then it's `foo` and `foo=""` for `declare foo` and `foo=`, respectively. Are the values of `foo` and `foo=""` e... | 2,355 | 588 | {
"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... |
638,211 | unix.stackexchange.com | coproc and named pipe behaviour under command substitution | <p>I have a requirement to make a function in a zsh shell script, that is called by command substitution, communicate state with subsequent calls to the same command substitution.</p>
<p>Something like C's static variables in functions (very crudely speaking).</p>
<p>To do this I tried 2 approaches - one using coproces... | I have a requirement to make a function in a zsh shell script, that is called by command substitution, communicate state with subsequent calls to the same command substitution. Something like C's static variables in functions (very crudely speaking). To do this I tried 2 approaches - one using coprocessors, and one use... | 5 | 256 | 2 | 5 | 1 | [
"<shell-script><zsh><pipe><fifo><coprocesses>"
] | 2021-03-08T16:25:31.210 | 2021-03-08T18:07:12.917 | 286,210 | 638,284 | [
{
"id": 638284,
"body": "<p>The reason your pipe-based script doesn't work isn't some peculiarity of zsh. It's due to the way shell command substitutions, shell redirections and pipes work. Here's the script without the superfluous parts.</p>\n<pre><code>mkfifo /tmp/foo.bar\necho 'Hello World!' > /tmp/fo... | The reason your pipe-based script doesn't work isn't some peculiarity of zsh. It's due to the way shell command substitutions, shell redirections and pipes work. Here's the script without the superfluous parts. ``` mkfifo /tmp/foo.bar echo 'Hello World!' > /tmp/foo.bar & call_me_from_cmd_subst() { echo 'Hello Response!... | # coproc and named pipe behaviour under command substitution
**Tags:** <shell-script><zsh><pipe><fifo><coprocesses>
**Question (score 5):**
I have a requirement to make a function in a zsh shell script, that is called by command substitution, communicate state with subsequent calls to the same command substitution. ... | 8,346 | 2,086 | {
"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... |
638,244 | unix.stackexchange.com | Is there a way to use the day of year as an input format for the date command? | <p>Using the command</p>
<pre><code>$ date +%j
</code></pre>
<p>gives an output of the day of the year (001-366).
However I need to use the day of the current year as an input format i.e.</p>
<pre><code>$ date --date='066 day' +%F
</code></pre>
<p>Which for year 2021 I would expect <code>2021-03-07</code> as the outpu... | Using the command ``` $ date +%j ``` gives an output of the day of the year (001-366). However I need to use the day of the current year as an input format i.e. ``` $ date --date='066 day' +%F ``` Which for year 2021 I would expect `2021-03-07` as the output. Instead I get `2021-05-13`. Does anyone know what is going o... | 11 | 702 | 2 | 0 | 2 | [
"<linux><date>"
] | 2021-03-08T19:27:25.360 | 2021-03-08T20:07:16.550 | 347,238 | 638,245 | [
{
"id": 638245,
"body": "<p>To get the 66th day of the year with GNU <code>date</code>:</p>\n<pre class=\"lang-none prettyprint-override\"><code>$ date --date='jan 1 + 65 days' +%F\n2021-03-07\n</code></pre>\n<p>or</p>\n<pre class=\"lang-none prettyprint-override\"><code>$ date --date='dec 31 last year + 66... | To get the 66th day of the year with GNU `date`: ``` $ date --date='jan 1 + 65 days' +%F 2021-03-07 ``` or ``` $ date --date='dec 31 last year + 66 days' +%F 2021-03-07 ``` With `date --date='066 day' +%F` you get the date 66 days from today. On the 8th of March, this happens to be the 13th of May. The above uses GNU `... | # Is there a way to use the day of year as an input format for the date command?
**Tags:** <linux><date>
**Question (score 11):**
Using the command ``` $ date +%j ``` gives an output of the day of the year (001-366). However I need to use the day of the current year as an input format i.e. ``` $ date --date='066 day... | 1,550 | 387 | {
"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... |
638,335 | unix.stackexchange.com | find command: -size behavior | <p>I have a question concerning the <code>find</code> command in Linux.</p>
<p>In all the articles I've found online it says that attribute <code>-size -10M</code>, for example, returns files that are less than 10 MB in size. But when I tried to test this, it seems that <code>-size -10M</code> returns files that are le... | I have a question concerning the `find` command in Linux. In all the articles I've found online it says that attribute `-size -10M`, for example, returns files that are less than 10 MB in size. But when I tried to test this, it seems that `-size -10M` returns files that are less than or equal 9 MB in size. If I do ``` ... | 10 | 646 | 2 | 0 | 1 | [
"<find><size>"
] | 2021-03-09T10:05:08.797 | 2021-03-09T10:37:22.217 | 459,820 | 638,347 | [
{
"id": 638347,
"body": "<p>The GNU find man page says as follows — and this appears specific to GNU find, other implementations may differ, see below:</p>\n<blockquote>\n<p>The + and - prefixes signify greater than and less than, as usual; i.e., an exact size of n units does not match. Bear in mind that... | The GNU find man page says as follows — and this appears specific to GNU find, other implementations may differ, see below: The + and - prefixes signify greater than and less than, as usual; i.e., an exact size of n units does not match. Bear in mind that the size is rounded up to the next unit. Therefore `-size -1M` i... | # find command: -size behavior
**Tags:** <find><size>
**Question (score 10):**
I have a question concerning the `find` command in Linux. In all the articles I've found online it says that attribute `-size -10M`, for example, returns files that are less than 10 MB in size. But when I tried to test this, it seems that... | 4,975 | 1,243 | {
"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... |
638,372 | unix.stackexchange.com | why does `find` still try to access .gvfs AND even includes it in the output, despite `-prune`? | <p><sub>beforehand: this evolved from a general question (I thought it was the case with every folder) to this specific corner case.<br>
as it seemed that a few other people are as curious as myself, I decided to not delete this question but rework it.</sub></p>
<hr />
<p>Let's say I want to list all items contained di... | beforehand: this evolved from a general question (I thought it was the case with every folder) to this specific corner case. as it seemed that a few other people are as curious as myself, I decided to not delete this question but rework it. Let's say I want to list all items contained direct in my home folder, except t... | 5 | 137 | 1 | 3 | 0 | [
"<shell><find>"
] | 2021-03-09T13:12:44.290 | 2021-03-17T08:18:18.207 | 93,768 | 638,570 | [
{
"id": 638570,
"body": "<p>This appears to be <a href=\"https://savannah.gnu.org/bugs/index.php?60207#comment0\" rel=\"nofollow noreferrer\">a bug</a> in the GNU implementation of <code>find</code>. Here, the trigger seems to be the fact that the <code>lstat()</code> / <code>fstatat()</code> system call (t... | This appears to be a bug (https://savannah.gnu.org/bugs/index.php?60207#comment0) in the GNU implementation of `find`. Here, the trigger seems to be the fact that the `lstat()` / `fstatat()` system call (to retrieve a file's metadata) fails with `EACCESS` (permission denied) on that `.gvfs` file. That typically happens... | # why does `find` still try to access .gvfs AND even includes it in the output, despite `-prune`?
**Tags:** <shell><find>
**Question (score 5):**
beforehand: this evolved from a general question (I thought it was the case with every folder) to this specific corner case. as it seemed that a few other people are as cu... | 5,966 | 1,491 | {
"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... |
638,721 | unix.stackexchange.com | Should the option "--rcfile /dev/null" have the same effect as "--norc" when invoking bash? | <p>To avoid the XY problem scenario, I'll explain why I'm asking this question.</p>
<p>I remember I had <code>shopt -s extglob</code> set in my <code>~/.bashrc</code> file, because things like <code>@(pattern-list)</code> do work.</p>
<p>However, I've just looked into <code>~/.bashrc</code> and that option is not set.<... | To avoid the XY problem scenario, I'll explain why I'm asking this question. I remember I had `shopt -s extglob` set in my `~/.bashrc` file, because things like `@(pattern-list)` do work. However, I've just looked into `~/.bashrc` and that option is not set. So I decided to see where it comes from, and discovered that ... | 7 | 293 | 1 | 6 | 0 | [
"<bash><arch-linux><shopt>"
] | 2021-03-11T08:18:16.057 | 2021-03-11T15:55:00.047 | 164,309 | null | [
{
"id": 638734,
"body": "<p>On Debian/Ubuntu, there's also <code>/etc/bash.bashrc</code>, which Bash reads similarly to <code>~/.bashrc</code>. Using it is a compile time option, and I understand Red Hat does a similar thing by just sourcing a similar file in <code>/etc/</code> from the per-user <code>.bash... | On Debian/Ubuntu, there's also `/etc/bash.bashrc`, which Bash reads similarly to `~/.bashrc`. Using it is a compile time option, and I understand Red Hat does a similar thing by just sourcing a similar file in `/etc/` from the per-user `.bashrc`. The Debian documentation (https://manpages.debian.org/buster/bash/bash.1.... | # Should the option "--rcfile /dev/null" have the same effect as "--norc" when invoking bash?
**Tags:** <bash><arch-linux><shopt>
**Question (score 7):**
To avoid the XY problem scenario, I'll explain why I'm asking this question. I remember I had `shopt -s extglob` set in my `~/.bashrc` file, because things like `@... | 1,912 | 478 | {
"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... |
638,826 | unix.stackexchange.com | When defining an environment variable, I get "Command not found" | <p>When I type <code>HELLO="hello"</code>, I would expect to create an environment variable called HELLO. Instead, I get the error <code>HELLO=hello: Command not found.</code> What could be going wrong here?</p>
<p>I am on Debian GNU/Linux 9.12, on a shared server where I am not root.</p>
| When I type `HELLO="hello"`, I would expect to create an environment variable called HELLO. Instead, I get the error `HELLO=hello: Command not found.` What could be going wrong here? I am on Debian GNU/Linux 9.12, on a shared server where I am not root. | 5 | 1,206 | 1 | 3 | 0 | [
"<environment-variables><tcsh>"
] | 2021-03-11T20:17:15.483 | 2021-03-12T17:04:30.470 | 460,292 | 638,830 | [
{
"id": 638830,
"body": "<p>That's the right command to set a shell variable. Or would be, in a POSIX shell. It doesn't actually export the variable to the environment of commands you run, though. To do that, you'd need <code>export HELLO</code> in addition.</p>\n<p>See e.g. <a href=\"https://unix.stackexch... | That's the right command to set a shell variable. Or would be, in a POSIX shell. It doesn't actually export the variable to the environment of commands you run, though. To do that, you'd need `export HELLO` in addition. See e.g. Difference between shell variables which are exported and those which are not in bash (http... | # When defining an environment variable, I get "Command not found"
**Tags:** <environment-variables><tcsh>
**Question (score 5):**
When I type `HELLO="hello"`, I would expect to create an environment variable called HELLO. Instead, I get the error `HELLO=hello: Command not found.` What could be going wrong here? I a... | 1,227 | 306 | {
"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... |
638,994 | unix.stackexchange.com | Why a text editor shows different from cat command | <p>I run:</p>
<pre><code>$ man cd > mancd
$ cat mancd
</code></pre>
<p>This shows as expected.
But when I open the file with VSCode and vim, they are completely different.</p>
<p><a href="https://i.stack.imgur.com/gY82n.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/gY82n.png" alt="enter image de... | I run: ``` $ man cd > mancd $ cat mancd ``` This shows as expected. But when I open the file with VSCode and vim, they are completely different. (https://i.stack.imgur.com/gY82n.png) (https://i.stack.imgur.com/t1CqM.png) Why is it and how can I redirect the man page to a file correctly. | 5 | 468 | 1 | 2 | 1 | [
"<cat><man><editors>"
] | 2021-03-12T21:02:57.890 | 2021-03-13T08:11:12.060 | 120,293 | null | [
{
"id": 639036,
"body": "<p>Notice a lot of <code>^H</code> in the screenshot above. It means <kbd>Ctrl</kbd>+<kbd>H</kbd> which produces the ASCII 08 character A.K.A. <em>Backspace</em>. When printing a character, move the cursor back with <em>Backspace</em> then <a href=\"https://en.wikipedia.org/wiki/Ove... | Notice a lot of `^H` in the screenshot above. It means Ctrl+H which produces the ASCII 08 character A.K.A. Backspace. When printing a character, move the cursor back with Backspace then overwrite the same character again (https://en.wikipedia.org/wiki/Overstrike) then it appears darker. That's how bold text is achieved... | # Why a text editor shows different from cat command
**Tags:** <cat><man><editors>
**Question (score 5):**
I run: ``` $ man cd > mancd $ cat mancd ``` This shows as expected. But when I open the file with VSCode and vim, they are completely different. (https://i.stack.imgur.com/gY82n.png) (https://i.stack.imgur.com/... | 2,965 | 741 | {
"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... |
639,105 | unix.stackexchange.com | Retaining permissions when copying a folder | <p>I am having an issue where I have Parent folder that has full permissions.. I can create a new folder and that folder also has full permissions. However when I copy a folder over to this parent Directory and try to create a new directory to this copied directory. it loses all permissions.. is there a way to retain p... | I am having an issue where I have Parent folder that has full permissions.. I can create a new folder and that folder also has full permissions. However when I copy a folder over to this parent Directory and try to create a new directory to this copied directory. it loses all permissions.. is there a way to retain perm... | 7 | 875 | 3 | 0 | 1 | [
"<permissions><cp>"
] | 2021-03-13T16:31:46.350 | 2021-03-14T03:16:09.500 | 460,592 | null | [
{
"id": 639110,
"body": "<p>Yes. When copying using <code>cp</code>, the <code>-p</code> option preserves permissions.</p>\n<p><a href=\"https://man7.org/linux/man-pages/man1/cp.1.html\" rel=\"noreferrer\">https://man7.org/linux/man-pages/man1/cp.1.html</a></p>\n<pre><code> -p same as --preserve=m... | Yes. When copying using `cp`, the `-p` option preserves permissions. https://man7.org/linux/man-pages/man1/cp.1.html (https://man7.org/linux/man-pages/man1/cp.1.html) ``` -p same as --preserve=mode,ownership,timestamps --preserve[=ATTR_LIST] preserve the specified attributes (default: mode,ownership,timestamps), if pos... | # Retaining permissions when copying a folder
**Tags:** <permissions><cp>
**Question (score 7):**
I am having an issue where I have Parent folder that has full permissions.. I can create a new folder and that folder also has full permissions. However when I copy a folder over to this parent Directory and try to crea... | 1,518 | 379 | {
"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... |
639,180 | unix.stackexchange.com | Debian 10: Why some SSL packages will be downgraded? | <p>I cannot find any informations about it. May someone has some insights to share.</p>
<p>apt suggests to downgrade some SSL packages.</p>
<pre><code># apt-get update && apt-get dist-upgrade --assume-yes
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculatin... | I cannot find any informations about it. May someone has some insights to share. apt suggests to downgrade some SSL packages. ``` # apt-get update && apt-get dist-upgrade --assume-yes Reading package lists... Done Building dependency tree Reading state information... Done Calculating upgrade... Done The following packa... | 5 | 1,924 | 3 | 2 | 0 | [
"<debian><apt><dist-upgrade>"
] | 2021-03-14T10:03:25.927 | 2021-05-06T06:12:30.340 | 250,324 | 639,237 | [
{
"id": 639237,
"body": "<p><a href=\"https://www.debian.org/security/2021/dsa-4855\" rel=\"noreferrer\">https://www.debian.org/security/2021/dsa-4855</a></p>\n<p>This, and other package information about openssl in Debian Buster, indicates that 1.1.1d is the current stable version. It looks like you've acq... | https://www.debian.org/security/2021/dsa-4855 (https://www.debian.org/security/2021/dsa-4855) This, and other package information about openssl in Debian Buster, indicates that 1.1.1d is the current stable version. It looks like you've acquired 1.1.1j from elsewhere (gbp2578a0), and it doesn't have this important secur... | # Debian 10: Why some SSL packages will be downgraded?
**Tags:** <debian><apt><dist-upgrade>
**Question (score 5):**
I cannot find any informations about it. May someone has some insights to share. apt suggests to downgrade some SSL packages. ``` # apt-get update && apt-get dist-upgrade --assume-yes Reading package ... | 9,724 | 2,431 | {
"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... |
639,326 | unix.stackexchange.com | How to redirect a command's `stdin` as well as `stdout` to the output | <p>Suppose I have the Python script:</p>
<pre class="lang-py prettyprint-override"><code>#!/usr/bin/env python
input('Y/n: ')
print('Next line')
</code></pre>
<p>After I press <code>Y</code>, I want both the terminal and my <code>output.txt</code> containing:</p>
<pre><code>Y/n: Y
Next line
</code></pre>
<p>Running the... | Suppose I have the Python script: ``` #!/usr/bin/env python input('Y/n: ') print('Next line') ``` After I press `Y`, I want both the terminal and my `output.txt` containing: ``` Y/n: Y Next line ``` Running the following I don't get `Y` in the output: ``` $ python ask.py 2>&1 | tee output.txt ``` How can I include my r... | 5 | 417 | 1 | 1 | 0 | [
"<pipe><stdout><stdin><tee>"
] | 2021-03-15T09:02:16.890 | 2021-03-15T12:52:10.380 | 63,246 | 639,335 | [
{
"id": 639335,
"body": "<p>Along the lines of what you already have (tested with <code>python3</code>):</p>\n<pre class=\"lang-bsh prettyprint-override\"><code>tee -a output.txt | python ask.py 2>&1 | tee -a output.txt\n</code></pre>\n<p>As a downside, you will need to explicitly type something afte... | Along the lines of what you already have (tested with `python3`): ``` tee -a output.txt | python ask.py 2>&1 | tee -a output.txt ``` As a downside, you will need to explicitly type something after the python script terminates, to make the first `tee` attempt writing to the pipe, receive a `SIGPIPE` and exit. You may be... | # How to redirect a command's `stdin` as well as `stdout` to the output
**Tags:** <pipe><stdout><stdin><tee>
**Question (score 5):**
Suppose I have the Python script: ``` #!/usr/bin/env python input('Y/n: ') print('Next line') ``` After I press `Y`, I want both the terminal and my `output.txt` containing: ``` Y/n: Y... | 1,410 | 352 | {
"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... |
639,349 | unix.stackexchange.com | Can ** (bash's globstar) run out of memory? | <p>Can using bash's globstar (<code>**</code>) operator cause an out of memory error? Consider something like:</p>
<pre><code>for f in /**/*; do printf '%s\n' "$f"; done
</code></pre>
<p>When <code>**</code> is being used to generate an enormous list of files, assuming the list is too large to fit in memory, ... | Can using bash's globstar (`**`) operator cause an out of memory error? Consider something like: ``` for f in /**/*; do printf '%s\n' "$f"; done ``` When `**` is being used to generate an enormous list of files, assuming the list is too large to fit in memory, will bash crash or does it have a mechanism to handle this?... | 5 | 425 | 1 | 7 | 2 | [
"<bash><wildcards><out-of-memory><globstar>"
] | 2021-03-15T12:36:15.683 | 2021-03-15T16:00:38.963 | 22,222 | 639,354 | [
{
"id": 639354,
"body": "<p>Yes, it can, and <a href=\"https://git.savannah.gnu.org/cgit/bash.git/tree/lib/glob/glob.c?id=8868edaf2250e09c4e9a1c75ffe3274f28f38581#n947\" rel=\"noreferrer\">this is explicitly accounted for in the globbing library</a>:</p>\n<pre class=\"lang-c prettyprint-override\"><code> /... | Yes, it can, and this is explicitly accounted for in the globbing library (https://git.savannah.gnu.org/cgit/bash.git/tree/lib/glob/glob.c?id=8868edaf2250e09c4e9a1c75ffe3274f28f38581#n947): ``` /* Have we run out of memory? */ if (lose) { tmplink = 0; /* Here free the strings we have got. */ while (lastlink) { /* Since... | # Can ** (bash's globstar) run out of memory?
**Tags:** <bash><wildcards><out-of-memory><globstar>
**Question (score 5):**
Can using bash's globstar (`**`) operator cause an out of memory error? Consider something like: ``` for f in /**/*; do printf '%s\n' "$f"; done ``` When `**` is being used to generate an enormo... | 2,229 | 557 | {
"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... |
639,423 | unix.stackexchange.com | How do bash loops work precisely? | <pre><code>for i in {0..999999999}; do echo "hi"; done
</code></pre>
<p>takes a long time to write it's output, as if all the <code>echo</code>s are first executed and then sent to <code>stdout</code>. The effect is even more pronounced with <code>cowfortune</code> instead of <code>echo</code> and makes termi... | ``` for i in {0..999999999}; do echo "hi"; done ``` takes a long time to write it's output, as if all the `echo`s are first executed and then sent to `stdout`. The effect is even more pronounced with `cowfortune` instead of `echo` and makes terminal buffering less likely to be the issue. So what precisely happens when ... | 6 | 1,169 | 1 | 5 | 0 | [
"<bash><for><brace-expansion>"
] | 2021-03-15T20:30:26.730 | 2021-03-15T22:37:19.920 | 20,506 | 639,425 | [
{
"id": 639425,
"body": "<p>Ordinary <code>for</code> loops always iterate over a static set of strings. This is regardless of whether the strings are generated by brace expansions or by filename globbing patterns, or some other expansion of a variable or command substitution, etc.</p>\n<p>For your <code>fo... | Ordinary `for` loops always iterate over a static set of strings. This is regardless of whether the strings are generated by brace expansions or by filename globbing patterns, or some other expansion of a variable or command substitution, etc. For your `for` loop, you generate the strings to loop over using a brace exp... | # How do bash loops work precisely?
**Tags:** <bash><for><brace-expansion>
**Question (score 6):**
``` for i in {0..999999999}; do echo "hi"; done ``` takes a long time to write it's output, as if all the `echo`s are first executed and then sent to `stdout`. The effect is even more pronounced with `cowfortune` inste... | 1,521 | 380 | {
"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... |
639,482 | unix.stackexchange.com | How can I disable the Wi-fi radio permanently to save power? | <p>I can disable it with</p>
<pre><code>sudo nmcli radio wifi off
</code></pre>
<p>but it turns back on after a reboot. The only thread I could find was <a href="https://askubuntu.com/questions/24171/how-can-i-keep-a-wireless-cards-radio-powered-off-by-default">this one</a>, but it only applies to Ubuntu, and I'm using... | I can disable it with ``` sudo nmcli radio wifi off ``` but it turns back on after a reboot. The only thread I could find was this one (https://askubuntu.com/questions/24171/how-can-i-keep-a-wireless-cards-radio-powered-off-by-default), but it only applies to Ubuntu, and I'm using Arch Linux. My laptop has a physical s... | 9 | 2,424 | 3 | 9 | 2 | [
"<arch-linux><wifi><networkmanager>"
] | 2021-03-16T04:50:20.873 | 2021-03-16T11:38:31.020 | 418,663 | 639,513 | [
{
"id": 639494,
"body": "<p>Many laptops use Mini PCI-Express cards or M.2 wireless cards for wi-fi, and these can be removed (see <a href=\"https://www.howtogeek.com/346854/how-to-upgrade-or-replace-your-pcs-wireless-card/\" rel=\"noreferrer\">this How-To Geek article on upgrading wireless cards</a> for ex... | Many laptops use Mini PCI-Express cards or M.2 wireless cards for wi-fi, and these can be removed (see this How-To Geek article on upgrading wireless cards (https://www.howtogeek.com/346854/how-to-upgrade-or-replace-your-pcs-wireless-card/) for example). In such cases, the best way to ensure that the wi-fi adapter does... | # How can I disable the Wi-fi radio permanently to save power?
**Tags:** <arch-linux><wifi><networkmanager>
**Question (score 9):**
I can disable it with ``` sudo nmcli radio wifi off ``` but it turns back on after a reboot. The only thread I could find was this one (https://askubuntu.com/questions/24171/how-can-i-k... | 1,390 | 347 | {
"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... |
639,687 | unix.stackexchange.com | Problems iterating over several Bash arrays in one loop | <p>I have problems with some arrays in bash.</p>
<pre><code>A=( "127.0.0.1" "localhost" "aaa nnn cvcc" )
B=( "8.8.8.8" "dns" "bbb tttt rrrr")
for n in ${A} ${B} ; do
if ping -c3 ${n[0]};then
echo "${n[1]}"
for share in ${n[2]};do
ech... | I have problems with some arrays in bash. ``` A=( "127.0.0.1" "localhost" "aaa nnn cvcc" ) B=( "8.8.8.8" "dns" "bbb tttt rrrr") for n in ${A} ${B} ; do if ping -c3 ${n[0]};then echo "${n[1]}" for share in ${n[2]};do echo $share done fi done ``` I'd like to print the second and third element of the array but the for loo... | 5 | 509 | 3 | 0 | 1 | [
"<bash><shell-script><array>"
] | 2021-03-17T09:08:48.847 | 2021-03-17T10:49:45.637 | 420,374 | null | [
{
"id": 639709,
"body": "<p>Your loop actually loops over the first elements of <code>A</code> and <code>B</code>, i.e. <code>${A[0]}</code> and <code>${B[0]}</code>, which later means that <code>${n[1]}</code> and <code>${n[2]}</code> would be empty strings while <code>${n[0]}</code> is the same as <code>$... | Your loop actually loops over the first elements of `A` and `B`, i.e. `${A[0]}` and `${B[0]}`, which later means that `${n[1]}` and `${n[2]}` would be empty strings while `${n[0]}` is the same as `$n`. I would probably employ a name reference variable to do this in `bash` (release 4.3 or later): ``` #!/bin/bash A=( 127... | # Problems iterating over several Bash arrays in one loop
**Tags:** <bash><shell-script><array>
**Question (score 5):**
I have problems with some arrays in bash. ``` A=( "127.0.0.1" "localhost" "aaa nnn cvcc" ) B=( "8.8.8.8" "dns" "bbb tttt rrrr") for n in ${A} ${B} ; do if ping -c3 ${n[0]};then echo "${n[1]}" for s... | 5,508 | 1,377 | {
"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... |
640,062 | unix.stackexchange.com | How to temporarily save and restore the IFS variable properly? | <p>How do I correctly run a few commands with an altered value of the <code>IFS</code> variable (to change the way field splitting works and how <code>"$*"</code> is handled), and then restore the original value of <code>IFS</code>?</p>
<p>I know I can do</p>
<pre class="lang-bsh prettyprint-override"><code>(... | How do I correctly run a few commands with an altered value of the `IFS` variable (to change the way field splitting works and how `"$*"` is handled), and then restore the original value of `IFS`? I know I can do ``` ( IFS='my value here' my-commands here ) ``` to localize the change of `IFS` to the sub-shell, but I do... | 27 | 1,170 | 5 | 12 | 3 | [
"<shell><variable>"
] | 2021-03-19T11:03:00.943 | 2021-03-21T09:18:07.430 | 116,858 | 640,063 | [
{
"id": 640063,
"body": "<p>Yes, in the case when <code>IFS</code> is unset, restoring the value from <code>$saved_IFS</code> would actually <em>set</em> the value of <code>IFS</code> (to an empty value).</p>\n<p>This would affect the way field splitting of unquoted expansions is done, it would affect field... | Yes, in the case when `IFS` is unset, restoring the value from `$saved_IFS` would actually set the value of `IFS` (to an empty value). This would affect the way field splitting of unquoted expansions is done, it would affect field splitting for the `read` built-in utility, and it would affect the way the positional par... | # How to temporarily save and restore the IFS variable properly?
**Tags:** <shell><variable>
**Question (score 27):**
How do I correctly run a few commands with an altered value of the `IFS` variable (to change the way field splitting works and how `"$*"` is handled), and then restore the original value of `IFS`? I ... | 5,188 | 1,297 | {
"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... |
640,272 | unix.stackexchange.com | /dev/random EXTREMELY slow in Ubuntu for Windows 10 (WSL) | <p>I am using Ubuntu 20.04 for Windows 10 (WSL2) on a Haswell laptop and I am getting about 0.6 bytes per second. As in 6 bytes total after 10 seconds of waiting. This is unacceptable. What is the problem?</p>
<p><strong>EDIT:</strong> This only appears to be an issue when operating in WSL2 mode.
WSL1 = 40MiB/s
WSL2 = ... | I am using Ubuntu 20.04 for Windows 10 (WSL2) on a Haswell laptop and I am getting about 0.6 bytes per second. As in 6 bytes total after 10 seconds of waiting. This is unacceptable. What is the problem? EDIT: This only appears to be an issue when operating in WSL2 mode. WSL1 = 40MiB/s WSL2 = 0.6 byte/s | 11 | 2,694 | 2 | 9 | 2 | [
"<windows-subsystem-for-linux><random>"
] | 2021-03-20T20:29:36.490 | 2021-03-20T20:52:48.880 | 430,596 | 640,281 | [
{
"id": 640281,
"body": "<p>Both <code>/dev/random</code> and <code>/dev/urandom</code> in Linux are cryptographically secure pseudorandom number generators. In older versions of the Linux kernel, <code>/dev/random</code> would block once initialized until additional sufficient entropy was accumulated, whe... | Both `/dev/random` and `/dev/urandom` in Linux are cryptographically secure pseudorandom number generators. In older versions of the Linux kernel, `/dev/random` would block once initialized until additional sufficient entropy was accumulated, whereas `/dev/urandom` would not. Since WSL2 is a virtual machine with a real... | # /dev/random EXTREMELY slow in Ubuntu for Windows 10 (WSL)
**Tags:** <windows-subsystem-for-linux><random>
**Question (score 11):**
I am using Ubuntu 20.04 for Windows 10 (WSL2) on a Haswell laptop and I am getting about 0.6 bytes per second. As in 6 bytes total after 10 seconds of waiting. This is unacceptable. Wh... | 3,121 | 780 | {
"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... |
640,294 | unix.stackexchange.com | Using `printf` to output chars given some ASCII numbers | <p>I've been trying to make <code>printf</code> output some chars, given their ASCII numbers (in hex)... something like this:</p>
<pre class="lang-bsh prettyprint-override"><code>#!/bin/bash
hexchars () { printf '\x%s' $@ ;}
hexchars 48 65 6c 6c 6f
Expected output:
Hello
</code></pre>
<p>For some reason that doesn't... | I've been trying to make `printf` output some chars, given their ASCII numbers (in hex)... something like this: ``` #!/bin/bash hexchars () { printf '\x%s' $@ ;} hexchars 48 65 6c 6c 6f Expected output: Hello ``` For some reason that doesn't work though. Any ideas? EDIT: Based on the answer provided by Isaac (accepted ... | 5 | 500 | 3 | 5 | 1 | [
"<bash><printf>"
] | 2021-03-21T02:29:47.723 | 2021-03-21T09:05:18.673 | null | 640,310 | [
{
"id": 640310,
"body": "<p>Oh, sure, just that it has to be done in two steps. Like a two step tango:</p>\n<pre><code>$ printf "$(printf '\\\\x%s' 48 65 6c 6c 6f)"; echo\nHello\n</code></pre>\n<p>Or, alternatively:</p>\n<pre><code>$ test () { printf "$(printf '\\\\x%s' "$@")"... | Oh, sure, just that it has to be done in two steps. Like a two step tango: ``` $ printf "$(printf '\\x%s' 48 65 6c 6c 6f)"; echo Hello ``` Or, alternatively: ``` $ test () { printf "$(printf '\\x%s' "$@")"; echo; } $ test 48 65 6c 6c 6f Hello ``` Or, to avoid printing on "no arguments": ``` $ test () { [ "$#" -gt 0 ] &... | # Using `printf` to output chars given some ASCII numbers
**Tags:** <bash><printf>
**Question (score 5):**
I've been trying to make `printf` output some chars, given their ASCII numbers (in hex)... something like this: ``` #!/bin/bash hexchars () { printf '\x%s' $@ ;} hexchars 48 65 6c 6c 6f Expected output: Hello `... | 1,710 | 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... |
640,343 | unix.stackexchange.com | Accidentally ran sudo rm /* on my Arch Linux installation | <p>I accidentally executed <code>sudo rm /*</code> instead of <code>sudo rm ./*</code> inside a directory whose contents I wanted to delete, and I have basically messed up my system.</p>
<p>None of the basic commands like <code>ls</code>, <code>grep</code> etc. are working, and none of my applications are opening, like... | I accidentally executed `sudo rm /*` instead of `sudo rm ./*` inside a directory whose contents I wanted to delete, and I have basically messed up my system. None of the basic commands like `ls`, `grep` etc. are working, and none of my applications are opening, like chromium, slack, image viewer etc. I tried to look up... | 21 | 8,396 | 2 | 16 | 4 | [
"<arch-linux><sudo><rm><data-recovery>"
] | 2021-03-21T13:41:57.747 | 2021-03-22T13:57:25.440 | 454,328 | null | [
{
"id": 640359,
"body": "<p>Arch Linux has four symbolic links in <code>/</code>:</p>\n<ul>\n<li><code>bin -> usr/bin</code></li>\n<li><code>lib -> usr/lib</code></li>\n<li><code>lib64 -> usr/lib</code></li>\n<li><code>sbin -> usr/bin</code></li>\n</ul>\n<p>You should be able to recreate them (u... | Arch Linux has four symbolic links in `/`: - `bin -> usr/bin` - `lib -> usr/lib` - `lib64 -> usr/lib` - `sbin -> usr/bin` You should be able to recreate them (using a Live-USB or an emergency shell) or by calling the linker (with root privileges and in `/` as working directory) directly: ``` /usr/lib/ld-linux-x86-64.so... | # Accidentally ran sudo rm /* on my Arch Linux installation
**Tags:** <arch-linux><sudo><rm><data-recovery>
**Question (score 21):**
I accidentally executed `sudo rm /*` instead of `sudo rm ./*` inside a directory whose contents I wanted to delete, and I have basically messed up my system. None of the basic commands... | 2,480 | 620 | {
"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... |
640,457 | unix.stackexchange.com | How can I prevent the second command in a chain while keeping the first one running? | <p>Yesterday before going to sleep I started a long process of which I thought it would be finished before I stand up, therefore I used</p>
<pre class="lang-bsh prettyprint-override"><code>./command && sudo poweroff
</code></pre>
<p>my system is configured to not ask for a password for <code>sudo poweroff</code... | Yesterday before going to sleep I started a long process of which I thought it would be finished before I stand up, therefore I used ``` ./command && sudo poweroff ``` my system is configured to not ask for a password for `sudo poweroff`, so it should shutdown when that command is finished. However it is still running ... | 27 | 1,618 | 3 | 6 | 2 | [
"<command-line><zsh><shutdown><job-control>"
] | 2021-03-22T10:20:58.063 | 2021-04-07T22:48:57.043 | 200,668 | 640,467 | [
{
"id": 640467,
"body": "<p>As you clarified in comments it's still running in foreground on an interactive shell, you should just be able to press <kbd>Ctrl+Z</kbd>.</p>\n<p>That will suspend the <code>./command</code> job. Unless <code>./command</code> actually intercepts the SIGTSTP signal and chooses to... | As you clarified in comments it's still running in foreground on an interactive shell, you should just be able to press Ctrl+Z. That will suspend the `./command` job. Unless `./command` actually intercepts the SIGTSTP signal and chooses to exit(0) in that case (unlikely), the exit status will be non-0 (128+SIGTSTP, gen... | # How can I prevent the second command in a chain while keeping the first one running?
**Tags:** <command-line><zsh><shutdown><job-control>
**Question (score 27):**
Yesterday before going to sleep I started a long process of which I thought it would be finished before I stand up, therefore I used ``` ./command && su... | 2,114 | 528 | {
"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... |
640,711 | unix.stackexchange.com | What are some useful use-cases for eval in Shell? | <p>You hear it a lot <code>eval is evil</code>, whether it's in Shell/POSIX world, or in other langs like python etc...</p>
<p>But I'm wondering, is it actually useless? or is it there some arcane, non-documented, interesting or just useful use-cases for it?</p>
<p>Would prefer if the answer is <code>sh</code>/<code>ba... | You hear it a lot `eval is evil`, whether it's in Shell/POSIX world, or in other langs like python etc... But I'm wondering, is it actually useless? or is it there some arcane, non-documented, interesting or just useful use-cases for it? Would prefer if the answer is `sh`/`bash` centric, but it's fine if it's about oth... | 15 | 1,751 | 10 | 11 | 2 | [
"<shell><eval>"
] | 2021-03-23T15:00:41.450 | 2021-03-23T15:10:50.330 | 409,852 | null | [
{
"id": 640716,
"body": "<p>I know of two ... common ... use cases for <code>eval</code>:</p>\n<ol>\n<li><p>Argument processing with <a href=\"https://manpages.debian.org/testing/util-linux/getopt.1.en.html#DESCRIPTION\" rel=\"noreferrer\"><code>getopt</code></a>:</p>\n<blockquote>\n<p>[T]his implementation... | I know of two ... common ... use cases for `eval`: - Argument processing with `getopt` (https://manpages.debian.org/testing/util-linux/getopt.1.en.html#DESCRIPTION): [T]his implementation can generate quoted output which must once again be interpreted by the shell (usually by using the eval command). - Setting up an SS... | # What are some useful use-cases for eval in Shell?
**Tags:** <shell><eval>
**Question (score 15):**
You hear it a lot `eval is evil`, whether it's in Shell/POSIX world, or in other langs like python etc... But I'm wondering, is it actually useless? or is it there some arcane, non-documented, interesting or just use... | 7,236 | 1,809 | {
"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... |
640,919 | unix.stackexchange.com | bash - get 1st argument of current command I am editing via history, or similar? | <p>Often I'm writing a command in a bash prompt, where I want to get previous arguments, in the CURRENT line I'm typing out, and put in other places in the command.</p>
<p>A simple example, would be if I want to rename a file. I would</p>
<ul>
<li>type out the <code>mv</code> command</li>
<li>type the filename I want t... | Often I'm writing a command in a bash prompt, where I want to get previous arguments, in the CURRENT line I'm typing out, and put in other places in the command. A simple example, would be if I want to rename a file. I would - type out the `mv` command - type the filename I want to move, `~/myTestFileWithLongFilename.t... | 5 | 320 | 4 | 0 | 2 | [
"<bash><history-expansion>"
] | 2021-03-24T18:42:19.287 | 2021-03-25T17:52:09.863 | 22,734 | 640,923 | [
{
"id": 640922,
"body": "<p>To lessen the amount of typing needed for that <code>mv</code> command, a brace expansion could be used:</p>\n<pre class=\"lang-bsh prettyprint-override\"><code>mv ~/myTestFileWithLongFilename.{txt,md}\n</code></pre>\n<p>The brace expansion expands to <code>~/myTestFileWithLongFi... | To lessen the amount of typing needed for that `mv` command, a brace expansion could be used: ``` mv ~/myTestFileWithLongFilename.{txt,md} ``` The brace expansion expands to `~/myTestFileWithLongFilename.txt` followed by `~/myTestFileWithLongFilename.md` (it's important to get the `{txt,md}` order right). Brace expansi... | # bash - get 1st argument of current command I am editing via history, or similar?
**Tags:** <bash><history-expansion>
**Question (score 5):**
Often I'm writing a command in a bash prompt, where I want to get previous arguments, in the CURRENT line I'm typing out, and put in other places in the command. A simple exa... | 2,029 | 507 | {
"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... |
641,003 | unix.stackexchange.com | Can read() return value exceed the count value? | <p>With the below function signature</p>
<p><code>ssize_t read(int <em>fd</em>, void *<em>buf</em>, size_t <em>count</em>);</code></p>
<p>While I do understand based off the man page that on a success case, return value can be lesser than <em>count</em>, but can the return value exceed <em>count</em> at any instance?</... | With the below function signature `ssize_t read(int fd, void *buf, size_t count);` While I do understand based off the man page that on a success case, return value can be lesser than count, but can the return value exceed count at any instance? | 6 | 944 | 2 | 0 | 0 | [
"<linux><c><read>"
] | 2021-03-25T07:32:34.463 | 2021-03-25T07:48:51.147 | 398,278 | 641,006 | [
{
"id": 641006,
"body": "<p>A call to <a href=\"https://pubs.opengroup.org/onlinepubs/9699919799/functions/read.html\" rel=\"noreferrer\"><code>read()</code></a> might result in more data being read behind the scenes than was requested (<em>e.g.</em> to read a full block from storage, or read ahead the foll... | A call to `read()` (https://pubs.opengroup.org/onlinepubs/9699919799/functions/read.html) might result in more data being read behind the scenes than was requested (e.g. to read a full block from storage, or read ahead the following blocks), but `read()` itself never returns more data than was requested (`count`). If i... | # Can read() return value exceed the count value?
**Tags:** <linux><c><read>
**Question (score 6):**
With the below function signature `ssize_t read(int fd, void *buf, size_t count);` While I do understand based off the man page that on a success case, return value can be lesser than count, but can the return value ... | 1,322 | 330 | {
"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... |
641,042 | unix.stackexchange.com | sh shell: Redirect output to both terminal and file inside script | <p>How to redirect both stdout and stderr to a file as well as terminal from inside the script.</p>
<pre><code>#!/bin/sh
LOG_FILE="/tmp/abc.log"
exec &> >(tee -a $LOG_FILE)
echo "Start"
echo "Hi" 1>&2
echo "End"
</code></pre>
<p>I found above script. But this... | How to redirect both stdout and stderr to a file as well as terminal from inside the script. ``` #!/bin/sh LOG_FILE="/tmp/abc.log" exec &> >(tee -a $LOG_FILE) echo "Start" echo "Hi" 1>&2 echo "End" ``` I found above script. But this script works only on bash. With sh shell it gives following error: ``` ./abc.sh: 5: Syn... | 8 | 669 | 1 | 1 | 2 | [
"<shell-script><shell><logs><io-redirection>"
] | 2021-03-25T12:47:24.310 | 2021-03-25T13:13:55.517 | 361,504 | 641,045 | [
{
"id": 641045,
"body": "<p>Yes, <code>&></code> is a <code>bash</code> operator (now also supported by <code>zsh</code>, while <code>zsh</code> always had <code>>&</code> for the same like in <code>csh</code>), and <code>>(...)</code> a <code>ksh</code> operator (now also supported by <cod... | Yes, `&>` is a `bash` operator (now also supported by `zsh`, while `zsh` always had `>&` for the same like in `csh`), and `>(...)` a `ksh` operator (now also supported by `zsh` and `bash`), neither are `sh` operator. That unquoted $LOG_FILE where you obviously don't want split+glob here, makes it zsh syntax (the only o... | # sh shell: Redirect output to both terminal and file inside script
**Tags:** <shell-script><shell><logs><io-redirection>
**Question (score 8):**
How to redirect both stdout and stderr to a file as well as terminal from inside the script. ``` #!/bin/sh LOG_FILE="/tmp/abc.log" exec &> >(tee -a $LOG_FILE) echo "Start"... | 1,839 | 459 | {
"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... |
641,098 | unix.stackexchange.com | why are the definition of true and false in stdbool.h the exact opposite from the UNIX programs true and false? | <p>stdbool.h is usually defined as:</p>
<pre><code>#define false 0
#define true 1
</code></pre>
<p>(Sources: <a href="https://github.com/openbsd/src/blob/master/include/stdbool.h#L16-L17" rel="nofollow noreferrer">OpenBSD</a>, <a href="https://git.musl-libc.org/cgit/musl/tree/include/stdbool.h" rel="nofollow noref... | stdbool.h is usually defined as: ``` #define false 0 #define true 1 ``` (Sources: OpenBSD (https://github.com/openbsd/src/blob/master/include/stdbool.h#L16-L17), musl (https://git.musl-libc.org/cgit/musl/tree/include/stdbool.h), etc.) whereas the unix program `false` - which just has a unsuccessful status code, is defi... | 5 | 456 | 5 | 1 | 1 | [
"<c><history><exit-status><historical-unix>"
] | 2021-03-25T18:36:25.967 | 2021-03-26T07:45:11.850 | 117,978 | null | [
{
"id": 641114,
"body": "<p>There are multiple ways for a program to fail. For example <code>grep</code> fails if it doesn't find the pattern looked for, or if it can't open one of the files specified.</p>\n<p>Presently Unix allows 1 (unsigned) byte of value (the return code) to be passed back from a child ... | There are multiple ways for a program to fail. For example `grep` fails if it doesn't find the pattern looked for, or if it can't open one of the files specified. Presently Unix allows 1 (unsigned) byte of value (the return code) to be passed back from a child to it's parent (I am ignoring the information about which s... | # why are the definition of true and false in stdbool.h the exact opposite from the UNIX programs true and false?
**Tags:** <c><history><exit-status><historical-unix>
**Question (score 5):**
stdbool.h is usually defined as: ``` #define false 0 #define true 1 ``` (Sources: OpenBSD (https://github.com/openbsd/src/blob... | 4,117 | 1,029 | {
"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... |
641,123 | unix.stackexchange.com | How can SQLite command ".import" read directly from standard input? | <p>How would you modify function <code>csv_to_sqlite</code> so that <a href="https://sqlite.org/cli.html" rel="nofollow noreferrer"><code>sqlite3</code></a> command <a href="https://sqlite.org/cli.html#importing_csv_files" rel="nofollow noreferrer"><code>.import</code></a> reads directly from standard input instead of ... | How would you modify function `csv_to_sqlite` so that `sqlite3` (https://sqlite.org/cli.html) command `.import` (https://sqlite.org/cli.html#importing_csv_files) reads directly from standard input instead of from a temporary named pipe? ``` #!/bin/bash function csv_to_sqlite() { local database_file_name="$1" local tabl... | 5 | 379 | 1 | 8 | 1 | [
"<bash><shell-script><io-redirection><csv><sqlite>"
] | 2021-03-25T21:46:40.210 | 2021-03-27T12:49:32.627 | 5,783 | null | [
{
"id": 642362,
"body": "<p>I found another solution that still uses <a href=\"https://sqlite.org/cli.html\" rel=\"nofollow noreferrer\"><code>sqlite3</code></a> <a href=\"https://sqlite.org/cli.html#importing_csv_files\" rel=\"nofollow noreferrer\"><code>.import</code></a>, but that doesn't read <code>/dev... | I found another solution that still uses `sqlite3` (https://sqlite.org/cli.html) `.import` (https://sqlite.org/cli.html#importing_csv_files), but that doesn't read `/dev/stdin` or a temporary named pipe. Instead, it uses `.import` with the pipe operator (https://www.sqlite.org/cli.html#reading_sql_from_a_file) to invok... | # How can SQLite command ".import" read directly from standard input?
**Tags:** <bash><shell-script><io-redirection><csv><sqlite>
**Question (score 5):**
How would you modify function `csv_to_sqlite` so that `sqlite3` (https://sqlite.org/cli.html) command `.import` (https://sqlite.org/cli.html#importing_csv_files) r... | 1,573 | 393 | {
"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... |
641,177 | unix.stackexchange.com | How to make a multiline alias in Bash? | <p>I want to make an alias for a multiline command to call it faster then <em>copying-pasting-executing</em> it from a text file each time.</p>
<p>An example for such command is this <em>execute-a-remote-updater</em> command:</p>
<pre><code>(
cd "${program_to_update_dir}"
wget https://raw.githubusercontent.c... | I want to make an alias for a multiline command to call it faster then copying-pasting-executing it from a text file each time. An example for such command is this execute-a-remote-updater command: ``` ( cd "${program_to_update_dir}" wget https://raw.githubusercontent.com/USER/PROJECT/BRANCH/update.sh source update.sh... | 8 | 2,221 | 1 | 1 | 3 | [
"<bash><alias><function>"
] | 2021-03-26T08:40:28.850 | 2021-03-27T14:11:13.567 | 462,635 | 641,179 | [
{
"id": 641179,
"body": "<p>It's not impossible at all.</p>\n<pre><code>alias thing='(\ncd "${program_to_update_dir}"\nwget "https://raw.githubusercontent.com/USER/PROJECT/BRANCH/update.sh"\nsource update.sh\nrm update.sh\n)'\n</code></pre>\n<p>or,</p>\n<pre><code>alias thing='( cd "... | It's not impossible at all. ``` alias thing='( cd "${program_to_update_dir}" wget "https://raw.githubusercontent.com/USER/PROJECT/BRANCH/update.sh" source update.sh rm update.sh )' ``` or, ``` alias thing='( cd "${program_to_update_dir}"; wget "https://raw.githubusercontent.com/USER/PROJECT/BRANCH/update.sh"; source up... | # How to make a multiline alias in Bash?
**Tags:** <bash><alias><function>
**Question (score 8):**
I want to make an alias for a multiline command to call it faster then copying-pasting-executing it from a text file each time. An example for such command is this execute-a-remote-updater command: ``` ( cd "${program... | 2,133 | 533 | {
"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... |
642,313 | unix.stackexchange.com | How does Linux assign inode numbers on filesystems not based on inodes? | <p>This is the output of the <code>ls -li</code> command on the VFAT filesystem.</p>
<pre><code>% ls -li
合計 736
1207 drwxr-xr-x 3 root root 16384 3月 10 10:42 efi
1208 -rwxr-xr-x 1 root root 721720 3月 22 14:15 kernel.bin
</code></pre>
<p><code>1207</code> and <code>1208</code> are the inode numbers of the directory a... | This is the output of the `ls -li` command on the VFAT filesystem. ``` % ls -li 合計 736 1207 drwxr-xr-x 3 root root 16384 3月 10 10:42 efi 1208 -rwxr-xr-x 1 root root 721720 3月 22 14:15 kernel.bin ``` `1207` and `1208` are the inode numbers of the directory and file. However, the VFAT filesystem does not have the concept... | 15 | 1,636 | 1 | 0 | 1 | [
"<linux><filesystems>"
] | 2021-03-27T01:28:19.433 | 2021-03-27T11:29:13.113 | 462,754 | 642,318 | [
{
"id": 642318,
"body": "<p>tl;dr: For virtual, volatile, or inode-agnostic filesystems, inode numbers are usually generated from a monotonically incrementing, 32-bit counter when the inode is created. The rest of the inode (eg. permissions) is built from the equivalent data in the underlying filesystem, or... | tl;dr: For virtual, volatile, or inode-agnostic filesystems, inode numbers are usually generated from a monotonically incrementing, 32-bit counter when the inode is created. The rest of the inode (eg. permissions) is built from the equivalent data in the underlying filesystem, or is replaced with values set at mount ti... | # How does Linux assign inode numbers on filesystems not based on inodes?
**Tags:** <linux><filesystems>
**Question (score 15):**
This is the output of the `ls -li` command on the VFAT filesystem. ``` % ls -li 合計 736 1207 drwxr-xr-x 3 root root 16384 3月 10 10:42 efi 1208 -rwxr-xr-x 1 root root 721720 3月 22 14:15 ker... | 4,465 | 1,116 | {
"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... |
642,445 | unix.stackexchange.com | Simplest way to run a script on startup (or reboot/shutdown) but only if it has not already been executed today? | <p>What's the simplest way you know? Using any tool</p>
| What's the simplest way you know? Using any tool | 5 | 1,690 | 3 | 2 | 1 | [
"<bash><shell-script><cron>"
] | 2021-03-28T03:49:40.553 | 2021-03-29T13:48:47.843 | 463,890 | null | [
{
"id": 642449,
"body": "<p>In the beginning of your script, just touch a flag somewhere, so that subsequent invocations of that script can check for the existence and age of that flag.</p>\n<p>There's some ambiguity in your question. So first, let's assume that you're asking "How to make a script exec... | In the beginning of your script, just touch a flag somewhere, so that subsequent invocations of that script can check for the existence and age of that flag. There's some ambiguity in your question. So first, let's assume that you're asking "How to make a script execute only if certain amount of time has passed since t... | # Simplest way to run a script on startup (or reboot/shutdown) but only if it has not already been executed today?
**Tags:** <bash><shell-script><cron>
**Question (score 5):**
What's the simplest way you know? Using any tool
### Answer (score 9)
In the beginning of your script, just touch a flag somewhere, so that ... | 6,148 | 1,537 | {
"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... |
642,880 | unix.stackexchange.com | Is disk encryption without requiring a password at boot possible? | <p>Is it possible to encrypt the boot disk but not require users to input a password when the system boots? I have some headless boxes in remote locations for which I cannot guarantee they will be securely disposed off.</p>
<p>I want to avoid somebody being able to take out the disk drive and hook it up to another devi... | Is it possible to encrypt the boot disk but not require users to input a password when the system boots? I have some headless boxes in remote locations for which I cannot guarantee they will be securely disposed off. I want to avoid somebody being able to take out the disk drive and hook it up to another device and loo... | 9 | 2,569 | 4 | 2 | 4 | [
"<ubuntu><disk-encryption>"
] | 2021-03-31T07:18:53.167 | 2021-04-07T12:47:08.310 | 274,656 | null | [
{
"id": 642883,
"body": "<p>To tie a disk drive to a given host, and allow it to be decrypted without requiring a manually-entered passphrase, you’d typically rely on storing or tying the encryption key to the host’s TPM (trusted platform module) or equivalent. With such a setup, the disk can’t be decrypted... | To tie a disk drive to a given host, and allow it to be decrypted without requiring a manually-entered passphrase, you’d typically rely on storing or tying the encryption key to the host’s TPM (trusted platform module) or equivalent. With such a setup, the disk can’t be decrypted if it’s removed from its host. Another ... | # Is disk encryption without requiring a password at boot possible?
**Tags:** <ubuntu><disk-encryption>
**Question (score 9):**
Is it possible to encrypt the boot disk but not require users to input a password when the system boots? I have some headless boxes in remote locations for which I cannot guarantee they wil... | 3,133 | 783 | {
"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... |
642,966 | unix.stackexchange.com | Why does "file xxx.src" lead to "cannot open `xxx.src' (No such file or directory)" but has an exit status of 0 (success)? | <p>Why does <code>file xxx.src</code> lead to <code>cannot open `xxx.src' (No such file or directory)</code> but has an exit status of 0 (success)?</p>
<pre><code>$ file xxx.src ; echo $?
xxx.src: cannot open `xxx.src' (No such file or directory)
0
</code></pre>
<p>Note: to compare with <code>ls</code>:</p>
<pre><code>... | Why does `file xxx.src` lead to `cannot open `xxx.src' (No such file or directory)` but has an exit status of 0 (success)? ``` $ file xxx.src ; echo $? xxx.src: cannot open `xxx.src' (No such file or directory) 0 ``` Note: to compare with `ls`: ``` $ ls xxx.src ; echo $? ls: cannot access 'xxx.src': No such file or dir... | 17 | 3,657 | 3 | 0 | 5 | [
"<linux><exit-status><file-command>"
] | 2021-03-31T17:24:57.043 | 2021-04-01T15:06:25.887 | 334,715 | 642,967 | [
{
"id": 642967,
"body": "<p>This behavior is documented on Linux, and required by the POSIX standard. From the <code>file</code> manual on an Ubuntu system:</p>\n<pre><code>EXIT STATUS\n file will exit with 0 if the operation was successful or >0 if an error was encoun‐\n tered. The following ... | This behavior is documented on Linux, and required by the POSIX standard. From the `file` manual on an Ubuntu system: ``` EXIT STATUS file will exit with 0 if the operation was successful or >0 if an error was encoun‐ tered. The following errors cause diagnostic messages, but don't affect the pro‐ gram exit code (as PO... | # Why does "file xxx.src" lead to "cannot open `xxx.src' (No such file or directory)" but has an exit status of 0 (success)?
**Tags:** <linux><exit-status><file-command>
**Question (score 17):**
Why does `file xxx.src` lead to `cannot open `xxx.src' (No such file or directory)` but has an exit status of 0 (success)?... | 3,964 | 991 | {
"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... |
643,128 | unix.stackexchange.com | Linux Mint 20.1 unbind "hidden" shortcuts | <p>Linux Mint 20.1 with Cinnamon opens the terminal when hitting Super+2 and brings windows to the front with Super+3 and Super+4. Super meaning the Windows-Key.</p>
<p>I would like to use these shortcuts otherwise, but going into the shortcuts tab of the "keyboard" window, the unwanted shortcuts are not even... | Linux Mint 20.1 with Cinnamon opens the terminal when hitting Super+2 and brings windows to the front with Super+3 and Super+4. Super meaning the Windows-Key. I would like to use these shortcuts otherwise, but going into the shortcuts tab of the "keyboard" window, the unwanted shortcuts are not even registered there, s... | 5 | 280 | 1 | 8 | 1 | [
"<linux-mint><keyboard-shortcuts>"
] | 2021-04-01T18:05:42.897 | 2021-05-12T13:06:33.687 | 54,910 | 649,861 | [
{
"id": 649861,
"body": "<p>This might be a dumb question, but have you tried rebooting?</p>\n<h3>I haven't used Cinnamon in ages, but it's based on GNOME, so many of the GNOME commands used to work on it (what I'm trying to say is that 'approach 1' might be obsolete)</h3>\n<p>If that doesn't work, you migh... | This might be a dumb question, but have you tried rebooting? ### I haven't used Cinnamon in ages, but it's based on GNOME, so many of the GNOME commands used to work on it (what I'm trying to say is that 'approach 1' might be obsolete) If that doesn't work, you might have more luck trying this: Approach 1 (this one use... | # Linux Mint 20.1 unbind "hidden" shortcuts
**Tags:** <linux-mint><keyboard-shortcuts>
**Question (score 5):**
Linux Mint 20.1 with Cinnamon opens the terminal when hitting Super+2 and brings windows to the front with Super+3 and Super+4. Super meaning the Windows-Key. I would like to use these shortcuts otherwise, ... | 2,209 | 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... |
643,296 | unix.stackexchange.com | Find the largest number that Bash arithmetic can handle? | <p>How can I let my script determine the largest number for itself?</p>
<p>I looked through my environment variables, and I found these two that looked promising:</p>
<pre><code>~# declare -p BASH_VERSINFO HOSTTYPE
declare -ar BASH_VERSINFO=([0]="5" [1]="0" [2]="11" [3]="1" [4]=&... | How can I let my script determine the largest number for itself? I looked through my environment variables, and I found these two that looked promising: ``` ~# declare -p BASH_VERSINFO HOSTTYPE declare -ar BASH_VERSINFO=([0]="5" [1]="0" [2]="11" [3]="1" [4]="release" [5]="x86_64-slackware-linux-gnu") declare -- HOSTTYP... | 11 | 1,109 | 3 | 7 | 1 | [
"<bash><arithmetic>"
] | 2021-04-03T04:10:14.003 | 2021-04-04T12:43:40.960 | null | 643,297 | [
{
"id": 643297,
"body": "<p>Bash arithmetic uses signed numbers.</p>\n<p>So the quick answer would be:</p>\n<pre><code>((MAX=(1<<63)-1))\n</code></pre>\n<p>But since you want your script to not know about the bitness of the system it's running on, then let's keep going.</p>\n<p>Brute force would be, k... | Bash arithmetic uses signed numbers. So the quick answer would be: ``` ((MAX=(1<<63)-1)) ``` But since you want your script to not know about the bitness of the system it's running on, then let's keep going. Brute force would be, keep adding 1 in a loop, until you hit the point where it will overflow unto a negative nu... | # Find the largest number that Bash arithmetic can handle?
**Tags:** <bash><arithmetic>
**Question (score 11):**
How can I let my script determine the largest number for itself? I looked through my environment variables, and I found these two that looked promising: ``` ~# declare -p BASH_VERSINFO HOSTTYPE declare -a... | 6,852 | 1,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... |
643,318 | unix.stackexchange.com | Bitwise operations in Bash not working as expected | <p>I ran into a strange problem. To demonstrate, let's take the largest unsigned number on my machine (<code>printf "%X \n" -1</code> gives me <code>FFFFFFFFFFFFFFFF</code>), and try to shift some bits. First, shift to the left:</p>
<pre><code>printf "%X \n" $(( 0xFFFFFFFFFFFFFFFF<<4 ))
FFFF... | I ran into a strange problem. To demonstrate, let's take the largest unsigned number on my machine (`printf "%X \n" -1` gives me `FFFFFFFFFFFFFFFF`), and try to shift some bits. First, shift to the left: ``` printf "%X \n" $(( 0xFFFFFFFFFFFFFFFF>4 )) FFFFFFFFFFFFFFFF printf "%X \n" $(( 0xFFFFFFFFFFFFFFFF>>8 )) FFFFFFFF... | 9 | 1,147 | 4 | 6 | 1 | [
"<bash><arithmetic>"
] | 2021-04-03T09:32:10.753 | 2021-04-04T20:28:00.930 | 439,686 | 643,323 | [
{
"id": 643323,
"body": "<p>There are <a href=\"https://en.wikipedia.org/wiki/Bitwise_operation#Bit_shifts\" rel=\"nofollow noreferrer\">two different ways to shift right</a> in common use.</p>\n<p>The "logical right shift" inserts zero bits on the left, so the result of shifting one bit to the ri... | There are two different ways to shift right (https://en.wikipedia.org/wiki/Bitwise_operation#Bit_shifts) in common use. The "logical right shift" inserts zero bits on the left, so the result of shifting one bit to the right corresponds to dividing the unsigned binary number by two. `echo $(( 16 >> 1 ))` gives `8`. And,... | # Bitwise operations in Bash not working as expected
**Tags:** <bash><arithmetic>
**Question (score 9):**
I ran into a strange problem. To demonstrate, let's take the largest unsigned number on my machine (`printf "%X \n" -1` gives me `FFFFFFFFFFFFFFFF`), and try to shift some bits. First, shift to the left: ``` pri... | 12,951 | 3,237 | {
"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... |
643,466 | unix.stackexchange.com | How can a process detect that it's in a child namespace? | <p>I have researched the subject and found the following code on Github, which says:</p>
<pre><code>// HasNamespace determines if a container is using a particular namespace or the
// host namespace.
// The device number of an unnamespaced /proc/1/ns/{ns} is 4 and anything else is
// higher.
// Only works from inside a... | I have researched the subject and found the following code on Github, which says: ``` // HasNamespace determines if a container is using a particular namespace or the // host namespace. // The device number of an unnamespaced /proc/1/ns/{ns} is 4 and anything else is // higher. // Only works from inside a container. ``... | 5 | 178 | 1 | 13 | 2 | [
"<linux><debian><docker><namespace><containers>"
] | 2021-04-04T15:46:22.253 | 2021-04-09T09:39:15.363 | 128,739 | 644,209 | [
{
"id": 644209,
"body": "<p>I can share what I found out some time ago when I researched the subject myself. It's certainly not authoritative nor exhaustive but it may be of some help.</p>\n<h3>Technical description</h3>\n<p><strong>Disclaimer note</strong></p>\n<p>I myself have never actually implemented a... | I can share what I found out some time ago when I researched the subject myself. It's certainly not authoritative nor exhaustive but it may be of some help. ### Technical description Disclaimer note I myself have never actually implemented any of the approaches that I am about to describe. They are just possibilities I... | # How can a process detect that it's in a child namespace?
**Tags:** <linux><debian><docker><namespace><containers>
**Question (score 5):**
I have researched the subject and found the following code on Github, which says: ``` // HasNamespace determines if a container is using a particular namespace or the // host na... | 11,811 | 2,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... |
643,520 | unix.stackexchange.com | Is there a file that will always not exist? | <p>Along the lines of <code>/dev/null</code> (path to an empty source/sink file), is there a path that will never point to a valid file on at least Linux? This is mostly for testing purposes of some scripts I'm writing, and I don't want to just delete or move a file that doesn't belong to the script if it exists.</p>
| Along the lines of `/dev/null` (path to an empty source/sink file), is there a path that will never point to a valid file on at least Linux? This is mostly for testing purposes of some scripts I'm writing, and I don't want to just delete or move a file that doesn't belong to the script if it exists. | 63 | 8,962 | 9 | 7 | 7 | [
"<files>"
] | 2021-04-04T23:05:41.880 | 2021-04-06T12:28:28.287 | 304,684 | 643,527 | [
{
"id": 643527,
"body": "\n<p>As an alternative, I would suggest that your script create a temporary directory, and then look for a file name in there. That way, you are 100% certain that the file doesn't exist, and you have full control and can easily clean up after yourself. Something like:</p>\n<pre clas... | As an alternative, I would suggest that your script create a temporary directory, and then look for a file name in there. That way, you are 100% certain that the file doesn't exist, and you have full control and can easily clean up after yourself. Something like: ``` dir=$(mktemp -d) if [ -e "$dir"/somefile ]; then ech... | # Is there a file that will always not exist?
**Tags:** <files>
**Question (score 63):**
Along the lines of `/dev/null` (path to an empty source/sink file), is there a path that will never point to a valid file on at least Linux? This is mostly for testing purposes of some scripts I'm writing, and I don't want to ju... | 7,964 | 1,991 | {
"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... |
643,772 | unix.stackexchange.com | Why does fdisk prefer 512 byte sector size even when the physical sector size of the block device is 4096? | <p>I have a disk with 4096 byte sectors:</p>
<pre><code># cat /sys/class/block/sda/queue/physical_block_size
4096
#
</code></pre>
<p>For some reason, <code>fdisk</code> prefers to show the information about the disk using 512 byte sectors:</p>
<pre><code>Disk /dev/sda: 465.8 GiB, 500107862016 bytes, 976773168 sectors
D... | I have a disk with 4096 byte sectors: ``` # cat /sys/class/block/sda/queue/physical_block_size 4096 # ``` For some reason, `fdisk` prefers to show the information about the disk using 512 byte sectors: ``` Disk /dev/sda: 465.8 GiB, 500107862016 bytes, 976773168 sectors Disk model: ST500DM002-1BD14 Units: sectors of 1 *... | 11 | 1,262 | 1 | 0 | 2 | [
"<fdisk>"
] | 2021-04-06T13:13:03.687 | 2021-04-06T13:20:15.417 | 33,060 | 643,773 | [
{
"id": 643773,
"body": "<p>Because your disk advertises a 512-byte logical sector size:</p>\n<pre><code>Sector size (logical/physical): 512 bytes / 4096 bytes\n</code></pre>\n<p>You should be able to confirm this:</p>\n<pre class=\"lang-sh prettyprint-override\"><code>$ cat /sys/class/block/sda/queue/logic... | Because your disk advertises a 512-byte logical sector size: ``` Sector size (logical/physical): 512 bytes / 4096 bytes ``` You should be able to confirm this: ``` $ cat /sys/class/block/sda/queue/logical_block_size 512 ``` The consequence is that sectors are addressed as 512-byte sectors, not 4096-byte sectors, so `fd... | # Why does fdisk prefer 512 byte sector size even when the physical sector size of the block device is 4096?
**Tags:** <fdisk>
**Question (score 11):**
I have a disk with 4096 byte sectors: ``` # cat /sys/class/block/sda/queue/physical_block_size 4096 # ``` For some reason, `fdisk` prefers to show the information ab... | 1,288 | 322 | {
"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... |
643,777 | unix.stackexchange.com | Is there any limit on line length when pasting to a terminal in Linux? | <p>I am trying to send messages from <code>kafka-console-producer.sh</code>, which is</p>
<pre><code>#!/bin/bash
if [ "x$KAFKA_HEAP_OPTS" = "x" ]; then
export KAFKA_HEAP_OPTS="-Xmx512M"
fi
exec $(dirname $0)/kafka-run-class.sh kafka.tools.ConsoleProducer "$@"
</code></pre>
<p... | I am trying to send messages from `kafka-console-producer.sh`, which is ``` #!/bin/bash if [ "x$KAFKA_HEAP_OPTS" = "x" ]; then export KAFKA_HEAP_OPTS="-Xmx512M" fi exec $(dirname $0)/kafka-run-class.sh kafka.tools.ConsoleProducer "$@" ``` I am pasting messages then via Putty terminal. On receive side I see messages tru... | 16 | 2,946 | 4 | 6 | 2 | [
"<linux><bash><terminal><putty><truncate>"
] | 2021-04-06T13:50:27.157 | 2021-04-09T14:53:20.823 | 28,089 | 643,783 | [
{
"id": 643783,
"body": "<p>4095 is the limit of the tty line discipline internal editor length on Linux. From the <code>termios(3)</code> man page:</p>\n<blockquote>\n<ul>\n<li>The maximum line length is 4096 chars (including the terminating newline character); lines longer than 4096 chars are truncated. ... | 4095 is the limit of the tty line discipline internal editor length on Linux. From the `termios(3)` man page: - The maximum line length is 4096 chars (including the terminating newline character); lines longer than 4096 chars are truncated. After 4095 characters, input processing (e.g., ISIG and ECHO* processing) conti... | # Is there any limit on line length when pasting to a terminal in Linux?
**Tags:** <linux><bash><terminal><putty><truncate>
**Question (score 16):**
I am trying to send messages from `kafka-console-producer.sh`, which is ``` #!/bin/bash if [ "x$KAFKA_HEAP_OPTS" = "x" ]; then export KAFKA_HEAP_OPTS="-Xmx512M" fi exec... | 2,754 | 688 | {
"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... |
643,939 | unix.stackexchange.com | Exclamation mark in the bash script vs in the terminal | <p>I have a simple bash script called <em>foo.sh</em> like this:</p>
<pre><code>#!/bin/bash
echo "Foo!"
</code></pre>
<p>When I run it as <code>./foo.sh</code> I get the <code>Foo!</code> message and everything's fine.
But if I <code>echo "Foo!"</code> directly from the console, then I obtain the e... | I have a simple bash script called foo.sh like this: ``` #!/bin/bash echo "Foo!" ``` When I run it as `./foo.sh` I get the `Foo!` message and everything's fine. But if I `echo "Foo!"` directly from the console, then I obtain the expected behavior and message: `bash: !": event not found`. I understand that the `!` is pr... | 7 | 256 | 1 | 5 | 1 | [
"<bash><shell-script>"
] | 2021-04-07T13:07:59.547 | 2021-04-08T21:36:21.367 | 465,544 | 643,940 | [
{
"id": 643940,
"body": "<p>By default, interactive bash shells have history expansion enabled (which is what controls the behaviour of <code>!</code>). Sourced files (which exist largely outside of the concept of history expansion) and scripts do not. From <code>man bash</code> (or the <a href=\"https://ww... | By default, interactive bash shells have history expansion enabled (which is what controls the behaviour of `!`). Sourced files (which exist largely outside of the concept of history expansion) and scripts do not. From `man bash` (or the online manual (https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.... | # Exclamation mark in the bash script vs in the terminal
**Tags:** <bash><shell-script>
**Question (score 7):**
I have a simple bash script called foo.sh like this: ``` #!/bin/bash echo "Foo!" ``` When I run it as `./foo.sh` I get the `Foo!` message and everything's fine. But if I `echo "Foo!"` directly from the con... | 1,716 | 429 | {
"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... |
644,176 | unix.stackexchange.com | How to permanently add self-signed certificate in Firefox? | <p>When I go to the web interface of my home server Nextcloud via Firefox, I get the following message:</p>
<p><a href="https://i.stack.imgur.com/Jm7sF.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Jm7sF.png" alt="enter image description here" /></a></p>
<p>After I click <code>Accept the Risk and C... | When I go to the web interface of my home server Nextcloud via Firefox, I get the following message: (https://i.stack.imgur.com/Jm7sF.png) After I click `Accept the Risk and Continue`, and then the self-signed certificate of Nextcloud is automatically added to the Firefox browser. The added certificate is displayed in ... | 5 | 3,334 | 2 | 0 | 1 | [
"<firefox><certificates><browser>"
] | 2021-04-08T18:46:25.423 | 2021-04-09T10:42:11.337 | 410,475 | null | [
{
"id": 644248,
"body": "<p>Easy URL to test: <a href=\"https://self-signed.badssl.com/\" rel=\"noreferrer\">https://self-signed.badssl.com/</a></p>\n<p>There are two ways:</p>\n<ul>\n<li><p>toggle Firefox to set server certificates added as Lifetime Permanent by default</p>\n<ul>\n<li><p>in <code>about:con... | Easy URL to test: https://self-signed.badssl.com/ (https://self-signed.badssl.com/) There are two ways: - toggle Firefox to set server certificates added as Lifetime Permanent by default in `about:config` toggle `security.certerrors.permanentOverride` to `true` - add the exception as usual (as described by OP), it will... | # How to permanently add self-signed certificate in Firefox?
**Tags:** <firefox><certificates><browser>
**Question (score 5):**
When I go to the web interface of my home server Nextcloud via Firefox, I get the following message: (https://i.stack.imgur.com/Jm7sF.png) After I click `Accept the Risk and Continue`, and ... | 2,944 | 736 | {
"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... |
644,403 | unix.stackexchange.com | What's the best way to actually "type" special UTF-8 chars? | <p>Everything on my system (that needs it) supports UTF-8 just fine.<br>
That's all nice when you want output...
But what if you want easy <strong>in</strong>put ?</p>
<p>At the moment the only non-ASCII chars I can easily type are chars like é by using <kbd>AtlGr</kbd>.<br>But for chars like ₂ ² ≈ √ π at the moment I... | Everything on my system (that needs it) supports UTF-8 just fine. That's all nice when you want output... But what if you want easy input ? At the moment the only non-ASCII chars I can easily type are chars like é by using AtlGr. But for chars like ₂ ² ≈ √ π at the moment I have to: - Open a browser - Surf to https://w... | 25 | 2,438 | 8 | 9 | 9 | [
"<keyboard><unicode><input><virtual-interface>"
] | 2021-04-10T08:33:12.347 | 2021-04-12T09:19:17.297 | 275,743 | 644,435 | [
{
"id": 644435,
"body": "<p>You could use <a href=\"https://launchpad.net/onboard\" rel=\"noreferrer\">Onboard Onscreen Keyboard</a> which is available in most distros.</p>\n<p>It allows to create a custom layout with the characters you need, e.g.</p>\n<p><a href=\"https://i.stack.imgur.com/VJhz5.png\" rel=... | You could use Onboard Onscreen Keyboard (https://launchpad.net/onboard) which is available in most distros. It allows to create a custom layout with the characters you need, e.g. (https://i.stack.imgur.com/VJhz5.png) In case you don't want to create a new layout it offers a feature called "Snippets" where you have the ... | # What's the best way to actually "type" special UTF-8 chars?
**Tags:** <keyboard><unicode><input><virtual-interface>
**Question (score 25):**
Everything on my system (that needs it) supports UTF-8 just fine. That's all nice when you want output... But what if you want easy input ? At the moment the only non-ASCII c... | 7,157 | 1,789 | {
"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... |
644,442 | unix.stackexchange.com | speedtest-cli: ValueError: invalid literal for int() with base 10: '' | <p>On 3 machines I get:</p>
<pre><code>$ speedtest-cli
Retrieving speedtest.net configuration...
Traceback (most recent call last):
File "/usr/bin/speedtest-cli", line 11, in <module>
load_entry_point('speedtest-cli==2.1.2', 'console_scripts', 'speedtest-cli')()
File "/usr/lib/python3/dist... | On 3 machines I get: ``` $ speedtest-cli Retrieving speedtest.net configuration... Traceback (most recent call last): File "/usr/bin/speedtest-cli", line 11, in load_entry_point('speedtest-cli==2.1.2', 'console_scripts', 'speedtest-cli')() File "/usr/lib/python3/dist-packages/speedtest.py", line 1986, in main shell() F... | 17 | 16,308 | 7 | 5 | 1 | [
"<testing><bandwidth>"
] | 2021-04-10T13:39:46.270 | 2021-11-02T16:08:36.413 | 2,972 | 645,065 | [
{
"id": 645065,
"body": "<p>From this speedtest-cli <a href=\"https://github.com/sivel/speedtest-cli/pull/769\" rel=\"noreferrer\">Pull Request</a>, I gather the speedtest site have changed something in the response their API gives out. Looking at the first commit in the PR, you just need to modify a singl... | From this speedtest-cli Pull Request (https://github.com/sivel/speedtest-cli/pull/769), I gather the speedtest site have changed something in the response their API gives out. Looking at the first commit in the PR, you just need to modify a single line in speedtest.py. If you're in Ubuntu or similar, and you have the f... | # speedtest-cli: ValueError: invalid literal for int() with base 10: ''
**Tags:** <testing><bandwidth>
**Question (score 17):**
On 3 machines I get: ``` $ speedtest-cli Retrieving speedtest.net configuration... Traceback (most recent call last): File "/usr/bin/speedtest-cli", line 11, in load_entry_point('speedtest-... | 2,561 | 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... |
644,558 | unix.stackexchange.com | Undoing wipefs --all --force /dev/sda? /dev/sda | <p>OS: Debian Bullseye, <code>uname -a</code>:</p>
<pre><code>Linux backup-server 5.10.0-5-amd64 #1 SMP Debian 5.10.24-1 (2021-03-19) x86_64 GNU/Linux
</code></pre>
<hr />
<p>I am looking for a way of <strong>undoing this <code>wipefs</code></strong> command:</p>
<pre><code>wipefs --all --force /dev/sda? /dev/sda
</cod... | OS: Debian Bullseye, `uname -a`: ``` Linux backup-server 5.10.0-5-amd64 #1 SMP Debian 5.10.24-1 (2021-03-19) x86_64 GNU/Linux ``` I am looking for a way of undoing this `wipefs` command: ``` wipefs --all --force /dev/sda? /dev/sda ``` while the former structure was: ``` fdisk -l /dev/sda Disk /dev/sda: 223.57 GiB, 2400... | 8 | 1,562 | 3 | 2 | 1 | [
"<filesystems><partition><data-recovery><disk><gpt>"
] | 2021-04-11T12:10:52.483 | 2021-04-11T16:46:58.583 | 126,755 | 644,566 | [
{
"id": 644566,
"body": "<p>You're lucky that <code>wipefs</code> actually prints out the parts it wipes.</p>\n<p>These,</p>\n<pre><code>wipefs -a /dev/sda\n/dev/sda: 8 bytes were erased at offset 0x00000200 (gpt): 45 46 49 20 50 41 52 54\n/dev/sda: 8 bytes were erased at offset 0x3b9e655e00 (gpt): 45 46 49... | You're lucky that `wipefs` actually prints out the parts it wipes. These, ``` wipefs -a /dev/sda /dev/sda: 8 bytes were erased at offset 0x00000200 (gpt): 45 46 49 20 50 41 52 54 /dev/sda: 8 bytes were erased at offset 0x3b9e655e00 (gpt): 45 46 49 20 50 41 52 54 /dev/sda: 2 bytes were erased at offset 0x000001fe (PMBR)... | # Undoing wipefs --all --force /dev/sda? /dev/sda
**Tags:** <filesystems><partition><data-recovery><disk><gpt>
**Question (score 8):**
OS: Debian Bullseye, `uname -a`: ``` Linux backup-server 5.10.0-5-amd64 #1 SMP Debian 5.10.24-1 (2021-03-19) x86_64 GNU/Linux ``` I am looking for a way of undoing this `wipefs` comm... | 7,437 | 1,859 | {
"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... |
644,626 | unix.stackexchange.com | Is there a clean way to `sudo pkill` processes without including the `sudo` process? | <p>I need to kill some processes that are run as sudo, matching them by full name, and count the number of original command invocations.</p>
<p>For each process there are two processes: the command itself, and the <code>sudo</code> one, but I can work this around:</p>
<pre class="lang-bsh prettyprint-override"><code>$ ... | I need to kill some processes that are run as sudo, matching them by full name, and count the number of original command invocations. For each process there are two processes: the command itself, and the `sudo` one, but I can work this around: ``` $ sudo -b perf record sleep 100 $ pgrep -fa '/perf record' 2245700 /usr/... | 6 | 1,670 | 3 | 2 | 1 | [
"<kill><pkill>"
] | 2021-04-11T21:12:22.147 | 2021-04-13T11:47:22.913 | 12,814 | 644,643 | [
{
"id": 644643,
"body": "<p>Try:</p>\n<pre><code>sudo pkill -ef '/[p]erf record' | wc -l\n</code></pre>\n<p>It's a trick which uses a character class containing only the single letter <code>p</code>.</p>\n<p>The regex is looking for <code>/perf</code>, but the <code>sudo pkill</code> command line has <code>... | Try: ``` sudo pkill -ef '/[p]erf record' | wc -l ``` It's a trick which uses a character class containing only the single letter `p`. The regex is looking for `/perf`, but the `sudo pkill` command line has `/[p]erf`, which doesn't match. This method has been used for decades in commands like `ps aux | awk '/[f]oo/ {pri... | # Is there a clean way to `sudo pkill` processes without including the `sudo` process?
**Tags:** <kill><pkill>
**Question (score 6):**
I need to kill some processes that are run as sudo, matching them by full name, and count the number of original command invocations. For each process there are two processes: the co... | 3,654 | 913 | {
"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... |
644,819 | unix.stackexchange.com | Is it possible to move .tmux.conf to ~/.config folder? | <p>I want to move the <code>.tmux.conf</code> file from <code>~</code> to <code>./config/...</code>, but I'm not sure about whether this would lead to tmux would not know about this location. So where are the alternative location(s) where tmux will source its <code>.tmux.conf</code> file?</p>
| I want to move the `.tmux.conf` file from `~` to `./config/...`, but I'm not sure about whether this would lead to tmux would not know about this location. So where are the alternative location(s) where tmux will source its `.tmux.conf` file? | 6 | 1,140 | 2 | 0 | 1 | [
"<tmux>"
] | 2021-04-13T04:53:55.333 | 2021-04-13T22:22:19.823 | 201,322 | 644,824 | [
{
"id": 644824,
"body": "<p>Starting with <code>tmux</code> version 3.1, <code>~/.config/tmux/tmux.conf</code> works as an alternative to <code>~/.tmux.conf</code>. Notice that there is no need to make it a hidden file.</p>\n",
"body_md": "Starting with `tmux` version 3.1, `~/.config/tmux/tmux.conf` wor... | Starting with `tmux` version 3.1, `~/.config/tmux/tmux.conf` works as an alternative to `~/.tmux.conf`. Notice that there is no need to make it a hidden file. | # Is it possible to move .tmux.conf to ~/.config folder?
**Tags:** <tmux>
**Question (score 6):**
I want to move the `.tmux.conf` file from `~` to `./config/...`, but I'm not sure about whether this would lead to tmux would not know about this location. So where are the alternative location(s) where tmux will source... | 535 | 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... |
645,008 | unix.stackexchange.com | Is there a problem with grep command? I am getting characters that don't match my regular expression | <p>I ran this command:</p>
<pre><code>grep -i 'bro*' shows.csv
</code></pre>
<p>and got this as output</p>
<pre><code>1845307,2 Broke Girls,2011,138,6.7,89093
1702042,An Idiot Abroad,2010,21,8.3,29759
903747,Breaking Bad,2008,62,9.5,1402577
2249364,Broadchurch,2013,24,8.4,89378
1733785,Bron/Broen,2011,38,8.6,56357
2467... | I ran this command: ``` grep -i 'bro*' shows.csv ``` and got this as output ``` 1845307,2 Broke Girls,2011,138,6.7,89093 1702042,An Idiot Abroad,2010,21,8.3,29759 903747,Breaking Bad,2008,62,9.5,1402577 2249364,Broadchurch,2013,24,8.4,89378 1733785,Bron/Broen,2011,38,8.6,56357 2467372,Brooklyn Nine-Nine,2013,145,8.4,20... | 15 | 2,631 | 2 | 1 | 0 | [
"<linux><command-line><grep>"
] | 2021-04-14T06:46:20.087 | 2021-04-14T19:46:52.237 | 466,667 | 645,011 | [
{
"id": 645011,
"body": "<p>In your code <code>o*</code> means "zero or more occurrences of <code>o</code>". It seems you confused regular expressions with glob syntax (where <code>o*</code> means "one <code>o</code> and zero or more whatever characters").</p>\n<p>In <code>Breaking Bad</... | In your code `o*` means "zero or more occurrences of `o`". It seems you confused regular expressions with glob syntax (where `o*` means "one `o` and zero or more whatever characters"). In `Breaking Bad` there is exactly zero `o` characters after `Br`, so it matches `bro*` (case-insensitively). `grep -i bro shows.csv` w... | # Is there a problem with grep command? I am getting characters that don't match my regular expression
**Tags:** <linux><command-line><grep>
**Question (score 15):**
I ran this command: ``` grep -i 'bro*' shows.csv ``` and got this as output ``` 1845307,2 Broke Girls,2011,138,6.7,89093 1702042,An Idiot Abroad,2010,2... | 1,641 | 410 | {
"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... |
645,358 | unix.stackexchange.com | Conditional continue in for loop breaks errexit in function | <p>AFAICT, having <code>continue</code> in for loop that calls another function breaks the <code>errexit</code> semantics. In the <code>main()</code> function, I want to continue onto the next iteration if anything fails in the <code>build()</code> function:</p>
<pre class="lang-bsh prettyprint-override"><code>#! /usr/... | AFAICT, having `continue` in for loop that calls another function breaks the `errexit` semantics. In the `main()` function, I want to continue onto the next iteration if anything fails in the `build()` function: ``` #! /usr/bin/env bash export PS4='# ${BASH_SOURCE}:${LINENO}: ${FUNCNAME[0]}() - [${SHLVL},${BASH_SUBSHEL... | 7 | 245 | 2 | 2 | 0 | [
"<bash><shell-script>"
] | 2021-04-16T08:11:47.257 | 2021-04-16T09:28:01.820 | 36,427 | 645,365 | [
{
"id": 645365,
"body": "<p>This seems to match the description of <code>-e</code>/<code>-errexit</code> in the <a href=\"https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html\" rel=\"nofollow noreferrer\">bash documentation</a>:</p>\n<blockquote>\n<p>The shell does not exit if the command... | This seems to match the description of `-e`/`-errexit` in the bash documentation (https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html): The shell does not exit if the command that fails is part of the command list immediately following a while or until keyword, part of the test in an if statement, p... | # Conditional continue in for loop breaks errexit in function
**Tags:** <bash><shell-script>
**Question (score 7):**
AFAICT, having `continue` in for loop that calls another function breaks the `errexit` semantics. In the `main()` function, I want to continue onto the next iteration if anything fails in the `build()... | 6,408 | 1,602 | {
"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... |
645,447 | unix.stackexchange.com | How to grep inside a specific file in tar.gz without extracting? | <p>I'm looking for a command that can perform a grep operation in a specific file contained in a tar.gz archive.</p>
<p>Example:</p>
<p>file: archive.tar.gz, which contains:</p>
<pre><code>fileA.txt
fileB.txt
fileC.txt
</code></pre>
<p>I want to grep only inside fileA.txt, not in the other two, without extract the fil... | I'm looking for a command that can perform a grep operation in a specific file contained in a tar.gz archive. Example: file: archive.tar.gz, which contains: ``` fileA.txt fileB.txt fileC.txt ``` I want to grep only inside fileA.txt, not in the other two, without extract the files from the original archive, with only o... | 7 | 1,865 | 2 | 2 | 4 | [
"<bash><grep><tar>"
] | 2021-04-16T14:59:13.853 | 2021-04-17T04:39:32.223 | 257,551 | null | [
{
"id": 645448,
"body": "<p>Tell <code>tar</code> which file it should process inside the archive:</p>\n<pre><code>for f in /path/*.gz; do\n tar -xzf "$f" --to-command='grep -Hn --label="$TAR_ARCHIVE/$TAR_FILENAME" pattern || true' fileA.txt\ndone\n</code></pre>\n<p>(<code>fileA.txt</co... | Tell `tar` which file it should process inside the archive: ``` for f in /path/*.gz; do tar -xzf "$f" --to-command='grep -Hn --label="$TAR_ARCHIVE/$TAR_FILENAME" pattern || true' fileA.txt done ``` (`fileA.txt` at the end of the `tar` command). | # How to grep inside a specific file in tar.gz without extracting?
**Tags:** <bash><grep><tar>
**Question (score 7):**
I'm looking for a command that can perform a grep operation in a specific file contained in a tar.gz archive. Example: file: archive.tar.gz, which contains: ``` fileA.txt fileB.txt fileC.txt ``` I ... | 1,423 | 355 | {
"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... |
645,758 | unix.stackexchange.com | Why does the `-` (minus) interpretation of GNU date differs from the intuitive one, when a date is specified? | <p>If I subtract a time amount from the current date, GNU date works intuitively:</p>
<pre class="lang-bsh prettyprint-override"><code>date '+%F %R'; date '+%F %R' --date='- 1 hour'
2021-04-19 15:35
2021-04-19 14:35
</code></pre>
<p>However, when I use a date as operand, the result is unexpected:</p>
<pre class="lang-b... | If I subtract a time amount from the current date, GNU date works intuitively: ``` date '+%F %R'; date '+%F %R' --date='- 1 hour' 2021-04-19 15:35 2021-04-19 14:35 ``` However, when I use a date as operand, the result is unexpected: ``` $ date '+%F %R' --date='2000/1/2 03:04:05 - 1 hour' 2000-01-02 06:04 $ date '+%F %R... | 12 | 1,320 | 3 | 2 | 1 | [
"<linux><date><gnu>"
] | 2021-04-19T08:40:16.760 | 2021-04-19T19:42:53.477 | 12,814 | 645,770 | [
{
"id": 645770,
"body": "<p>In short: The date you give with <code>--date</code> is taken in local time, unless you specify a time zone, and something like <code>+/- NNN</code> is taken as one. Only anything after that, even if it's just <code>hour</code> is taken as the relative modifier. So <code>- 1 hour... | In short: The date you give with `--date` is taken in local time, unless you specify a time zone, and something like `+/- NNN` is taken as one. Only anything after that, even if it's just `hour` is taken as the relative modifier. So `- 1 hour` doesn't mean to subtract one hour from the given time, but to specify that t... | # Why does the `-` (minus) interpretation of GNU date differs from the intuitive one, when a date is specified?
**Tags:** <linux><date><gnu>
**Question (score 12):**
If I subtract a time amount from the current date, GNU date works intuitively: ``` date '+%F %R'; date '+%F %R' --date='- 1 hour' 2021-04-19 15:35 2021... | 5,898 | 1,474 | {
"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... |
645,782 | unix.stackexchange.com | awk doesn't recognize field as a number | <p>I think it's somewhat a simple problem but I don't understand what's happening.
I have a file such as</p>
<pre><code>Scaffold_19:10402053-10402986 Scaffold_33:25064012-25064819 92.806 278 5 5 8 279 269 1 2.84e-107 388
Scaffold_6:54625155-54625833 Scaffold_33:6634011-6634353 96.774 248 6 2 1 ... | I think it's somewhat a simple problem but I don't understand what's happening. I have a file such as ``` Scaffold_19:10402053-10402986 Scaffold_33:25064012-25064819 92.806 278 5 5 8 279 269 1 2.84e-107 388 Scaffold_6:54625155-54625833 Scaffold_33:6634011-6634353 96.774 248 6 2 1 248 97 342 1.21e-114 412 Scaffold_9:948... | 6 | 234 | 1 | 5 | 0 | [
"<text-processing><awk><locale>"
] | 2021-04-19T11:52:27.400 | 2021-04-19T13:29:40.083 | 424,075 | null | [
{
"id": 645798,
"body": "<p>The problem is that you have <code>LC_NUMERIC=fr_BE.UTF-8</code>. Under this locale, the decimal separator is <code>,</code> and not <code>.</code> so <code>98.9</code> is not considered a number. To illustrate:</p>\n<pre><code>$ echo "98.5" | LC_NUMERIC=C mawk '$1<1... | The problem is that you have `LC_NUMERIC=fr_BE.UTF-8`. Under this locale, the decimal separator is `,` and not `.` so `98.9` is not considered a number. To illustrate: ``` $ echo "98.5" | LC_NUMERIC=C mawk '$1<100' 98.5 $ echo "98.5" | LC_NUMERIC=fr_BE.UTF-8 mawk '$1<100' $ ``` So either change your locale to one that ... | # awk doesn't recognize field as a number
**Tags:** <text-processing><awk><locale>
**Question (score 6):**
I think it's somewhat a simple problem but I don't understand what's happening. I have a file such as ``` Scaffold_19:10402053-10402986 Scaffold_33:25064012-25064819 92.806 278 5 5 8 279 269 1 2.84e-107 388 Sca... | 2,525 | 631 | {
"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... |
645,865 | unix.stackexchange.com | How do I create binary file with certain value? | <p>I need to create a binary file that is filled only with <code>11111111</code>.</p>
<p>I only know how to create zero-filled binary with</p>
<pre><code>dd if=/dev/zero bs=18520 count=1
</code></pre>
<p>Could you please say to me what a command in pipeline should I use to fill the bin with <code>1</code>? How can I us... | I need to create a binary file that is filled only with `11111111`. I only know how to create zero-filled binary with ``` dd if=/dev/zero bs=18520 count=1 ``` Could you please say to me what a command in pipeline should I use to fill the bin with `1`? How can I use `awk` in this case? | 8 | 2,211 | 3 | 1 | 1 | [
"<shell-script><dd><binary>"
] | 2021-04-19T20:37:56.213 | 2021-04-19T21:11:14.190 | 269,307 | 645,868 | [
{
"id": 645868,
"body": "<p>Probably easiest to use <code>tr</code> to convert the zeroes from <code>/dev/zero</code> to whatever you want, and then cut to length using <code>dd</code> or <code>head</code> or such.</p>\n<p>This would write 18520 bytes with all bits ones, so value 0xff or 255, or 377 in octa... | Probably easiest to use `tr` to convert the zeroes from `/dev/zero` to whatever you want, and then cut to length using `dd` or `head` or such. This would write 18520 bytes with all bits ones, so value 0xff or 255, or 377 in octal as the input must be: ``` test.bin ``` (To convert from hex or decimal to octal, you could... | # How do I create binary file with certain value?
**Tags:** <shell-script><dd><binary>
**Question (score 8):**
I need to create a binary file that is filled only with `11111111`. I only know how to create zero-filled binary with ``` dd if=/dev/zero bs=18520 count=1 ``` Could you please say to me what a command in pi... | 1,608 | 402 | {
"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... |
645,966 | unix.stackexchange.com | Remove paths from list if parent directory is also in the list | <p>My title may be a bit oddly worded, so here's my situation: I have a bunch of directory paths, e.g.</p>
<pre><code>/a/b
/a/b/c
/a/b/c/d
/a/e/f/g/h
/a/e/f/g/h/i/j/k/l
/a/e/f/g/m/n/o
/a/e/f/g/m/n/p
</code></pre>
<p>and I want to filter out all lines that are child paths of an entry that already exists in the list, e.g... | My title may be a bit oddly worded, so here's my situation: I have a bunch of directory paths, e.g. ``` /a/b /a/b/c /a/b/c/d /a/e/f/g/h /a/e/f/g/h/i/j/k/l /a/e/f/g/m/n/o /a/e/f/g/m/n/p ``` and I want to filter out all lines that are child paths of an entry that already exists in the list, e.g. ``` /a/b /a/e/f/g/h /a/e/... | 5 | 744 | 6 | 6 | 1 | [
"<bash><awk><sed><grep>"
] | 2021-04-20T15:28:57.063 | 2021-04-20T15:57:58.977 | 143,458 | 646,005 | [
{
"id": 645970,
"body": "<p>I'm assuming that the list of pathnames may possibly not be sorted, and that the resulting list of pathnames should be in the same order as in the input. I also assume that no pathname contains embedded newline characters.</p>\n<p>Using <code>/bin/sh</code>:</p>\n<pre class=\"lan... | I'm assuming that the list of pathnames may possibly not be sorted, and that the resulting list of pathnames should be in the same order as in the input. I also assume that no pathname contains embedded newline characters. Using `/bin/sh`: ``` #!/bin/sh set -- while IFS= read -r pathname; do for p do case $pathname in ... | # Remove paths from list if parent directory is also in the list
**Tags:** <bash><awk><sed><grep>
**Question (score 5):**
My title may be a bit oddly worded, so here's my situation: I have a bunch of directory paths, e.g. ``` /a/b /a/b/c /a/b/c/d /a/e/f/g/h /a/e/f/g/h/i/j/k/l /a/e/f/g/m/n/o /a/e/f/g/m/n/p ``` and I ... | 4,249 | 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... |
646,532 | unix.stackexchange.com | Why does exec print its output after the program exits? | <p>I'm writing a program to pipe one command to another. Inputs will be from the command line:</p>
<pre class="lang-none prettyprint-override"><code>$ ./a.out ls '|' wc
c2 PID 6804
c1 PID 6803
PARENT PID 6802
$ 2 2 17
</code></pre>
<p>Why does the output print after the prompt returns. Is there any way... | I'm writing a program to pipe one command to another. Inputs will be from the command line: ``` $ ./a.out ls '|' wc c2 PID 6804 c1 PID 6803 PARENT PID 6802 $ 2 2 17 ``` Why does the output print after the prompt returns. Is there any way to prevent that? This is the code I've written: ``` #include #include #include #in... | 7 | 798 | 2 | 2 | 1 | [
"<pipe><c><exec>"
] | 2021-04-24T13:41:18.503 | 2021-04-25T20:42:17.770 | 468,391 | 646,541 | [
{
"id": 646541,
"body": "<p>You have:</p>\n<pre class=\"lang-c prettyprint-override\"><code> waitpid(cmd_pid,NULL,WNOHANG);\n</code></pre>\n<p>By including the <code>WNOHANG</code> option, you're telling <code>waitpid()</code> to not wait for the process to terminate if it hasn't already terminated.</p>\... | You have: ``` waitpid(cmd_pid,NULL,WNOHANG); ``` By including the `WNOHANG` option, you're telling `waitpid()` to not wait for the process to terminate if it hasn't already terminated. My guess is that you added that because your program hangs if you don't include it. That's because the original parent still has an ope... | # Why does exec print its output after the program exits?
**Tags:** <pipe><c><exec>
**Question (score 7):**
I'm writing a program to pipe one command to another. Inputs will be from the command line: ``` $ ./a.out ls '|' wc c2 PID 6804 c1 PID 6803 PARENT PID 6802 $ 2 2 17 ``` Why does the output print after the prom... | 4,516 | 1,129 | {
"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... |
646,590 | unix.stackexchange.com | Why does "ls" take extremely long in a small directory that used to be big? How to fix this? | <p>I'm running Arch Linux, and use ext4 filesystems.</p>
<p>When I run <code>ls</code> in a directory that is actually small now, but used to be huge - it hangs for a while. But the next time I run it, it's almost instantaneous.</p>
<p>I tried doing:</p>
<pre><code>strace ls
</code></pre>
<p>but I honestly don't know h... | I'm running Arch Linux, and use ext4 filesystems. When I run `ls` in a directory that is actually small now, but used to be huge - it hangs for a while. But the next time I run it, it's almost instantaneous. I tried doing: ``` strace ls ``` but I honestly don't know how to debug the output. I can post it if necessary, ... | 44 | 6,233 | 2 | 15 | 8 | [
"<bash><ls><ext4>"
] | 2021-04-24T22:40:08.120 | 2021-04-26T11:55:23.797 | 414,347 | 646,596 | [
{
"id": 646596,
"body": "<p>A directory that used to be huge may still have a lot of blocks allocated for directory entries (= names and inode numbers of files and sub-directories in that directory), although almost all of them are now marked as deleted.</p>\n<p>When a new directory is created, only a minim... | A directory that used to be huge may still have a lot of blocks allocated for directory entries (= names and inode numbers of files and sub-directories in that directory), although almost all of them are now marked as deleted. When a new directory is created, only a minimum number of spaces are allocated for directory ... | # Why does "ls" take extremely long in a small directory that used to be big? How to fix this?
**Tags:** <bash><ls><ext4>
**Question (score 44):**
I'm running Arch Linux, and use ext4 filesystems. When I run `ls` in a directory that is actually small now, but used to be huge - it hangs for a while. But the next time... | 4,289 | 1,072 | {
"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... |
646,715 | unix.stackexchange.com | 'find -exec mv' tries to move the same file it previously moved | <p>My wrong command :</p>
<pre><code>find . -type f -name '*2019*' -exec mv {} ./backup_2019 \;
</code></pre>
<p>result :</p>
<pre><code>mv: ‘./backup_2019/2019-A.txt’ and ‘backup_2019/2019-A.txt’ are the same file
mv: ‘./backup_2019/2019-B.txt’ and ‘backup_2019/2019-B.txt’ are the same file
mv: ‘./backup_2019/2019-C.t... | My wrong command : ``` find . -type f -name '*2019*' -exec mv {} ./backup_2019 \; ``` result : ``` mv: ‘./backup_2019/2019-A.txt’ and ‘backup_2019/2019-A.txt’ are the same file mv: ‘./backup_2019/2019-B.txt’ and ‘backup_2019/2019-B.txt’ are the same file mv: ‘./backup_2019/2019-C.txt’ and ‘backup_2019/2019-C.txt’ are t... | 5 | 444 | 2 | 0 | 0 | [
"<find><backup><mv>"
] | 2021-04-26T02:34:12.853 | 2021-04-26T12:38:33.157 | 275,107 | 646,793 | [
{
"id": 646756,
"body": "<p>You should ignore the target directory you want to exclude</p>\n<pre><code>find . -path './backup_2019' -prune -o -type f -name '*2019*' -exec mv {} ./backup_2019 \\;\n</code></pre>\n<p>The implicit AND between operators binds more tightly than the OR (<code>-o</code>), so it tra... | You should ignore the target directory you want to exclude ``` find . -path './backup_2019' -prune -o -type f -name '*2019*' -exec mv {} ./backup_2019 \; ``` The implicit AND between operators binds more tightly than the OR (`-o`), so it translates as (skip if the path matches `./backup_2019`) OR (`mv` if we have files... | # 'find -exec mv' tries to move the same file it previously moved
**Tags:** <find><backup><mv>
**Question (score 5):**
My wrong command : ``` find . -type f -name '*2019*' -exec mv {} ./backup_2019 \; ``` result : ``` mv: ‘./backup_2019/2019-A.txt’ and ‘backup_2019/2019-A.txt’ are the same file mv: ‘./backup_2019/20... | 3,702 | 925 | {
"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... |
647,054 | unix.stackexchange.com | Process states in OS theory vs in Linux | <p>I'm trying to map Linux process state codes (as in <code>ps</code>) to states in the OS state diagram but I can't seem to map them. Is it because Linux process states don't necessarily match the theoretical OS state diagram? Specifically, I am unsure where <code>D</code>/<code>S</code>/<code>T</code>/<code>I</code> ... | I'm trying to map Linux process state codes (as in `ps`) to states in the OS state diagram but I can't seem to map them. Is it because Linux process states don't necessarily match the theoretical OS state diagram? Specifically, I am unsure where `D`/`S`/`T`/`I` fit in the diagram. - `ps` process state codes (https://ma... | 18 | 2,278 | 1 | 0 | 3 | [
"<linux-kernel><process><process-management>"
] | 2021-04-27T20:32:01.167 | 2021-04-29T01:07:12.310 | 451,495 | 647,066 | [
{
"id": 647066,
"body": "<h2>Short answer:</h2>\n<p>The states (roughly) map like this:</p>\n<div class=\"s-table-container\">\n<table class=\"s-table\">\n<thead>\n<tr>\n<th>State</th>\n<th>Meaning</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><code>D</code></td>\n<td>Blocked</td>\n</tr>\n<tr>\n<td><code>I</cod... | ## Short answer: The states (roughly) map like this: State Meaning `D` Blocked `I` Blocked `R` Waiting or Running `S` Blocked `T` Blocked (more or less) `t` Blocked (more or less) `W` Blocked (obsolete since Linux 1.1.30) `X` Terminated `Z` Terminated ## Long answer: The externally visible process state codes in Linux ... | # Process states in OS theory vs in Linux
**Tags:** <linux-kernel><process><process-management>
**Question (score 18):**
I'm trying to map Linux process state codes (as in `ps`) to states in the OS state diagram but I can't seem to map them. Is it because Linux process states don't necessarily match the theoretical ... | 4,749 | 1,187 | {
"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... |
647,503 | unix.stackexchange.com | Zoom - Problems with sound in Ubuntu | <p>I have some weird issues with Zoom in Ubuntu 20.04. <strong>Every time</strong> I join a meeting and select "Join with my Computer Audio", Zoom volume starts at 10%:</p>
<p><a href="https://i.stack.imgur.com/S183Y.png" rel="noreferrer"><img src="https://i.stack.imgur.com/S183Y.png" alt="enter image descrip... | I have some weird issues with Zoom in Ubuntu 20.04. Every time I join a meeting and select "Join with my Computer Audio", Zoom volume starts at 10%: (https://i.stack.imgur.com/S183Y.png) The second problem is weirder. It happens when I am in a meeting created by a specific colleague of mine (and only him!): when someon... | 6 | 3,394 | 3 | 2 | 0 | [
"<ubuntu><audio>"
] | 2021-04-30T21:50:19.363 | 2021-05-01T03:53:27.830 | 192,321 | null | [
{
"id": 648269,
"body": "<p>Most recent call softwares do have some automatic volume levelling. Look after volume or device options in Zoom.</p>\n<p>It may also be a pulseaudio/pavucontrol issue, but it's far less likely considering that Zoom is an Electron "app".\nWeb "apps" are known t... | Most recent call softwares do have some automatic volume levelling. Look after volume or device options in Zoom. It may also be a pulseaudio/pavucontrol issue, but it's far less likely considering that Zoom is an Electron "app". Web "apps" are known to be far more buggy than real ones, an infamous example would be Disc... | # Zoom - Problems with sound in Ubuntu
**Tags:** <ubuntu><audio>
**Question (score 6):**
I have some weird issues with Zoom in Ubuntu 20.04. Every time I join a meeting and select "Join with my Computer Audio", Zoom volume starts at 10%: (https://i.stack.imgur.com/S183Y.png) The second problem is weirder. It happens... | 1,720 | 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... |
647,551 | unix.stackexchange.com | How is having processes kept as files in `/proc` not a performance issue? | <p>I understand that "everything is a file" is not entirely true, but as far as I know, every process gets a directory in <code>/proc</code> with lots of files. Read/write operations are often great bottlenecks in speed, and having to read/write from/to files all the time can significantly slow down processin... | I understand that "everything is a file" is not entirely true, but as far as I know, every process gets a directory in `/proc` with lots of files. Read/write operations are often great bottlenecks in speed, and having to read/write from/to files all the time can significantly slow down processing. Does having to keep a... | 9 | 3,090 | 6 | 9 | 1 | [
"<performance><proc>"
] | 2021-05-01T09:39:59.270 | 2021-05-03T11:47:16.387 | 370,354 | null | [
{
"id": 647555,
"body": "<p>Files in <code>/proc</code> and <code>/sys</code> exist purely dynamically, i.e. when nothing is reading them, they aren't there at all and the kernel spends no time generating them.</p>\n<p>You could think of <code>/proc</code> and <code>/sys</code> files as API calls. If you do... | Files in `/proc` and `/sys` exist purely dynamically, i.e. when nothing is reading them, they aren't there at all and the kernel spends no time generating them. You could think of `/proc` and `/sys` files as API calls. If you don't execute them, the kernel doesn't run any code | # How is having processes kept as files in `/proc` not a performance issue?
**Tags:** <performance><proc>
**Question (score 9):**
I understand that "everything is a file" is not entirely true, but as far as I know, every process gets a directory in `/proc` with lots of files. Read/write operations are often great bo... | 4,834 | 1,208 | {
"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... |
647,843 | unix.stackexchange.com | How can I redirect the output of a C program from /dev/tty to /dev/null? | <p>Consider this sample C program which writes to <code>/dev/tty</code> and doesn't have command line options to make it not do so.</p>
<pre class="lang-c prettyprint-override"><code>#include <stdio.h>
int main (void) {
FILE* fout = fopen("/dev/tty", "w");
fprintf(fout, "Hello, W... | Consider this sample C program which writes to `/dev/tty` and doesn't have command line options to make it not do so. ``` #include int main (void) { FILE* fout = fopen("/dev/tty", "w"); fprintf(fout, "Hello, World!\n"); fclose(fout); } ``` How could I redirect the output of it to `/dev/null` in a shell script? P.S. I r... | 9 | 1,376 | 2 | 2 | 1 | [
"<shell><io-redirection><tty><c><controlling-terminal>"
] | 2021-05-03T12:06:48.847 | 2021-05-04T12:25:01.833 | 216,846 | 647,847 | [
{
"id": 647847,
"body": "<p>TL,DR:</p>\n<pre><code>script -c myprogram /dev/null </dev/null >/dev/null\n</code></pre>\n<hr />\n<p>You can't “redirect” <code>/dev/tty</code> in the same sense that you can redirect standard output. Standard output is defined as a file descriptor. Programs write to whate... | TL,DR: ``` script -c myprogram /dev/null /dev/null ``` You can't “redirect” `/dev/tty` in the same sense that you can redirect standard output. Standard output is defined as a file descriptor. Programs write to whatever file is already open on file descriptor 1 when they start. Some operating systems offer `/dev/stdout... | # How can I redirect the output of a C program from /dev/tty to /dev/null?
**Tags:** <shell><io-redirection><tty><c><controlling-terminal>
**Question (score 9):**
Consider this sample C program which writes to `/dev/tty` and doesn't have command line options to make it not do so. ``` #include int main (void) { FILE*... | 2,338 | 584 | {
"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... |
647,907 | unix.stackexchange.com | bash: ./*.exe: No such file or directory with executables named *.exe | <p>Looks like I cannot run any normal linux binaries if their name ends with <code>.exe</code>, any idea why?</p>
<pre><code>$ cp /bin/pwd pwd
$ ./pwd
/home/premek
</code></pre>
<p>This is ok. But...</p>
<pre><code>$ cp /bin/pwd pwd.exe
$ ./pwd.exe
bash: ./pwd.exe: No such file or directory
$ ls -la pwd.exe
-rwxr-xr... | Looks like I cannot run any normal linux binaries if their name ends with `.exe`, any idea why? ``` $ cp /bin/pwd pwd $ ./pwd /home/premek ``` This is ok. But... ``` $ cp /bin/pwd pwd.exe $ ./pwd.exe bash: ./pwd.exe: No such file or directory $ ls -la pwd.exe -rwxr-xr-x 1 premek premek 39616 May 3 20:27 pwd.exe $ file ... | 15 | 1,792 | 2 | 0 | 1 | [
"<debian><executable>"
] | 2021-05-03T18:44:28.980 | 2021-05-03T19:26:22.327 | 20,860 | 647,908 | [
{
"id": 647908,
"body": "<p>I spent one day on this and of course 1 second after posting this question I remembered something like this existed to register .exe files for wine:</p>\n<pre><code>$ sudo cat /proc/sys/fs/binfmt_misc/wine \nenabled\ninterpreter /usr/bin/wine\nflags: \nextension .exe\n</code></pr... | I spent one day on this and of course 1 second after posting this question I remembered something like this existed to register .exe files for wine: ``` $ sudo cat /proc/sys/fs/binfmt_misc/wine enabled interpreter /usr/bin/wine flags: extension .exe ``` and `/usr/bin/wine` did not exist. I got rid of it using: ``` $ su... | # bash: ./*.exe: No such file or directory with executables named *.exe
**Tags:** <debian><executable>
**Question (score 15):**
Looks like I cannot run any normal linux binaries if their name ends with `.exe`, any idea why? ``` $ cp /bin/pwd pwd $ ./pwd /home/premek ``` This is ok. But... ``` $ cp /bin/pwd pwd.exe $... | 2,948 | 737 | {
"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... |
648,081 | unix.stackexchange.com | linux sort 'field skip' options not documented, but seem to work | <p>I was porting over a script from AIX to linux that had code of the form</p>
<pre><code>grep <pattern> $LOG | sort -b +rn4 -5 +2 -3
</code></pre>
<p>On AIX, this kind of sort syntax is documented, and basically the +a -b syntax means skip a fields and consider fields between a and b as your sort key.</p>
<p>Thi... | I was porting over a script from AIX to linux that had code of the form ``` grep $LOG | sort -b +rn4 -5 +2 -3 ``` On AIX, this kind of sort syntax is documented, and basically the +a -b syntax means skip a fields and consider fields between a and b as your sort key. This didn't work on linux, because the linux sort com... | 9 | 169 | 1 | 0 | 0 | [
"<linux><sort>"
] | 2021-05-04T15:26:27.090 | 2021-05-04T15:36:36.447 | 60,524 | null | [
{
"id": 648083,
"body": "<p>I’m assuming your Linux system uses GNU <code>sort</code>; GNU <code>sort</code>’s man page doesn’t provide complete documentation. Instead, the documentation is provided as an Info file (<code>info sort</code>) and is <a href=\"https://www.gnu.org/software/coreutils/manual/html_... | I’m assuming your Linux system uses GNU `sort`; GNU `sort`’s man page doesn’t provide complete documentation. Instead, the documentation is provided as an Info file (`info sort`) and is also available in the online Coreutils manual (https://www.gnu.org/software/coreutils/manual/html_node/sort-invocation.html). The latt... | # linux sort 'field skip' options not documented, but seem to work
**Tags:** <linux><sort>
**Question (score 9):**
I was porting over a script from AIX to linux that had code of the form ``` grep $LOG | sort -b +rn4 -5 +2 -3 ``` On AIX, this kind of sort syntax is documented, and basically the +a -b syntax means ski... | 2,552 | 638 | {
"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... |
648,308 | unix.stackexchange.com | Why do all users start in /root instead of their home directories after su as root? | <p>I feel like this should be straightforward but I've never seen anyone ask this that I can tell. The situation is pretty straight forward. Whenever I become a user, ie <code>su user</code> it always starts in /root directory instead of it's home directory. Let me show you.</p>
<pre><code>[root@st-test2 ~]# grep "... | I feel like this should be straightforward but I've never seen anyone ask this that I can tell. The situation is pretty straight forward. Whenever I become a user, ie `su user` it always starts in /root directory instead of it's home directory. Let me show you. ``` [root@st-test2 ~]# grep "postgres" /etc/passwd postgre... | 12 | 2,198 | 2 | 0 | 2 | [
"<centos><su><cwd>"
] | 2021-05-05T20:55:53.220 | 2021-05-10T15:08:44.333 | 470,260 | 648,310 | [
{
"id": 648310,
"body": "<p>If you only give a username as argument, <code>su</code> changes user <a href=\"https://man7.org/linux/man-pages/man1/su.1.html\" rel=\"noreferrer\">without changing much else</a>:</p>\n<blockquote>\n<p>For backward compatibility, <code>su</code> defaults to not change the curren... | If you only give a username as argument, `su` changes user without changing much else (https://man7.org/linux/man-pages/man1/su.1.html): For backward compatibility, `su` defaults to not change the current directory and to only set the environment variables `HOME` and `SHELL` (plus `USER` and `LOGNAME` if the target use... | # Why do all users start in /root instead of their home directories after su as root?
**Tags:** <centos><su><cwd>
**Question (score 12):**
I feel like this should be straightforward but I've never seen anyone ask this that I can tell. The situation is pretty straight forward. Whenever I become a user, ie `su user` i... | 1,666 | 416 | {
"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... |
648,352 | unix.stackexchange.com | Are ∈ and ℝ symbols available in eqn/roff? | <p>A set of commonly used symbols to represent that a variable belongs to a given real coordinate space are ∈ ("ELEMENT OF", Unicode U+2208) and ℝ ("DOUBLE-STRUCK CAPITAL R", Unicode U+211D).</p>
<p>Are those two symbols available in <code>eqn</code>, <code>troff</code>, and/or <code>groff</code>? I... | A set of commonly used symbols to represent that a variable belongs to a given real coordinate space are ∈ ("ELEMENT OF", Unicode U+2208) and ℝ ("DOUBLE-STRUCK CAPITAL R", Unicode U+211D). Are those two symbols available in `eqn`, `troff`, and/or `groff`? I can not find them in the documentation. Edit: I have tested pr... | 9 | 564 | 3 | 1 | 1 | [
"<unicode><special-characters><groff><roff>"
] | 2021-05-06T06:21:03.480 | 2021-05-06T11:12:20.337 | 378,578 | 648,485 | [
{
"id": 648485,
"body": "<p>If you want to see a unicode character like U+211D in groff you need to find a font that contains it, and provide the font metrics file for it to groff, usually by converting a ttf file to pfa and adding it to a list.</p>\n<p>One site that does the look-up for you for some common... | If you want to see a unicode character like U+211D in groff you need to find a font that contains it, and provide the font metrics file for it to groff, usually by converting a ttf file to pfa and adding it to a list. One site that does the look-up for you for some common fonts is fileformat.info (https://www.fileforma... | # Are ∈ and ℝ symbols available in eqn/roff?
**Tags:** <unicode><special-characters><groff><roff>
**Question (score 9):**
A set of commonly used symbols to represent that a variable belongs to a given real coordinate space are ∈ ("ELEMENT OF", Unicode U+2208) and ℝ ("DOUBLE-STRUCK CAPITAL R", Unicode U+211D). Are th... | 3,659 | 914 | {
"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... |
649,013 | unix.stackexchange.com | Why does AWK print "0xffffffffbb6002e0" as "ffffffffbb600000" using printf? | <p>I have been experimenting with hex numbers in AWK (<code>gawk</code>), but sometimes when I print them using e.g. <code>printf</code>, they are printed with some LSBs masked out, like in the following example:</p>
<pre><code>awk 'BEGIN { x=0xffffffffbb6002e0; printf("%x\n", x); }'
ffffffffbb600000
</code><... | I have been experimenting with hex numbers in AWK (`gawk`), but sometimes when I print them using e.g. `printf`, they are printed with some LSBs masked out, like in the following example: ``` awk 'BEGIN { x=0xffffffffbb6002e0; printf("%x\n", x); }' ffffffffbb600000 ``` Why do I experience this behaviour and how can I c... | 23 | 3,640 | 3 | 1 | 1 | [
"<awk>"
] | 2021-05-10T06:50:01.010 | 2021-05-11T07:12:39.037 | 128,739 | 649,017 | [
{
"id": 649017,
"body": "<p>Numbers in AWK are floating-point numbers by default, and your value exceeds the precision available. <code>0xffffffffbb6002e0</code> ends up represented as <code>0 10000111110 1111111111111111111111111111111101110110110000000000</code> in IEEE-754 binary64 (<a href=\"https://en.... | Numbers in AWK are floating-point numbers by default, and your value exceeds the precision available. `0xffffffffbb6002e0` ends up represented as `0 10000111110 1111111111111111111111111111111101110110110000000000` in IEEE-754 binary64 (double-precision (https://en.wikipedia.org/wiki/Double-precision_floating-point_for... | # Why does AWK print "0xffffffffbb6002e0" as "ffffffffbb600000" using printf?
**Tags:** <awk>
**Question (score 23):**
I have been experimenting with hex numbers in AWK (`gawk`), but sometimes when I print them using e.g. `printf`, they are printed with some LSBs masked out, like in the following example: ``` awk 'B... | 5,822 | 1,455 | {
"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... |
649,061 | unix.stackexchange.com | Why do ^M and \r behave inconsistently? | <p>Perhaps there are already answers out there that indirectly answer my question, but I've read many of them and haven't yet found a satisfactory answer to this discrepancy.</p>
<p>The original meaning of carriage return comes from old teleprinters: it meant to move the print head to the left in the current line. If y... | Perhaps there are already answers out there that indirectly answer my question, but I've read many of them and haven't yet found a satisfactory answer to this discrepancy. The original meaning of carriage return comes from old teleprinters: it meant to move the print head to the left in the current line. If you kept wr... | 13 | 978 | 1 | 2 | 2 | [
"<terminal><history><terminal-emulator><ascii><control-characters>"
] | 2021-05-10T12:51:29.850 | 2021-05-10T14:31:45.200 | 407,566 | 649,064 | [
{
"id": 649064,
"body": "<p>This is the result of the terminal’s input handling: by default, the terminal device driver (software in the kernel of your operating system to handle input from the terminal, not the terminal itself) converts <kbd>Ctrl</kbd><kbd>M</kbd> to <kbd>Ctrl</kbd><kbd>J</kbd>. You can se... | This is the result of the terminal’s input handling: by default, the terminal device driver (software in the kernel of your operating system to handle input from the terminal, not the terminal itself) converts CtrlM to CtrlJ. You can see this by running ``` od -t x1 ``` and then entering both characters: ``` $ od -t x1... | # Why do ^M and \r behave inconsistently?
**Tags:** <terminal><history><terminal-emulator><ascii><control-characters>
**Question (score 13):**
Perhaps there are already answers out there that indirectly answer my question, but I've read many of them and haven't yet found a satisfactory answer to this discrepancy. Th... | 2,117 | 529 | {
"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... |
649,189 | unix.stackexchange.com | List only sub-directories containing two specific files | <p>I'm running the following code on iOS using my iPhone's terminal, to be clear, this command is run within my jailbroken iphone using a slim terminal tweak called New Term 2:</p>
<pre><code>cd /var/mobile/Library/Widgets
find . -maxdepth 3 -name 'index.html' -printf "%h\n"
</code></pre>
<p>This returns the ... | I'm running the following code on iOS using my iPhone's terminal, to be clear, this command is run within my jailbroken iphone using a slim terminal tweak called New Term 2: ``` cd /var/mobile/Library/Widgets find . -maxdepth 3 -name 'index.html' -printf "%h\n" ``` This returns the list of the folders containing `index... | 6 | 489 | 6 | 7 | 1 | [
"<scripting><find><ios>"
] | 2021-05-11T10:07:07.923 | 2021-05-11T13:43:46.900 | 471,005 | 649,210 | [
{
"id": 649210,
"body": "<p>You were almost there; once <code>find</code> finds the index.html file, we ask it to look for the Config_extra.js file within the same directory via the <code>-execdir</code> (a non-POSIX option that is supported by some <code>find</code> implementations, including BSD-<code>fi... | You were almost there; once `find` finds the index.html file, we ask it to look for the Config_extra.js file within the same directory via the `-execdir` (a non-POSIX option that is supported by some `find` implementations, including BSD-`find` which is on iOS) and upon success we print the directory name. ``` find . -... | # List only sub-directories containing two specific files
**Tags:** <scripting><find><ios>
**Question (score 6):**
I'm running the following code on iOS using my iPhone's terminal, to be clear, this command is run within my jailbroken iphone using a slim terminal tweak called New Term 2: ``` cd /var/mobile/Library/W... | 4,903 | 1,225 | {
"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... |
649,222 | unix.stackexchange.com | /dev/sda **sometimes** confused with /dev/sdb by smartctl | <p>I have a script - run from <code>cron.daily</code> that gathers SMART stats from two identical SATA SSD's.
However, <code>smartctl -A /dev/sda</code> sometimes returns the stats for /dev/sdb - and if does so <code>smartctl -A /dev/sdb</code> returns the stats for /dev/sdb. However, sometimes it gets it right!</p>
<p... | I have a script - run from `cron.daily` that gathers SMART stats from two identical SATA SSD's. However, `smartctl -A /dev/sda` sometimes returns the stats for /dev/sdb - and if does so `smartctl -A /dev/sdb` returns the stats for /dev/sdb. However, sometimes it gets it right! The system boots into / on a M2 nvme0n1 wi... | 5 | 557 | 2 | 3 | 0 | [
"<shell-script><hard-disk><smartctl>"
] | 2021-05-11T13:55:47.207 | 2021-05-12T11:03:32.540 | 205,853 | null | [
{
"id": 649238,
"body": "<p>Device nodes for drives aren't guaranteed to be consistent across reboots. They're allocated on a first-seen basis, at boot time. This may vary due to hardware changes, kernel changes, module loading order, minor variations in timing, etc.</p>\n<p>If you want persistent device ... | Device nodes for drives aren't guaranteed to be consistent across reboots. They're allocated on a first-seen basis, at boot time. This may vary due to hardware changes, kernel changes, module loading order, minor variations in timing, etc. If you want persistent device node naming, use the symlinks under `/dev/disk/*/`... | # /dev/sda **sometimes** confused with /dev/sdb by smartctl
**Tags:** <shell-script><hard-disk><smartctl>
**Question (score 5):**
I have a script - run from `cron.daily` that gathers SMART stats from two identical SATA SSD's. However, `smartctl -A /dev/sda` sometimes returns the stats for /dev/sdb - and if does so `... | 4,494 | 1,123 | {
"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... |
649,408 | unix.stackexchange.com | I just deleted everything in my home directory. How? And why are some files still there? | <p>Never thought this would happen to me, but there you go. <code>¯\_(ツ)_/¯</code></p>
<p>I ran a build script from a repository inside the wrong directory without looking at the source first. Here's the script <code>Scripts/BuildLocalWheelLinux.sh</code>:</p>
<pre><code>cd ../Dependencies/cpython
mkdir debug
cd debug
... | Never thought this would happen to me, but there you go. `¯\_(ツ)_/¯` I ran a build script from a repository inside the wrong directory without looking at the source first. Here's the script `Scripts/BuildLocalWheelLinux.sh`: ``` cd ../Dependencies/cpython mkdir debug cd debug ../configure --with-pydebug --enable-shared... | 32 | 3,986 | 3 | 9 | 7 | [
"<bash><shell-script><zsh><rm><deleted-files>"
] | 2021-05-12T16:57:15.113 | 2021-05-14T16:18:00.447 | 67,771 | 649,413 | [
{
"id": 649413,
"body": "<p>Ouch. <a href=\"https://github.com/hoffstadt/DearPyGui/issues/796\" rel=\"noreferrer\">You aren't the first victim</a>.</p>\n<h3>What went wrong?</h3>\n<p>Starting in your home directory, e.g. <code>/home/felix</code>, or even in <code>/home/felix/src</code> or <code>/home/felix/... | Ouch. You aren't the first victim (https://github.com/hoffstadt/DearPyGui/issues/796). ### What went wrong? Starting in your home directory, e.g. `/home/felix`, or even in `/home/felix/src` or `/home/felix/Downloads/src`. ``` cd ../Dependencies/cpython ``` Failed because there is no `../Dependencies`. ``` mkdir debug c... | # I just deleted everything in my home directory. How? And why are some files still there?
**Tags:** <bash><shell-script><zsh><rm><deleted-files>
**Question (score 32):**
Never thought this would happen to me, but there you go. `¯\_(ツ)_/¯` I ran a build script from a repository inside the wrong directory without loo... | 11,250 | 2,812 | {
"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... |
649,628 | unix.stackexchange.com | Replace Nth line after match | <p>let's say, I have this file with five hundred lines of text.</p>
<pre><code>one
two
three
four
five
six
seven
eight
nine
ten
.
.
.
five-hundred
</code></pre>
<p>If I wanted to replace the fifth line after match with some string, I would just do this:</p>
<pre><code>sed '/two/{n;n;n;n;n;s/.*/MODIFIED/}' inputfile
</c... | let's say, I have this file with five hundred lines of text. ``` one two three four five six seven eight nine ten . . . five-hundred ``` If I wanted to replace the fifth line after match with some string, I would just do this: ``` sed '/two/{n;n;n;n;n;s/.*/MODIFIED/}' inputfile ``` output: ``` one two three four five s... | 8 | 1,801 | 9 | 4 | 0 | [
"<text-processing><awk><sed>"
] | 2021-05-14T01:32:59.380 | 2021-05-14T05:04:03.273 | 471,609 | 649,631 | [
{
"id": 649630,
"body": "<p>Workaround with <code>awk</code>:</p>\n<pre><code>awk '/two/{ n=NR+5 } NR==n{ sub(/.*/, "MODIFIED") }1' file\n</code></pre>\n<p>or if you want to replace the line</p>\n<pre><code>awk '/two/{ n=NR+5 } NR==n{ $0="MODIFIED" }1' file\n</code></pre>\n",
"body_m... | Workaround with `awk`: ``` awk '/two/{ n=NR+5 } NR==n{ sub(/.*/, "MODIFIED") }1' file ``` or if you want to replace the line ``` awk '/two/{ n=NR+5 } NR==n{ $0="MODIFIED" }1' file ``` | # Replace Nth line after match
**Tags:** <text-processing><awk><sed>
**Question (score 8):**
let's say, I have this file with five hundred lines of text. ``` one two three four five six seven eight nine ten . . . five-hundred ``` If I wanted to replace the fifth line after match with some string, I would just do thi... | 3,783 | 945 | {
"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... |
649,759 | unix.stackexchange.com | Linux 64-bit SSH port numbers? | <p>While there is usually no need for more than the 64k available ports, I am interested in the PoC that having a port number on 64 bits would mitigate the regular attacks on the access ports (ssh, vpn...). Having a 64b port makes it almost impossible to randomly attack a service, targeting either DoS or a login. Like<... | While there is usually no need for more than the 64k available ports, I am interested in the PoC that having a port number on 64 bits would mitigate the regular attacks on the access ports (ssh, vpn...). Having a 64b port makes it almost impossible to randomly attack a service, targeting either DoS or a login. Like ```... | 7 | 2,638 | 6 | 11 | 1 | [
"<networking><security><routing><tcp><port>"
] | 2021-05-15T04:12:12.270 | 2021-05-15T16:38:46.057 | 3,527 | 649,762 | [
{
"id": 649762,
"body": "<blockquote>\n<p>Is it possible to configure Linux to use 64 bit ports?</p>\n</blockquote>\n<p>You cannot change a parameter to use 64bit ports in TCP/UDP.</p>\n<p>You <strong>could</strong> create similar protocols, but you would only be able to communicate with your modified hosts... | Is it possible to configure Linux to use 64 bit ports? You cannot change a parameter to use 64bit ports in TCP/UDP. You could create similar protocols, but you would only be able to communicate with your modified hosts and it would not be TCP / UDP, but a new set of protocols, let's say TCP64 / UDP64. Here are just som... | # Linux 64-bit SSH port numbers?
**Tags:** <networking><security><routing><tcp><port>
**Question (score 7):**
While there is usually no need for more than the 64k available ports, I am interested in the PoC that having a port number on 64 bits would mitigate the regular attacks on the access ports (ssh, vpn...). Hav... | 6,577 | 1,644 | {
"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... |
649,996 | unix.stackexchange.com | Is "dd" a reliable tool to make an SSD image? | <p>I want to back up my SSD using the Linux <code>dd</code> command, but I'm not sure how reliable that method will be. I think I read somewhere that <code>dd</code> does not check for or report errors, so obviously if true then it will be a deal breaker.</p>
<p>This will be the command:</p>
<p><code>sudo dd status=pro... | I want to back up my SSD using the Linux `dd` command, but I'm not sure how reliable that method will be. I think I read somewhere that `dd` does not check for or report errors, so obviously if true then it will be a deal breaker. This will be the command: `sudo dd status=progress bs=512K if=/dev/nvme0n1 of=/media/d/ss... | 14 | 4,574 | 8 | 9 | 2 | [
"<hard-disk><backup><dd><ssd>"
] | 2021-05-17T01:52:13.357 | 2021-05-17T02:12:45.513 | 472,052 | 650,000 | [
{
"id": 650000,
"body": "<p>TLDR: Use <code>ddrescue</code></p>\n<p>It supports resume/continue capabilities, has automatic logs, and tons of other options. More at the <a href=\"https://www.gnu.org/software/ddrescue/\" rel=\"nofollow noreferrer\">ddrescue home page</a>.</p>\n<p>Example syntax:</p>\n<pre cl... | TLDR: Use `ddrescue` It supports resume/continue capabilities, has automatic logs, and tons of other options. More at the ddrescue home page (https://www.gnu.org/software/ddrescue/). Example syntax: ``` ddrescue /dev/sde yourimagename.image sde.log ``` IF you want to (given your comment mentioning restoring) restore th... | # Is "dd" a reliable tool to make an SSD image?
**Tags:** <hard-disk><backup><dd><ssd>
**Question (score 14):**
I want to back up my SSD using the Linux `dd` command, but I'm not sure how reliable that method will be. I think I read somewhere that `dd` does not check for or report errors, so obviously if true then i... | 2,424 | 606 | {
"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.