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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
622,283 | unix.stackexchange.com | What is the application of `rev` in real life? | <p>According to <a href="https://www.geeksforgeeks.org/rev-command-in-linux-with-examples/" rel="noreferrer">https://www.geeksforgeeks.org/rev-command-in-linux-with-examples/</a></p>
<blockquote>
<p>rev command in Linux is used to reverse the lines characterwise.</p>
</blockquote>
<p>e.g.</p>
<pre><code>wolf@linux:~$ r... | According to https://www.geeksforgeeks.org/rev-command-in-linux-with-examples/ (https://www.geeksforgeeks.org/rev-command-in-linux-with-examples/) rev command in Linux is used to reverse the lines characterwise. e.g. ``` wolf@linux:~$ rev Hello World! !dlroW olleH ``` What is the example of application of `rev` in real... | 15 | 2,829 | 3 | 4 | 0 | [
"<command-line><string>"
] | 2020-12-01T01:10:05.713 | 2021-07-02T14:36:57.267 | 409,008 | 622,314 | [
{
"id": 622314,
"body": "<p>The non-standard <code>rev</code> utility is useful in situations where it's easier to express or do an operation from one direction of a string, but it's the reverse of what you have.</p>\n<p>For example, to get the <em>last</em> tab-delimited field from lines of text using <cod... | The non-standard `rev` utility is useful in situations where it's easier to express or do an operation from one direction of a string, but it's the reverse of what you have. For example, to get the last tab-delimited field from lines of text using `cut` (assuming the text arrives on standard input): ``` rev | cut -f 1 ... | # What is the application of `rev` in real life?
**Tags:** <command-line><string>
**Question (score 15):**
According to https://www.geeksforgeeks.org/rev-command-in-linux-with-examples/ (https://www.geeksforgeeks.org/rev-command-in-linux-with-examples/) rev command in Linux is used to reverse the lines characterwise... | 2,855 | 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... |
622,296 | unix.stackexchange.com | Why must I put the command read into a subshell while using pipeline | <p>The command <code>df .</code> can show us which device we are on. For example,</p>
<pre><code>me@ubuntu1804:~$ df .
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sdb1 61664044 8510340 49991644 15% /home
</code></pre>
<p>Now I want to get the string <code>/dev/sdb1</code>.</p>
<p>I tried lik... | The command `df .` can show us which device we are on. For example, ``` me@ubuntu1804:~$ df . Filesystem 1K-blocks Used Available Use% Mounted on /dev/sdb1 61664044 8510340 49991644 15% /home ``` Now I want to get the string `/dev/sdb1`. I tried like this but it didn't work: `df . | read a; read a b; echo "$a"`, this c... | 5 | 513 | 3 | 1 | 1 | [
"<bash><pipe><read><subshell>"
] | 2020-12-01T02:58:18.107 | 2020-12-01T20:51:01.433 | 145,824 | 622,298 | [
{
"id": 622298,
"body": "<p>The main problem here is grouping the commands correctly. Subshells are a secondary issue.</p>\n<blockquote>\n<p><code>x|y</code> will redirect the output of <code>x</code> to the input of <code>y</code></p>\n</blockquote>\n<p>Yes, but <code>x | y; z</code> isn't going to redirec... | The main problem here is grouping the commands correctly. Subshells are a secondary issue. `x|y` will redirect the output of `x` to the input of `y` Yes, but `x | y; z` isn't going to redirect the output of `x` to both `y` and `z`. In `df . | read a; read a b; echo "$a"`, the pipeline only connects `df .` and `read a`,... | # Why must I put the command read into a subshell while using pipeline
**Tags:** <bash><pipe><read><subshell>
**Question (score 5):**
The command `df .` can show us which device we are on. For example, ``` me@ubuntu1804:~$ df . Filesystem 1K-blocks Used Available Use% Mounted on /dev/sdb1 61664044 8510340 49991644 1... | 2,128 | 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... |
622,330 | unix.stackexchange.com | How can dd over ssh report read speeds exceeding the network bandwidth? | <p>I am executing this command to test a connection from a remove server:</p>
<pre><code>ssh -l user $IP "dd if=/dev/zero count=3500 bs=1M status=progress" > /dev/null
</code></pre>
<p>This shows progress reports of the form</p>
<pre><code>3145728000 bytes (3,1 GB, 2,9 GiB) copied, 276,047 s, 11,4 MB/s
</c... | I am executing this command to test a connection from a remove server: ``` ssh -l user $IP "dd if=/dev/zero count=3500 bs=1M status=progress" > /dev/null ``` This shows progress reports of the form ``` 3145728000 bytes (3,1 GB, 2,9 GiB) copied, 276,047 s, 11,4 MB/s ``` so apparently, `dd` reads at 11mb per second. The ... | 9 | 1,158 | 1 | 3 | 0 | [
"<linux><ssh><pipe><dd>"
] | 2020-12-01T11:23:48.810 | 2020-12-03T04:05:39.117 | 208,945 | 622,331 | [
{
"id": 622331,
"body": "<p>SSH can be operated as a compressed protocol, and judging by your results, it is enabled as such by default in your distribution or configuration (or you are using <code>ssh -C</code>). As such, your stream of zeroes compresses nicely into something much more compact -- from your... | SSH can be operated as a compressed protocol, and judging by your results, it is enabled as such by default in your distribution or configuration (or you are using `ssh -C`). As such, your stream of zeroes compresses nicely into something much more compact -- from your readings, with a compression ratio of about 300: t... | # How can dd over ssh report read speeds exceeding the network bandwidth?
**Tags:** <linux><ssh><pipe><dd>
**Question (score 9):**
I am executing this command to test a connection from a remove server: ``` ssh -l user $IP "dd if=/dev/zero count=3500 bs=1M status=progress" > /dev/null ``` This shows progress reports ... | 1,837 | 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... |
622,355 | unix.stackexchange.com | Systemd stopped docker daemon for no obvious reason | <p>I'm trying to investigate why systemd sent a terminate signal to dockerd. This is related to this <a href="https://stackoverflow.com/questions/65090971/docker-daemon-unexpectedly-exits/65091213#65091213">stackoverflow post</a>.</p>
<pre><code>$ journalctl -r
Dec 01 06:25:05 ip-10-38-4-210 dockerd[2218]: time="... | I'm trying to investigate why systemd sent a terminate signal to dockerd. This is related to this stackoverflow post (https://stackoverflow.com/questions/65090971/docker-daemon-unexpectedly-exits/65091213#65091213). ``` $ journalctl -r Dec 01 06:25:05 ip-10-38-4-210 dockerd[2218]: time="2020-12-01T06:25:05.867748396Z" ... | 5 | 547 | 1 | 2 | 1 | [
"<systemd><docker>"
] | 2020-12-01T14:20:25.207 | 2020-12-02T01:30:53.083 | 444,382 | 622,460 | [
{
"id": 622460,
"body": "<p>In this specific case, the thing telling systemd to stop the docker service appears to be the Ubuntu unattended-update service applying updates the the Ubuntu version of the containerd package. There's an open issue showing many others impacted by the same problem today:</p>\n<p>... | In this specific case, the thing telling systemd to stop the docker service appears to be the Ubuntu unattended-update service applying updates the the Ubuntu version of the containerd package. There's an open issue showing many others impacted by the same problem today: https://bugs.launchpad.net/ubuntu/+source/contai... | # Systemd stopped docker daemon for no obvious reason
**Tags:** <systemd><docker>
**Question (score 5):**
I'm trying to investigate why systemd sent a terminate signal to dockerd. This is related to this stackoverflow post (https://stackoverflow.com/questions/65090971/docker-daemon-unexpectedly-exits/65091213#650912... | 2,484 | 621 | {
"source": "stackexchange-archive.org",
"license": "CC BY-SA 4.0",
"dump_version": "2021-12-07",
"extraction_date": "2026-07-02T12:57:40Z",
"parser_version": "stackexchange-streaming-v1.0",
"site_name": "unix.stackexchange.com",
"original_7z_url": "https://archive.org/download/stack-exchange-2021-12-07/u... |
622,736 | unix.stackexchange.com | Using ddrescue to shred only rescued portions of disk | <ol>
<li>Magnetic drive has failed.</li>
<li>I used ddrescue to recover ~85% of it, with a map file, but the rest is borked and continuing to scrub it would take years.</li>
<li>I can return it for a replacement.</li>
<li>I'd like to shred my data first.</li>
<li>When I try to write to it, it works for the first few hu... | - Magnetic drive has failed. - I used ddrescue to recover ~85% of it, with a map file, but the rest is borked and continuing to scrub it would take years. - I can return it for a replacement. - I'd like to shred my data first. - When I try to write to it, it works for the first few hundred MB but then starts pouring in... | 12 | 359 | 1 | 2 | 3 | [
"<data-recovery><ddrescue><shred>"
] | 2020-12-03T15:47:27.360 | 2020-12-04T03:47:21.837 | 19,012 | 622,745 | [
{
"id": 622745,
"body": "<p>The <a href=\"https://www.gnu.org/software/ddrescue/manual/ddrescue_manual.html#Fill-mode\" rel=\"noreferrer\">manual</a> gives you an example which is almost exactly what you want:</p>\n<blockquote>\n<p>When <code>ddrescue</code> is invoked with the option <code>--fill-mode</cod... | The manual (https://www.gnu.org/software/ddrescue/manual/ddrescue_manual.html#Fill-mode) gives you an example which is almost exactly what you want: When `ddrescue` is invoked with the option `--fill-mode` it operates in "fill mode", which is different from the default "rescue mode". That is, in "fill mode" `ddrescue` ... | # Using ddrescue to shred only rescued portions of disk
**Tags:** <data-recovery><ddrescue><shred>
**Question (score 12):**
- Magnetic drive has failed. - I used ddrescue to recover ~85% of it, with a map file, but the rest is borked and continuing to scrub it would take years. - I can return it for a replacement. -... | 1,980 | 495 | {
"source": "stackexchange-archive.org",
"license": "CC BY-SA 4.0",
"dump_version": "2021-12-07",
"extraction_date": "2026-07-02T12:57:40Z",
"parser_version": "stackexchange-streaming-v1.0",
"site_name": "unix.stackexchange.com",
"original_7z_url": "https://archive.org/download/stack-exchange-2021-12-07/u... |
622,768 | unix.stackexchange.com | For what purpose does "read" exit 1 when EOF is encountered? | <p>The bash man page says the following about the <code>read</code> builtin:</p>
<blockquote>
<p>The exit status is zero, unless end-of-file is encountered</p>
</blockquote>
<p>This recently bit me because I had the <code>-e</code> option set and was using the following code:</p>
<pre><code>read -rd '' json <&... | The bash man page says the following about the `read` builtin: The exit status is zero, unless end-of-file is encountered This recently bit me because I had the `-e` option set and was using the following code: ``` read -rd '' json <<EOF { "foo":"bar" } EOF ``` I just don't understand why it would be desirable to exit ... | 11 | 1,243 | 3 | 7 | 1 | [
"<shell><read>"
] | 2020-12-03T17:55:04.653 | 2020-12-03T18:25:48.107 | 237,982 | 622,770 | [
{
"id": 622770,
"body": "<p><code>read</code> reads a record (line by default, but ksh93/bash/zsh allow other delimiters with <code>-d</code>, even NUL with zsh/bash) and returns success as long as a full record has been read.</p>\n<p><code>read</code> returns non-zero when it finds EOF while the record del... | `read` reads a record (line by default, but ksh93/bash/zsh allow other delimiters with `-d`, even NUL with zsh/bash) and returns success as long as a full record has been read. `read` returns non-zero when it finds EOF while the record delimiter has still not been encountered. That allows you do do things like ``` whil... | # For what purpose does "read" exit 1 when EOF is encountered?
**Tags:** <shell><read>
**Question (score 11):**
The bash man page says the following about the `read` builtin: The exit status is zero, unless end-of-file is encountered This recently bit me because I had the `-e` option set and was using the following ... | 2,093 | 523 | {
"source": "stackexchange-archive.org",
"license": "CC BY-SA 4.0",
"dump_version": "2021-12-07",
"extraction_date": "2026-07-02T12:57:40Z",
"parser_version": "stackexchange-streaming-v1.0",
"site_name": "unix.stackexchange.com",
"original_7z_url": "https://archive.org/download/stack-exchange-2021-12-07/u... |
622,855 | unix.stackexchange.com | Print count number of unique pattern occurences after each occurence | <p>Supposing I have a log file containing thrown Exceptions:</p>
<pre><code>ExceptionA
loggedFunctionCall
ExceptionB
ExceptionA
loggedFunctionCall
ExceptionD
ExceptionB
loggedFunctionCall
ExceptionB
</code></pre>
<p>I want to count the number of occurrences of every different Exception and currently my solution is:</p>... | Supposing I have a log file containing thrown Exceptions: ``` ExceptionA loggedFunctionCall ExceptionB ExceptionA loggedFunctionCall ExceptionD ExceptionB loggedFunctionCall ExceptionB ``` I want to count the number of occurrences of every different Exception and currently my solution is: `cat file.txt | grep Exception... | 5 | 315 | 2 | 1 | 1 | [
"<text-processing><awk><grep><sort><uniq>"
] | 2020-12-04T09:18:01.280 | 2020-12-27T04:18:52.200 | 379,903 | null | [
{
"id": 622861,
"body": "<p>You could use a simple awk command for the whole task:</p>\n<pre><code>awk '/Exception/{a[$0]++} END {for (x in a) print x,a[x]}' file | sort -nk2\n</code></pre>\n<p>Output</p>\n<pre><code>ExceptionD 1\nExceptionA 2\nExceptionB 3\n</code></pre>\n<p>The order for an <code>awk</cod... | You could use a simple awk command for the whole task: ``` awk '/Exception/{a[$0]++} END {for (x in a) print x,a[x]}' file | sort -nk2 ``` Output ``` ExceptionD 1 ExceptionA 2 ExceptionB 3 ``` The order for an `awk` associative array is undefined, so usually you will need to pipe to `sort`, `k2` means sorting by second... | # Print count number of unique pattern occurences after each occurence
**Tags:** <text-processing><awk><grep><sort><uniq>
**Question (score 5):**
Supposing I have a log file containing thrown Exceptions: ``` ExceptionA loggedFunctionCall ExceptionB ExceptionA loggedFunctionCall ExceptionD ExceptionB loggedFunctionCa... | 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... |
622,902 | unix.stackexchange.com | How can I determine, within a shell script, whether it is being called by systemd or not? | <p>We have a shell script that -- for various reasons -- wraps a vendor's application. We have system administrators and application owners who have mixed levels of familiarity with systemd. As a result, in situations where the application has failed (systemctl indicates as much), some end users (including “root” syste... | We have a shell script that -- for various reasons -- wraps a vendor's application. We have system administrators and application owners who have mixed levels of familiarity with systemd. As a result, in situations where the application has failed (systemctl indicates as much), some end users (including “root” system a... | 24 | 1,945 | 5 | 5 | 3 | [
"<shell-script><systemd>"
] | 2020-12-04T13:37:07.257 | 2020-12-04T14:15:11.193 | 117,549 | 622,903 | [
{
"id": 622903,
"body": "<p>From <a href=\"https://serverfault.com/users/343005/lucas-werkmeister\">Lucas Werkmeister</a>'s informative <a href=\"https://serverfault.com/a/927481/293440\">answer on Server Fault</a>:</p>\n<ul>\n<li>With systemd versions 231 and later, there's a JOURNAL_STREAM variable that i... | From Lucas Werkmeister (https://serverfault.com/users/343005/lucas-werkmeister)'s informative answer on Server Fault (https://serverfault.com/a/927481/293440): - With systemd versions 231 and later, there's a JOURNAL_STREAM variable that is set for services whose stdout or stderr is connected to the journal. - With sys... | # How can I determine, within a shell script, whether it is being called by systemd or not?
**Tags:** <shell-script><systemd>
**Question (score 24):**
We have a shell script that -- for various reasons -- wraps a vendor's application. We have system administrators and application owners who have mixed levels of fami... | 4,771 | 1,192 | {
"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... |
623,001 | unix.stackexchange.com | How many services are listening on the target system on all interfaces? (Not on localhost and IPv4 only) | <p>I need to find out how many services are listening to my interfaces (ipv4 only, not localhost)</p>
<pre><code>$ ifconfig
ens192: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 10.129.56.137 netmask 255.255.0.0 broadcast 10.129.255.255
inet6 dead:beef::250:56ff:feb9:8c07 prefixlen... | I need to find out how many services are listening to my interfaces (ipv4 only, not localhost) ``` $ ifconfig ens192: flags=4163 mtu 1500 inet 10.129.56.137 netmask 255.255.0.0 broadcast 10.129.255.255 inet6 dead:beef::250:56ff:feb9:8c07 prefixlen 64 scopeid 0x0 inet6 fe80::250:56ff:feb9:8c07 prefixlen 64 scopeid 0x20 ... | 7 | 8,937 | 4 | 0 | 1 | [
"<linux><command-line><network-interface><services>"
] | 2020-12-05T06:53:22.040 | 2021-05-07T06:34:13.437 | 445,018 | 623,004 | [
{
"id": 627590,
"body": "<p>From man netstat:</p>\n<blockquote>\n<p>This program is mostly obsolete. Replacement for netstat is ss.</p>\n</blockquote>\n<p>At this point, I think this will be the best option:</p>\n<p><code>ss -l -4 | grep -v "127\\.0\\.0" | grep "LISTEN" | wc -l</code... | From man netstat: This program is mostly obsolete. Replacement for netstat is ss. At this point, I think this will be the best option: `ss -l -4 | grep -v "127\.0\.0" | grep "LISTEN" | wc -l` Where: - -l: show only listening services - -4: show only ipv4 - -grep -v "127.0.0": exclude all localhost results - -grep "LIST... | # How many services are listening on the target system on all interfaces? (Not on localhost and IPv4 only)
**Tags:** <linux><command-line><network-interface><services>
**Question (score 7):**
I need to find out how many services are listening to my interfaces (ipv4 only, not localhost) ``` $ ifconfig ens192: flags=4... | 1,999 | 499 | {
"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... |
623,112 | unix.stackexchange.com | How to get all paths from a website using cURL | <p><code>curl //website//</code>
will get me the source code but from there how would I filter our every unique path and obtain the number of them?</p>
<p>the question:</p>
<blockquote>
<p>Use cURL from your machine to obtain the source code of the "https://www.inlanefreight.com" website and filter all unique... | `curl //website//` will get me the source code but from there how would I filter our every unique path and obtain the number of them? the question: Use cURL from your machine to obtain the source code of the "https://www.inlanefreight.com" website and filter all unique paths of that domain. Submit the number of these p... | 7 | 11,788 | 5 | 2 | 3 | [
"<curl><wget><source-code>"
] | 2020-12-06T01:58:31.097 | 2020-12-06T10:45:02.313 | 445,018 | null | [
{
"id": 623134,
"body": "<p>I used this method and it worked somehow</p>\n<pre><code>$ wget --spider --recursive https://www.inlanefreight.com\n</code></pre>\n<p>this will show-</p>\n<pre><code>Found 10 broken links.\n\nhttps://www.inlanefreight.com/wp-content/themes/ben_theme/fonts/glyphicons-halflings-reg... | I used this method and it worked somehow ``` $ wget --spider --recursive https://www.inlanefreight.com ``` this will show- ``` Found 10 broken links. https://www.inlanefreight.com/wp-content/themes/ben_theme/fonts/glyphicons-halflings-regular.svg https://www.inlanefreight.com/wp-content/themes/ben_theme/fonts/glyphicon... | # How to get all paths from a website using cURL
**Tags:** <curl><wget><source-code>
**Question (score 7):**
`curl //website//` will get me the source code but from there how would I filter our every unique path and obtain the number of them? the question: Use cURL from your machine to obtain the source code of the ... | 3,225 | 806 | {
"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... |
623,458 | unix.stackexchange.com | IntelliJ IDEA — Please consider switching to the bundled Java runtime that is better suited for IDE | <p>IntelliJ IDEA shows this message on every startup.</p>
<p><a href="https://i.stack.imgur.com/dZiZs.png" rel="noreferrer"><img src="https://i.stack.imgur.com/dZiZs.png" alt="image" /></a></p>
<p>How can I correct this warning on IntelliJ IDEA?</p>
<p>Edit: I installed IntelliJ IDEA ultimate edition by yay on arch lin... | IntelliJ IDEA shows this message on every startup. (https://i.stack.imgur.com/dZiZs.png) How can I correct this warning on IntelliJ IDEA? Edit: I installed IntelliJ IDEA ultimate edition by yay on arch linux. | 5 | 2,451 | 2 | 3 | 0 | [
"<arch-linux><java><ide><intellij>"
] | 2020-12-08T14:59:43.100 | 2020-12-14T20:26:02.657 | 429,595 | 638,229 | [
{
"id": 638229,
"body": "<p>On Arch Linux:</p>\n<ul>\n<li>Install <a href=\"https://aur.archlinux.org/packages/jdk-jetbrains/\" rel=\"nofollow noreferrer\">jdk-jetbrains</a> from AUR.</li>\n<li>put in ~/.bash_profile <code>export IDEA_JDK=/usr/lib/jvm/jdk-jetbrains</code></li>\n</ul>\n",
"body_md": "On ... | On Arch Linux: - Install jdk-jetbrains (https://aur.archlinux.org/packages/jdk-jetbrains/) from AUR. - put in ~/.bash_profile `export IDEA_JDK=/usr/lib/jvm/jdk-jetbrains` | # IntelliJ IDEA — Please consider switching to the bundled Java runtime that is better suited for IDE
**Tags:** <arch-linux><java><ide><intellij>
**Question (score 5):**
IntelliJ IDEA shows this message on every startup. (https://i.stack.imgur.com/dZiZs.png) How can I correct this warning on IntelliJ IDEA? Edit: I i... | 585 | 146 | {
"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... |
623,612 | unix.stackexchange.com | Command parameters & arguments - Correct way of typing? | <p>Which is <em>the correct way</em> - to separate the argument from the parameter with a whitespace, or no?</p>
<p><em>And</em> should you separate arguments or stick them all together?</p>
<p>Examples:</p>
<pre><code><command> -D 192.168.0.100 -p 80
<command> -cvvfz
</code></pre>
<p>or:</p>
<pre><code><... | Which is the correct way - to separate the argument from the parameter with a whitespace, or no? And should you separate arguments or stick them all together? Examples: ``` -D 192.168.0.100 -p 80 -cvvfz ``` or: ``` -D192.168.0.100 -p80 -c -vv -f -z ``` Do some programs accept only one "style", or does it matter at all,... | 5 | 944 | 6 | 2 | 1 | [
"<bash><arguments><parameter>"
] | 2020-12-09T12:40:29.087 | 2020-12-10T06:46:14.620 | 381,778 | 623,614 | [
{
"id": 623617,
"body": "<p>Some programs <em>do</em> accept only one style. One or the other.</p>\n<p>Anything that uses <code>getopt()</code> should accept both <code>-xfoo</code> and <code>-x foo</code> for option <code>-x</code> that takes an argument. However, not all programs use <code>getopt()</code>... | Some programs do accept only one style. One or the other. Anything that uses `getopt()` should accept both `-xfoo` and `-x foo` for option `-x` that takes an argument. However, not all programs use `getopt()`. Optional arguments are another thing yet, they might not work with `-x foo`, but may require `-xfoo`, because ... | # Command parameters & arguments - Correct way of typing?
**Tags:** <bash><arguments><parameter>
**Question (score 5):**
Which is the correct way - to separate the argument from the parameter with a whitespace, or no? And should you separate arguments or stick them all together? Examples: ``` -D 192.168.0.100 -p 80 ... | 2,449 | 612 | {
"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... |
623,877 | unix.stackexchange.com | Substitute variable inside the previous declared variable | <p>Here is template variable VAR1 that need to be updated based on the VAR2 and the order of variable is as below how can I update VAR1 without sed command</p>
<pre><code>#!/bin/bash
VAR1="<tr>
<th>\$VAR2</th>
</tr>"
VAR2=test
echo $VAR2
</code></pre>
| Here is template variable VAR1 that need to be updated based on the VAR2 and the order of variable is as below how can I update VAR1 without sed command ``` #!/bin/bash VAR1=" \$VAR2 " VAR2=test echo $VAR2 ``` | 6 | 435 | 4 | 5 | 1 | [
"<bash><shell-script>"
] | 2020-12-10T18:07:58.900 | 2020-12-11T06:48:00.287 | 98,659 | null | [
{
"id": 623899,
"body": "<p>You could use <code>envsubst</code>:</p>\n<p>(with any POSIX shell, including <code>bash</code>):</p>\n<pre><code>VAR1="<tr>\n <th>\\$VAR2</th>\n </tr>"\nVAR2=test\n\nexpanded_VAR1=$(\n export VAR2\n printf '%s\\n' "$VAR1" |\n ... | You could use `envsubst`: (with any POSIX shell, including `bash`): ``` VAR1=" \$VAR2 " VAR2=test expanded_VAR1=$( export VAR2 printf '%s\n' "$VAR1" | envsubst '$VAR2' ) ``` Or to perform all word expansions (parameter expansion, command substitution, arithmetic expansion) upon parameter expansion, you could use `zsh` ... | # Substitute variable inside the previous declared variable
**Tags:** <bash><shell-script>
**Question (score 6):**
Here is template variable VAR1 that need to be updated based on the VAR2 and the order of variable is as below how can I update VAR1 without sed command ``` #!/bin/bash VAR1=" \$VAR2 " VAR2=test echo $V... | 3,233 | 808 | {
"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... |
623,881 | unix.stackexchange.com | How to gzip 100 GB files faster with high compression | <p>We have 100+ GB files on a Linux machine, and while trying to perform gzip using below command, gzip is taking minimum 1-2 hours to complete:</p>
<pre><code>gzip file.txt
</code></pre>
<p>Is there a way we can make gzip to run fast with the same level of compression happening when we use gzip?</p>
<hr />
<p>CPU: Int... | We have 100+ GB files on a Linux machine, and while trying to perform gzip using below command, gzip is taking minimum 1-2 hours to complete: ``` gzip file.txt ``` Is there a way we can make gzip to run fast with the same level of compression happening when we use gzip? CPU: Intel(R) Core(TM) i3-2350M CPU @2.30 GHz | 14 | 7,748 | 8 | 23 | 2 | [
"<performance><gzip>"
] | 2020-12-10T18:25:58.050 | 2020-12-11T22:28:03.477 | 379,007 | null | [
{
"id": 623887,
"body": "<p>If you are using gzip, you use mostly one processor core (well, some parts of the task, like reading and writing data are kernel tasks and kernel will use another core). Have a look at some multicore-capable gzip replacements, e.g. MiGz (<a href=\"https://github.com/linkedin/migz... | If you are using gzip, you use mostly one processor core (well, some parts of the task, like reading and writing data are kernel tasks and kernel will use another core). Have a look at some multicore-capable gzip replacements, e.g. MiGz (https://github.com/linkedin/migz (https://github.com/linkedin/migz)) or Pigz (http... | # How to gzip 100 GB files faster with high compression
**Tags:** <performance><gzip>
**Question (score 14):**
We have 100+ GB files on a Linux machine, and while trying to perform gzip using below command, gzip is taking minimum 1-2 hours to complete: ``` gzip file.txt ``` Is there a way we can make gzip to run fas... | 7,890 | 1,972 | {
"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... |
623,969 | unix.stackexchange.com | Replace blank line with above line content | <p>How do I replace the blank lines in tab delimited text file with the content of the row above on a Linux machine? For example:</p>
<pre><code>101 abc group1
765 efg group2
345 hij group4
456 gfd group9
762 ert group7
554 fgt group11
</code></pre>
<p>Expected Output:</p>
<pre><code>101 abc group1
765 efg group2
34... | How do I replace the blank lines in tab delimited text file with the content of the row above on a Linux machine? For example: ``` 101 abc group1 765 efg group2 345 hij group4 456 gfd group9 762 ert group7 554 fgt group11 ``` Expected Output: ``` 101 abc group1 765 efg group2 345 hij group3 345 hij group3 456 gfd group... | 5 | 526 | 6 | 1 | 1 | [
"<text-processing><awk><sed>"
] | 2020-12-11T10:09:53.380 | 2020-12-11T11:40:57.420 | 312,065 | 623,971 | [
{
"id": 623974,
"body": "<p>Here is one way with <code>awk</code> (<code>p</code> holds the previous line when <code>NF</code> is zero).</p>\n<pre><code>awk 'NF {p = $0} {print p}' file\n</code></pre>\n<p>When the line is not empty, we store the line into <code>p</code> (for future use) and print <code>p</c... | Here is one way with `awk` (`p` holds the previous line when `NF` is zero). ``` awk 'NF {p = $0} {print p}' file ``` When the line is not empty, we store the line into `p` (for future use) and print `p`. When `NF==0` (for empty lines) we only print `p`. | # Replace blank line with above line content
**Tags:** <text-processing><awk><sed>
**Question (score 5):**
How do I replace the blank lines in tab delimited text file with the content of the row above on a Linux machine? For example: ``` 101 abc group1 765 efg group2 345 hij group4 456 gfd group9 762 ert group7 554 ... | 3,619 | 904 | {
"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... |
624,086 | unix.stackexchange.com | Run a command on files with filenames matching a pattern, excluding a particular list of files | <p>The following script searches files with the suffix <code>.tex</code> in a directory (i.e. TeX files), for the string <code>\RequireLuaTeX</code>, i.e. LuaTeX files in that directory, and creates a Bash array from the results.</p>
<p>It then runs the command <code>latexmk</code> on the files in that array.</p>
<p>I'... | The following script searches files with the suffix `.tex` in a directory (i.e. TeX files), for the string `\RequireLuaTeX`, i.e. LuaTeX files in that directory, and creates a Bash array from the results. It then runs the command `latexmk` on the files in that array. I'd like to exclude a list of user defined files fro... | 7 | 526 | 6 | 2 | 1 | [
"<bash><shell-script><scripting>"
] | 2020-12-12T09:24:32.173 | 2021-01-24T17:02:07.933 | 4,671 | 624,094 | [
{
"id": 624094,
"body": "<p><code>-L</code> flag to Grep list files not matching a pattern. You want <code>-l</code> instead. Also, Grep needs to see double-backslash to match a single backslash.</p>\n<p>Since you are in Bash, let us get hold of some useful constructs.</p>\n<pre><code>#!/bin/bash -\nshopt -... | `-L` flag to Grep list files not matching a pattern. You want `-l` instead. Also, Grep needs to see double-backslash to match a single backslash. Since you are in Bash, let us get hold of some useful constructs. ``` #!/bin/bash - shopt -s globstar extglob mapfile -t -d "" filenames - `**/!(foo|bar|baz).tex` expands to ... | # Run a command on files with filenames matching a pattern, excluding a particular list of files
**Tags:** <bash><shell-script><scripting>
**Question (score 7):**
The following script searches files with the suffix `.tex` in a directory (i.e. TeX files), for the string `\RequireLuaTeX`, i.e. LuaTeX files in that dir... | 4,184 | 1,046 | {
"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... |
624,220 | unix.stackexchange.com | PulseAudio as remote source *and* sink? | <p>I'm an amateur radio operator, and I use a software package called WSJT-X to connect my computer to my radio to operate it using what we call "digital modes". This works by sending audio signals from the speaker output of a USB sound card to my radio, and reading audio signals from the microphone input on ... | I'm an amateur radio operator, and I use a software package called WSJT-X to connect my computer to my radio to operate it using what we call "digital modes". This works by sending audio signals from the speaker output of a USB sound card to my radio, and reading audio signals from the microphone input on that same car... | 5 | 284 | 1 | 0 | 1 | [
"<pulseaudio><remote><remote-control>"
] | 2020-12-13T04:16:55.417 | 2020-12-13T04:33:55.003 | 382,204 | 624,222 | [
{
"id": 624222,
"body": "<p>Yes, <a href=\"https://www.freedesktop.org/wiki/Software/PulseAudio/Documentation/User/Network/#index3h3\" rel=\"noreferrer\">you can</a> (this is an example of something you can do):</p>\n<blockquote>\n<p><strong>How can I use PulseAudio to share a single LINE-IN/MIC jack on the... | Yes, you can (https://www.freedesktop.org/wiki/Software/PulseAudio/Documentation/User/Network/#index3h3) (this is an example of something you can do): How can I use PulseAudio to share a single LINE-IN/MIC jack on the entire LAN? On the sender side simply load the RTP sender module: load-module module-rtp-send On the r... | # PulseAudio as remote source *and* sink?
**Tags:** <pulseaudio><remote><remote-control>
**Question (score 5):**
I'm an amateur radio operator, and I use a software package called WSJT-X to connect my computer to my radio to operate it using what we call "digital modes". This works by sending audio signals from the ... | 1,656 | 414 | {
"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... |
624,296 | unix.stackexchange.com | Remove left padding of line numbers in less | <p>If you toggle the <code>-N</code> switch within <code>less</code>, it displays line numbers. However, there seems to be an unnecessarily generous amount of padding added, even when the total lines is small. E.g. the output of <code>man less</code> with line numbers enabled is:</p>
<pre><code> 1 LESS(1)
2
... | If you toggle the `-N` switch within `less`, it displays line numbers. However, there seems to be an unnecessarily generous amount of padding added, even when the total lines is small. E.g. the output of `man less` with line numbers enabled is: ``` 1 LESS(1) 2 3 NAME 4 less - opposite of more 5 6 SYNOPSIS 7 less -? 8 l... | 5 | 308 | 1 | 2 | 0 | [
"<less>"
] | 2020-12-13T16:23:20.327 | 2020-12-14T12:11:17.740 | 229,444 | 624,305 | [
{
"id": 624305,
"body": "<p><strong>Update</strong></p>\n<p>This functionality has been promptly added to Less <a href=\"https://github.com/gwsw/less/commit/13f1a7d9efe3a017a08bf3666a6da87771734d17\" rel=\"nofollow noreferrer\">in the\nform of an extra command line option</a>, <code>--line-num-width=N</code... | Update This functionality has been promptly added to Less in the form of an extra command line option (https://github.com/gwsw/less/commit/13f1a7d9efe3a017a08bf3666a6da87771734d17), `--line-num-width=N`. The original answer below is valid up to Less version 570, as per the commit history (https://github.com/gwsw/less/c... | # Remove left padding of line numbers in less
**Tags:** <less>
**Question (score 5):**
If you toggle the `-N` switch within `less`, it displays line numbers. However, there seems to be an unnecessarily generous amount of padding added, even when the total lines is small. E.g. the output of `man less` with line numbe... | 2,069 | 517 | {
"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... |
624,550 | unix.stackexchange.com | Understand load average on multicore system | <p>For only one microprocessor unit, the load average output by <code>top</code> could be understood that if it's above 1.0 then there are jobs waiting. But if we have n number of cores on a multicore system with <code>l*n</code> logical cores (on my Intel CPU n=6 and <code>l*n</code> = 12 so the output from <code>npro... | For only one microprocessor unit, the load average output by `top` could be understood that if it's above 1.0 then there are jobs waiting. But if we have n number of cores on a multicore system with `l*n` logical cores (on my Intel CPU n=6 and `l*n` = 12 so the output from `nproc` is 12), should we divide the load aver... | 5 | 571 | 1 | 1 | 1 | [
"<load-average>"
] | 2020-12-15T12:26:14.387 | 2020-12-15T16:27:45.617 | 9,115 | 624,567 | [
{
"id": 624567,
"body": "<p>Your assumption is correct, you divide the load average across the cores. To understand load averages better I highly recommend this article by Brendan Gregg <a href=\"http://www.brendangregg.com/blog/2017-08-08/linux-load-averages.html\" rel=\"noreferrer\">http://www.brendangreg... | Your assumption is correct, you divide the load average across the cores. To understand load averages better I highly recommend this article by Brendan Gregg http://www.brendangregg.com/blog/2017-08-08/linux-load-averages.html (http://www.brendangregg.com/blog/2017-08-08/linux-load-averages.html) | # Understand load average on multicore system
**Tags:** <load-average>
**Question (score 5):**
For only one microprocessor unit, the load average output by `top` could be understood that if it's above 1.0 then there are jobs waiting. But if we have n number of cores on a multicore system with `l*n` logical cores (on... | 1,333 | 333 | {
"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... |
624,875 | unix.stackexchange.com | Is there a way to use HEREDOC for Bash and Zsh, and be able to use arguments? | <p>Bash and Zsh's HEREDOC seems to act like a file, instead of string, and if I hope to do something like</p>
<pre><code>foo() {
ruby << 'EOF'
3.times do
puts "Ruby is getting the argument #{ARGV[0]}"
end
EOF
}
</code></pre>
<p>is there a way to pass in an argument to th... | Bash and Zsh's HEREDOC seems to act like a file, instead of string, and if I hope to do something like ``` foo() { ruby << 'EOF' 3.times do puts "Ruby is getting the argument #{ARGV[0]}" end EOF } ``` is there a way to pass in an argument to the Ruby program? It will be best not to interpolate the `$1` into the Ruby co... | 6 | 1,126 | 3 | 2 | 1 | [
"<bash><shell-script><zsh><here-document>"
] | 2020-12-17T04:24:44.297 | 2020-12-17T22:41:17.277 | 19,342 | null | [
{
"id": 624892,
"body": "<p>On systems with <code>/dev/fd/<i>n</i></code>, you can always do:</p>\n<pre class=\"lang-bsh prettyprint-override\"><code>foo() {\n ruby /dev/fd/3 "$@" 3<< 'EOF'\n 3.times do\n puts "Ruby is getting the argument #{ARGV[0]}"\n end\nEOF\n}\n</c... | On systems with `/dev/fd/n`, you can always do: ``` foo() { ruby /dev/fd/3 "$@" 3n`, you can do: ``` foo() { ruby - "$@" stdin). But that means that the `ruby` inline script's stdin is now that heredoc, so that script won't be able to query the user via the original stdin unless you provide that stream some other way. ... | # Is there a way to use HEREDOC for Bash and Zsh, and be able to use arguments?
**Tags:** <bash><shell-script><zsh><here-document>
**Question (score 6):**
Bash and Zsh's HEREDOC seems to act like a file, instead of string, and if I hope to do something like ``` foo() { ruby << 'EOF' 3.times do puts "Ruby is getting ... | 3,476 | 869 | {
"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... |
624,922 | unix.stackexchange.com | Where is the terminal view of tty7 | <p>When I use <kbd>ctrl</kbd>+<kbd>alt</kbd>+<kbd>F7</kbd> and switch to the X11 server, I can see the desktop UI.</p>
<p>When I switch to <kbd>ctrl</kbd>+<kbd>alt</kbd>+[<kbd>F1</kbd>-<kbd>F6</kbd>], I can see the virtual terminal.</p>
<p>Now how do I access the virtual terminal 7 where I can input commands even thoug... | When I use ctrl+alt+F7 and switch to the X11 server, I can see the desktop UI. When I switch to ctrl+alt+[F1-F6], I can see the virtual terminal. Now how do I access the virtual terminal 7 where I can input commands even though X is running parallely | 5 | 293 | 2 | 0 | 0 | [
"<linux><ubuntu><x11><tty>"
] | 2020-12-17T12:09:47.660 | 2020-12-20T18:42:10.500 | 446,881 | 624,927 | [
{
"id": 624930,
"body": "<p>If you run <code>fuser /dev/tty7</code>, you'll see that the X11 server is actually holding that TTY device for itself.</p>\n<p>The X11 server is not running <em>parallel to</em> virtual console 7, but <em>actually in</em> virtual console 7. It is switching that virtual console t... | If you run `fuser /dev/tty7`, you'll see that the X11 server is actually holding that TTY device for itself. The X11 server is not running parallel to virtual console 7, but actually in virtual console 7. It is switching that virtual console to graphics mode and using it. By itself, a virtual console is just a black sc... | # Where is the terminal view of tty7
**Tags:** <linux><ubuntu><x11><tty>
**Question (score 5):**
When I use ctrl+alt+F7 and switch to the X11 server, I can see the desktop UI. When I switch to ctrl+alt+[F1-F6], I can see the virtual terminal. Now how do I access the virtual terminal 7 where I can input commands even... | 1,790 | 447 | {
"source": "stackexchange-archive.org",
"license": "CC BY-SA 4.0",
"dump_version": "2021-12-07",
"extraction_date": "2026-07-02T12:57:40Z",
"parser_version": "stackexchange-streaming-v1.0",
"site_name": "unix.stackexchange.com",
"original_7z_url": "https://archive.org/download/stack-exchange-2021-12-07/u... |
625,121 | unix.stackexchange.com | Configure SSH to read HostName for a Host from a file | <p>I have the following host definition in my <code>~/.ssh/config</code> file:</p>
<pre><code>Host testbox
User abc
Port 12345
HostKeyAlias=hello
HostName 123.123.123.123
</code></pre>
<p>The problem is, this host changes IP all the time. The IP is refreshed and stored in this text file <code>~/ip.txt</code> as... | I have the following host definition in my `~/.ssh/config` file: ``` Host testbox User abc Port 12345 HostKeyAlias=hello HostName 123.123.123.123 ``` The problem is, this host changes IP all the time. The IP is refreshed and stored in this text file `~/ip.txt` as it's contents. Is there a way to configure SSH such that... | 5 | 245 | 2 | 3 | 0 | [
"<ssh><openssh>"
] | 2020-12-18T14:00:59.770 | 2020-12-18T18:33:12.933 | 447,074 | null | [
{
"id": 625276,
"body": "<p>if you ~/ip.txt can be made to contain</p>\n<pre><code>hostname 1.2.3.4\n</code></pre>\n<p>then you can</p>\n<pre><code>include ~/ip.txt\n</code></pre>\n<p>at the appropriate place in the ~/.ssh/config.</p>\n",
"body_md": "if you ~/ip.txt can be made to contain ``` hostname 1... | if you ~/ip.txt can be made to contain ``` hostname 1.2.3.4 ``` then you can ``` include ~/ip.txt ``` at the appropriate place in the ~/.ssh/config. | # Configure SSH to read HostName for a Host from a file
**Tags:** <ssh><openssh>
**Question (score 5):**
I have the following host definition in my `~/.ssh/config` file: ``` Host testbox User abc Port 12345 HostKeyAlias=hello HostName 123.123.123.123 ``` The problem is, this host changes IP all the time. The IP is r... | 925 | 231 | {
"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... |
625,213 | unix.stackexchange.com | Changing directory by changing one early word in a pathname | <p>How do I change to a near-identical path with a different low-level parent? If you’re working in for instance <code>~/foobar/<strong>foo</strong>/data/images/2020/01/14/0001/</code> and need to get to the same path in <code>bar</code> instead of <code>foo</code>, how can you get there without typing out <code>cd ~/f... | How do I change to a near-identical path with a different low-level parent? If you’re working in for instance `~/foobar/foo/data/images/2020/01/14/0001/` and need to get to the same path in `bar` instead of `foo`, how can you get there without typing out `cd ~/foobar/bar/data/images/2020/01/14/0001/`? Surely there’s so... | 10 | 609 | 5 | 4 | 1 | [
"<shell><cd-command>"
] | 2020-12-19T02:20:39.030 | 2020-12-24T03:29:36.087 | 337,540 | 625,232 | [
{
"id": 625232,
"body": "<p>In some shells, e.g. <code>ksh</code> and <code>zsh</code>, doing <code>cd word1 word2</code> would change to a directory given by changing the first occurrence of <code>word1</code> in the pathname of the current directory to <code>word2</code>.</p>\n<p>For example, in the <code... | In some shells, e.g. `ksh` and `zsh`, doing `cd word1 word2` would change to a directory given by changing the first occurrence of `word1` in the pathname of the current directory to `word2`. For example, in the `zsh` shell: ``` $ pwd /usr/local/sbin $ cd sbin bin /usr/local/bin $ ``` In other shells that support the n... | # Changing directory by changing one early word in a pathname
**Tags:** <shell><cd-command>
**Question (score 10):**
How do I change to a near-identical path with a different low-level parent? If you’re working in for instance `~/foobar/foo/data/images/2020/01/14/0001/` and need to get to the same path in `bar` inst... | 2,969 | 742 | {
"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... |
625,416 | unix.stackexchange.com | Using the caret symbol (^) in substitutions in the vi editor | <p>I'm using CentOS and I was reading about the substitution command, <code>s///</code>, in the <code>vi</code> editor. I wanted to test some of the examples I saw:</p>
<pre><code>:%s/old/new/g Substitutes old with new throughout the file
:.,$s/old/new/g Substitutes old with new from the current cursor position t... | I'm using CentOS and I was reading about the substitution command, `s///`, in the `vi` editor. I wanted to test some of the examples I saw: ``` :%s/old/new/g Substitutes old with new throughout the file :.,$s/old/new/g Substitutes old with new from the current cursor position to the end of the file ``` The above exampl... | 5 | 649 | 2 | 3 | 0 | [
"<vi><editors>"
] | 2020-12-20T18:24:40.553 | 2020-12-20T21:15:29.780 | 447,343 | 625,423 | [
{
"id": 625423,
"body": "<p>In the <code>vi</code> editor, as well as in both <code>ex</code> and <code>ed</code> (as found on BSD systems), the <code>^</code> addresses the previous line. This means that the command <code>^d</code> would delete the previous line, <code>^m.</code> would swap this line with... | In the `vi` editor, as well as in both `ex` and `ed` (as found on BSD systems), the `^` addresses the previous line. This means that the command `^d` would delete the previous line, `^m.` would swap this line with the previous, and that `^,.s/old/new/g` would substitute all strings matching `old` with `new` on the prev... | # Using the caret symbol (^) in substitutions in the vi editor
**Tags:** <vi><editors>
**Question (score 5):**
I'm using CentOS and I was reading about the substitution command, `s///`, in the `vi` editor. I wanted to test some of the examples I saw: ``` :%s/old/new/g Substitutes old with new throughout the file :.,... | 3,244 | 811 | {
"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... |
625,529 | unix.stackexchange.com | What is the most lightweight way to render graphics Gentoo? | <p>Basically, I am exploring <code>Gentoo</code>, and I would like to be able to perform some kind of graphics rendering (open a jpg, or draw basic shapes, or even set the colors of individual pixels if I have to).</p>
<p>I do not have any desktop or window manager, and I would rather not need one, but that is exactly ... | Basically, I am exploring `Gentoo`, and I would like to be able to perform some kind of graphics rendering (open a jpg, or draw basic shapes, or even set the colors of individual pixels if I have to). I do not have any desktop or window manager, and I would rather not need one, but that is exactly the question. What is... | 5 | 611 | 2 | 0 | 0 | [
"<linux><terminal><gentoo><graphics>"
] | 2020-12-21T14:12:01.220 | 2020-12-21T14:54:47.747 | 447,457 | 625,533 | [
{
"id": 625533,
"body": "<p>You can display graphics using the Linux frame-buffer interface without X11 or Wayland at all.</p>\n<p><a href=\"https://packages.gentoo.org/packages/media-gfx/fbida\" rel=\"noreferrer\">The <code>fbida</code> package</a> includes the <code>fbi</code> image viewer, which can run ... | You can display graphics using the Linux frame-buffer interface without X11 or Wayland at all. The `fbida` package (https://packages.gentoo.org/packages/media-gfx/fbida) includes the `fbi` image viewer, which can run directly on the virtual console. You can't get much more light-weight than that. | # What is the most lightweight way to render graphics Gentoo?
**Tags:** <linux><terminal><gentoo><graphics>
**Question (score 5):**
Basically, I am exploring `Gentoo`, and I would like to be able to perform some kind of graphics rendering (open a jpg, or draw basic shapes, or even set the colors of individual pixels... | 841 | 210 | {
"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... |
625,570 | unix.stackexchange.com | group and count by a regex | <p>I have dozens of values in a file such as</p>
<pre><code>(1608926678.237962) vcan0 123#0000000158
(1608926678.251533) vcan0 456#0000000186
</code></pre>
<p>I want to count how many of each there are based on the numbers before the hash symbol (can include it also)</p>
<p>I have tried to following but keep getting ze... | I have dozens of values in a file such as ``` (1608926678.237962) vcan0 123#0000000158 (1608926678.251533) vcan0 456#0000000186 ``` I want to count how many of each there are based on the numbers before the hash symbol (can include it also) I have tried to following but keep getting zero ``` grep -o '\b\d+#\b' ./file.l... | 5 | 810 | 5 | 1 | 1 | [
"<bash><text-processing><awk><grep>"
] | 2020-12-21T19:27:20.817 | 2020-12-21T20:05:51.420 | 205,324 | null | [
{
"id": 625571,
"body": "<p>It's not exactly the output you described but if that is really a hard requirement it can be massaged to that format but:</p>\n<pre><code>awk -F'[ #]' '{print $3}' input | sort -n | uniq -c\n</code></pre>\n<p>The awk command will extract your number before <code>#</code> and then... | It's not exactly the output you described but if that is really a hard requirement it can be massaged to that format but: ``` awk -F'[ #]' '{print $3}' input | sort -n | uniq -c ``` The awk command will extract your number before `#` and then pass it to `sort`/`uniq`. `uniq -c` will provide a count of each value. To ge... | # group and count by a regex
**Tags:** <bash><text-processing><awk><grep>
**Question (score 5):**
I have dozens of values in a file such as ``` (1608926678.237962) vcan0 123#0000000158 (1608926678.251533) vcan0 456#0000000186 ``` I want to count how many of each there are based on the numbers before the hash symbol ... | 2,142 | 535 | {
"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... |
625,819 | unix.stackexchange.com | sed parameter substitution with multiline quoted string | <h2>Goals</h2>
<p>Replace the text <code>"scripts: {"</code> with the following string</p>
<pre><code>"scripts": {
"watch": "tsc -w",
</code></pre>
<p>in a <code>json</code> file.</p>
<h2>Attempts</h2>
<p>I created two variables for source and destination strings:</p>
<h3>Fir... | ## Goals Replace the text `"scripts: {"` with the following string ``` "scripts": { "watch": "tsc -w", ``` in a `json` file. ## Attempts I created two variables for source and destination strings: ### First attempt ``` SRC='"scripts": {' DST='"scripts": { "watch": "tsc -w",' ``` And ran the following command: ``` sed "... | 5 | 485 | 5 | 3 | 0 | [
"<sed><json>"
] | 2020-12-23T08:41:55.850 | 2020-12-23T09:06:10.710 | 390,517 | 625,820 | [
{
"id": 625820,
"body": "<p>Assuming your JSON document looks something like</p>\n<pre class=\"lang-json prettyprint-override\"><code>{\n "scripts": {\n "other-key": "some value"\n }\n}\n</code></pre>\n<p>... and you'd like to insert some other key-value pair into the <cod... | Assuming your JSON document looks something like ``` { "scripts": { "other-key": "some value" } } ``` ... and you'd like to insert some other key-value pair into the `.scripts` object. Then you may use `jq` to do this: ``` $ jq '.scripts.watch |= "tsc -w"' file.json { "scripts": { "other-key": "some value", "watch": "t... | # sed parameter substitution with multiline quoted string
**Tags:** <sed><json>
**Question (score 5):**
## Goals Replace the text `"scripts: {"` with the following string ``` "scripts": { "watch": "tsc -w", ``` in a `json` file. ## Attempts I created two variables for source and destination strings: ### First attemp... | 3,616 | 904 | {
"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... |
625,989 | unix.stackexchange.com | Why do my computers take a long time to shut down? | <p>I have been using Arch Linux + GNOME 3 on both my computers (notebook and desktop) for over a year now. And all the time, computers were shutting down quickly (in 3 seconds). After a recent update of all packages on both computers via Pamac, the computers now take a long time to shut down (it takes about 2 minutes t... | I have been using Arch Linux + GNOME 3 on both my computers (notebook and desktop) for over a year now. And all the time, computers were shutting down quickly (in 3 seconds). After a recent update of all packages on both computers via Pamac, the computers now take a long time to shut down (it takes about 2 minutes to w... | 5 | 975 | 2 | 1 | 2 | [
"<arch-linux><systemd><gnome3>"
] | 2020-12-24T14:45:02.197 | 2020-12-24T16:38:43.050 | 410,475 | 626,035 | [
{
"id": 625992,
"body": "<p>Slow shutdown after an update can be caused by orphaned packages that are no longer used or required for anything following a software update. If so, searching for orphaned packages and uninstalling them will solve the problem.</p>\n<p>List orphaned packages:</p>\n<pre class=\"la... | Slow shutdown after an update can be caused by orphaned packages that are no longer used or required for anything following a software update. If so, searching for orphaned packages and uninstalling them will solve the problem. List orphaned packages: ``` pacman -Qtdq ``` If the above command finds any orphaned package... | # Why do my computers take a long time to shut down?
**Tags:** <arch-linux><systemd><gnome3>
**Question (score 5):**
I have been using Arch Linux + GNOME 3 on both my computers (notebook and desktop) for over a year now. And all the time, computers were shutting down quickly (in 3 seconds). After a recent update of ... | 3,132 | 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... |
626,065 | unix.stackexchange.com | Do all linux distros have same boot files and all the main files? | <p>I am having a question that do all the linux distros boot files,grub files and kernel files , that are main to run them and only the iso image of the distro is different?<br><br>I have Fedora installed on my system and can replace it with manjaro by changing the grub entry? How safe it is?</p>
| I am having a question that do all the linux distros boot files,grub files and kernel files , that are main to run them and only the iso image of the distro is different? I have Fedora installed on my system and can replace it with manjaro by changing the grub entry? How safe it is? | 9 | 1,486 | 4 | 0 | 0 | [
"<linux><arch-linux><rhel><boot><grub2>"
] | 2020-12-25T06:04:02.617 | 2020-12-26T09:53:41.847 | 441,027 | 626,092 | [
{
"id": 626092,
"body": "<p>Various distributions of course have different packages of pretty much everything. Nevertheless, three components are typically rather well isolated from each other: bootloader, kernel, userspace programs.</p>\n<ol>\n<li><p>Bootloader needs to be able to boot various kernels, oth... | Various distributions of course have different packages of pretty much everything. Nevertheless, three components are typically rather well isolated from each other: bootloader, kernel, userspace programs. - Bootloader needs to be able to boot various kernels, otherwise its usability would be quite limited. - The kerne... | # Do all linux distros have same boot files and all the main files?
**Tags:** <linux><arch-linux><rhel><boot><grub2>
**Question (score 9):**
I am having a question that do all the linux distros boot files,grub files and kernel files , that are main to run them and only the iso image of the distro is different? I hav... | 2,849 | 712 | {
"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... |
626,068 | unix.stackexchange.com | Why created directories disappearing after reboot in /dev? | <p>I'm new to Linux. When I try to create a directory in <code>/dev</code> folder it's happening smoothly but after rebooting all created folders are disappearing. I tried in other folder like <code>/etc</code>, everywhere directories are not disappearing. I tried as normal user and as root user but same thing happenin... | I'm new to Linux. When I try to create a directory in `/dev` folder it's happening smoothly but after rebooting all created folders are disappearing. I tried in other folder like `/etc`, everywhere directories are not disappearing. I tried as normal user and as root user but same thing happening. How to create director... | 5 | 1,291 | 1 | 3 | 1 | [
"<linux><kali-linux><devices>"
] | 2020-12-25T07:11:35.200 | 2020-12-26T09:23:01.037 | 447,965 | null | [
{
"id": 626069,
"body": "<p>Yes, you can create files and/or directories under <code>/dev/</code>. But you can't expect them to still be there after a reboot.</p>\n<p>Here is why: the <code>dev</code> filesystem is responsible for device access. It's not a block filesystem (with underlying "real" ... | Yes, you can create files and/or directories under `/dev/`. But you can't expect them to still be there after a reboot. Here is why: the `dev` filesystem is responsible for device access. It's not a block filesystem (with underlying "real" storage) but a memory-based filesystem. As it exists only in RAM everything unde... | # Why created directories disappearing after reboot in /dev?
**Tags:** <linux><kali-linux><devices>
**Question (score 5):**
I'm new to Linux. When I try to create a directory in `/dev` folder it's happening smoothly but after rebooting all created folders are disappearing. I tried in other folder like `/etc`, everyw... | 1,585 | 396 | {
"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... |
626,070 | unix.stackexchange.com | How to mirror directory structure and files with zero size? | <p>I am trying to mirror the directory <em>and</em> file structure of a particular directory. However, I want the mirrored files to have no size. So for example, if I had the following directory tree:</p>
<pre><code>original_folder
├── images
│ ├── image1.jpg (2 MB)
│ ├── image2.jpg (3 MB)
├── video... | I am trying to mirror the directory and file structure of a particular directory. However, I want the mirrored files to have no size. So for example, if I had the following directory tree: ``` original_folder ├── images │ ├── image1.jpg (2 MB) │ ├── image2.jpg (3 MB) ├── videos │ ├── video1.mp4 (300 MB) │ ├── video2.mp... | 6 | 447 | 2 | 2 | 1 | [
"<bash><find><directory-structure><macos><touch>"
] | 2020-12-25T07:37:26.433 | 2020-12-25T08:49:12.243 | 262,730 | 626,074 | [
{
"id": 626074,
"body": "<p>GNU <code>cp</code> (from <a href=\"https://www.gnu.org/software/coreutils/\" rel=\"nofollow noreferrer\">coreutils</a>) can do this:</p>\n<pre><code>cp -r --attributes-only original_folder/* mirrored_folder/\n</code></pre>\n<hr />\n<p>From <a href=\"https://man7.org/linux/man-pa... | GNU `cp` (from coreutils (https://www.gnu.org/software/coreutils/)) can do this: ``` cp -r --attributes-only original_folder/* mirrored_folder/ ``` From man cp (https://man7.org/linux/man-pages/man1/cp.1.html): `--attributes-only` don't copy the file data, just the attributes `-R`, `-r`, `--recursive` copy directories ... | # How to mirror directory structure and files with zero size?
**Tags:** <bash><find><directory-structure><macos><touch>
**Question (score 6):**
I am trying to mirror the directory and file structure of a particular directory. However, I want the mirrored files to have no size. So for example, if I had the following ... | 1,747 | 436 | {
"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... |
626,143 | unix.stackexchange.com | sign_and_send_pubkey: signing failed for RSA key; from agent: agent refused operation | <p>I have a new machine running debian sid on which I generated a new ssh key-pair. I wanted to find a convenient way to copy this new key-pair to various other machines using my old Ubuntu machine and its key-pair. I have disabled password logins for all the "remote" machines, so I wanted to use the old mach... | I have a new machine running debian sid on which I generated a new ssh key-pair. I wanted to find a convenient way to copy this new key-pair to various other machines using my old Ubuntu machine and its key-pair. I have disabled password logins for all the "remote" machines, so I wanted to use the old machine as an int... | 7 | 4,041 | 1 | 0 | 1 | [
"<ssh><ssh-agent><gnome-keyring><ssh-keygen>"
] | 2020-12-25T23:52:47.083 | 2021-05-27T08:00:15.043 | 134,933 | null | [
{
"id": 630564,
"body": "<p>Make sure the permissions of the key directory and keys are correct on the client.\nThe ~/.ssh directory should only have execute, read and write permissions for the user. If not then change them:</p>\n<p>User can execute, read and write</p>\n<p><code>chmod 700 ~/.ssh</code></p>\... | Make sure the permissions of the key directory and keys are correct on the client. The ~/.ssh directory should only have execute, read and write permissions for the user. If not then change them: User can execute, read and write `chmod 700 ~/.ssh` For the private keys and also the id_rsa, user can read and write `chmod... | # sign_and_send_pubkey: signing failed for RSA key; from agent: agent refused operation
**Tags:** <ssh><ssh-agent><gnome-keyring><ssh-keygen>
**Question (score 7):**
I have a new machine running debian sid on which I generated a new ssh key-pair. I wanted to find a convenient way to copy this new key-pair to various... | 2,347 | 586 | {
"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... |
626,248 | unix.stackexchange.com | Find -exec dry run? | <p>Is there a way to see what the result of a <code>find . -exec somecommand {} \;</code> would be with substitutions, without actually running the commands? Like a dry run (or test run or print)?</p>
<p>For example, suppose I have the following file structure:</p>
<pre><code>/a/1.txt
/a/2.txt
/a/b/3.txt
</code></pre>
... | Is there a way to see what the result of a `find . -exec somecommand {} \;` would be with substitutions, without actually running the commands? Like a dry run (or test run or print)? For example, suppose I have the following file structure: ``` /a/1.txt /a/2.txt /a/b/3.txt ``` Is there a way to test `find . type f -exe... | 6 | 1,620 | 3 | 7 | 1 | [
"<find><exec>"
] | 2020-12-27T00:06:49.733 | 2020-12-27T00:37:23.637 | 6,250 | 626,251 | [
{
"id": 626251,
"body": "<p>You can run <code>echo rm</code> instead of <code>rm</code></p>\n<pre><code>find . type f -exec echo rm {} \\;\n</code></pre>\n<p>Also, <code>find</code> has <code>-delete</code> option to delete files it finds</p>\n",
"body_md": "You can run `echo rm` instead of `rm` ``` fin... | You can run `echo rm` instead of `rm` ``` find . type f -exec echo rm {} \; ``` Also, `find` has `-delete` option to delete files it finds | # Find -exec dry run?
**Tags:** <find><exec>
**Question (score 6):**
Is there a way to see what the result of a `find . -exec somecommand {} \;` would be with substitutions, without actually running the commands? Like a dry run (or test run or print)? For example, suppose I have the following file structure: ``` /a/... | 1,999 | 499 | {
"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... |
626,314 | unix.stackexchange.com | htop CPU% at ~100% but bar graph shows every core much lower | <p>I'm using Debian 9 to host a game server. Specifically, I'm hosting about 10 instances of the game Don't Starve Together.</p>
<p>The other day I noticed one of those instances (which was getting a lot of player activity) exhibit performance issues. When I loaded up <code>htop</code> I saw that <code>CPU%</code> was ... | I'm using Debian 9 to host a game server. Specifically, I'm hosting about 10 instances of the game Don't Starve Together. The other day I noticed one of those instances (which was getting a lot of player activity) exhibit performance issues. When I loaded up `htop` I saw that `CPU%` was reporting `101%` but the bar gra... | 7 | 1,540 | 1 | 1 | 0 | [
"<cpu-usage><htop>"
] | 2020-12-27T15:10:28.933 | 2020-12-27T16:09:04.433 | 448,206 | 626,319 | [
{
"id": 626319,
"body": "<p>Over time, the operating system schedules threads on different CPU cores, so the 101% reported for your processes are potentially distributed over all 8 bars.</p>\n",
"body_md": "Over time, the operating system schedules threads on different CPU cores, so the 101% reported fo... | Over time, the operating system schedules threads on different CPU cores, so the 101% reported for your processes are potentially distributed over all 8 bars. | # htop CPU% at ~100% but bar graph shows every core much lower
**Tags:** <cpu-usage><htop>
**Question (score 7):**
I'm using Debian 9 to host a game server. Specifically, I'm hosting about 10 instances of the game Don't Starve Together. The other day I noticed one of those instances (which was getting a lot of playe... | 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... |
626,393 | unix.stackexchange.com | In ZSH, how do I unset an arbitrary associative array element? | <p>An associative array I have has arbitrary keys, including keys containing backquotes, brackets, etc:</p>
<pre><code>$ typeset -A arr
$ key='`'
$ arr[$key]=backquote
$ echo $arr[$key]
backquote
</code></pre>
<p>I now need to unset <code>arr[$key]</code>. Looking through the web, I tried:</p>
<pre><code>$ unset "... | An associative array I have has arbitrary keys, including keys containing backquotes, brackets, etc: ``` $ typeset -A arr $ key='`' $ arr[$key]=backquote $ echo $arr[$key] backquote ``` I now need to unset `arr[$key]`. Looking through the web, I tried: ``` $ unset "arr[$key]" unset: arr[`]: invalid parameter name $ uns... | 6 | 347 | 1 | 0 | 0 | [
"<zsh><associative-array>"
] | 2020-12-28T00:33:44.090 | 2020-12-28T22:56:59.837 | 14,298 | 626,529 | [
{
"id": 626529,
"body": "<p>Wow, this is a mess.</p>\n<p>Since <a href=\"https://www.zsh.org/mla/workers/2016/msg00440.html\" rel=\"noreferrer\">Bart Schaefer's 2016 patch</a>, merged as <a href=\"https://github.com/zsh-users/zsh/commit/95663e936596933d529a648ed3d6c707d1a1dffe\" rel=\"noreferrer\">patch 379... | Wow, this is a mess. Since Bart Schaefer's 2016 patch (https://www.zsh.org/mla/workers/2016/msg00440.html), merged as patch 37914 in commit 95663e936596933d529a648ed3d6c707d1a1dffe (https://github.com/zsh-users/zsh/commit/95663e936596933d529a648ed3d6c707d1a1dffe) and first released in zsh 5.4, experimentally, `unset "a... | # In ZSH, how do I unset an arbitrary associative array element?
**Tags:** <zsh><associative-array>
**Question (score 6):**
An associative array I have has arbitrary keys, including keys containing backquotes, brackets, etc: ``` $ typeset -A arr $ key='`' $ arr[$key]=backquote $ echo $arr[$key] backquote ``` I now n... | 5,122 | 1,280 | {
"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... |
626,637 | unix.stackexchange.com | Allow bash script to be run as root, but not sudo | <p>I'm new here and new to bash/linux.</p>
<p>My teacher gave me an assignment to allow a script to be run only when you're "really" root and not when you're using sudo. After two hours of searching and trying I'm beginning to think he's trolling me. Allowing only root is easy, but how do I exclude users that... | I'm new here and new to bash/linux. My teacher gave me an assignment to allow a script to be run only when you're "really" root and not when you're using sudo. After two hours of searching and trying I'm beginning to think he's trolling me. Allowing only root is easy, but how do I exclude users that run it with sudo? T... | 25 | 4,038 | 8 | 13 | 5 | [
"<bash><shell-script><sudo><root>"
] | 2020-12-29T13:43:36.713 | 2020-12-30T03:33:34.707 | 448,526 | 626,639 | [
{
"id": 626639,
"body": "<p>The only way I could think of is to check one of the <code>SUDO_*</code> environment\nvariables set by sudo:</p>\n<pre><code>#!/usr/bin/env sh\n\nif [ "$(id -u)" -eq 0 ]\nthen\n if [ -n "$SUDO_USER" ]\n then\n printf "This script has to run a... | The only way I could think of is to check one of the `SUDO_*` environment variables set by sudo: ``` #!/usr/bin/env sh if [ "$(id -u)" -eq 0 ] then if [ -n "$SUDO_USER" ] then printf "This script has to run as root (not sudo)\n" >&2 exit 1 fi printf "OK, script run as root (not sudo)\n" else printf "This script has to ... | # Allow bash script to be run as root, but not sudo
**Tags:** <bash><shell-script><sudo><root>
**Question (score 25):**
I'm new here and new to bash/linux. My teacher gave me an assignment to allow a script to be run only when you're "really" root and not when you're using sudo. After two hours of searching and tryi... | 6,279 | 1,569 | {
"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... |
626,700 | unix.stackexchange.com | Why is the file descriptor opened and read only once? | <p>Why can it be used only 1 time when we open the file descriptor ourselves and redirect it to stdin?
Please take a look at the example below to understand what I want to say. After reading it once with the cat command, the file is not read via the same file descriptor for the second time.</p>
<pre><code>└─$ exec 6<... | Why can it be used only 1 time when we open the file descriptor ourselves and redirect it to stdin? Please take a look at the example below to understand what I want to say. After reading it once with the cat command, the file is not read via the same file descriptor for the second time. ``` └─$ exec 6< input.txt └─$ c... | 7 | 479 | 1 | 0 | 0 | [
"<bash><file-descriptors><stdin>"
] | 2020-12-29T20:46:30.423 | 2020-12-30T12:01:52.833 | 364,572 | 626,705 | [
{
"id": 626705,
"body": "<p>To print the file, the first <code>cat</code> has to read it until the end.\n<code>exec 6< input.txt</code> causes the shell to hold the file descriptor until the\nshell dies or closes it, so the file offset still points to the end of the\nfile when the second <code>cat</code>... | To print the file, the first `cat` has to read it until the end. `exec 6< input.txt` causes the shell to hold the file descriptor until the shell dies or closes it, so the file offset still points to the end of the file when the second `cat` is invoked, which thus writes nothing to stdout. If on a Linux-based system, y... | # Why is the file descriptor opened and read only once?
**Tags:** <bash><file-descriptors><stdin>
**Question (score 7):**
Why can it be used only 1 time when we open the file descriptor ourselves and redirect it to stdin? Please take a look at the example below to understand what I want to say. After reading it once... | 1,395 | 348 | {
"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... |
626,788 | unix.stackexchange.com | Is there a remote desktop solution for GNU/Linux as performant as RDP for Microsoft Windows? | <p>Currently I have a very powerful dedicated server I run Windows 10 on and <a href="https://en.wikipedia.org/wiki/Remote_Desktop_Protocol" rel="noreferrer">RDP</a> into from other Windows "thin clients".</p>
<p>This works very well and you can barely feel that you're RDPing. Multiple monitors, audio, microp... | Currently I have a very powerful dedicated server I run Windows 10 on and RDP (https://en.wikipedia.org/wiki/Remote_Desktop_Protocol) into from other Windows "thin clients". This works very well and you can barely feel that you're RDPing. Multiple monitors, audio, microphones, USB, etc. all just work. I'd prefer to be ... | 16 | 2,226 | 4 | 5 | 8 | [
"<xrdp><rdp><freerdp><xfreerdp>"
] | 2020-12-30T12:59:09.137 | 2020-12-31T06:40:00.377 | 448,708 | null | [
{
"id": 626800,
"body": "<p>If you really want the Linux analog of a Windows Remote Desktop Service system, you should look into the Linux Terminal Server Project (<a href=\"https://ltsp.org/\" rel=\"noreferrer\"><code>ltsp</code></a>).</p>\n<p>This is the very definition of having one server and all client... | If you really want the Linux analog of a Windows Remote Desktop Service system, you should look into the Linux Terminal Server Project (`ltsp` (https://ltsp.org/)). This is the very definition of having one server and all clients just being thin clients (that may even run without local hard drives). Your thin client co... | # Is there a remote desktop solution for GNU/Linux as performant as RDP for Microsoft Windows?
**Tags:** <xrdp><rdp><freerdp><xfreerdp>
**Question (score 16):**
Currently I have a very powerful dedicated server I run Windows 10 on and RDP (https://en.wikipedia.org/wiki/Remote_Desktop_Protocol) into from other Window... | 3,460 | 865 | {
"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... |
626,807 | unix.stackexchange.com | "grep string | grep string" with awk without pipe | <p>Is there a way to do:</p>
<pre><code>output | grep "string1" | grep "string2"
</code></pre>
<p><strong>BUT with awk, WITHOUT PIPE?</strong></p>
<p>Something like:</p>
<pre><code>output | awk '/string1/ | /string2/ {print $XY}'
</code></pre>
<p>Result should be subset of matches, if tha makes se... | Is there a way to do: ``` output | grep "string1" | grep "string2" ``` BUT with awk, WITHOUT PIPE? Something like: ``` output | awk '/string1/ | /string2/ {print $XY}' ``` Result should be subset of matches, if tha makes sense. | 5 | 310 | 2 | 7 | 0 | [
"<bash><awk>"
] | 2020-12-30T14:48:06.930 | 2020-12-30T15:06:17.497 | 118,321 | 626,809 | [
{
"id": 626809,
"body": "<p>The default action with <code>awk</code> is to print, so the equivalent of</p>\n<pre><code>output | grep string1 | grep string2\n</code></pre>\n<p>is</p>\n<pre><code>output | awk '/string1/ && /string2/'\n</code></pre>\n<p>e.g.</p>\n<pre><code>$ cat tst\nfoo\nbar\nfoobar\... | The default action with `awk` is to print, so the equivalent of ``` output | grep string1 | grep string2 ``` is ``` output | awk '/string1/ && /string2/' ``` e.g. ``` $ cat tst foo bar foobar barfoo foothisbarbaz otherstuff $ cat tst | awk '/foo/ && /bar/' foobar barfoo foothisbarbaz ``` | # "grep string | grep string" with awk without pipe
**Tags:** <bash><awk>
**Question (score 5):**
Is there a way to do: ``` output | grep "string1" | grep "string2" ``` BUT with awk, WITHOUT PIPE? Something like: ``` output | awk '/string1/ | /string2/ {print $XY}' ``` Result should be subset of matches, if tha make... | 958 | 239 | {
"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... |
626,975 | unix.stackexchange.com | What happens when writing gigabytes of data to a pipe? | <p>Let's say I have a makefile with a recipe called <code>hour_long_recipe</code>, which as its name suggests takes an hour to run. At random points throughout the recipe it asks yes/no questions. Let's say it asks 10 questions in total.</p>
<p>One possible (and often recommended) way to run it is:</p>
<pre><code>yes |... | Let's say I have a makefile with a recipe called `hour_long_recipe`, which as its name suggests takes an hour to run. At random points throughout the recipe it asks yes/no questions. Let's say it asks 10 questions in total. One possible (and often recommended) way to run it is: ``` yes | make hour_long_recipe ``` which... | 18 | 1,911 | 1 | 11 | 1 | [
"<linux><pipe><yes>"
] | 2020-12-31T13:20:16.843 | 2020-12-31T15:29:24.713 | 383,346 | 626,976 | [
{
"id": 626976,
"body": "<p>tl;dr: at some point, <code>yes</code> will be blocked from writing if the data isn't being read on the other side. It will not be able to continue executing until either that data is read, or it receives a signal, so you typically don't need to worry about <code>yes</code> writi... | tl;dr: at some point, `yes` will be blocked from writing if the data isn't being read on the other side. It will not be able to continue executing until either that data is read, or it receives a signal, so you typically don't need to worry about `yes` writing gigabytes and gigabytes of data. The important thing to rem... | # What happens when writing gigabytes of data to a pipe?
**Tags:** <linux><pipe><yes>
**Question (score 18):**
Let's say I have a makefile with a recipe called `hour_long_recipe`, which as its name suggests takes an hour to run. At random points throughout the recipe it asks yes/no questions. Let's say it asks 10 qu... | 5,505 | 1,376 | {
"source": "stackexchange-archive.org",
"license": "CC BY-SA 4.0",
"dump_version": "2021-12-07",
"extraction_date": "2026-07-02T12:57:40Z",
"parser_version": "stackexchange-streaming-v1.0",
"site_name": "unix.stackexchange.com",
"original_7z_url": "https://archive.org/download/stack-exchange-2021-12-07/u... |
627,155 | unix.stackexchange.com | duration, start time and end time of a command after it is finished | <p>I want to have a report like the following after a command finishes:</p>
<pre><code>Start Time: 02/01/21 01:27pm
End Time: 02/01/21 02:29pm
Total Duration: 01 Hour 02 Minutes
</code></pre>
<p>I figured out I can get the Start Time and End Time using <code>date +"%d/%m/%y %I:%M%P"</code>.</p>
<p>For example... | I want to have a report like the following after a command finishes: ``` Start Time: 02/01/21 01:27pm End Time: 02/01/21 02:29pm Total Duration: 01 Hour 02 Minutes ``` I figured out I can get the Start Time and End Time using `date +"%d/%m/%y %I:%M%P"`. For example, ``` start=$(date +"%d/%m/%y %I:%M%P") start_duration=... | 5 | 638 | 1 | 0 | 0 | [
"<bash><shell-script><zsh>"
] | 2021-01-02T08:16:06.247 | 2021-01-03T06:45:57.760 | 206,574 | 627,157 | [
{
"id": 627157,
"body": "<p>With <code>zsh</code>:</p>\n<pre><code>zmodload zsh/datetime\nTIMEFMT='Total duration for %J: %*E'\npreexec() strftime 'Start Time: %d/%m/%y %I:%M%P'\nprecmd() strftime 'End Time: %d/%m/%y %I:%M%P'\nREPORTTIME=0\n</code></pre>\n<p>And then, you'll get the start time printed when ... | With `zsh`: ``` zmodload zsh/datetime TIMEFMT='Total duration for %J: %*E' preexec() strftime 'Start Time: %d/%m/%y %I:%M%P' precmd() strftime 'End Time: %d/%m/%y %I:%M%P' REPORTTIME=0 ``` And then, you'll get the start time printed when you enter a command line, end time printed just before displaying the next prompt,... | # duration, start time and end time of a command after it is finished
**Tags:** <bash><shell-script><zsh>
**Question (score 5):**
I want to have a report like the following after a command finishes: ``` Start Time: 02/01/21 01:27pm End Time: 02/01/21 02:29pm Total Duration: 01 Hour 02 Minutes ``` I figured out I can... | 5,023 | 1,255 | {
"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... |
627,366 | unix.stackexchange.com | Filesystem copied to new server is 60% bigger - why | <p>I'm migrating a server from an Ubuntu Server 18.02 instance ("saturn") to a newly-built Debian Buster 10 system ("enceladus"). I have copied a complete filesystem across the network using</p>
<pre><code>sudo rsync --progress -au --delete --rsync-path="sudo rsync" /u/ henry@enceladus:/u... | I'm migrating a server from an Ubuntu Server 18.02 instance ("saturn") to a newly-built Debian Buster 10 system ("enceladus"). I have copied a complete filesystem across the network using ``` sudo rsync --progress -au --delete --rsync-path="sudo rsync" /u/ henry@enceladus:/u ``` I check the number of directories and th... | 27 | 3,974 | 1 | 4 | 2 | [
"<rsync><ext4>"
] | 2021-01-03T17:52:33.320 | 2021-01-03T18:03:10.337 | 449,269 | 627,368 | [
{
"id": 627368,
"body": "<p>I can think of two things offhand:</p>\n<ul>\n<li>you didn't use <code>-H</code>, so hardlinks are lost.</li>\n<li>you didn't use <code>-S</code>, so sparse files may have been expanded</li>\n</ul>\n",
"body_md": "I can think of two things offhand: - you didn't use `-H`, so h... | I can think of two things offhand: - you didn't use `-H`, so hardlinks are lost. - you didn't use `-S`, so sparse files may have been expanded | # Filesystem copied to new server is 60% bigger - why
**Tags:** <rsync><ext4>
**Question (score 27):**
I'm migrating a server from an Ubuntu Server 18.02 instance ("saturn") to a newly-built Debian Buster 10 system ("enceladus"). I have copied a complete filesystem across the network using ``` sudo rsync --progress ... | 1,282 | 320 | {
"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... |
627,429 | unix.stackexchange.com | zsh prompt: check whether inside git repository and not being ignored by git | <p>In my <code>zsh</code> shell, I am dynamically changing prompt depending on whether I am inside <code>git</code> repository or not. I am using following git command to check:</p>
<pre><code>if $(git rev-parse --is-inside-work-tree >/dev/null 2>&1); then
...
</code></pre>
<p>now I also want to distinguish w... | In my `zsh` shell, I am dynamically changing prompt depending on whether I am inside `git` repository or not. I am using following git command to check: ``` if $(git rev-parse --is-inside-work-tree >/dev/null 2>&1); then ... ``` now I also want to distinguish whether current directory is being ignored by `git`. So I ha... | 9 | 1,112 | 2 | 0 | 1 | [
"<zsh><git><prompt>"
] | 2021-01-04T06:10:35.687 | 2021-01-10T08:17:21.797 | 155,832 | 627,431 | [
{
"id": 627431,
"body": "<p><a href=\"https://git-scm.com/docs/git-check-ignore\" rel=\"nofollow noreferrer\"><code>git check-ignore .</code></a> will fail with exit code 128 if <code>.</code> isn’t in a <code>git</code> repository (or any other error occurs), and with exit code 1 only if the path isn’t ign... | `git check-ignore .` (https://git-scm.com/docs/git-check-ignore) will fail with exit code 128 if `.` isn’t in a `git` repository (or any other error occurs), and with exit code 1 only if the path isn’t ignored. So you can check for the latter only: ``` git check-ignore -q . 2>/dev/null; if [ "$?" -ne "1" ]; then ... ``... | # zsh prompt: check whether inside git repository and not being ignored by git
**Tags:** <zsh><git><prompt>
**Question (score 9):**
In my `zsh` shell, I am dynamically changing prompt depending on whether I am inside `git` repository or not. I am using following git command to check: ``` if $(git rev-parse --is-insi... | 3,979 | 994 | {
"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... |
627,474 | unix.stackexchange.com | How to use associative arrays safely inside arithmetic expressions? | <p>A few Bourne-like shells support associative arrays: <code>ksh93</code> (since 1993), <code>zsh</code> (since 1998), <code>bash</code> (since 2009), though with some differences in behaviour between the 3.</p>
<p>A common use is for counting occurrences of some strings.</p>
<p>However, I find that things like:</p>
<... | A few Bourne-like shells support associative arrays: `ksh93` (since 1993), `zsh` (since 1998), `bash` (since 2009), though with some differences in behaviour between the 3. A common use is for counting occurrences of some strings. However, I find that things like: ``` typeset -A count (( count[$var]++ )) ``` Don't work... | 17 | 693 | 1 | 0 | 2 | [
"<bash><security><zsh><ksh><associative-array>"
] | 2021-01-04T15:12:29.010 | 2021-01-05T20:14:28.523 | 22,565 | 627,475 | [
{
"id": 627475,
"body": "<p>The problem is that in a shell arithmetic expression, such as inside <code>$((...))</code> (POSIX), or <code>((...))</code> (ksh/bash/zsh), or array indices or arguments of some shell builtins or <code>[[...]]</code> operands, word expansions (<code>${param}</code>, <code>$((...)... | The problem is that in a shell arithmetic expression, such as inside `$((...))` (POSIX), or `((...))` (ksh/bash/zsh), or array indices or arguments of some shell builtins or `[[...]]` operands, word expansions (`${param}`, `$((...))`, `$[...]`, `$(...)`, ``...``, `${ ...; }`) are performed first, and then the resulting... | # How to use associative arrays safely inside arithmetic expressions?
**Tags:** <bash><security><zsh><ksh><associative-array>
**Question (score 17):**
A few Bourne-like shells support associative arrays: `ksh93` (since 1993), `zsh` (since 1998), `bash` (since 2009), though with some differences in behaviour between ... | 7,307 | 1,826 | {
"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... |
627,494 | unix.stackexchange.com | Wine cannot find Wine Gecko despite installing wine-gecko 2.47.1 | <p>As per the helpful advice given by @GAD3R at <a href="https://unix.stackexchange.com/questions/627029/wine64-or-wine-32-for-64-bit-lubuntu-20-04">Wine64 or Wine 32 for 64-bit Lubuntu 20.04?</a> I installed Wine 5.0 (64-bit) from the Ubuntu 20.04 repository.</p>
<p>On running my windows application I got the followin... | As per the helpful advice given by @GAD3R at Wine64 or Wine 32 for 64-bit Lubuntu 20.04? (https://unix.stackexchange.com/questions/627029/wine64-or-wine-32-for-64-bit-lubuntu-20-04) I installed Wine 5.0 (64-bit) from the Ubuntu 20.04 repository. On running my windows application I got the following error: ``` Could not... | 6 | 7,806 | 1 | 0 | 1 | [
"<ubuntu><wine><html><64bit>"
] | 2021-01-04T17:41:14.870 | 2021-01-05T08:07:30.297 | 447,557 | 627,495 | [
{
"id": 627495,
"body": "<p>If your application is a 32-bit program, <a href=\"https://wiki.winehq.org/Gecko\" rel=\"nofollow noreferrer\">you’ll need 32-bit Gecko too</a>:</p>\n<blockquote>\n<p>For 64 bit (WoW64) Wine, both the x86 and x86_64 packages are required.</p>\n</blockquote>\n<pre><code>wget http:... | If your application is a 32-bit program, you’ll need 32-bit Gecko too (https://wiki.winehq.org/Gecko): For 64 bit (WoW64) Wine, both the x86 and x86_64 packages are required. ``` wget http://dl.winehq.org/wine/wine-gecko/2.47.1/wine-gecko-2.47.1-x86.msi wine msiexec /i wine-gecko-2.47.1-x86.msi ``` | # Wine cannot find Wine Gecko despite installing wine-gecko 2.47.1
**Tags:** <ubuntu><wine><html><64bit>
**Question (score 6):**
As per the helpful advice given by @GAD3R at Wine64 or Wine 32 for 64-bit Lubuntu 20.04? (https://unix.stackexchange.com/questions/627029/wine64-or-wine-32-for-64-bit-lubuntu-20-04) I inst... | 1,810 | 452 | {
"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... |
627,498 | unix.stackexchange.com | If cp's destination path turns out to be a directory, how do I avoid mistakenly creating files inside that directory? | <p>My understanding of <code>cp src dest</code> is:</p>
<ol>
<li>If <code>src</code> is a file and <code>dest</code> doesn't exist, but its parent directory does, <code>dest</code> is created.</li>
<li>If <code>src</code> is a file and <code>dest</code> is a file, <code>dest</code> is overwritten with the contents of <... | My understanding of `cp src dest` is: - If `src` is a file and `dest` doesn't exist, but its parent directory does, `dest` is created. - If `src` is a file and `dest` is a file, `dest` is overwritten with the contents of `src`. - If `src` is a file and `dest` is a directory, `dest/src` is created. I'm trying to avoid c... | 5 | 182 | 2 | 5 | 0 | [
"<files><cp>"
] | 2021-01-04T18:18:29.553 | 2021-01-04T18:33:31.167 | 7,421 | 627,504 | [
{
"id": 627504,
"body": "<p>A redirection would do that. It behaves as <code>cp</code>'s <code>-T, --no-target-directory</code> (it exits with error if <code>dst</code> is a directory):</p>\n<pre><code>$ cat src > dst\n</code></pre>\n",
"body_md": "A redirection would do that. It behaves as `cp`'s `-... | A redirection would do that. It behaves as `cp`'s `-T, --no-target-directory` (it exits with error if `dst` is a directory): ``` $ cat src > dst ``` | # If cp's destination path turns out to be a directory, how do I avoid mistakenly creating files inside that directory?
**Tags:** <files><cp>
**Question (score 5):**
My understanding of `cp src dest` is: - If `src` is a file and `dest` doesn't exist, but its parent directory does, `dest` is created. - If `src` is a ... | 1,987 | 496 | {
"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... |
627,513 | unix.stackexchange.com | Arch linux randomly freezes after updating to kernel 5.10 | <p>last three days I am experiencing random freezes. If i am looking on youtube when this happens Audio keeps playing but screen is froze and keyboard or cursor do not do anything.</p>
<p>I trying to look in <code>sudo journalctl</code> and this is what I found:</p>
<pre><code>led 04 10:44:02 arch-thinkpad kernel: i915... | last three days I am experiencing random freezes. If i am looking on youtube when this happens Audio keeps playing but screen is froze and keyboard or cursor do not do anything. I trying to look in `sudo journalctl` and this is what I found: ``` led 04 10:44:02 arch-thinkpad kernel: i915 0000:00:02.0: [drm] *ERROR* Ato... | 10 | 3,112 | 2 | 1 | 3 | [
"<arch-linux><kernel><package-management><freeze><journalctl>"
] | 2021-01-04T20:01:33.117 | 2021-02-18T13:54:04.693 | 429,595 | 633,853 | [
{
"id": 633853,
"body": "<p>5.10.15 doesn't solve this problem. I still have same error. Intel bugs are really annoying since kernel > 4.19.85 (November 2019 !)</p>\n<p>As a workaround, i915 guc need to be enable as mentionned in Archlinux Wiki : <a href=\"https://wiki.archlinux.org/index.php/Intel_graph... | 5.10.15 doesn't solve this problem. I still have same error. Intel bugs are really annoying since kernel > 4.19.85 (November 2019 !) As a workaround, i915 guc need to be enable as mentionned in Archlinux Wiki : https://wiki.archlinux.org/index.php/Intel_graphics#Enable_GuC_/_HuC_firmware_loading (https://wiki.archlinux... | # Arch linux randomly freezes after updating to kernel 5.10
**Tags:** <arch-linux><kernel><package-management><freeze><journalctl>
**Question (score 10):**
last three days I am experiencing random freezes. If i am looking on youtube when this happens Audio keeps playing but screen is froze and keyboard or cursor do ... | 2,359 | 589 | {
"source": "stackexchange-archive.org",
"license": "CC BY-SA 4.0",
"dump_version": "2021-12-07",
"extraction_date": "2026-07-02T12:57:40Z",
"parser_version": "stackexchange-streaming-v1.0",
"site_name": "unix.stackexchange.com",
"original_7z_url": "https://archive.org/download/stack-exchange-2021-12-07/u... |
627,578 | unix.stackexchange.com | How to append text stored in a shell variable in the beginning of the file by using sed? | <p>I found interesting discussion here and tried the solution given with <code>sed</code></p>
<blockquote>
<p>How to insert a text at the beginning of a file?</p>
<p><a href="https://stackoverflow.com/a/9533736/13353532">https://stackoverflow.com/a/9533736/13353532</a></p>
</blockquote>
<p>It works with normal text, bu... | I found interesting discussion here and tried the solution given with `sed` How to insert a text at the beginning of a file? https://stackoverflow.com/a/9533736/13353532 (https://stackoverflow.com/a/9533736/13353532) It works with normal text, but not when the text is saved in a variable. ``` wolf@linux:~$ cat file.txt... | 5 | 446 | 1 | 0 | 1 | [
"<bash><sed><variable>"
] | 2021-01-05T09:06:23.253 | 2021-01-25T15:09:11.770 | 409,008 | 627,579 | [
{
"id": 627579,
"body": "<p>The problem is that you have - as is recommended - enclosed the <code>sed</code> instructions in single quotes <code>' ... '</code>. However, inside single quotes, <a href=\"https://unix.stackexchange.com/q/503013/377345\">variable expansion such as <code>$var</code> is disabled<... | The problem is that you have - as is recommended - enclosed the `sed` instructions in single quotes `' ... '`. However, inside single quotes, variable expansion such as `$var` is disabled (https://unix.stackexchange.com/q/503013/377345), and the expression remains verbatim. As a solution, you can enclose the instructio... | # How to append text stored in a shell variable in the beginning of the file by using sed?
**Tags:** <bash><sed><variable>
**Question (score 5):**
I found interesting discussion here and tried the solution given with `sed` How to insert a text at the beginning of a file? https://stackoverflow.com/a/9533736/13353532 ... | 2,025 | 506 | {
"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... |
627,704 | unix.stackexchange.com | IFS=',' /usr/bin/read vs IFS=',' read | <h3>Context</h3>
<pre><code>$ bash --version
GNU bash, version 4.4.19(1)-release (x86_64-redhat-linux-gnu)
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software; you are free to change and redistribute it.
There is NO... | ### Context ``` $ bash --version GNU bash, version 4.4.19(1)-release (x86_64-redhat-linux-gnu) Copyright (C) 2016 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later This is free software; you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.$ which read... | 6 | 1,026 | 5 | 3 | 2 | [
"<bash><shell><read><shell-builtin><which>"
] | 2021-01-05T20:26:48.540 | 2021-01-06T04:48:22.110 | 449,613 | null | [
{
"id": 627710,
"body": "<p><code>read</code> is a shell builtin, i.e. a command that is provided by the shell itself rather than by an external program. For more information about shell builtins, see <a href=\"https://unix.stackexchange.com/questions/11454/what-is-the-difference-between-a-builtin-command-a... | `read` is a shell builtin, i.e. a command that is provided by the shell itself rather than by an external program. For more information about shell builtins, see What is the difference between a builtin command and one that is not? (https://unix.stackexchange.com/questions/11454/what-is-the-difference-between-a-builtin... | # IFS=',' /usr/bin/read vs IFS=',' read
**Tags:** <bash><shell><read><shell-builtin><which>
**Question (score 6):**
### Context ``` $ bash --version GNU bash, version 4.4.19(1)-release (x86_64-redhat-linux-gnu) Copyright (C) 2016 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later This is free ... | 4,940 | 1,235 | {
"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... |
627,800 | unix.stackexchange.com | Can `awk` sum a column over a specified number of lines | <p>I've reviewed the "Similar questions", and none seem to solve my problem:</p>
<p>I have a large CSV input file; each line in the file is an <code>x,y</code> data point. Here are a few lines for illustration, but please note that in general the data <strong>are not</strong> <a href="https://en.wikipedia.org... | I've reviewed the "Similar questions", and none seem to solve my problem: I have a large CSV input file; each line in the file is an `x,y` data point. Here are a few lines for illustration, but please note that in general the data are not monotonic (https://en.wikipedia.org/wiki/Monotonic_function): ``` 1.904E-10,2.150... | 7 | 280 | 2 | 0 | 1 | [
"<awk><numeric-data>"
] | 2021-01-06T09:57:48.167 | 2021-01-06T19:44:18.123 | 286,615 | 627,803 | [
{
"id": 627803,
"body": "<p>Here’s a generic variant:</p>\n<pre class=\"lang-awk prettyprint-override\"><code>BEGIN { OFS = FS = "," }\n\n{\n for (i = 1; i <= NF; i++) sum[i] += $i\n count++\n}\n\ncount % 3 == 0 {\n for (i = 1; i <= NF; i++) $i = sum[i] / count\n delete sum\n ... | Here’s a generic variant: ``` BEGIN { OFS = FS = "," } { for (i = 1; i = 1.1 * last || $NF 0) { for (i = 1; i = 1.1 * last || $NF N lines. | # Can `awk` sum a column over a specified number of lines
**Tags:** <awk><numeric-data>
**Question (score 7):**
I've reviewed the "Similar questions", and none seem to solve my problem: I have a large CSV input file; each line in the file is an `x,y` data point. Here are a few lines for illustration, but please note... | 2,390 | 597 | {
"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... |
627,858 | unix.stackexchange.com | Why does the dpkg folder contain very old files from 2006? | <p>I know what <a href="https://www.debian.org/doc/manuals/debian-reference/ch02.en.html" rel="nofollow noreferrer">Debian package management</a> says:</p>
<blockquote>
<p>Do not erase or alter files in <code>/var/lib/dpkg/</code>.</p>
</blockquote>
<p>However, there are 11,501 files in that folder dating from 2006:</p... | I know what Debian package management (https://www.debian.org/doc/manuals/debian-reference/ch02.en.html) says: Do not erase or alter files in `/var/lib/dpkg/`. However, there are 11,501 files in that folder dating from 2006: ``` $ ls -l /var/lib/dpkg/info | wc -l 11502 sudo find /var/lib/dpkg/info -type f -printf '%T+ ... | 10 | 3,849 | 2 | 0 | 1 | [
"<debian><package-management><administration>"
] | 2021-01-06T15:02:48.073 | 2021-01-08T01:31:44.847 | 84,879 | null | [
{
"id": 627859,
"body": "<p>The modification time on files installed by dpkg, including the metadata files in <code>/var/lib/dpkg/info</code>, is the modification time they have inside the package archive file (the <code>.tar.gz</code> or equivalent contained inside the <code>.deb</code> file). It's normall... | The modification time on files installed by dpkg, including the metadata files in `/var/lib/dpkg/info`, is the modification time they have inside the package archive file (the `.tar.gz` or equivalent contained inside the `.deb` file). It's normally the time they were last changed by the maintainer for files that are ma... | # Why does the dpkg folder contain very old files from 2006?
**Tags:** <debian><package-management><administration>
**Question (score 10):**
I know what Debian package management (https://www.debian.org/doc/manuals/debian-reference/ch02.en.html) says: Do not erase or alter files in `/var/lib/dpkg/`. However, there a... | 3,794 | 948 | {
"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... |
627,998 | unix.stackexchange.com | How to resolve __vi_internal_vim_alias: command not found? | <p>I have recently upgraded to Fedora 33 (Linux 5.9.16-200) on my machine. I am running vim-enhanced version 8.2. When I type <code>sudo vim</code> (or even <code>sudo vi</code>) in order to edit files with admin privilege, I get the following error.</p>
<pre><code>sudo: __vi_internal_vim_alias: command not found
</cod... | I have recently upgraded to Fedora 33 (Linux 5.9.16-200) on my machine. I am running vim-enhanced version 8.2. When I type `sudo vim` (or even `sudo vi`) in order to edit files with admin privilege, I get the following error. ``` sudo: __vi_internal_vim_alias: command not found ``` I am not sure what is causing this. V... | 8 | 360 | 2 | 14 | 0 | [
"<linux><fedora><sudo><vim>"
] | 2021-01-07T10:54:09.993 | 2021-01-07T20:07:07.123 | 224,776 | 631,761 | [
{
"id": 628732,
"body": "<p>Hitting the same issue on Fedora 33.\nThis seems due to having an alias defined for <code>sudo</code> in my environment:</p>\n<pre><code>$ alias sudo\nalias sudo='\\sudo '\n</code></pre>\n<p>Due to this, somehow bash resolves aliases passed as arguments to <code>sudo</code> alias... | Hitting the same issue on Fedora 33. This seems due to having an alias defined for `sudo` in my environment: ``` $ alias sudo alias sudo='\sudo ' ``` Due to this, somehow bash resolves aliases passed as arguments to `sudo` alias, as shown in the example below: ``` $ alias foo='echo foo' $ sudo foo foo ``` I would have ... | # How to resolve __vi_internal_vim_alias: command not found?
**Tags:** <linux><fedora><sudo><vim>
**Question (score 8):**
I have recently upgraded to Fedora 33 (Linux 5.9.16-200) on my machine. I am running vim-enhanced version 8.2. When I type `sudo vim` (or even `sudo vi`) in order to edit files with admin privile... | 2,820 | 705 | {
"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... |
628,428 | unix.stackexchange.com | What one should check when re writing bash conditions for sh or ash? | <p>Sometime, it is not possible to have the luxury of bash on a system, but conditions are easier to make on bash compared to sh or ash, what one should verify to ensure condition won't break with typical "unexpected operator" when rewriting from bash to sh or ash ?</p>
| Sometime, it is not possible to have the luxury of bash on a system, but conditions are easier to make on bash compared to sh or ash, what one should verify to ensure condition won't break with typical "unexpected operator" when rewriting from bash to sh or ash ? | 5 | 623 | 3 | 3 | 3 | [
"<bash><shell-script><shell><scripting><ash>"
] | 2021-01-10T04:18:49.083 | 2021-01-11T13:49:30.573 | 53,490 | 628,440 | [
{
"id": 628440,
"body": "<p>I don't agree conditions are easier to make with <code>((...))</code> and <code>[[...]]</code> (assuming that's what you're referring to; note that those operators are not specific to bash and come from ksh) than the standard <code>[</code> or <code>test</code> command. <code>[[ ... | I don't agree conditions are easier to make with `((...))` and `[[...]]` (assuming that's what you're referring to; note that those operators are not specific to bash and come from ksh) than the standard `[` or `test` command. `[[ ... ]]` and `(( ... ))` have several problems of their own¹ and which are much worse than... | # What one should check when re writing bash conditions for sh or ash?
**Tags:** <bash><shell-script><shell><scripting><ash>
**Question (score 5):**
Sometime, it is not possible to have the luxury of bash on a system, but conditions are easier to make on bash compared to sh or ash, what one should verify to ensure c... | 10,305 | 2,576 | {
"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... |
628,607 | unix.stackexchange.com | How to bypass RemoteCommand option in ssh_config | <p>I have defined a <code>ssh_config</code> file with all the hosts to which I connect on a regular basis. I like to start/connect to a tmux session upon connection to the host, so I've added the line <code>RemoteCommand tmux new -ADs remote</code> in my config. The problem is that if at some point I want to use rsync ... | I have defined a `ssh_config` file with all the hosts to which I connect on a regular basis. I like to start/connect to a tmux session upon connection to the host, so I've added the line `RemoteCommand tmux new -ADs remote` in my config. The problem is that if at some point I want to use rsync over ssh (which I do ever... | 5 | 529 | 2 | 0 | 1 | [
"<ssh><rsync><ssh-config>"
] | 2021-01-11T10:52:05.807 | 2021-01-13T12:12:03.230 | 286,195 | 628,879 | [
{
"id": 628879,
"body": "<p>Don't put <code>RemoteCommand</code> in the configuration file. Having <code>RemoteCommand</code> is occasionally useful to define an alias for a host such that <code>ssh myalias</code> runs a specific command. It isn't useful in a general-purpose entry. As you've noticed, it pre... | Don't put `RemoteCommand` in the configuration file. Having `RemoteCommand` is occasionally useful to define an alias for a host such that `ssh myalias` runs a specific command. It isn't useful in a general-purpose entry. As you've noticed, it prevents doing anything other than running that specific command: you can't ... | # How to bypass RemoteCommand option in ssh_config
**Tags:** <ssh><rsync><ssh-config>
**Question (score 5):**
I have defined a `ssh_config` file with all the hosts to which I connect on a regular basis. I like to start/connect to a tmux session upon connection to the host, so I've added the line `RemoteCommand tmux ... | 4,032 | 1,008 | {
"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... |
628,613 | unix.stackexchange.com | (Ba)sh parameter expansion not consistent in script and interactive shell | <p>I encountered the following issue with parameter expansion while trying to write a script for setting the metric of my VPN's default route.</p>
<p>For testing purposes, I've simplified the code to the following:</p>
<pre class="lang-bsh prettyprint-override"><code>vpn_route='default via 10.106.160.1 proto static met... | I encountered the following issue with parameter expansion while trying to write a script for setting the metric of my VPN's default route. For testing purposes, I've simplified the code to the following: ``` vpn_route='default via 10.106.160.1 proto static metric 50' echo ip route del "$vpn_route" echo ip route add "$... | 7 | 189 | 1 | 0 | 1 | [
"<bash><shell-script><shell>"
] | 2021-01-11T11:57:43.917 | 2021-01-11T13:10:25.910 | 450,550 | 628,623 | [
{
"id": 628623,
"body": "<p>You need to enable extended globs for <code>+([0-9])</code> to work. It's probably set in your <code>bashrc</code>, so is enabled in the interactive shell, but not in the script. Add <code>shopt -s extglob</code> to the script to enable it. See <a href=\"https://www.gnu.org/softw... | You need to enable extended globs for `+([0-9])` to work. It's probably set in your `bashrc`, so is enabled in the interactive shell, but not in the script. Add `shopt -s extglob` to the script to enable it. See Pattern Matching in the manual (https://www.gnu.org/software/bash/manual/html_node/Pattern-Matching.html). W... | # (Ba)sh parameter expansion not consistent in script and interactive shell
**Tags:** <bash><shell-script><shell>
**Question (score 7):**
I encountered the following issue with parameter expansion while trying to write a script for setting the metric of my VPN's default route. For testing purposes, I've simplified t... | 2,294 | 573 | {
"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... |
628,617 | unix.stackexchange.com | Concatenate files placing an empty line between them | <p>I have a bunch of files with the same extension (let's say .txt) and I would like to concatenate them. I am using <code>cat *.txt > concat.txt</code>, but I would like to add a new line between each file so to distinguish them in concat.txt.</p>
<p>Is it possible to do it with a single bash command rather than an... | I have a bunch of files with the same extension (let's say .txt) and I would like to concatenate them. I am using `cat *.txt > concat.txt`, but I would like to add a new line between each file so to distinguish them in concat.txt. Is it possible to do it with a single bash command rather than an implementation such as ... | 8 | 1,506 | 7 | 0 | 2 | [
"<files><cat><newlines>"
] | 2021-01-11T12:29:09.897 | 2021-01-12T19:46:31.133 | 277,882 | 628,651 | [
{
"id": 628618,
"body": "<p>Not a single command, but a simple one-liner:</p>\n<pre><code>for f in *.txt; do cat -- "$f"; printf "\\n"; done > newfile.txt\n</code></pre>\n<p>That will give this error:</p>\n<pre><code>cat: newfile.txt: input file is output file\n</code></pre>\n<p>But y... | Not a single command, but a simple one-liner: ``` for f in *.txt; do cat -- "$f"; printf "\n"; done > newfile.txt ``` That will give this error: ``` cat: newfile.txt: input file is output file ``` But you can ignore it, at least on GNU/Linux systems. Stéphane Chazelas pointed out in the comments that apparently, on oth... | # Concatenate files placing an empty line between them
**Tags:** <files><cat><newlines>
**Question (score 8):**
I have a bunch of files with the same extension (let's say .txt) and I would like to concatenate them. I am using `cat *.txt > concat.txt`, but I would like to add a new line between each file so to distin... | 4,199 | 1,049 | {
"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... |
629,281 | unix.stackexchange.com | gitk crashes when viewing commit containing emoji: X Error of failed request: BadLength (poly request too large or internal Xlib length error) | <p>I'm able to open <code>gitk</code> but it crashes as soon as I open a commit whom changes contains an emoji (not the commit message).</p>
<h3>Error</h3>
<pre><code>❯ gitk --all
X Error of failed request: BadLength (poly request too large or internal Xlib length error)
Major opcode of failed request: 139 (RENDER)... | I'm able to open `gitk` but it crashes as soon as I open a commit whom changes contains an emoji (not the commit message). ### Error ``` ❯ gitk --all X Error of failed request: BadLength (poly request too large or internal Xlib length error) Major opcode of failed request: 139 (RENDER) Minor opcode of failed request: 2... | 24 | 1,347 | 4 | 0 | 5 | [
"<x11><git><unicode><emoji>"
] | 2021-01-15T09:57:27.030 | 2021-12-03T10:12:13.833 | 17,362 | null | [
{
"id": 629282,
"body": "<p>After digging with <code>XFT_DEBUG</code> flag I found something weird. I run the command with the flag and navigate to the problematic commit:</p>\n<pre><code>❯ XFT_DEBUG=1 gitk --all\nXFT_DEBUG=1\nXftFontInfoFill: /usr/share/fonts/truetype/noto/NotoSans-Medium.ttf: 0 (15.9999 p... | After digging with `XFT_DEBUG` flag I found something weird. I run the command with the flag and navigate to the problematic commit: ``` ❯ XFT_DEBUG=1 gitk --all XFT_DEBUG=1 XftFontInfoFill: /usr/share/fonts/truetype/noto/NotoSans-Medium.ttf: 0 (15.9999 pixels) XftFontInfoFill: /usr/share/fonts/truetype/noto/NotoSans-M... | # gitk crashes when viewing commit containing emoji: X Error of failed request: BadLength (poly request too large or internal Xlib length error)
**Tags:** <x11><git><unicode><emoji>
**Question (score 24):**
I'm able to open `gitk` but it crashes as soon as I open a commit whom changes contains an emoji (not the comm... | 4,739 | 1,184 | {
"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... |
629,353 | unix.stackexchange.com | Accidentally ran chmod +x /* - How bad did I just mess up? | <p>I wanted to mark all of the files in the directory I was in as executable, and I ran <code>chmod +x /*</code> because I thought that was the command to mark all the files in the directory you were currently in as executable.</p>
<p>Did I mess up? I don't remember what the file permissions looked like beforehand. I d... | I wanted to mark all of the files in the directory I was in as executable, and I ran `chmod +x /*` because I thought that was the command to mark all the files in the directory you were currently in as executable. Did I mess up? I don't remember what the file permissions looked like beforehand. I didn't use `sudo`. | 10 | 2,169 | 1 | 8 | 0 | [
"<linux><permissions><executable><chmod>"
] | 2021-01-15T17:42:04.917 | 2021-01-15T18:18:28.967 | 449,850 | null | [
{
"id": 629354,
"body": "<p>That's probably the least harmful accidental chmod-in-root you can do, since it doesn't even recurse. Looking at my Ubuntu box, the only non-directory files in the root directory are vmlinuz and initrd, and an x bit on those shouldn't hurt.</p>\n<p>Do a <code>chmod go-x /root</co... | That's probably the least harmful accidental chmod-in-root you can do, since it doesn't even recurse. Looking at my Ubuntu box, the only non-directory files in the root directory are vmlinuz and initrd, and an x bit on those shouldn't hurt. Do a `chmod go-x /root` so the root user's home directory is protected (moderat... | # Accidentally ran chmod +x /* - How bad did I just mess up?
**Tags:** <linux><permissions><executable><chmod>
**Question (score 10):**
I wanted to mark all of the files in the directory I was in as executable, and I ran `chmod +x /*` because I thought that was the command to mark all the files in the directory you ... | 1,046 | 261 | {
"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... |
629,412 | unix.stackexchange.com | How to blur webcam background in Microsoft Teams | <p>I am currently using Teams for a master and I would like to blur my backgrounds, do you know any way to do it?</p>
| I am currently using Teams for a master and I would like to blur my backgrounds, do you know any way to do it? | 8 | 6,394 | 3 | 2 | 2 | [
"<images><camera><image-manipulation><microsoft-teams>"
] | 2021-01-16T08:25:48.883 | 2021-01-16T19:15:21.780 | 308,906 | 629,413 | [
{
"id": 629413,
"body": "<p>Microsoft Teams has this option built-in (<a href=\"https://support.microsoft.com/en-us/office/change-your-background-for-a-teams-meeting-f77a2381-443a-499d-825e-509a140f4780\" rel=\"nofollow noreferrer\">as described in the official Microsoft documentation</a>). Unfortunately, t... | Microsoft Teams has this option built-in (as described in the official Microsoft documentation (https://support.microsoft.com/en-us/office/change-your-background-for-a-teams-meeting-f77a2381-443a-499d-825e-509a140f4780)). Unfortunately, the documentation also states that as of today: Notes: - For now, Linux users aren'... | # How to blur webcam background in Microsoft Teams
**Tags:** <images><camera><image-manipulation><microsoft-teams>
**Question (score 8):**
I am currently using Teams for a master and I would like to blur my backgrounds, do you know any way to do it?
### Answer (score 5 · accepted)
Microsoft Teams has this option bu... | 1,009 | 252 | {
"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... |
629,492 | unix.stackexchange.com | Create and populate FAT32 filesystem without mounting it | <p>Is there a way to create a FAT32 filesystem containing a set of files, without needing to mount it or have root access?</p>
<p>I am developing a software application for an old operating system as a hobby, and as part of the build process I would like to package up some source files into a FAT32 disk image, then lau... | Is there a way to create a FAT32 filesystem containing a set of files, without needing to mount it or have root access? I am developing a software application for an old operating system as a hobby, and as part of the build process I would like to package up some source files into a FAT32 disk image, then launch QEMU t... | 25 | 2,110 | 1 | 2 | 3 | [
"<filesystems><utilities><fat>"
] | 2021-01-17T00:31:11.407 | 2021-01-17T00:42:41.863 | 6,662 | 629,494 | [
{
"id": 629494,
"body": "<p>Of course despite all my unsuccessful searching, I finally find the answer only moments after posting a question about it.</p>\n<p>So the <code>mtools</code> package can do it like this:</p>\n<pre><code># Create a 2 MB file\ndd if=/dev/zero of=disk.img bs=1M count=2\n\n# Put a FA... | Of course despite all my unsuccessful searching, I finally find the answer only moments after posting a question about it. So the `mtools` package can do it like this: ``` # Create a 2 MB file dd if=/dev/zero of=disk.img bs=1M count=2 # Put a FAT filesystem on it (use -F for FAT32, otherwise it's automatic) mformat -i ... | # Create and populate FAT32 filesystem without mounting it
**Tags:** <filesystems><utilities><fat>
**Question (score 25):**
Is there a way to create a FAT32 filesystem containing a set of files, without needing to mount it or have root access? I am developing a software application for an old operating system as a h... | 1,780 | 445 | {
"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... |
629,616 | unix.stackexchange.com | What does the ^ character mean in sequences like ^X^I? | <p>I was reading <a href="https://www.zsh.org/mla/users/2007/msg00976.html" rel="noreferrer">this message from the zsh mailing list</a> about key bindings and I'd like to know which key I need to press:</p>
<ol>
<li><code>^X^I</code> (I think <code>Ctrl-X</code> <code>Ctrl-I</code>, the capital <code>X</code> and <code... | I was reading this message from the zsh mailing list (https://www.zsh.org/mla/users/2007/msg00976.html) about key bindings and I'd like to know which key I need to press: - `^X^I` (I think `Ctrl-X` `Ctrl-I`, the capital `X` and `I`) - `^[^@` (I think `Ctrl-Esc-@` ??) - `^X^[q`(I think `Ctrl-X` `Esc-q` ??) - `^XQ` (I th... | 23 | 2,117 | 3 | 4 | 5 | [
"<terminal><keyboard><escape-characters>"
] | 2021-01-17T23:19:04.770 | 2021-01-19T13:01:13.153 | 120,293 | 629,622 | [
{
"id": 629622,
"body": "<p><code>^<em>c</em></code> is a common notation for <kbd>Ctrl</kbd>+<kbd><em>c</em></kbd> where <em>c</em> is a (uppercase) letter or one of <code>@[\\]^_</code>. It designates the corresponding <a href=\"https://en.wikipedia.org/wiki/Control_character\" rel=\"noreferrer\">control ... | `^c` is a common notation for Ctrl+c where c is a (uppercase) letter or one of `@[\]^_`. It designates the corresponding control character (https://en.wikipedia.org/wiki/Control_character). The correspondence is that the numeric code of the control character is the numeric code of the printable character (letter or pun... | # What does the ^ character mean in sequences like ^X^I?
**Tags:** <terminal><keyboard><escape-characters>
**Question (score 23):**
I was reading this message from the zsh mailing list (https://www.zsh.org/mla/users/2007/msg00976.html) about key bindings and I'd like to know which key I need to press: - `^X^I` (I th... | 6,192 | 1,548 | {
"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... |
629,925 | unix.stackexchange.com | How would you gracefully handle this snippet to allow for spaces in directories? | <p>I have a series of commands, e.g.:</p>
<pre><code>ssh -i key 10.10.10.10 mkdir -p "${DEST_PATH}/subdir1" "${DEST_PATH}/subdir2"
rsync "${SOURCE_PATH}" "$DEST_HOST:${DEST_PATH}/subdir1"
...
</code></pre>
<p>These are fed variables as</p>
<pre><code>DEST_PATH=$( myfun "foo&... | I have a series of commands, e.g.: ``` ssh -i key 10.10.10.10 mkdir -p "${DEST_PATH}/subdir1" "${DEST_PATH}/subdir2" rsync "${SOURCE_PATH}" "$DEST_HOST:${DEST_PATH}/subdir1" ... ``` These are fed variables as ``` DEST_PATH=$( myfun "foo" ) SOURCE_PATH=$( myfun "bar" ) ``` which in turn are fed string as ``` function my... | 7 | 547 | 3 | 0 | 0 | [
"<bash><shell-script><ssh><rsync><quoting>"
] | 2021-01-19T18:38:26.727 | 2021-01-19T19:34:23.870 | 388,493 | 629,944 | [
{
"id": 629944,
"body": "<p>If you know the remote system has a <code>xargs</code> command that supports a <code>-0</code> option, you can do:</p>\n<pre><code>printf '%s\\0' "$DEST_PATH/subdir1" "$DEST_PATH/subdir2" |\n ssh -i key 10.10.10.10 'xargs -0 mkdir -p --'\n</code></pre>\n<p>Th... | If you know the remote system has a `xargs` command that supports a `-0` option, you can do: ``` printf '%s\0' "$DEST_PATH/subdir1" "$DEST_PATH/subdir2" | ssh -i key 10.10.10.10 'xargs -0 mkdir -p --' ``` That `xargs -0 mkdir -p --` piece of shell code would be interpreted the same by all shells (remember `sshd` on the... | # How would you gracefully handle this snippet to allow for spaces in directories?
**Tags:** <bash><shell-script><ssh><rsync><quoting>
**Question (score 7):**
I have a series of commands, e.g.: ``` ssh -i key 10.10.10.10 mkdir -p "${DEST_PATH}/subdir1" "${DEST_PATH}/subdir2" rsync "${SOURCE_PATH}" "$DEST_HOST:${DEST... | 5,622 | 1,405 | {
"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... |
630,057 | unix.stackexchange.com | SSH to multiple hosts in file and run command fails - only goes to the first host | <p>I have this script:</p>
<pre><code>#!/bin/sh
SERVERLIST=hosts
ICMD='cat /etc/redhat-release'
while read SERVERNAME
do
ssh $SERVERNAME $ICMD
done < "$SERVERLIST"
</code></pre>
<p>With <code>hosts</code> just like:</p>
<pre><code>hostname
hostname
hostname
</code></pre>
<p>When I run the script <code>.... | I have this script: ``` #!/bin/sh SERVERLIST=hosts ICMD='cat /etc/redhat-release' while read SERVERNAME do ssh $SERVERNAME $ICMD done < "$SERVERLIST" ``` With `hosts` just like: ``` hostname hostname hostname ``` When I run the script `./run.sh` it only goes to a single host and stops. Why is it not reading the entire ... | 8 | 926 | 2 | 1 | 2 | [
"<ssh>"
] | 2021-01-20T15:04:58.370 | 2021-01-20T15:13:28.093 | 137,794 | 630,060 | [
{
"id": 630060,
"body": "<p>ssh pre-reads stdin on the assumption that the remote job will want some data, and it makes for a faster start-up. So the first job eats the rest of your hosts list.</p>\n<p>You can prevent this happening either using the <code>ssh -n</code> option, or by redirecting like <code>s... | ssh pre-reads stdin on the assumption that the remote job will want some data, and it makes for a faster start-up. So the first job eats the rest of your hosts list. You can prevent this happening either using the `ssh -n` option, or by redirecting like `ssh < /dev/null`. Being a belt-and-braces man, I do both: `ssh -n... | # SSH to multiple hosts in file and run command fails - only goes to the first host
**Tags:** <ssh>
**Question (score 8):**
I have this script: ``` #!/bin/sh SERVERLIST=hosts ICMD='cat /etc/redhat-release' while read SERVERNAME do ssh $SERVERNAME $ICMD done < "$SERVERLIST" ``` With `hosts` just like: ``` hostname ho... | 1,999 | 499 | {
"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... |
630,186 | unix.stackexchange.com | How to add ssh keys to a specific user in linux? | <p>I have Ubuntu 18.04 and we have an admin account and an account for other users. I have added the public SSH keys of users who need admin access to the admin account, but when I try to do the same for an individual user, I don't see the <code>authorized_keys</code> file in <code>.ssh</code> directory for that user.... | I have Ubuntu 18.04 and we have an admin account and an account for other users. I have added the public SSH keys of users who need admin access to the admin account, but when I try to do the same for an individual user, I don't see the `authorized_keys` file in `.ssh` directory for that user. How should I proceed here... | 7 | 5,080 | 4 | 2 | 0 | [
"<ubuntu><ssh>"
] | 2021-01-21T07:49:52.700 | 2021-01-21T19:12:06.743 | 452,155 | null | [
{
"id": 630195,
"body": "<p>Generate an ssh-key:</p>\n<pre><code>ssh-keygen -t rsa -b 4096 -C "comment"\n</code></pre>\n<p>copy it to your remote server:</p>\n<pre><code>ssh-copy-id user@ip\n</code></pre>\n<p>or you can manually copy the <code>~/.ssh/id_rsa.pub</code> to <code>~/.ssh/authorized_ke... | Generate an ssh-key: ``` ssh-keygen -t rsa -b 4096 -C "comment" ``` copy it to your remote server: ``` ssh-copy-id user@ip ``` or you can manually copy the `~/.ssh/id_rsa.pub` to `~/.ssh/authorized_keys`. Edit It can be done through `ssh` command as mentioned @chepner (https://unix.stackexchange.com/users/22257/chepner... | # How to add ssh keys to a specific user in linux?
**Tags:** <ubuntu><ssh>
**Question (score 7):**
I have Ubuntu 18.04 and we have an admin account and an account for other users. I have added the public SSH keys of users who need admin access to the admin account, but when I try to do the same for an individual use... | 2,708 | 677 | {
"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... |
630,189 | unix.stackexchange.com | xset: ignore mouse movement when display is blanked | <p>I can blank/turn off display on my laptop with following command:</p>
<pre><code>xset dpms force off
</code></pre>
<p>then, any mouse movement or keyboard press "wakes up" the display.</p>
<p>Is it possible to ignore mouse movements, and only unblank the screen on keyboard action?</p>
<p>If this is not pos... | I can blank/turn off display on my laptop with following command: ``` xset dpms force off ``` then, any mouse movement or keyboard press "wakes up" the display. Is it possible to ignore mouse movements, and only unblank the screen on keyboard action? If this is not possible in `xset` at the moment, I would welcome any ... | 8 | 248 | 2 | 4 | 0 | [
"<display><power-management><screensaver><xset>"
] | 2021-01-21T08:13:09.543 | 2021-09-09T07:47:10.533 | 155,832 | null | [
{
"id": 630667,
"body": "<p>A work around could be having a service running <code>xset q</code> to determine whether monitor is on/off. If off, disable mouse/touchpad and if on enable it back again.</p>\n<p>To enable/disable first get your mouse/touchpad id with</p>\n<pre><code>xinput -list\n</code></pre>\n... | A work around could be having a service running `xset q` to determine whether monitor is on/off. If off, disable mouse/touchpad and if on enable it back again. To enable/disable first get your mouse/touchpad id with ``` xinput -list ``` Then use ``` xinput --disable ``` Service should run something like this: ``` #!/bi... | # xset: ignore mouse movement when display is blanked
**Tags:** <display><power-management><screensaver><xset>
**Question (score 8):**
I can blank/turn off display on my laptop with following command: ``` xset dpms force off ``` then, any mouse movement or keyboard press "wakes up" the display. Is it possible to ign... | 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... |
630,368 | unix.stackexchange.com | GCC does not throw warnings and compiles erroneous code | <pre><code>#include <stdio.h>
int main() {
printf("Enter your name\n");
char name[99];
scanf("%d", name);
printf("Hello %s\n", name);
}
</code></pre>
<p>While executing this simple program I mistakenly used <code>%d</code> instead of <code>%s</code>. But when I compiled the... | ``` #include int main() { printf("Enter your name\n"); char name[99]; scanf("%d", name); printf("Hello %s\n", name); } ``` While executing this simple program I mistakenly used `%d` instead of `%s`. But when I compiled the code using `gcc`, it didn't display any warnings. It simply created an output file. ``` $ gcc gre... | 6 | 788 | 1 | 0 | 0 | [
"<debian><gcc>"
] | 2021-01-22T08:12:17.197 | 2021-01-22T08:26:03.167 | 421,466 | 630,369 | [
{
"id": 630369,
"body": "<p>On GCC, format string checks are controlled by <a href=\"https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html\" rel=\"noreferrer\"><code>-Wformat</code></a>, which isn’t enabled by default.</p>\n<p>Building your code with <code>-Wformat</code> (or <code>-Wall</code>, which inc... | On GCC, format string checks are controlled by `-Wformat` (https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html), which isn’t enabled by default. Building your code with `-Wformat` (or `-Wall`, which includes it) does warn: ``` $ gcc -Wformat 630368.c -o 630368 630368.c: In function ‘main’: 630368.c:6:16: warning: f... | # GCC does not throw warnings and compiles erroneous code
**Tags:** <debian><gcc>
**Question (score 6):**
``` #include int main() { printf("Enter your name\n"); char name[99]; scanf("%d", name); printf("Hello %s\n", name); } ``` While executing this simple program I mistakenly used `%d` instead of `%s`. But when I c... | 2,244 | 561 | {
"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... |
630,398 | unix.stackexchange.com | Why is verifying downloads with MD5 hash considered insecure? | <p>I have downloaded a <a href="https://cdimage.debian.org/cdimage/weekly-builds/amd64/jigdo-cd/" rel="noreferrer">Debian ISO</a> with <code>jigdo</code>, the download has finished successfully, and printed the following message:</p>
<pre><code>FINISHED --2021-01-22 11:57:20--
Total wall clock time: 4.3s
Downloaded: 9 ... | I have downloaded a Debian ISO (https://cdimage.debian.org/cdimage/weekly-builds/amd64/jigdo-cd/) with `jigdo`, the download has finished successfully, and printed the following message: ``` FINISHED --2021-01-22 11:57:20-- Total wall clock time: 4.3s Downloaded: 9 files, 897K in 1.8s (494 KB/s) Found 9 of the 9 files ... | 10 | 1,259 | 1 | 2 | 2 | [
"<debian><security><hashsum><debian-cd>"
] | 2021-01-22T12:04:01.193 | 2021-01-22T14:03:48.613 | 153,195 | 630,402 | [
{
"id": 630402,
"body": "<p>MD5 and SHA-1 are both vulnerable to (chosen-prefix) <a href=\"https://en.wikipedia.org/wiki/Collision_attack\" rel=\"nofollow noreferrer\">collision attacks</a>. The SHA2 (SHA-256, SHA-384, SHA-512, …) and SHA3 families of hash functions are not.</p>\n<p>What a chosen-prefix col... | MD5 and SHA-1 are both vulnerable to (chosen-prefix) collision attacks (https://en.wikipedia.org/wiki/Collision_attack). The SHA2 (SHA-256, SHA-384, SHA-512, …) and SHA3 families of hash functions are not. What a chosen-prefix collision attack means is that given a prefix and a suffix, it's possible to find two middles... | # Why is verifying downloads with MD5 hash considered insecure?
**Tags:** <debian><security><hashsum><debian-cd>
**Question (score 10):**
I have downloaded a Debian ISO (https://cdimage.debian.org/cdimage/weekly-builds/amd64/jigdo-cd/) with `jigdo`, the download has finished successfully, and printed the following m... | 2,835 | 708 | {
"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... |
630,817 | unix.stackexchange.com | How was I able to access the 14th positional parameter using $14 in a shell script? | <p>I was reading about positional parameters in Unix and then I found this info:</p>
<blockquote>
<p>The shell allows a command line to contain at least 128 arguments;
however, a shell program is restricted to referencing only nine
positional parameters, $1 through $9, at a given time. You can work
around this restrict... | I was reading about positional parameters in Unix and then I found this info: The shell allows a command line to contain at least 128 arguments; however, a shell program is restricted to referencing only nine positional parameters, $1 through $9, at a given time. You can work around this restriction by using the shift ... | 42 | 3,944 | 1 | 9 | 3 | [
"<shell-script>"
] | 2021-01-25T01:46:09.213 | 2021-01-25T09:45:12.930 | 449,598 | 630,856 | [
{
"id": 630856,
"body": "<p>When you run</p>\n<pre><code>echo $14\n</code></pre>\n<p>what happens is that bash interprets the argument <code>$14</code> as <code>$1</code> and <code>4</code> separately. It then expands <code>$1</code> (which in this case is equal to "1"), then appends the string <c... | When you run ``` echo $14 ``` what happens is that bash interprets the argument `$14` as `$1` and `4` separately. It then expands `$1` (which in this case is equal to "1"), then appends the string `4` to it, which results in "14". Although that was the result you were expecting, it's actually a side effect from Bash's ... | # How was I able to access the 14th positional parameter using $14 in a shell script?
**Tags:** <shell-script>
**Question (score 42):**
I was reading about positional parameters in Unix and then I found this info: The shell allows a command line to contain at least 128 arguments; however, a shell program is restrict... | 1,829 | 457 | {
"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... |
630,860 | unix.stackexchange.com | How to replace a string in one file if a pattern present in another file using awk | <p>I have a data file <code>A.txt</code> (field separator = \t) :</p>
<pre><code>Well Well Type Well Name Dye Target
A1 Unknown HIGH-001 FAM ViroFAM
A1 Unknown HIGH-001 HEX ViroHEX
</code></pre>
<p>And a template file <code>B.txt</code>:</p>
<pre><code>kit
Software Vers... | I have a data file `A.txt` (field separator = \t) : ``` Well Well Type Well Name Dye Target A1 Unknown HIGH-001 FAM ViroFAM A1 Unknown HIGH-001 HEX ViroHEX ``` And a template file `B.txt`: ``` kit Software Version = NOVA_v1 Date And Time of Export = 07/02/2020 13:44:11 UTC Experiment Name = Instrument Software Version ... | 5 | 362 | 3 | 0 | 1 | [
"<text-processing><awk>"
] | 2021-01-25T10:15:52.317 | 2021-01-25T11:07:46.500 | 416,180 | 630,870 | [
{
"id": 630870,
"body": "<pre><code>awk -F'\\t' '\n NR==FNR{ if ($5=="ViroHEX"){ viro=1 } next }\n viro && $1=="Software Version"{ $2="VIRO_v1" }\n 1\n' A.txt FS=" = " OFS=" = " B.txt > result.txt\n</code></pre>\n<p>This replaces the second fie... | ``` awk -F'\t' ' NR==FNR{ if ($5=="ViroHEX"){ viro=1 } next } viro && $1=="Software Version"{ $2="VIRO_v1" } 1 ' A.txt FS=" = " OFS=" = " B.txt > result.txt ``` This replaces the second field (`NOVA_v1`) with `VIRO_v1` in the second file if the first field equals `Software Version` and `ViroHEX` is present anywhere in ... | # How to replace a string in one file if a pattern present in another file using awk
**Tags:** <text-processing><awk>
**Question (score 5):**
I have a data file `A.txt` (field separator = \t) : ``` Well Well Type Well Name Dye Target A1 Unknown HIGH-001 FAM ViroFAM A1 Unknown HIGH-001 HEX ViroHEX ``` And a template ... | 3,394 | 848 | {
"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... |
631,065 | unix.stackexchange.com | Why does find not find my directory neither with -name nor with -regex | <p>I have a directory <code>~/Documents/machine_learning_coursera/</code>.</p>
<p>The command</p>
<pre><code>find . -type d -name '^machine'
</code></pre>
<p>does not find anything</p>
<p>I also tried</p>
<pre><code>find . -type d -regextype posix-extended -regex '^machine'
</code></pre>
<p>so as to match the the begin... | I have a directory `~/Documents/machine_learning_coursera/`. The command ``` find . -type d -name '^machine' ``` does not find anything I also tried ``` find . -type d -regextype posix-extended -regex '^machine' ``` so as to match the the beginning of the string and nothing. I tried also with `-name`: ``` find . -type ... | 10 | 903 | 3 | 0 | 1 | [
"<find><pattern-matching>"
] | 2021-01-26T09:43:35.137 | 2021-01-26T11:33:27.303 | 440,181 | 631,066 | [
{
"id": 631066,
"body": "<p><code>find</code>'s <code>-name</code> takes a shell/glob/<code>fnmatch()</code> wildcard pattern, not a regular expression.</p>\n<p>GNU <code>find</code>'s <code>-regex</code> non-standard extension does take a regexp (old style emacs type by default), but that's applied on the ... | `find`'s `-name` takes a shell/glob/`fnmatch()` wildcard pattern, not a regular expression. GNU `find`'s `-regex` non-standard extension does take a regexp (old style emacs type by default), but that's applied on the full path (like the standard `-path` which also takes wildcards), not just the file name (and are ancho... | # Why does find not find my directory neither with -name nor with -regex
**Tags:** <find><pattern-matching>
**Question (score 10):**
I have a directory `~/Documents/machine_learning_coursera/`. The command ``` find . -type d -name '^machine' ``` does not find anything I also tried ``` find . -type d -regextype posix... | 2,915 | 728 | {
"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... |
631,093 | unix.stackexchange.com | Do I need drivers to install Linux on my old laptop? Am I likely to face any problems if I install it? | <p>I have a Dell Inspiron 15R N5110 Laptop (Core i5 2nd Gen/4 GB/500 GB/Windows 7).</p>
<p>I previously installed Windows 10 on my system, but my computer was very slow, so I decided to install Linux on it.</p>
<p>It is currently running Windows 7.</p>
<p>My problem is: the only drivers I have for my laptop are Windows... | I have a Dell Inspiron 15R N5110 Laptop (Core i5 2nd Gen/4 GB/500 GB/Windows 7). I previously installed Windows 10 on my system, but my computer was very slow, so I decided to install Linux on it. It is currently running Windows 7. My problem is: the only drivers I have for my laptop are Windows 7's and I can't find Li... | 9 | 3,385 | 6 | 8 | 3 | [
"<linux><system-installation>"
] | 2021-01-26T13:42:00.000 | 2021-02-03T20:28:25.703 | 452,982 | 631,117 | [
{
"id": 631117,
"body": "<p>It is very unlikely that you will need any additional device drivers other than those that already come with most popular Linux distributions, specially on non brand new laptops. The only exception regards GPU devices used for games, such as NVidia and AMD Radeon GPUs. In such ca... | It is very unlikely that you will need any additional device drivers other than those that already come with most popular Linux distributions, specially on non brand new laptops. The only exception regards GPU devices used for games, such as NVidia and AMD Radeon GPUs. In such cases, some manufacturers sometimes provid... | # Do I need drivers to install Linux on my old laptop? Am I likely to face any problems if I install it?
**Tags:** <linux><system-installation>
**Question (score 9):**
I have a Dell Inspiron 15R N5110 Laptop (Core i5 2nd Gen/4 GB/500 GB/Windows 7). I previously installed Windows 10 on my system, but my computer was ... | 3,601 | 900 | {
"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... |
631,146 | unix.stackexchange.com | Where does bluetoothctl store command history? | <p>There is nothing about command history in <code>man bluetoothctl</code>, <code>info bluetoothctl</code>, and <code>bluetoothctl --help</code>.</p>
| There is nothing about command history in `man bluetoothctl`, `info bluetoothctl`, and `bluetoothctl --help`. | 7 | 441 | 1 | 0 | 1 | [
"<command-history><bluetooth>"
] | 2021-01-26T20:14:05.990 | 2021-01-28T00:53:48.503 | 53,143 | 631,147 | [
{
"id": 631147,
"body": "<h3>Short answer</h3>\n<p><code>bluetoothctl</code> stores command history in <code>~/.cache/.bluetoothctl_history</code>.</p>\n<hr />\n<h3>Long answer</h3>\n<p><em>Disclaimer: long answer requires some understanding of programming language C.</em></p>\n<p><code>bluetoothctl</code> ... | ### Short answer `bluetoothctl` stores command history in `~/.cache/.bluetoothctl_history`. ### Long answer Disclaimer: long answer requires some understanding of programming language C. `bluetoothctl` is a command line tool which is shipped with BlueZ – Bluetooth protocol stack for Linux (http://www.bluez.org/). If we... | # Where does bluetoothctl store command history?
**Tags:** <command-history><bluetooth>
**Question (score 7):**
There is nothing about command history in `man bluetoothctl`, `info bluetoothctl`, and `bluetoothctl --help`.
### Answer (score 11 · accepted)
### Short answer `bluetoothctl` stores command history in `~/... | 3,000 | 750 | {
"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... |
631,217 | unix.stackexchange.com | How do I check if my CPU supports x86-64-v2? | <p>AMD, Intel, Red Hat, and SUSE have defined a set of <a href="https://developers.redhat.com/blog/2021/01/05/building-red-hat-enterprise-linux-9-for-the-x86-64-v2-microarchitecture-level/" rel="noreferrer">"architecture levels" for x86-64 CPUs</a>. For example <code>x86-64-v2</code> means that a CPU support ... | AMD, Intel, Red Hat, and SUSE have defined a set of "architecture levels" for x86-64 CPUs (https://developers.redhat.com/blog/2021/01/05/building-red-hat-enterprise-linux-9-for-the-x86-64-v2-microarchitecture-level/). For example `x86-64-v2` means that a CPU support not only the basic x86-64 instructions set, but also ... | 14 | 4,777 | 4 | 0 | 5 | [
"<cpu><cpu-architecture>"
] | 2021-01-27T08:44:28.230 | 2021-01-28T08:33:47.970 | 14,861 | null | [
{
"id": 631226,
"body": "<p>This is based on <a href=\"https://unix.stackexchange.com/a/631218/86440\">gioele’s answer</a>; the whole script might as well be written in AWK:</p>\n<pre class=\"lang-awk prettyprint-override\"><code>#!/usr/bin/awk -f\n\nBEGIN {\n while (!/flags/) if (getline < "/pro... | This is based on gioele’s answer (https://unix.stackexchange.com/a/631218/86440); the whole script might as well be written in AWK: ``` #!/usr/bin/awk -f BEGIN { while (!/flags/) if (getline 0) { print "CPU supports x86-64-v" level; exit level + 1 } exit 1 } ``` This also checks for the baseline (“level 1” here), only ... | # How do I check if my CPU supports x86-64-v2?
**Tags:** <cpu><cpu-architecture>
**Question (score 14):**
AMD, Intel, Red Hat, and SUSE have defined a set of "architecture levels" for x86-64 CPUs (https://developers.redhat.com/blog/2021/01/05/building-red-hat-enterprise-linux-9-for-the-x86-64-v2-microarchitecture-le... | 3,648 | 912 | {
"source": "stackexchange-archive.org",
"license": "CC BY-SA 4.0",
"dump_version": "2021-12-07",
"extraction_date": "2026-07-02T12:57:40Z",
"parser_version": "stackexchange-streaming-v1.0",
"site_name": "unix.stackexchange.com",
"original_7z_url": "https://archive.org/download/stack-exchange-2021-12-07/u... |
631,237 | unix.stackexchange.com | In Linux, which filesystems support reflinks? | <p><code>btrfs</code> supports reflinks, <code>XFS</code> supports reflinks <a href="https://blogs.oracle.com/linux/xfs-data-block-sharing-reflink#:%7E:text=Three%20years%20ago%2C%20I%20introduced,efficient%20use%20of%20storage%20hardware." rel="nofollow noreferrer">(since 2017 I think?)</a>.</p>
<p>Are there any other... | `btrfs` supports reflinks, `XFS` supports reflinks (since 2017 I think?) (https://blogs.oracle.com/linux/xfs-data-block-sharing-reflink#:%7E:text=Three%20years%20ago%2C%20I%20introduced,efficient%20use%20of%20storage%20hardware.). Are there any other filesystems that support it? ``` truncate -s 1G test.file; cp --refli... | 9 | 939 | 1 | 1 | 1 | [
"<linux><filesystems><reflink>"
] | 2021-01-27T10:21:12.197 | 2021-06-18T19:03:02.363 | 139,042 | 631,238 | [
{
"id": 631238,
"body": "<p><a href=\"https://www.kernel.org/doc/html/latest/filesystems/vfs.html#struct-file-operations\" rel=\"noreferrer\">Support for reflinks</a> is indicated using the <a href=\"https://elixir.bootlin.com/linux/latest/A/ident/remap_file_range\" rel=\"noreferrer\"><code>remap_file_range... | Support for reflinks (https://www.kernel.org/doc/html/latest/filesystems/vfs.html#struct-file-operations) is indicated using the `remap_file_range` (https://elixir.bootlin.com/linux/latest/A/ident/remap_file_range) operation, which is currently (5.11) supported by Btrfs, CIFS, NFS 4.2, OCFS2, overlayfs, and XFS. | # In Linux, which filesystems support reflinks?
**Tags:** <linux><filesystems><reflink>
**Question (score 9):**
`btrfs` supports reflinks, `XFS` supports reflinks (since 2017 I think?) (https://blogs.oracle.com/linux/xfs-data-block-sharing-reflink#:%7E:text=Three%20years%20ago%2C%20I%20introduced,efficient%20use%20o... | 821 | 205 | {
"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... |
631,438 | unix.stackexchange.com | Update sudo in Debian Wheezy for CVE-2021-3156 | <p>I have sudo 1.8.5p2-1+nmu3+deb7u1 installed in Debian Wheezy and I need to update it to fix the CVE-2021-3156 vulnerability. Unfortunately, there are no security patches for Wheezy anymore and upgrading to Stretch is not an option.</p>
<p>I can not install the sudo package from Stretch because it depends on libc6 (&... | I have sudo 1.8.5p2-1+nmu3+deb7u1 installed in Debian Wheezy and I need to update it to fix the CVE-2021-3156 vulnerability. Unfortunately, there are no security patches for Wheezy anymore and upgrading to Stretch is not an option. I can not install the sudo package from Stretch because it depends on libc6 (>= 2.17) an... | 5 | 1,517 | 2 | 2 | 0 | [
"<sudo>"
] | 2021-01-28T12:36:47.293 | 2021-01-28T18:34:07.797 | 426,747 | 631,441 | [
{
"id": 631441,
"body": "<p>I think the simplest option for you is to build the Debian 9 version of <code>sudo</code>:</p>\n<pre class=\"lang-sh prettyprint-override\"><code>apt-get install devscripts libpam0g-dev libldap2-dev libsasl2-dev libselinux1-dev autoconf autotools-dev bison flex libaudit-dev\ndget... | I think the simplest option for you is to build the Debian 9 version of `sudo`: ``` apt-get install devscripts libpam0g-dev libldap2-dev libsasl2-dev libselinux1-dev autoconf autotools-dev bison flex libaudit-dev dget -u http://security.debian.org/pool/updates/main/s/sudo/sudo_1.8.19p1-2.1+deb9u3.ds cd sudo-1.8.19p1 de... | # Update sudo in Debian Wheezy for CVE-2021-3156
**Tags:** <sudo>
**Question (score 5):**
I have sudo 1.8.5p2-1+nmu3+deb7u1 installed in Debian Wheezy and I need to update it to fix the CVE-2021-3156 vulnerability. Unfortunately, there are no security patches for Wheezy anymore and upgrading to Stretch is not an opt... | 2,879 | 719 | {
"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... |
631,453 | unix.stackexchange.com | Understanding locate command regex | <p>To use <code>locate</code> command with regex , do we need to enclose the pattern in quotes along with passing <code>--regex</code> option ? If yes, then what do the following mean -</p>
<p>a) <code>locate --regex file*</code> ? Here regex will happen or shell globbing ?</p>
<p>b) <code>locate 'file*'</code> ? Will ... | To use `locate` command with regex , do we need to enclose the pattern in quotes along with passing `--regex` option ? If yes, then what do the following mean - a) `locate --regex file*` ? Here regex will happen or shell globbing ? b) `locate 'file*'` ? Will locate do regex search even though we did not passed `--regex... | 5 | 294 | 1 | 0 | 1 | [
"<command-line><locate>"
] | 2021-01-28T14:49:03.163 | 2021-01-28T15:05:00.917 | 369,393 | 631,456 | [
{
"id": 631456,
"body": "<p>You type the command at the shell prompt. The shell processes what you typed, which includes globbing, substituting variables, substituting <code>$()</code> and so on. After processing what you typed, the shell executes the command.</p>\n<p>Quotes are needed if a string contains ... | You type the command at the shell prompt. The shell processes what you typed, which includes globbing, substituting variables, substituting `$()` and so on. After processing what you typed, the shell executes the command. Quotes are needed if a string contains characters that are special to the shell, such as spaces or... | # Understanding locate command regex
**Tags:** <command-line><locate>
**Question (score 5):**
To use `locate` command with regex , do we need to enclose the pattern in quotes along with passing `--regex` option ? If yes, then what do the following mean - a) `locate --regex file*` ? Here regex will happen or shell gl... | 2,153 | 538 | {
"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... |
631,501 | unix.stackexchange.com | base64 -d decodes, but says invalid input | <p>Does anybody know why this is happening and how to fix it?</p>
<pre><code>me@box:~$ echo "eyJmb28iOiJiYXIiLCJiYXoiOiJiYXQifQ" | base64 -di
{"foo":"bar","baz":"bat"}base64: invalid input
</code></pre>
| Does anybody know why this is happening and how to fix it? ``` me@box:~$ echo "eyJmb28iOiJiYXIiLCJiYXoiOiJiYXQifQ" | base64 -di {"foo":"bar","baz":"bat"}base64: invalid input ``` | 10 | 5,554 | 3 | 2 | 1 | [
"<linux><bash><echo><base64>"
] | 2021-01-28T17:45:22.743 | 2021-08-25T00:52:56.187 | 38,649 | 631,503 | [
{
"id": 631503,
"body": "<p>If you do the reverse, you'll note that the string isn't complete:</p>\n<pre class=\"lang-bsh prettyprint-override\"><code>$ echo '{"foo":"bar","baz":"bat"}' | base64\neyJmb28iOiJiYXIiLCJiYXoiOiJiYXQifQo=\n\n$ echo "eyJmb28iOiJiYXIiLCJ... | If you do the reverse, you'll note that the string isn't complete: ``` $ echo '{"foo":"bar","baz":"bat"}' | base64 eyJmb28iOiJiYXIiLCJiYXoiOiJiYXQifQo= $ echo "eyJmb28iOiJiYXIiLCJiYXoiOiJiYXQifQo=" | base64 -di {"foo":"bar","baz":"bat"} ``` Extracts of Why does base64 encoding require padding if the input length is not... | # base64 -d decodes, but says invalid input
**Tags:** <linux><bash><echo><base64>
**Question (score 10):**
Does anybody know why this is happening and how to fix it? ``` me@box:~$ echo "eyJmb28iOiJiYXIiLCJiYXoiOiJiYXQifQ" | base64 -di {"foo":"bar","baz":"bat"}base64: invalid input ```
### Answer (score 17 · accepte... | 1,692 | 423 | {
"source": "stackexchange-archive.org",
"license": "CC BY-SA 4.0",
"dump_version": "2021-12-07",
"extraction_date": "2026-07-02T12:57:40Z",
"parser_version": "stackexchange-streaming-v1.0",
"site_name": "unix.stackexchange.com",
"original_7z_url": "https://archive.org/download/stack-exchange-2021-12-07/u... |
631,652 | unix.stackexchange.com | Remove accents from characters | <p>I'm quite certain this has been asked and answered before, however, I cannot find the answer to my specific use-case.</p>
<p>I've got this file with accented characters in it:</p>
<pre class="lang-bsh prettyprint-override"><code>> ~ cat file
ë
ê
Ý,text
Ò
É
</code></pre>
<p>How would I convert them to their respe... | I'm quite certain this has been asked and answered before, however, I cannot find the answer to my specific use-case. I've got this file with accented characters in it: ``` > ~ cat file ë ê Ý,text Ò É ``` How would I convert them to their respective non-accented letters? So the outcome would be something along the line... | 6 | 1,277 | 2 | 3 | 1 | [
"<text-processing>"
] | 2021-01-29T15:10:15.827 | 2021-01-29T15:24:00.413 | 200,654 | 631,653 | [
{
"id": 631653,
"body": "<p>You can try <code>iconv</code>, with the <code>//TRANSLIT</code> (transliteration) option</p>\n<p>Ex. given</p>\n<pre><code>$ cat file\në\nê\nÝ,text\nÒ\nÉ\n</code></pre>\n<p>then</p>\n<pre><code>$ iconv -t ASCII//TRANSLIT file\ne\ne\nY,text\nO\nE\n</code></pre>\n",
"body_md":... | You can try `iconv`, with the `//TRANSLIT` (transliteration) option Ex. given ``` $ cat file ë ê Ý,text Ò É ``` then ``` $ iconv -t ASCII//TRANSLIT file e e Y,text O E ``` | # Remove accents from characters
**Tags:** <text-processing>
**Question (score 6):**
I'm quite certain this has been asked and answered before, however, I cannot find the answer to my specific use-case. I've got this file with accented characters in it: ``` > ~ cat file ë ê Ý,text Ò É ``` How would I convert them to... | 959 | 239 | {
"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... |
631,734 | unix.stackexchange.com | Kali ate my Windows 10 :( | <p>I know other questions similar to this have been asked, but I think this situation is a bit different.</p>
<p>System is a Lenovo T430 with 2xSSDs (one is in the optical drive bay).</p>
<p>Original install was Win10 in primary SSD. Added Mint to make it dual boot, all good.</p>
<p>Decided to make it triple boot with ... | I know other questions similar to this have been asked, but I think this situation is a bit different. System is a Lenovo T430 with 2xSSDs (one is in the optical drive bay). Original install was Win10 in primary SSD. Added Mint to make it dual boot, all good. Decided to make it triple boot with Kali on the Secondary SS... | 6 | 2,337 | 3 | 1 | 3 | [
"<linux><windows><grub2><dual-boot><uefi>"
] | 2021-01-30T05:29:39.097 | 2021-01-30T23:43:54.887 | 453,611 | null | [
{
"id": 631743,
"body": "<p>OK, some background information first:</p>\n<ul>\n<li><p>An OS that is booted in UEFI-native way will have an ability to access the boot configuration while the OS is running as a set of UEFI NVRAM boot variables; this is part of the UEFI specification. In Linux, the most user-fr... | OK, some background information first: - An OS that is booted in UEFI-native way will have an ability to access the boot configuration while the OS is running as a set of UEFI NVRAM boot variables; this is part of the UEFI specification. In Linux, the most user-friendly way is the `efibootmgr` command; in Windows, the ... | # Kali ate my Windows 10 :(
**Tags:** <linux><windows><grub2><dual-boot><uefi>
**Question (score 6):**
I know other questions similar to this have been asked, but I think this situation is a bit different. System is a Lenovo T430 with 2xSSDs (one is in the optical drive bay). Original install was Win10 in primary SS... | 14,597 | 3,649 | {
"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... |
631,766 | unix.stackexchange.com | Can I get UNIX file permissions to take effect immediately for all processes? | <p>When I change the permissions on a file using <code>chmod</code>, existing file descriptors can continue to access the file under the previous permissions.</p>
<p>Can I cause those existing file descriptors to close or fail or become unusable immediately after the permission change?</p>
| When I change the permissions on a file using `chmod`, existing file descriptors can continue to access the file under the previous permissions. Can I cause those existing file descriptors to close or fail or become unusable immediately after the permission change? | 10 | 972 | 3 | 1 | 4 | [
"<permissions><file-descriptors>"
] | 2021-01-30T13:21:09.330 | 2021-01-31T15:46:10.157 | 26,068 | 631,769 | [
{
"id": 631769,
"body": "<p>The kernel doesn't check permissions on file descriptions. They can even be duplicated to other processes that never had access to the original file by <a href=\"https://openforums.wordpress.com/2016/08/07/open-file-descriptor-passing-over-unix-domain-sockets/\" rel=\"nofollow n... | The kernel doesn't check permissions on file descriptions. They can even be duplicated to other processes that never had access to the original file by fd passing (https://openforums.wordpress.com/2016/08/07/open-file-descriptor-passing-over-unix-domain-sockets/). The only thing I think you could try would be to manual... | # Can I get UNIX file permissions to take effect immediately for all processes?
**Tags:** <permissions><file-descriptors>
**Question (score 10):**
When I change the permissions on a file using `chmod`, existing file descriptors can continue to access the file under the previous permissions. Can I cause those existin... | 2,951 | 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... |
631,850 | unix.stackexchange.com | Is there a way to do multiple replacements with sed, without chaining the replacements? | <p>I want to write a shell script that replaces A by BB and B by AA. For example, <code>AYB</code> becomes <code>BBYAA</code>. My usual solution to this kind of thing is to chain multiple calls to sed, like this:</p>
<pre><code>sed 's/A/BB/g;s/B/AA/g'
</code></pre>
<p>However, that doesn't work in this situation becaus... | I want to write a shell script that replaces A by BB and B by AA. For example, `AYB` becomes `BBYAA`. My usual solution to this kind of thing is to chain multiple calls to sed, like this: ``` sed 's/A/BB/g;s/B/AA/g' ``` However, that doesn't work in this situation because the `A` ends up being translated into `AAAA` in... | 19 | 1,642 | 9 | 1 | 3 | [
"<text-processing><sed>"
] | 2021-01-31T01:33:32.490 | 2021-02-02T12:07:24.293 | 23,960 | 631,859 | [
{
"id": 631874,
"body": "<p>You can't do the whole operation with a single substitution in <code>sed</code>, but you can do it correctly in different ways depending on whether the two substrings <code>A</code> and <code>B</code> are single characters or longer strings.</p>\n<p>Assuming the two substrings <c... | You can't do the whole operation with a single substitution in `sed`, but you can do it correctly in different ways depending on whether the two substrings `A` and `B` are single characters or longer strings. Assuming the two substrings `A` and `B` are single characters... You want to transform `AYB` into `BBYAA`. To d... | # Is there a way to do multiple replacements with sed, without chaining the replacements?
**Tags:** <text-processing><sed>
**Question (score 19):**
I want to write a shell script that replaces A by BB and B by AA. For example, `AYB` becomes `BBYAA`. My usual solution to this kind of thing is to chain multiple calls ... | 7,067 | 1,766 | {
"source": "stackexchange-archive.org",
"license": "CC BY-SA 4.0",
"dump_version": "2021-12-07",
"extraction_date": "2026-07-02T12:57:40Z",
"parser_version": "stackexchange-streaming-v1.0",
"site_name": "unix.stackexchange.com",
"original_7z_url": "https://archive.org/download/stack-exchange-2021-12-07/u... |
632,000 | unix.stackexchange.com | Using echo -e with backslash (\) | <p>I was reading about the echo command in Unix and I got confused in the -e option with the backslash (<code>\</code>) escaped characters I ran the following two examples :</p>
<pre><code>echo "hello\\\\world"
</code></pre>
<p>output: <code>hello\\world</code></p>
<p>now running the same command with the -e ... | I was reading about the echo command in Unix and I got confused in the -e option with the backslash (`\`) escaped characters I ran the following two examples : ``` echo "hello\\\\world" ``` output: `hello\\world` now running the same command with the -e : ``` echo -e "hello\\\\world" ``` output: `hello\world` so what i... | 6 | 1,857 | 1 | 4 | 4 | [
"<bash><shell><echo>"
] | 2021-02-01T02:13:49.633 | 2021-02-01T04:12:54.850 | 449,598 | 632,001 | [
{
"id": 632001,
"body": "<p>In Bash double-quoted strings you can use backslash to make sure the next character is treated as a literal. That is, typing the argument <code>"a\\\\b"</code> results in passing the <em>literal string</em> <code>a\\b</code> to the command. From this we can conclude tha... | In Bash double-quoted strings you can use backslash to make sure the next character is treated as a literal. That is, typing the argument `"a\\b"` results in passing the literal string `a\b` to the command. From this we can conclude that in both cases you are passing `hello\\world` as the final argument to `echo` in bo... | # Using echo -e with backslash (\)
**Tags:** <bash><shell><echo>
**Question (score 6):**
I was reading about the echo command in Unix and I got confused in the -e option with the backslash (`\`) escaped characters I ran the following two examples : ``` echo "hello\\\\world" ``` output: `hello\\world` now running the... | 2,198 | 549 | {
"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... |
632,047 | unix.stackexchange.com | Why it is possible for normal users to power off computer? | <p>I used the command <code>poweroff</code> and unexpectedly the system went off. I didn't used <code>sudo</code> therefore I didn't expect computer to be turned off. Why it was possible for me to use this command without root privilege?</p>
| I used the command `poweroff` and unexpectedly the system went off. I didn't used `sudo` therefore I didn't expect computer to be turned off. Why it was possible for me to use this command without root privilege? | 25 | 3,650 | 1 | 2 | 2 | [
"<privileges><halt>"
] | 2021-02-01T12:23:40.553 | 2021-04-06T09:36:30.643 | 378,964 | 632,048 | [
{
"id": 632048,
"body": "<p>This is alluded to in a comment on <a href=\"https://unix.stackexchange.com/q/253767/86440\">Why does reboot and poweroff require root privileges?</a></p>\n<p>On some distributions using systemd, <a href=\"https://www.freedesktop.org/software/systemd/man/poweroff.html\" rel=\"nor... | This is alluded to in a comment on Why does reboot and poweroff require root privileges? (https://unix.stackexchange.com/q/253767/86440) On some distributions using systemd, `poweroff` is now a symlink to `systemctl` (https://www.freedesktop.org/software/systemd/man/poweroff.html), which instructs systemd to shut the s... | # Why it is possible for normal users to power off computer?
**Tags:** <privileges><halt>
**Question (score 25):**
I used the command `poweroff` and unexpectedly the system went off. I didn't used `sudo` therefore I didn't expect computer to be turned off. Why it was possible for me to use this command without root ... | 1,099 | 274 | {
"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... |
632,109 | unix.stackexchange.com | is there a way to cd into a directory based on the last characters? | <p>I have directories that begin with <code>164</code> but they differ based on the last few digits. I would like to cd into a directory based on the last few digits if not the last digit itself, say <code>9</code> vs <code>8</code>. The directories are unique in the last digits. Is it possible to do so? Autocomplete l... | I have directories that begin with `164` but they differ based on the last few digits. I would like to cd into a directory based on the last few digits if not the last digit itself, say `9` vs `8`. The directories are unique in the last digits. Is it possible to do so? Autocomplete lists a number of possibilities when ... | 8 | 2,089 | 3 | 1 | 0 | [
"<bash><cd-command>"
] | 2021-02-01T17:58:51.717 | 2021-02-03T14:05:26.067 | 313,163 | null | [
{
"id": 632118,
"body": "<p>With Bash, yes, you can use wildcards:</p>\n<pre><code>cd /path/to/*9/\n</code></pre>\n<p>(replace <code>9</code> with however many digits you need; you can drop <code>/path/to/</code> if you’re in the directory containing all the <code>164...</code> directories).</p>\n<p>You nee... | With Bash, yes, you can use wildcards: ``` cd /path/to/*9/ ``` (replace `9` with however many digits you need; you can drop `/path/to/` if you’re in the directory containing all the `164...` directories). You need to ensure that the expression is specific enough to resolve to a single directory, otherwise `cd` will cha... | # is there a way to cd into a directory based on the last characters?
**Tags:** <bash><cd-command>
**Question (score 8):**
I have directories that begin with `164` but they differ based on the last few digits. I would like to cd into a directory based on the last few digits if not the last digit itself, say `9` vs `... | 2,180 | 545 | {
"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... |
632,220 | unix.stackexchange.com | Replace to first matching character using sed | <p>Trying to update some latex code. The four lines:</p>
<pre><code>something $^\text{TT}$ and more stuff
something $^\text{T}$ and more stuff
something $^\text{M\times N}$ and more stuff
something $^\text{T} {otherstuff}$
</code></pre>
<p>should turn into</p>
<pre><code>something $^{\text{TT}}$ and more stuff
somethin... | Trying to update some latex code. The four lines: ``` something $^\text{TT}$ and more stuff something $^\text{T}$ and more stuff something $^\text{M\times N}$ and more stuff something $^\text{T} {otherstuff}$ ``` should turn into ``` something $^{\text{TT}}$ and more stuff something $^{\text{T}}$ and more stuff somethi... | 6 | 226 | 3 | 1 | 0 | [
"<text-processing><sed><regular-expression>"
] | 2021-02-02T10:12:28.253 | 2021-02-02T10:30:08.713 | 454,075 | 632,225 | [
{
"id": 632225,
"body": "<p>One method to overcome the greedy regular expression problem is to explicitly look for a string of non-delimiter characters, followed by the delimiter character. At the same time, you can probably simplify your replacement syntax via:</p>\n<pre><code>sed 's/\\^\\(\\\\text{[^}]*}\... | One method to overcome the greedy regular expression problem is to explicitly look for a string of non-delimiter characters, followed by the delimiter character. At the same time, you can probably simplify your replacement syntax via: ``` sed 's/\^\(\\text{[^}]*}\)/\^{\1}/' input.tex ``` It should be possible to use ``... | # Replace to first matching character using sed
**Tags:** <text-processing><sed><regular-expression>
**Question (score 6):**
Trying to update some latex code. The four lines: ``` something $^\text{TT}$ and more stuff something $^\text{T}$ and more stuff something $^\text{M\times N}$ and more stuff something $^\text{... | 2,703 | 675 | {
"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... |
632,342 | unix.stackexchange.com | Why parentheses returns exit status but not braces | <p>I understand that parentheses cause the commands to be run in a subshell and braces cause the commands to be grouped together but not in a subshell.</p>
<p>When I run this with parentheses:</p>
<pre><code>no_func || (
echo "there is nothing"
exit 1
)
echo $?
</code></pre>
<p>This returns the exit ... | I understand that parentheses cause the commands to be run in a subshell and braces cause the commands to be grouped together but not in a subshell. When I run this with parentheses: ``` no_func || ( echo "there is nothing" exit 1 ) echo $? ``` This returns the exit status: ``` /Users/myname/bin/ex5: line 34: n_func: c... | 5 | 1,013 | 2 | 2 | 1 | [
"<bash><shell-script>"
] | 2021-02-02T22:59:58.750 | 2021-02-02T23:24:39.147 | 120,293 | 632,347 | [
{
"id": 632347,
"body": "<p>Look at the command execution trace (<code>set -x</code>). With braces:</p>\n<pre><code>+ no_func\n./a: line 3: no_func: command not found\n+ echo 'there is nothing'\nthere is nothing\n+ exit 1\n</code></pre>\n<p><code>exit</code> exits the (sub)shell. Since braces don't create a... | Look at the command execution trace (`set -x`). With braces: ``` + no_func ./a: line 3: no_func: command not found + echo 'there is nothing' there is nothing + exit 1 ``` `exit` exits the (sub)shell. Since braces don't create a subshell, `exit` exits the main shell process, so it never reaches the point where it would ... | # Why parentheses returns exit status but not braces
**Tags:** <bash><shell-script>
**Question (score 5):**
I understand that parentheses cause the commands to be run in a subshell and braces cause the commands to be grouped together but not in a subshell. When I run this with parentheses: ``` no_func || ( echo "the... | 1,601 | 400 | {
"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... |
632,382 | unix.stackexchange.com | Increment numbers greater than 50 in a file | <p>I have a file <code>Builder.java</code>, with lines like:</p>
<pre class="lang-java prettyprint-override"><code>public class Builder{
@Override
public void setCallId(long value) {
set4ByteField(value, 48);
setLogtype(1);
setVerify("ABAB");
}
public void setOriginCal... | I have a file `Builder.java`, with lines like: ``` public class Builder{ @Override public void setCallId(long value) { set4ByteField(value, 48); setLogtype(1); setVerify("ABAB"); } public void setOriginCallId(long value) { set8ByteField(value, 52); } public void setDateTimeYear(int value) { set2ByteField(value, 60); } ... | 7 | 336 | 2 | 3 | 0 | [
"<awk><sed><perl>"
] | 2021-02-03T08:45:43.683 | 2021-02-04T08:52:36.027 | 302,371 | 632,404 | [
{
"id": 632390,
"body": "<ul>\n<li><p>Increment all numbers with absolute value greater than 50.</p>\n<pre><code>perl -pe 's/\\b(\\d+)\\b/$1>50 ? $1+1 : $1/ge' file\n</code></pre>\n<p>The pattern is a sequence\nof digits (<code>\\d+</code>) with boundaries (<code>\\b</code>), so that it does not match th... | - Increment all numbers with absolute value greater than 50. ``` perl -pe 's/\b(\d+)\b/$1>50 ? $1+1 : $1/ge' file ``` The pattern is a sequence of digits (`\d+`) with boundaries (`\b`), so that it does not match the number `4` in `set4ByteField`, for example. The `e` flag (https://perldoc.perl.org/perlop#s%2FPATTERN%2F... | # Increment numbers greater than 50 in a file
**Tags:** <awk><sed><perl>
**Question (score 7):**
I have a file `Builder.java`, with lines like: ``` public class Builder{ @Override public void setCallId(long value) { set4ByteField(value, 48); setLogtype(1); setVerify("ABAB"); } public void setOriginCallId(long value)... | 3,074 | 768 | {
"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... |
632,414 | unix.stackexchange.com | How to count the lines containing one of two words but not both | <p>I need to count the lines containing the words <code>the</code> and <code>an</code> in a text file (<code>poem.txt</code>), but <em>not those containing both</em>.</p>
<p>I've tried using</p>
<pre><code>grep -c the poem.txt | grep -c an poem.txt
</code></pre>
<p>but this gives me the wrong answer of 6 when the total... | I need to count the lines containing the words `the` and `an` in a text file (`poem.txt`), but not those containing both. I've tried using ``` grep -c the poem.txt | grep -c an poem.txt ``` but this gives me the wrong answer of 6 when the total number of `the` and `an` is 9 lines. I do want to count the lines containin... | 5 | 1,208 | 8 | 6 | 2 | [
"<text-processing><awk><grep>"
] | 2021-02-03T12:27:06.310 | 2021-02-05T12:35:36.637 | 454,299 | 632,437 | [
{
"id": 632448,
"body": "<pre><code>perl -nE 'END {say $c+0} ++$c if /\\bthe\\b/i xor /\\ban\\b/i' file\n</code></pre>\n<pre><code>gawk 'END {print c+0} /\\<the\\>/ != /\\<an\\>/ {++c}' IGNORECASE=1 file\n</code></pre>\n<p>Comparing the results from matching each expression can give the outcome ... | ``` perl -nE 'END {say $c+0} ++$c if /\bthe\b/i xor /\ban\b/i' file ``` ``` gawk 'END {print c+0} /\/ != /\/ {++c}' IGNORECASE=1 file ``` Comparing the results from matching each expression can give the outcome you want. For example, the result of matching `\<the\>` may be either 0 or 1. If the result of the other matc... | # How to count the lines containing one of two words but not both
**Tags:** <text-processing><awk><grep>
**Question (score 5):**
I need to count the lines containing the words `the` and `an` in a text file (`poem.txt`), but not those containing both. I've tried using ``` grep -c the poem.txt | grep -c an poem.txt ``... | 8,021 | 2,005 | {
"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... |
632,418 | unix.stackexchange.com | Why do I not have sufficient permission when running sudo as a user | <p>The below fails:</p>
<pre><code>sudo -u chris ls /root
ls: cannot open directory '/root': Permission denied
</code></pre>
<p>While the below succeeds:</p>
<pre><code>sudo ls /root
...
</code></pre>
<p>I do not understand why. I assume <code>-u</code> just changes the <code>$USER</code>/running user to the parameter ... | The below fails: ``` sudo -u chris ls /root ls: cannot open directory '/root': Permission denied ``` While the below succeeds: ``` sudo ls /root ... ``` I do not understand why. I assume `-u` just changes the `$USER`/running user to the parameter provided in addition to having root privliges. What is the cause behind t... | 7 | 1,426 | 3 | 1 | 0 | [
"<permissions><sudo>"
] | 2021-02-03T13:00:23.777 | 2021-02-03T13:06:29.287 | 124,109 | 632,419 | [
{
"id": 632419,
"body": "<p><code>sudo -u chris</code> runs the given command as user <code>chris</code>, not as root with <code>USER</code> set to <code>chris</code>. So if <code>chris</code> can’t access <code>/root</code>, <code>sudo -u chris</code> won’t change that.</p>\n<p>See <a href=\"https://www.su... | `sudo -u chris` runs the given command as user `chris`, not as root with `USER` set to `chris`. So if `chris` can’t access `/root`, `sudo -u chris` won’t change that. See `man sudo` (https://www.sudo.ws/man/1.9.5/sudo.man.html#u): -u user, --user=user Run the command as a user other than the default target user (usuall... | # Why do I not have sufficient permission when running sudo as a user
**Tags:** <permissions><sudo>
**Question (score 7):**
The below fails: ``` sudo -u chris ls /root ls: cannot open directory '/root': Permission denied ``` While the below succeeds: ``` sudo ls /root ... ``` I do not understand why. I assume `-u` j... | 918 | 229 | {
"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... |
632,649 | unix.stackexchange.com | What is the purpose of Snap for Linux? | <p>One of the things I loved about Linux when I first switched was its package management. There are a few projects that bring Linux-style package management to Mac (Homebrew) and Windows (Chocolatey).</p>
<p>I'm increasingly seeing apps that provide Snap install instructions for Linux, but what would be the purpose of... | One of the things I loved about Linux when I first switched was its package management. There are a few projects that bring Linux-style package management to Mac (Homebrew) and Windows (Chocolatey). I'm increasingly seeing apps that provide Snap install instructions for Linux, but what would be the purpose of adding a ... | 9 | 526 | 2 | 8 | 0 | [
"<package-management><snap>"
] | 2021-02-04T16:20:03.633 | 2021-02-04T22:02:15.953 | 88,347 | 632,658 | [
{
"id": 632658,
"body": "<p>Traditional package management on Linux has a lot of strengths. Dependencies can be shared, which keeps things small and efficient. They generally go through a committee of some kind, and thus several eyes (this varies between Linux distributions, some have less of a process than... | Traditional package management on Linux has a lot of strengths. Dependencies can be shared, which keeps things small and efficient. They generally go through a committee of some kind, and thus several eyes (this varies between Linux distributions, some have less of a process than others). There's usually a central plac... | # What is the purpose of Snap for Linux?
**Tags:** <package-management><snap>
**Question (score 9):**
One of the things I loved about Linux when I first switched was its package management. There are a few projects that bring Linux-style package management to Mac (Homebrew) and Windows (Chocolatey). I'm increasingly... | 5,083 | 1,270 | {
"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... |
632,670 | unix.stackexchange.com | The paradox of logical AND (&&) and OR (||) in a bash script to check the successful execution of command (exit code of 0 is interpreted as true) | <p>So I well understand that exit code of <code>0</code> is considered success in running of a program. Then we use this in bash scripts with logical <code>AND</code> and <code>OR</code> to run the next program based on the exit status of the first program. A good example can be found here: <a href="https://unix.stacke... | So I well understand that exit code of `0` is considered success in running of a program. Then we use this in bash scripts with logical `AND` and `OR` to run the next program based on the exit status of the first program. A good example can be found here: https://unix.stackexchange.com/a/187148/454362 (https://unix.sta... | 5 | 1,414 | 3 | 4 | 0 | [
"<bash><shell-script><exit-status>"
] | 2021-02-04T18:03:18.143 | 2021-02-04T18:41:54.337 | 454,362 | 632,683 | [
{
"id": 632683,
"body": "<p>The examples in the post you linked to are things like:</p>\n<pre><code>false && echo "OK"\ntrue || echo "OK"\n</code></pre>\n<p>In that context, with the exit status of a processes, yes, <code>0</code> is truthy, and anything else is falsy. (Yes, <cod... | The examples in the post you linked to are things like: ``` false && echo "OK" true || echo "OK" ``` In that context, with the exit status of a processes, yes, `0` is truthy, and anything else is falsy. (Yes, `true` and `false` are programs here. Probably builtin to the shell, but that works the same.) From the POSIX d... | # The paradox of logical AND (&&) and OR (||) in a bash script to check the successful execution of command (exit code of 0 is interpreted as true)
**Tags:** <bash><shell-script><exit-status>
**Question (score 5):**
So I well understand that exit code of `0` is considered success in running of a program. Then we use... | 6,876 | 1,719 | {
"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... |
633,220 | unix.stackexchange.com | Bash: value too great for base when using a date as array key | <p>I have read about specifying "10#", but I don't think it's my case as I am not doing number comparison. I am trying to create an associative array in Bash, and the code worked fine until today (2021-02-08):</p>
<pre class="lang-bsh prettyprint-override"><code>dailyData["$today"]="$todayData&... | I have read about specifying "10#", but I don't think it's my case as I am not doing number comparison. I am trying to create an associative array in Bash, and the code worked fine until today (2021-02-08): ``` dailyData["$today"]="$todayData" ``` $today is a day in ISO format, $todayData is not relevant. I am getting ... | 6 | 1,368 | 2 | 0 | 0 | [
"<bash><string><associative-array>"
] | 2021-02-07T23:58:31.247 | 2021-02-08T09:55:37.647 | 423,407 | 633,226 | [
{
"id": 633226,
"body": "<p>It's because <code>dailyData</code> is being automatically created as indexed array rather than an associative array. From <code>man bash</code>:</p>\n<blockquote>\n<p>An indexed array is created automatically if any variable is assigned\nto using the syntax <code>name[subscrip... | It's because `dailyData` is being automatically created as indexed array rather than an associative array. From `man bash`: An indexed array is created automatically if any variable is assigned to using the syntax `name[subscript]=value`. The subscript is treated as an arithmetic expression that must evaluate to a numb... | # Bash: value too great for base when using a date as array key
**Tags:** <bash><string><associative-array>
**Question (score 6):**
I have read about specifying "10#", but I don't think it's my case as I am not doing number comparison. I am trying to create an associative array in Bash, and the code worked fine unti... | 1,792 | 448 | {
"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... |
633,242 | unix.stackexchange.com | zsh completion: do not offer directories when extracting archive with tar | <p>the completion system for <code>tar</code> command is quite clever. When I have different archive types, it offers the relevant files depending on tar options used:</p>
<pre><code>$ ls
file.tar.xz
file.tar.gz
$ tar xJf f<TAB>
file.tar.xz
$ tar xzf f<TAB>
file.tar.gz
</code></pre>
<p>It recognizes <code... | the completion system for `tar` command is quite clever. When I have different archive types, it offers the relevant files depending on tar options used: ``` $ ls file.tar.xz file.tar.gz $ tar xJf f file.tar.xz $ tar xzf f file.tar.gz ``` It recognizes `xJf` as acting on `tar.xz` files, and `xzf` acting on `tar.gz` fil... | 5 | 135 | 1 | 2 | 1 | [
"<shell><zsh><autocomplete>"
] | 2021-02-08T04:20:52.360 | 2021-02-11T12:01:27.967 | 155,832 | 633,806 | [
{
"id": 633806,
"body": "<p>Getting the completion system to present only files for <em>every</em> invocation of\n<code>tar</code> is relatively straightforward. This <code>zstyle</code> command added to <code>.zshrc</code>\nwill do the trick:</p>\n<pre><code>zstyle ':completion:*:*:tar:*' 'file-patterns' ... | Getting the completion system to present only files for every invocation of `tar` is relatively straightforward. This `zstyle` command added to `.zshrc` will do the trick: ``` zstyle ':completion:*:*:tar:*' 'file-patterns' '*(.)' ``` This triggers code in the `_files` builtin function that restricts the file pattern ma... | # zsh completion: do not offer directories when extracting archive with tar
**Tags:** <shell><zsh><autocomplete>
**Question (score 5):**
the completion system for `tar` command is quite clever. When I have different archive types, it offers the relevant files depending on tar options used: ``` $ ls file.tar.xz file.... | 4,126 | 1,031 | {
"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... |
633,260 | unix.stackexchange.com | How can I control a shell script from outside while it is sleeping? | <p>I am fairly new to shell scripting. I have a script similar to the following,</p>
<pre class="lang-bsh prettyprint-override"><code>while [ true ]
do
sleep 5m
# PART X: code that executes every 5 mins
done
</code></pre>
<p>While this is running (1) how can I intercept the program from outside and (2) stop the sle... | I am fairly new to shell scripting. I have a script similar to the following, ``` while [ true ] do sleep 5m # PART X: code that executes every 5 mins done ``` While this is running (1) how can I intercept the program from outside and (2) stop the sleep process and execute PART X right away? Can I use SIGNALS for that ... | 17 | 2,244 | 5 | 3 | 3 | [
"<shell-script><process>"
] | 2021-02-08T07:01:20.753 | 2021-02-08T09:54:25.117 | 402,053 | 633,432 | [
{
"id": 633432,
"body": "<p>Handling the timing is the script's responsibility. Even if that means using <code>/bin/sleep</code> today, it might not in the future, so killing that isn't actually guaranteed to work long-term. Well, I guess you <em>can</em> make that guarantee, but it's neater not to. My poin... | Handling the timing is the script's responsibility. Even if that means using `/bin/sleep` today, it might not in the future, so killing that isn't actually guaranteed to work long-term. Well, I guess you can make that guarantee, but it's neater not to. My point is you shouldn't kill the sleep directly from outside the ... | # How can I control a shell script from outside while it is sleeping?
**Tags:** <shell-script><process>
**Question (score 17):**
I am fairly new to shell scripting. I have a script similar to the following, ``` while [ true ] do sleep 5m # PART X: code that executes every 5 mins done ``` While this is running (1) ho... | 4,994 | 1,248 | {
"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... |
633,316 | unix.stackexchange.com | How to statically link missing libgcc_s_seh-1.dll and libstdc++-6.dll DLLs for 9.3-win32 MinGW executable | <p>I want to compile a simple Windows application on Linux using MinGW.</p>
<p>I compile as follows:</p>
<pre><code>x86_64-w64-mingw32-g++ -L. -l:mathlib.dll -o fib main.cpp mathlib.h
</code></pre>
<p>This results in an executable <code>fib</code> that computes the N'th fibonacci number using a function imported from <... | I want to compile a simple Windows application on Linux using MinGW. I compile as follows: ``` x86_64-w64-mingw32-g++ -L. -l:mathlib.dll -o fib main.cpp mathlib.h ``` This results in an executable `fib` that computes the N'th fibonacci number using a function imported from `mathlib.dll`. Now, when executing `fib` on Wi... | 7 | 1,338 | 1 | 0 | 1 | [
"<debian><windows><gcc><g++><mingw>"
] | 2021-02-08T13:10:31.017 | 2021-02-08T15:02:40.960 | 128,739 | 633,321 | [
{
"id": 633321,
"body": "<p>Build your program (and <code>mathlib.dll</code>, if necessary) with the <code>-static-libgcc</code> and <code>-static-libstdc++</code> options:</p>\n<pre><code>x86_64-w64-mingw32-g++ -static-libgcc -static-libstdc++ -L. -l:mathlib.dll -o fib main.cpp mathlib.h\n</code></pre>\n<p... | Build your program (and `mathlib.dll`, if necessary) with the `-static-libgcc` and `-static-libstdc++` options: ``` x86_64-w64-mingw32-g++ -static-libgcc -static-libstdc++ -L. -l:mathlib.dll -o fib main.cpp mathlib.h ``` This will produce a binary with no external dependencies on `libgcc` and `libstdc++`. | # How to statically link missing libgcc_s_seh-1.dll and libstdc++-6.dll DLLs for 9.3-win32 MinGW executable
**Tags:** <debian><windows><gcc><g++><mingw>
**Question (score 7):**
I want to compile a simple Windows application on Linux using MinGW. I compile as follows: ``` x86_64-w64-mingw32-g++ -L. -l:mathlib.dll -o ... | 1,159 | 289 | {
"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... |
633,322 | unix.stackexchange.com | What prevents me from just editing the /etc/shadow file in unencrypted systems? | <p>Real dumb question, but suppose a computer with Linux does not have an encrypted hard drive. If I generated a hash with <em>"openssl passwd"</em>, couldn't I just run a live version of Ubuntu and add my hash to the /etc/shadow file? Or is /etc/shadow encrypted even if the hard drive isn't?</p>
| Real dumb question, but suppose a computer with Linux does not have an encrypted hard drive. If I generated a hash with "openssl passwd", couldn't I just run a live version of Ubuntu and add my hash to the /etc/shadow file? Or is /etc/shadow encrypted even if the hard drive isn't? | 5 | 876 | 2 | 1 | 3 | [
"<linux><security><password><shadow>"
] | 2021-02-08T13:40:58.577 | 2021-02-08T13:55:48.413 | 455,116 | 633,324 | [
{
"id": 633324,
"body": "<blockquote>\n<p>What prevents me from just editing the /etc/shadow file in unencrypted systems?</p>\n</blockquote>\n<p>Nothing, there is no specific protection for <code>/etc/shadow</code>. Some systems might have tampering detection, so the system administrator would know that <co... | What prevents me from just editing the /etc/shadow file in unencrypted systems? Nothing, there is no specific protection for `/etc/shadow`. Some systems might have tampering detection, so the system administrator would know that `/etc/shadow` was changed (unless you also overrode the tampering detection, typically by u... | # What prevents me from just editing the /etc/shadow file in unencrypted systems?
**Tags:** <linux><security><password><shadow>
**Question (score 5):**
Real dumb question, but suppose a computer with Linux does not have an encrypted hard drive. If I generated a hash with "openssl passwd", couldn't I just run a live ... | 1,514 | 378 | {
"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... |
633,648 | unix.stackexchange.com | replace lines in one file with lines in another by line number | <p>I have a fileA.txt with many lines and I want to replace specific lines with other specific lines from a second file fileB.txt which also has many lines</p>
<p>For example:
fileA.txt</p>
<pre><code>Italy
Korea
USA
England
Peru
Japan
Uruguay
</code></pre>
<p>fileB.txt</p>
<pre><code>Argentina
Switzerland
Spain
Greece... | I have a fileA.txt with many lines and I want to replace specific lines with other specific lines from a second file fileB.txt which also has many lines For example: fileA.txt ``` Italy Korea USA England Peru Japan Uruguay ``` fileB.txt ``` Argentina Switzerland Spain Greece Denmark Singapore Thailand Colombia ``` I wa... | 5 | 518 | 2 | 4 | 1 | [
"<linux><text-processing><awk><sed>"
] | 2021-02-10T06:54:47.490 | 2021-02-10T08:25:37.027 | 361,114 | 633,663 | [
{
"id": 633663,
"body": "<p>Using <code>awk</code>:</p>\n<pre><code>awk -v a='2,4,5,7' -v b='1,2,5,8' '\nBEGIN { split(a, ax, ","); split(b, bx, ",");\n for(n in ax) mapping[ bx[n] ] =ax[n];\n};\nNR==FNR { if (FNR in mapping) hold[ mapping[FNR] ]=$0; next; };\n{ print (FNR in hold... | Using `awk`: ``` awk -v a='2,4,5,7' -v b='1,2,5,8' ' BEGIN { split(a, ax, ","); split(b, bx, ","); for(n in ax) mapping[ bx[n] ] =ax[n]; }; NR==FNR { if (FNR in mapping) hold[ mapping[FNR] ]=$0; next; }; { print (FNR in hold)? hold[FNR]: $0; }' fileB fileA ``` Here, we pass line numbers as an awk `-v`ariable in `a='...... | # replace lines in one file with lines in another by line number
**Tags:** <linux><text-processing><awk><sed>
**Question (score 5):**
I have a fileA.txt with many lines and I want to replace specific lines with other specific lines from a second file fileB.txt which also has many lines For example: fileA.txt ``` Ita... | 4,466 | 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... |
633,847 | unix.stackexchange.com | Since CentOS 8 will reach EOL in 2021, what would be a good alternative to CentOS 8 for learning and practicing Red Hat? | <p>I just came across the <a href="https://developers.redhat.com/articles/faqs-no-cost-red-hat-enterprise-linux#general" rel="nofollow noreferrer">FAQs for no-cost Red Hat Enterprise Linux</a> and looks like they are giving Red Hat Enterprise Linux (RHEL) for free for individual users, since CentOS has been my desktop ... | I just came across the FAQs for no-cost Red Hat Enterprise Linux (https://developers.redhat.com/articles/faqs-no-cost-red-hat-enterprise-linux#general) and looks like they are giving Red Hat Enterprise Linux (RHEL) for free for individual users, since CentOS has been my desktop for years and now it is going to reach EO... | 16 | 6,073 | 5 | 12 | 4 | [
"<centos><rhel>"
] | 2021-02-11T04:14:30.953 | 2021-02-14T12:35:48.850 | 8,032 | null | [
{
"id": 633875,
"body": "<p>If you want to practice RHEL, you might as well use RHEL, which is now available <a href=\"https://www.redhat.com/en/blog/new-year-new-red-hat-enterprise-linux-programs-easier-ways-access-rhel\" rel=\"noreferrer\">for no-cost production use, in a personal capacity, for small work... | If you want to practice RHEL, you might as well use RHEL, which is now available for no-cost production use, in a personal capacity, for small workloads (https://www.redhat.com/en/blog/new-year-new-red-hat-enterprise-linux-programs-easier-ways-access-rhel) of up to 16 nodes or instances (in addition to the no-cost deve... | # Since CentOS 8 will reach EOL in 2021, what would be a good alternative to CentOS 8 for learning and practicing Red Hat?
**Tags:** <centos><rhel>
**Question (score 16):**
I just came across the FAQs for no-cost Red Hat Enterprise Linux (https://developers.redhat.com/articles/faqs-no-cost-red-hat-enterprise-linux#g... | 2,418 | 604 | {
"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,046 | unix.stackexchange.com | Are there any single character bash aliases to be avoided? | <p>Often I find my self making single character aliases, because after all, they exist to save input time. I'm curious if this should be avoided. I do not know of any conflicts.</p>
| Often I find my self making single character aliases, because after all, they exist to save input time. I'm curious if this should be avoided. I do not know of any conflicts. | 33 | 2,513 | 6 | 1 | 4 | [
"<bash><shell><alias>"
] | 2021-02-12T05:55:58.233 | 2021-02-12T09:16:38.453 | 420,883 | 634,057 | [
{
"id": 634057,
"body": "<p>Things to avoid:</p>\n<ul>\n<li>standard or common commands with single character names: <code>w</code> (show logged in users' activity), <code>X</code> (X Window System server), <code>R</code> (R programming language interpreter), <code>[</code> (similar to <code>test</code>)</l... | Things to avoid: - standard or common commands with single character names: `w` (show logged in users' activity), `X` (X Window System server), `R` (R programming language interpreter), `[` (similar to `test`) - builtins of your shell or of common shells: `[`, `.`, `:`, `-`, `r` - shell keywords: `{`, `}`, `!` - `?` an... | # Are there any single character bash aliases to be avoided?
**Tags:** <bash><shell><alias>
**Question (score 33):**
Often I find my self making single character aliases, because after all, they exist to save input time. I'm curious if this should be avoided. I do not know of any conflicts.
### Answer (score 38 · a... | 4,038 | 1,009 | {
"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,112 | unix.stackexchange.com | Is there any utility for performing ICMP testing ("ping") in only one direction? | <p>I've been having trouble with some network configuration lately which has been tricky to resolve.</p>
<p>It seems this would be <em>much</em> easier to diagnose if I knew which direction the traffic was failing to get through. Since all <code>ping</code> requests receive no responses back I'd like to know if the pi... | I've been having trouble with some network configuration lately which has been tricky to resolve. It seems this would be much easier to diagnose if I knew which direction the traffic was failing to get through. Since all `ping` requests receive no responses back I'd like to know if the ping-request packets are getting ... | 12 | 847 | 4 | 2 | 2 | [
"<linux><networking><icmp>"
] | 2021-02-12T14:33:53.440 | 2021-02-13T15:33:06.743 | 20,140 | 634,113 | [
{
"id": 634113,
"body": "<p><code>tcpdump</code> can do this, and is available pretty much everywhere:</p>\n<pre><code>tcpdump -n -i enp0s25 icmp\n</code></pre>\n<p>will dump all incoming and outgoing ICMP packets on <code>enp0s25</code>.</p>\n<p>To see only ICMP echo requests:</p>\n<pre><code>tcpdump -n -i... | `tcpdump` can do this, and is available pretty much everywhere: ``` tcpdump -n -i enp0s25 icmp ``` will dump all incoming and outgoing ICMP packets on `enp0s25`. To see only ICMP echo requests: ``` tcpdump -n -i enp0s25 "icmp[0] == 8" ``` (`-n` avoids DNS lookups, which can delay packet reporting and introduce unwanted... | # Is there any utility for performing ICMP testing ("ping") in only one direction?
**Tags:** <linux><networking><icmp>
**Question (score 12):**
I've been having trouble with some network configuration lately which has been tricky to resolve. It seems this would be much easier to diagnose if I knew which direction th... | 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.