Unix & Linux Stack Exchange
Q&A for users of Linux, FreeBSD and other Unix-like operating systems
Latest Questions
23
votes
6
answers
21514
views
Command-line tool to search docx files
Is there a command-line tool to text-search a docx file? I tried `grep`, but it doesn't work with docx even though it works fine with txt and xml files. I could convert the docx to txt first, but I'd prefer a tool that operates directly on docx files. I need the tool to work under Cygwin. OP edit: L...
Is there a command-line tool to text-search a docx file? I tried
grep
, but it doesn't work with docx even though it works fine with txt and xml files. I could convert the docx to txt first, but I'd prefer a tool that operates directly on docx files. I need the tool to work under Cygwin.
OP edit: Later I found out that the easiest way to achieve the grep is actually to convert those docx to txt then grep over them.
RoundPi
(331 rep)
Jan 6, 2012, 04:25 PM
• Last activity: Jul 29, 2025, 01:51 PM
1
votes
1
answers
2092
views
LS_COLORS not respected on Cygwin
Whilst trying to configure ls' colors on Cygwin (specifically the distro babun), I found that the custom extension colors that were in the LS_COLORS environment variable weren't being used. Here's an example: `di=34:ln=35:so=32:pi=33:ex=31:bd=34;46:cd=34;43:su=30;41:sg=30;46:tw=30;42:ow=30;43:*.tar=...
Whilst trying to configure ls' colors on Cygwin (specifically the distro babun), I found that the custom extension colors that were in the LS_COLORS environment variable weren't being used. Here's an example:
di=34:ln=35:so=32:pi=33:ex=31:bd=34;46:cd=34;43:su=30;41:sg=30;46:tw=30;42:ow=30;43:*.tar=1;31
Normally, the ls
command should output white text for every file EXCEPT .tar files, which should be red. However, what I'm getting is white text for everything INCLUDING .tar files. I wonder if it's a problem with MSYS ls
, or if it's a problem with my shell (zsh).
Basically, the custom file extension colors that I try and define fall back to the default file color.
Here's the corresponding part of my .zshrc
where I've defined the ls
alias and run the output of dircolors
.
eval "dircolors /etc/DIR_COLORS
"
alias ls="/bin/ls --color=auto"
IllinoisJackson
(11 rep)
Mar 21, 2017, 09:14 PM
• Last activity: Jun 22, 2025, 03:05 PM
0
votes
0
answers
23
views
Is reinstalling Cygwin supposed to wipe out our home folder tree?
For many years, I've had home folder `~` correspond to `c:\cygwin64\home\User.Name`. I recently had a problem that I tried to solve by uninstalling and reinstalling Cygwin. Since I rarely do this, I went through the processof googling how to set the home directory away from `c:\Users\User.Name` to `...
For many years, I've had home folder
~
correspond to c:\cygwin64\home\User.Name
. I recently had a problem that I tried to solve by uninstalling and reinstalling Cygwin. Since I rarely do this, I went through the processof googling how to set the home directory away from c:\Users\User.Name
to c:\cygwin64\home\User.Name
. In /etc/nsswitch.conf
, I ended up changing db_home:
to /home/%U
, which did the trick.
I then found that all of the previous folder trees rooted in ~
were gone. Of course I try to diligently back up snapshots of my work to a network drive, but being busy, I last did this 10 days ago. After spending time reconstructing content from material distributed all over the place, I've mitigated my losses.
I do wonder, however, *is reinstalling Cygwin **supposed** to wipe out all of the content in ~
, specifically when it corresponds to c:\cygwin64\home\User.Name
?*
I just now noticed that all of the lines in /etc/nsswitch.conf
are commented out with a leading #
, include the db_home:
line. This means my setting had no effect. It seems that just by restarting Cygwin a few times (by which I mean launch mintty
or X-windows + xterm
) and shutting them down, ~
seemed to change by itself from c:\Users\User.Name
to c:\cygwin64\home\User.Name
. I'm not entirely sure, however, because I didn't really know what I was doing when I was messing around with changing the mapping of ~
. However, I don't recall changing any files other than /etc/nsswitch.conf
.
user2153235
(467 rep)
Jun 2, 2025, 03:06 PM
6
votes
1
answers
4576
views
Running sshd in cygwin: "/var/empty must be owned by root..."
I installed OpenSSH on my Windows 7 system so I could tunnel my VNC into it from my Arch machine. However, when I run `/usr/sbin/sshd -D` on the W7 machine, I get the error: `/var/empty must be owned by root and not group or world-writable.` This is the output of the `ls -All /var`: $ ls -All /var t...
I installed OpenSSH on my Windows 7 system so I could tunnel my VNC into it from my Arch machine. However, when I run
/usr/sbin/sshd -D
on the W7 machine, I get the error: /var/empty must be owned by root and not group or world-writable.
This is the output of the ls -All /var
:
$ ls -All /var
total 0
drwxr-xr-x+ 1 {my_usrnm} None 0 Jul 15 21:39 cache
drw-------+ 1 cyg_server Administrators 0 Jul 15 21:43 empty
drwxr-xr-x+ 1 {my_usrnm} None 0 Jul 15 21:39 lib
drwxrwxrwt+ 1 {my_usrnm} None 0 Jul 15 21:45 log
drwxrwxrwt+ 1 {my_usrnm} None 0 Jul 15 23:36 run
drwxrwxrwt+ 1 {my_usrnm} None 0 Jul 15 21:39 tmp
I've tried a few of the permissions fixes and rebooted and reinstalled OpenSSH (by running ssh-host-config
) at least 10 times, but nothing had fixed it.
How do I fix this error? Thanks!
ZuluDeltaNiner
(361 rep)
Jul 16, 2016, 06:43 AM
• Last activity: Jun 1, 2025, 07:05 AM
0
votes
0
answers
39
views
Cygwin is trying to open wait.sh repeatedly
My Cygwin is trying to open wait.sh every time I use my notebook and asks me which program to use to open `wait.sh.` `wait.sh` is located in `C:/cygwin64/bin/` I have Windows 11, and all programs are using stable versions. I uninstalled Cygwin, but that's the easy way, and I need Cygwin because my W...
My Cygwin is trying to open wait.sh every time I use my notebook and asks me which program to use to open
wait.sh.
wait.sh
is located in C:/cygwin64/bin/
I have Windows 11, and all programs are using stable versions.
I uninstalled Cygwin, but that's the easy way, and I need Cygwin because my WSL is not working well.
The other option was deleting wait.sh
, but I don't know what kind of process uses this bash file.
user23061829
(1 rep)
Dec 7, 2023, 10:11 PM
• Last activity: Mar 18, 2025, 12:07 PM
0
votes
4
answers
97
views
Unusual symbols (parentheses) in the name of an environment variable
**Situation.** I work in Cygwin and there is a Windows environment variable that points to one of special folders: ProgramFiles(x86)=C:\Program Files (x86) As you see the variable name contains parentheses. Naive attempts to read the value do not seem to work: echo "${ProgramFiles(x86)}" # bad subst...
**Situation.** I work in Cygwin and there is a Windows environment variable that points to one of special folders:
ProgramFiles(x86)=C:\Program Files (x86)
As you see the variable name contains parentheses. Naive attempts to read the value do not seem to work:
echo "${ProgramFiles(x86)}" # bad substitution
echo "${ProgramFiles\(x86\)}" # bad substitution
I tried to find general rules on escaping characters in variable names, but failed.
**Question.** Is it possible to use a variable whose name includes parentheses or other unusual symbols?
P. S. In my specific case I got the same value with
cygpath -F 42
.
Mikhail Edoshin
(103 rep)
Mar 15, 2025, 11:56 AM
• Last activity: Mar 16, 2025, 07:58 PM
10
votes
2
answers
9735
views
Why is the updatedb command taking so much time?
I have read that to run the **locate** command on **CYGWIN**, first I need to run the following command: updatedb --localpaths=c:/ What does this command do exactly? As I run this on CYGWIN and it is taking too much time.
I have read that to run the **locate** command on **CYGWIN**, first I need to run the following command:
updatedb --localpaths=c:/
What does this command do exactly? As I run this on CYGWIN and it is taking too much time.
Elvin
(921 rep)
Dec 24, 2013, 04:26 AM
• Last activity: Mar 14, 2025, 11:58 PM
0
votes
4
answers
4162
views
Alternatives for Cygwin
Are there any command-line interface for Microsoft Windows other than cygwin. Currently, I am using cygwin but there are some commands that do not work as they are supposed to work on linux
Are there any command-line interface for Microsoft Windows other than cygwin. Currently, I am using cygwin but there are some commands that do not work as they are supposed to work on linux
ashu
(141 rep)
Apr 12, 2017, 02:16 PM
• Last activity: Mar 14, 2025, 05:02 PM
28
votes
5
answers
259266
views
why won't x11 display work through ssh login?
I have logged in to a remote server and am trying to display an X application (e.g. firefox) but an error message appears. The below are my attempts to open firefox: ```lang-shellsession Black@Black-PC ~$ ssh -X kwagjj@$labserver -p 122 [kwagjj@James5 ~]$ firefox Error: no display specified [kwagjj@...
I have logged in to a remote server and am trying to display an X application (e.g. firefox) but an error message appears. The below are my attempts to open firefox:
-shellsession
Black@Black-PC ~$ ssh -X kwagjj@$labserver -p 122
[kwagjj@James5 ~]$ firefox
Error: no display specified
[kwagjj@James5 ~]$ exit
logout
Connection to 143.248.146.204 closed.
Black@Black-PC ~$ ssh -Y kwagjj@$labserver -p 122
[kwagjj@James5 ~]$ firefox
Error: no display specified
[kwagjj@James5 ~]$
I used -X
, -Y
because I read somewhere that these two options are related with credentials regarding X11 and these switches will do the job for me. Even without the -X
, -Y
switches, my attempt failed.
What does the "no display specified" error mean?
P.S. The weird thing is that if I connect to the remote server through my PUTTY and repeat the command firefox
it works?!?! (firefox
is displayed on local computer)
P.S. my local computer is Windows 7 so I have [Xming
](https://sourceforge.net/projects/xming/) running on background in order to allow X11 display. As for the attempt written on the upper part, the commands were typed in at Cygwin terminal.
kwagjj
(2319 rep)
Jun 24, 2014, 12:43 PM
• Last activity: Mar 7, 2025, 03:07 PM
0
votes
2
answers
67
views
Using Bash, mysteriously don't need "export" command
I'm using Cygwin to get Linux functionality on Windows 11. Specifically, I am using Cygwin's `xpdf` to browse PDFs. It can open a hyperlinked URL if `$BROWSER` is set. Mysteriously, I found that I don't need to issue `export BROWSER=firefox` before issuing `xpdf MyFile.pdf &`. I just need a precedin...
I'm using Cygwin to get Linux functionality on Windows 11. Specifically, I am using Cygwin's
xpdf
to browse PDFs. It can open a hyperlinked URL if $BROWSER
is set. Mysteriously, I found that I don't need to issue export BROWSER=firefox
before issuing xpdf MyFile.pdf &
. I just need a preceding BROWSER=firefox
before the xpdf
command.
# This works
BROWSER=firefox
xpdf MyFile.pdf &
Why is it that xpdf
sees BROWSER=firefox
even though I didn't export this at the Bash command line?
user2153235
(467 rep)
Jan 17, 2025, 07:52 PM
• Last activity: Jan 18, 2025, 08:02 PM
0
votes
0
answers
46
views
Buffer Overflow and Over-read Vulnerabilities
I've ported (stolen from KallistiOS) genromfs to build on Windows for ps2sdk-ports, but there may be potential bugs. Here are the problems. [line 434:][1] Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). [line 555][2]: Does not handle strings that are not \0-ter...
I've ported (stolen from KallistiOS) genromfs to build on Windows for ps2sdk-ports, but there may be potential bugs. Here are the problems.
line 434: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20).
line 555 : Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126).
line 972 : Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126).
line 990 : Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126).
line 1037 : Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126).
How do I fix them or are there any work around's to fix them.
7dog123
(11 rep)
Jan 5, 2025, 02:35 AM
• Last activity: Jan 5, 2025, 05:38 AM
0
votes
1
answers
87
views
meld won't run on Cygwin: AttributeError: module 'gi' has no attribute 'require_version
I'm trying to run meld on Cygwin, after having installed it, and circumvented the ["no module named 'meld'" issue by forcing it to use Python 3.6][1]. Now, I get: ``` $ meld Traceback (most recent call last): File "/usr/bin/meld", line 341, in check_requirements() File "/usr/bin/meld", line 193, in...
I'm trying to run meld on Cygwin, after having installed it, and circumvented the "no module named 'meld'" issue by forcing it to use Python 3.6 . Now, I get:
$ meld
Traceback (most recent call last):
File "/usr/bin/meld", line 341, in
check_requirements()
File "/usr/bin/meld", line 193, in check_requirements
gi.require_version("Gtk", "3.0")
AttributeError: module 'gi' has no attribute 'require_version'
Where do I get gi
from, and what do I do to get meld
to work?
Version info:
* Windows: Version 10.0.19045.5131
* Cygwin: Updated 2024-12-05
* meld: 3.18.0-1
* Python3: 3.9.16
* Python3.6: 3.6.15
I can provide additional information as relevant, just ask in a comment.
einpoklum
(10753 rep)
Dec 5, 2024, 01:21 PM
• Last activity: Dec 20, 2024, 05:40 PM
0
votes
1
answers
110
views
Is it possible to make Windows git bash support chinese
I am trying to use `curl` (v8.6.0) to send the HTTP request to sever side under Windows git bash terminal. The server side is a Java spring boot application. When the `curl` JSON content contains Chinese words, the server side shows this error: ```text Caused by: com.fasterxml.jackson.databind.JsonM...
I am trying to use
curl
(v8.6.0) to send the HTTP request to sever side under Windows git bash terminal. The server side is a Java spring boot application. When the curl
JSON content contains Chinese words, the server side shows this error:
Caused by: com.fasterxml.jackson.databind.JsonMappingException: Invalid UTF-8 start byte 0xb2
at [Source: (org.springframework.util.StreamUtils$NonClosingInputStream); line: 1, column: 11] (through reference chain: com.guangdanet.youxue.admin.rest.vo.product.line.LineSaveReqVO["name"])
at com.fasterxml.jackson.databind.JsonMappingException.wrapWithPath(JsonMappingException.java:402)
at com.fasterxml.jackson.databind.JsonMappingException.wrapWithPath(JsonMappingException.java:361)
at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.wrapAndThrow(BeanDeserializerBase.java:1863)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserializeFromObject(BeanDeserializer.java:394)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:185)
at com.fasterxml.jackson.databind.deser.DefaultDeserializationContext.readRootValue(DefaultDeserializationContext.java:323)
at com.fasterxml.jackson.databind.ObjectReader._bindAndClose(ObjectReader.java:2105)
at com.fasterxml.jackson.databind.ObjectReader.readValue(ObjectReader.java:1481)
at org.springframework.http.converter.json.AbstractJackson2HttpMessageConverter.readJavaType(AbstractJackson2HttpMessageConverter.java:395)
... 175 common frames omitted
Caused by: com.fasterxml.jackson.core.JsonParseException: Invalid UTF-8 start byte 0xb2
at [Source: (org.springframework.util.StreamUtils$NonClosingInputStream); line: 1, column: 11]
at com.fasterxml.jackson.core.JsonParser._constructError(JsonParser.java:2477)
at com.fasterxml.jackson.core.base.ParserMinimalBase._reportError(ParserMinimalBase.java:750)
at com.fasterxml.jackson.core.json.UTF8StreamJsonParser._reportInvalidInitial(UTF8StreamJsonParser.java:3712)
at com.fasterxml.jackson.core.json.UTF8StreamJsonParser._reportInvalidChar(UTF8StreamJsonParser.java:3708)
at com.fasterxml.jackson.core.json.UTF8StreamJsonParser._finishString2(UTF8StreamJsonParser.java:2634)
at com.fasterxml.jackson.core.json.UTF8StreamJsonParser._finishAndReturnString(UTF8StreamJsonParser.java:2560)
at com.fasterxml.jackson.core.json.UTF8StreamJsonParser.getText(UTF8StreamJsonParser.java:335)
at com.fasterxml.jackson.databind.deser.std.StringDeserializer.deserialize(StringDeserializer.java:42)
at com.fasterxml.jackson.databind.deser.std.StringDeserializer.deserialize(StringDeserializer.java:11)
at com.fasterxml.jackson.databind.deser.impl.MethodProperty.deserializeAndSet(MethodProperty.java:129)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserializeFromObject(BeanDeserializer.java:392)
The jackson was the default JSON parser for spring boot application, and this server side works fine with a Google Chrome xhr request, but failed with the curl
request from Windows git terminal.
Am I missing something? It looks like this git bash has some encoding issue in Windows. What should I to to make the windows git bash support Chinese words?
This is the curl
info:
curl 8.6.0(x86_64-w64-mingw32) 1ibcur1/8.6.0 schannel z1ib/1.3.1 brotli/1.1.0std/1.5.5 1ibidn2/2.3.7 1ibps1/0.21.5 1ibssh2/1.11.0
Release-Date: 2024-01-31
Protocols: dict file ftp ftps gopher gophers http https imap imaps ipfs ipns lda2 ldaps mgtt pop3 pop3s rtsp scp sftp smb smbs smtp smtps telnet tftp
Features: alt-svc AsynchDNs brotli HSTS HTTPS-prOXy IDN IPv6 Kerberos Largefileibz NTLM PSL SPNEGO SSL SSPI threadsafe UnixSockets zstd
Dolphin
(791 rep)
Oct 18, 2024, 04:15 AM
• Last activity: Oct 18, 2024, 08:59 PM
2
votes
1
answers
167
views
Why does sort on Linux and on Cygwin return different results?
Scenario: ``` # on Linux $ cat r456.txt e+e+l e+e-c $ cat r456.txt | sort e+e-c e+e+l $ sort --version sort (GNU coreutils) 8.30 # on Cygwin $ cat r456.txt e+e+l e+e-c $ cat r456.txt | sort e+e+l e+e-c $ sort --version sort (GNU coreutils) 9.0 Packaged by Cygwin (9.0-1) ``` Here we see that `sort` o...
Scenario:
# on Linux
$ cat r456.txt
e+e+l
e+e-c
$ cat r456.txt | sort
e+e-c
e+e+l
$ sort --version
sort (GNU coreutils) 8.30
# on Cygwin
$ cat r456.txt
e+e+l
e+e-c
$ cat r456.txt | sort
e+e+l
e+e-c
$ sort --version
sort (GNU coreutils) 9.0
Packaged by Cygwin (9.0-1)
Here we see that sort
on Linux and on Cygwin returns different results. Why?
How to make sort
on Linux and on Cygwin return the same results?
---
UPD. Locales:
# on Linux
$ locale
LANG=en_US.UTF-8
LANGUAGE=en_US:
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=
# on Cygwin
$ locale
LANG=
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="C.UTF-8"
LC_TIME="C.UTF-8"
LC_COLLATE="C.UTF-8"
LC_MONETARY="C.UTF-8"
LC_MESSAGES="C.UTF-8"
LC_ALL=
---
UPD2. I've changed all locales on Cygwin to en_US.UTF-8
. However, sort
still returns different results:
# on Linux
$ cat r456a.txt
u1
u-1
$ cat r456a.txt | sort
u-1
u1
# on Cygwin
$ cat r456a.txt
u1
u-1
$ cat r456a.txt | sort
u1
u-1
$ locale
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_ALL=en_US.UTF-8
How to fix?
---
UPD3. Observation: on both Linux and Windows all LC
variables are set to en_US.UTF-8
, strings to sort are:
ProfileDataContainer.cpp
ProfileData.cpp
Linux sort
sorts them as
ProfileDataContainer.cpp
ProfileData.cpp
Cygwin sort
sorts them as
ProfileData.cpp
ProfileDataContainer.cpp
Is it a bug in Linux sort
or in Cygwin sort
?
How to make Linux sort
produce the same results as Cygwin sort
?
Versions: Linux sort
: 8.32, Cygwin sort
: 9.0. Both are GNU coreutils
.
pmor
(665 rep)
Feb 18, 2024, 07:44 PM
• Last activity: Oct 4, 2024, 12:22 PM
0
votes
1
answers
95
views
How to create `/run` folder and possibly subfolders?
For the past few years, running `xdf` yields the warning $QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-fma' QXcbShmImage: shmget() failed (88: Function not implemented) for size 3208656 (1133x708) According to [this page](https://github.com/swaywm/sway/issues/7202#issuecommen...
For the past few years, running
xdf
yields the warning
$QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-fma'
QXcbShmImage: shmget() failed (88: Function not implemented) for size 3208656 (1133x708)
According to [this page](https://github.com/swaywm/sway/issues/7202#issuecomment-1741707958) . I need the following in my ~/.bashrc
:
export XDG_RUNTIME_DIR=/run/user/$(id -u)
I using Cygwin, and I don't have a folder /run
. I want to create it, but I'm not sure how best to do so in a way that all accounts can use it. I have an admin account and various other accounts for different purposes, e.g.,. personal, work-related, gaming, etc.
How should I create /run
? Should I also create /run/user
for different accounts?
user2153235
(467 rep)
Sep 15, 2024, 06:00 PM
• Last activity: Sep 15, 2024, 08:41 PM
3
votes
2
answers
1433
views
Why does `find` not delete the files it found?
I'm trying to understand why the `find` command is not deleting files in one particular case. I've got the following command: find C:\\path\\to\\Pictures\\pmcctv -name cap_*.jpg -o -name cap_*.ogg -o -name cap_*.flv -o -name cap_*.mp4 -o -name cap_*.webm -mtime +7 Which returns the files I would exp...
I'm trying to understand why the
find
command is not deleting files in one particular case. I've got the following command:
find C:\\path\\to\\Pictures\\pmcctv -name cap_*.jpg
-o -name cap_*.ogg -o -name cap_*.flv -o -name cap_*.mp4 -o -name cap_*.webm -mtime +7
Which returns the files I would expect:
C:\path\to/Pictures/pmcctv/cap_20160915T193251_620067800.jpg
C:\path\to/Pictures/pmcctv/cap_20160915T193322_742708800.jpg
C:\path\to/Pictures/pmcctv/cap_20160916T081046_394767500.jpg
C:\path\to/Pictures/pmcctv/cap_20160916T081125_615129600.jpg
C:\path\to/Pictures/pmcctv/cap_20160916T081129_503678200.jpg
C:\path\to/Pictures/pmcctv/cap_20160916T081255_842394600.jpg
C:\path\to/Pictures/pmcctv/cap_20160916T161008_693586800.jpg
C:\path\to/Pictures/pmcctv/cap_20160916T161012_749396800.jpg
C:\path\to/Pictures/pmcctv/cap_20160916T161043_774132200.jpg
C:\path\to/Pictures/pmcctv/cap_20160916T161150_497251900.jpg
C:\path\to/Pictures/pmcctv/cap_20160916T161154_437379600.jpg
C:\path\to/Pictures/pmcctv/cap_20160916T161337_350955300.jpg
C:\path\to/Pictures/pmcctv/cap_20160916T161341_452596000.jpg
C:\path\to/Pictures/pmcctv/cap_20160916T161412_870774000.jpg
C:\path\to/Pictures/pmcctv/cap_20160916T161443_969064400.jpg
C:\path\to/Pictures/pmcctv/cap_20160916T161554_468109900.jpg
C:\path\to/Pictures/pmcctv/cap_20160916T161558_378086000.jpg
C:\path\to/Pictures/pmcctv/cap_20160916T161916_668433100.jpg
Now if I try to run the same command with -delete
, the files are not deleted:
find C:\\path\\to\\Pictures\\pmcctv -name cap_*.jpg -o -name cap_*.ogg
-o -name cap_*.flv -o -name cap_*.mp4 -o -name cap_*.webm -mtime +7 -delete
I've also tried with -exec rm
, but they are also not deleted:
find C:\\path\\to\\Pictures\\pmcctv -name cap_*.jpg -o -name cap_*.ogg
-o -name cap_*.flv -o -name cap_*.mp4 -o -name cap_*.webm -mtime +7 -exec rm {} \;
find
returns no error and the files are owned by me with permissions 644.
Any idea what could be causing this?
(note: I've cut the commands to make it more readable but normally there's no line break)
laurent
(2068 rep)
Sep 18, 2016, 02:46 PM
• Last activity: Aug 28, 2024, 01:18 PM
2
votes
1
answers
287
views
How can I get tput to fill the whole background without leaving a border?
I'm using bash in cygwin on a Windows laptop. I'd like to be able to change the background color of my terminal to green (actual color irrelevant) and to do that I can use either of these commands: 1. `tput setb 2; echo` 2. `printf '\e]11;#00FF00\a'` For more info on what that `printf` is doing, see...
I'm using bash in cygwin on a Windows laptop. I'd like to be able to change the background color of my terminal to green (actual color irrelevant) and to do that I can use either of these commands:
1.
The
but it does not change the area of the background that was set by
I can just use the
tput setb 2; echo
2. printf '\e]11;#00FF00\a'
For more info on what that printf
is doing, see [how-to-set-the-background-color-of-the-linux-console-screen](https://unix.stackexchange.com/questions/474502/how-to-set-the-background-color-of-the-linux-console-screen/474924#474924) and the specific use of 11
for background is documented on page 34 of https://invisible-island.net/xterm/ctlseqs/ctlseqs.pdf (Ps = 1 0 → Change VT100 text foreground color to Pt.
and Ps = 1 1 → Change VT100 text background color to Pt.
)
The printf
immediately changes the bacground of the whole terminal while the tput
just sets the color for what is typed next, hence the echo
to start on the next empty line, but I don't care much about that. What I do most care about is the following:
The tput
leaves a small border in the original background color (pale beige, set by the "Options" GUI I get by clicking on the top-left of the terminal) as can be seen in this image (the pale grey around the left/bottom of the image is my Windows desktop color):

printf
changes the color of the border (it's a lighter shade of green from tput
's but that's irrelevant):

tput
unless I first re-initialize what my original tput
did with tput init; echo
and then execute the printf
:

printf
to get what I want as long as I don't use tput setb
first but I'd prefer to **only** use tput setb
if I can for portability so - why is tput
leaving a small border of the existing background color and is there any way to tell tput
to set the background color in a way that does not leave that small border?
I'd also like to know if there's a way to have tput
set the whole terminal background immediately, as the printf
does, rather than after the next string I type, but that's not nearly as important as getting rid of that border.
Additional info now that [@MarcusMüller](https://unix.stackexchange.com/users/106650/marcus-m%c3%bcller) gave me the hint [in a comment](https://unix.stackexchange.com/questions/780532/how-can-i-get-tput-to-fill-the-whole-background-without-leaving-a-border?noredirect=1#comment1493703_780532) that this might be a mintty
issue -
I see this same behavior when I use git bash
from Windows on a different machine. They apparently both use mintty
as the terminal emulator. Since I have to log into many different Windows machines and use cygwin
or git bash
, I'd like to be able to solve this problem without having to change terminal emulator every time I use one of those machines (I'm not even sure if/how I could do that). In fact, if it came down to changing terminal emulator to solve the tput
problem, I'd just use the printf
approach instead.
I found at [set-border-width-for-mintty-window-on-cygwin-windows-10](https://stackoverflow.com/a/67448126/1745001) a way to control the border width from ~/.minttyrc
by setting the Padding
variable and if I update it to say:
Padding=0
then that does work around the above tput
problem but
1. That'd mean I'd have to change the .minttyrc
on every machine I log into and restart the terminal afterwards, and
2. When I open the "Options" GUI to change anything about the terminal then save it, it overwrites that .minttyrc
file and removes the Padding
setting
so I still would like to find some way to simply tell tput
to fill that "padding" area just like it does the rest of the background.
[@Vilinkameni](https://unix.stackexchange.com/users/367454/vilinkameni) also points out [in a comment](https://unix.stackexchange.com/questions/780532/how-can-i-get-tput-to-fill-the-whole-background-without-leaving-a-border#comment1493719_780532) that with the above tput
in a mintty
and MSYS2 MINGW64
terminal, any ANSI SGR color switching by a subsequent ls --color
or other command that uses colors will effectively reset the color again. That does not happen if I use the above printf
so I may ask about that in a subsequent question.
See also "Changing colours" towards the bottom https://code.google.com/archive/p/mintty/wikis/Tips.wiki#Changing_colours for more information on the above printf
and other things related to mintty
. My $TERM
value is xterm
.
Ed Morton
(35459 rep)
Jul 21, 2024, 12:32 PM
• Last activity: Jul 26, 2024, 11:46 AM
5
votes
1
answers
70
views
Is it normal for "complete -p git" to error until I autocomplete git first?
If I restart my terminal, I get an error when I type this: ``` $ complete -p git bash: complete: git: no completion specification ``` But if I type `git ` tab then run the `complete` command again, I get a different output: ``` $ complete -p git complete -o bashdefault -o default -o nospace -F __git...
If I restart my terminal, I get an error when I type this:
$ complete -p git
bash: complete: git: no completion specification
But if I type git
tab then run the complete
command again, I get a different output:
$ complete -p git
complete -o bashdefault -o default -o nospace -F __git_wrap__git_main git
Once the shell becomes interactive, should complete -p git
succeed on the first try, or is this working as designed?
---
For context, I'd like to call the __git_complete
function in my .bashrc/.bash_profile
to add autocompletion to my custom command , but it doesn't seem to exist until I autocomplete git
first.
Also, I'm using cygwin on a Windows 10 machine, but I'm more interested in knowing how complete -p git
works on other unix's.
Daniel Kaplan
(1070 rep)
Jul 14, 2024, 11:39 PM
• Last activity: Jul 15, 2024, 05:40 PM
-2
votes
1
answers
115
views
How to trim directory from which output without basename?
For a shell script I need to call an executable by name, regardless of the path leading there; thus far I know this code reports the right name: ``` tmpprog=`which program` prog=${tmpprog%%*/} if $prog="" then echo >&2 "Main Program not found" else echo >&2 "$prog" fi ``` How can I cut the code so t...
For a shell script I need to call an executable by name, regardless of the path leading there; thus far I know this code reports the right name:
tmpprog=which program
prog=${tmpprog%%*/}
if $prog=""
then
echo >&2 "Main Program not found"
else
echo >&2 "$prog"
fi
How can I cut the code so that I may trim the path to keep the executable name and remove the path in a one liner?
Beware: basename
won't do it, since I may be working on a hybrid environment (cygwin/busybox on windoze), and sometimes the paths have spaces.
jarnowy
(200 rep)
Jan 16, 2024, 02:14 AM
• Last activity: Apr 5, 2024, 08:31 AM
5
votes
4
answers
1707
views
How do I make WSL2's cd command accept windows paths?
I'm a WSL convert, coming from cygwin. One of the neat things cygwin does is accept unix *and* Windows file paths in the `cd` command. Of course, most Windows paths contain `\`, which is a special character in unix, but so long as you escape it, `cd`ing to Windows paths works as expected: `cd 'C:\Pr...
I'm a WSL convert, coming from cygwin. One of the neat things cygwin does is accept unix *and* Windows file paths in the
cd
command. Of course, most Windows paths contain \
, which is a special character in unix, but so long as you escape it, cd
ing to Windows paths works as expected: cd 'C:\Program Files'
will *C*hange your *D*irectory to /cygdrive/c/Program Files
1.
This isn't the case for WSL. cd 'C:\Program Files'
prints an error message: cd: no such file or directory: C:\Program Files
.
I like the cygwin functionality. **Is there a way of getting the same behavior when I use cd
in WSL?**
The solution could come in the form of installing a 3rd party tool (i.e., sudo apt install
), creating an alias, enabling some bind
or bindkey
in my shell, or writing my own shell script. So long as it allows me to use unix *and* Windows paths as a cd
argument, I'll be happy.
---
### Additional information
My distro is Ubuntu. I use zsh as my main shell but write shell scripts in bash. Ideally, the solution would work for both, but if that's not possible, I'd want a zsh solution.
I found this related question that may help people trying to answer mine: https://unix.stackexchange.com/questions/174182/cygwin-cd-to-windows-paths-easily
For those that don't use WSL but would like to help, it's worth knowing that WSL comes with a command named wslpath
. This is the closest thing I've found to official documentation , and this is its usage output:
➜ ~ wslpath
wslpath: Invalid argument
Usage:
-a force result to absolute path format
-u translate from a Windows path to a WSL path (default)
-w translate from a WSL path to a Windows path
-m translate from a WSL path to a Windows path, with '/' instead of '\'
EX: wslpath 'c:\users'
I'm already using this command in another script I wrote to open a directory/file in Windows from the WSL command line:
➜ ~ cat ~/bin/open
#! /bin/bash
set -x
arg="$*"
explorer.exe "$(wslpath -w "$arg")" # take a unix path and open it in Windows
1: cygwin's /cygdrive/c/
path is synonymous with WSL's /mnt/c
path.
Daniel Kaplan
(1070 rep)
Dec 21, 2023, 01:48 AM
• Last activity: Apr 5, 2024, 12:47 AM
Showing page 1 of 20 total questions