Unix & Linux Stack Exchange
Q&A for users of Linux, FreeBSD and other Unix-like operating systems
Latest Questions
1
votes
0
answers
51
views
rename "Duplicate specification" for option error
The other day something started going wrong with the perl `rename` terminal command that was pre-installed on my system; which is Ubuntu 22.04.5 LTS. When I try to use any version of the rename command I get the following message: Duplicate specification "V|version" for option "v" Duplicate specific...
The other day something started going wrong with the perl
rename
terminal command that was pre-installed on my system; which is Ubuntu 22.04.5 LTS. When I try to use any version of the rename command I get the following message:
Duplicate specification "V|version" for option "v"
Duplicate specification "E=s" for option "e"
By this I mean that any attempts at using rename, including simply rename -h
bring up this error. rename -h
will still print out the help information, which is as follows for my version of rename (2.02)
Duplicate specification "V|version" for option "v"
Duplicate specification "E=s" for option "e"
Usage:
rename [ -h|-m|-V ] [ -v ] [ -0 ] [ -n ] [ -f ] [ -d ] [ -u [enc]]
[ -e|-E perlexpr]*|perlexpr [ files ]
Options:
-v, --verbose
Verbose: print names of files successfully renamed.
-0, --null
Use \0 as record separator when reading from STDIN.
-n, --nono
No action: print names of files to be renamed, but don't rename.
-f, --force
Over write: allow existing files to be over-written.
--path, --fullpath
Rename full path: including any directory component. DEFAULT
-d, --filename, --nopath, --nofullpath
Do not rename directory: only rename filename component of path.
-h, --help
Help: print SYNOPSIS and OPTIONS.
-m, --man
Manual: print manual page.
-V, --version
Version: show version number.
-u, --unicode [encoding]
Treat filenames as perl (unicode) strings when running the
user-supplied code.
Decode/encode filenames using encoding, if present.
encoding is optional: if omitted, the next argument should be an
option starting with '-', for instance -e.
-e Expression: code to act on files name.
May be repeated to build up code (like "perl -e"). If no -e, the
first argument is used as code.
-E Statement: code to act on files name, as -e but terminated by
';'.
If I attempt any actuall usage of the program, even as simple as rename -n -s/\.txt//' *
the program stalls out and freezes after printing the error message.
As far as I have been able to find digging around for help and answers, the issue is apparently due to Getopt::Long
somehow ignoring case, despite the fact that File::Rename::Options
is meant to specifically turn on no_ignore_case
when it calls Getopt::Long
.
I have tried updating, upgrading, and cleaning apt
and apt-get
, purging and then reinstalling rename
, updating/upgrading Perl, along with basic computer updates and restarting. If anyone knows what is going on to cause this, or has a solution, I'd be extremely grateful.
Danae Stephens
(11 rep)
Jul 2, 2025, 07:52 PM
• Last activity: Jul 3, 2025, 06:05 PM
8
votes
1
answers
697
views
Configuration or command for case insensitive bash history search
Bash provides the interactive commands `forward-search-history` and `reverse-search-history` typically bound to the keys `CTRL-s` and `CTRL-r` respectively. Are there case-insentive equivalents or is there a configuration to have these commands case-insensitive? `bind -P | grep -iE 'search|case'` di...
Bash provides the interactive commands
forward-search-history
and reverse-search-history
typically bound to the keys CTRL-s
and CTRL-r
respectively.
Are there case-insentive equivalents or is there a configuration to have these commands case-insensitive?
bind -P | grep -iE 'search|case'
did not turn out anything relevant.
Harald
(1030 rep)
Jan 17, 2022, 07:53 AM
• Last activity: Dec 30, 2024, 06:28 AM
5
votes
2
answers
1704
views
How can I turn off git bash for Windows case-insensitive behavior?
I use the [Git Bash on Windows](https://gitforwindows.org/) for numerous bash tasks exceeding the Git use. It works well over years, but I cannot turn of the case-insensitive behavior. Auto-complete is cumbersome this way. I tried the flag ```lang-bash shopt -u nocasematch ``` in the `.bashrc` as de...
I use the [Git Bash on Windows](https://gitforwindows.org/) for numerous bash tasks exceeding the Git use. It works well over years, but I cannot turn of the case-insensitive behavior. Auto-complete is cumbersome this way.
I tried the flag
-bash
shopt -u nocasematch
in the .bashrc
as described [in solution #3](https://bash.cyberciti.biz/guide/Dealing_with_case_sensitive_pattern) but it does not resolve the issue.
Neither solution #1 or #2 are an option for what I am looking for, as I have aliases uppercase, directories mixed cases and some files all lowercase and it is too many cases to apply a case-map.
Is there any way to enable case-sensitive autocomplete in my non-default Linux shell?
Since it is a different flavor, I would appreciate some hints or suggestions.
spaceKelan
(57 rep)
Jul 4, 2023, 10:24 AM
• Last activity: Aug 8, 2024, 01:39 PM
1
votes
3
answers
126
views
Why does this Perl Regex one-liner not respect the \U escape sequence?
Why does this Perl Regex one-liner not make the full result upper case using the `\U` modifier? I expect `MY_NICE_WORD`. ```lang-console $ perl -pe 's/(? important case covered by this: HTTPHeader would not become h_t_t_p_header, rather `HTTP_Header` (or with upper case HTTP_HEADER)
Why does this Perl Regex one-liner not make the full result upper case using the
\U
modifier?
I expect MY_NICE_WORD
.
```lang-console
$ perl -pe 's/(? important case covered by this: HTTPHeader would not become h_t_t_p_header, rather HTTP_Header
(or with upper case HTTP_HEADER)
Jonathan Komar
(7034 rep)
Aug 2, 2024, 11:59 AM
• Last activity: Aug 4, 2024, 12:35 PM
1
votes
1
answers
1243
views
Format disk as HFS+, but case sensitive?
Linux can format an (external) disk as HFS+, e.g.: `apt-get install gparted hfsprogs`, then `gparted /dev/sdd`, rightclick on the partition to format, choose HFS+, click Apply, quit; `mount -t hfsplus /dev/sdd2 /mnt/foo`. But then you can't make both `/mnt/foo/xyzzy` and `/mnt/foo/XYZZY`, because gp...
Linux can format an (external) disk as HFS+, e.g.:
apt-get install gparted hfsprogs
, then
gparted /dev/sdd
, rightclick on the partition to format, choose HFS+, click Apply, quit; mount -t hfsplus /dev/sdd2 /mnt/foo
.
But then you can't make both /mnt/foo/xyzzy
and /mnt/foo/XYZZY
, because gparted used macOS's default option, case-insensitive. So copying files onto it from Linux causes all sorts of problems.
Can Linux format it as case sensitive?
Or must I plug the disk into a Mac to format it like that?
Related: https://apple.stackexchange.com/questions/334330/which-filesystems-support-symbolic-links
Camille Goudeseune
(385 rep)
Aug 21, 2018, 07:37 PM
• Last activity: Jul 23, 2024, 10:43 AM
2
votes
1
answers
87
views
Can we make an aptitude search case-sensitive?
In a script: aptitude search " ?description($1) " ... can that be made case-sensitive?
In a script:
aptitude search "?description($1)"... can that be made case-sensitive?
Ray Andrews
(2615 rep)
Apr 4, 2024, 03:34 PM
• Last activity: Apr 6, 2024, 03:54 PM
197
votes
6
answers
329833
views
How to uppercase the command line argument?
I searched SO and found that to uppercase a string following would work str="Some string" echo ${str^^} But I tried to do a similar thing on a command-line argument, which gave me the following error ### Tried #!/bin/bash ## Output echo ${1^^} ## line 3: ${1^^}: bad substitution echo {$1^^} ## No er...
I searched SO and found that to uppercase a string following would work
str="Some string"
echo ${str^^}
But I tried to do a similar thing on a command-line argument, which gave me the following error
### Tried
#!/bin/bash
## Output
echo ${1^^} ## line 3: ${1^^}: bad substitution
echo {$1^^} ## No error, but output was still smaller case i.e. no effect
How could we do this?
mtk
(28468 rep)
Oct 16, 2012, 12:27 PM
• Last activity: Feb 5, 2024, 08:33 PM
4
votes
0
answers
445
views
What causes tmux search to be case insensitive or casesensitive?
When I run a search in the copy paste mode of `tmux` sometimes it's case insensitive and other times it isn't. I think I know what I do, but I don't understand what causes the search to be case-insensitive or case-sensitive. I press CTRL+B,[ and then CTRL+s. And sometimes the search is case sensitiv...
When I run a search in the copy paste mode of
tmux
sometimes it's case insensitive and other times it isn't.
I think I know what I do, but I don't understand what causes the search to be case-insensitive or case-sensitive.
I press CTRL+B,[ and then CTRL+s.
And sometimes the search is case sensitive and other times it isn't.
It's possible I'm not doing what I think I'm doing. What causes this?
leeand00
(4937 rep)
Feb 5, 2024, 12:34 AM
11
votes
4
answers
51186
views
How can I find all lines containing two specified words, case-insensitively?
I need to check if two (specified) words exist on any line in a text file. There are no limits for the characters of the words. For example: I want to find lines of a text file that contain the two words “cat” and “elephant” together (i.e., on the same line; not necessarily side-by-side): Cat is sma...
I need to check if two (specified) words exist on any line in a text file. There are no limits for the characters of the words. For example:
I want to find lines of a text file that contain the two words “cat” and “elephant” together (i.e., on the same line;
not necessarily side-by-side):
Cat is smaller than elephant
Elephant is larger than cat
Cats are cute!
Elephants are very strong
Cat and elephants live in different environments
cats are friendly
In the previous examples, how can I find the lines containing both words?
Cat is smaller than elephant
Elephant is larger than cat
Cat and elephants live in different environments
I tried grep and awk with no hope. The problem is there are words that have upper and lower case, so how can I match for both words regardless of their letter status!?
user315982
Oct 16, 2018, 10:13 PM
• Last activity: Jan 16, 2024, 11:06 AM
0
votes
1
answers
142
views
Display the results in an alphabetical order, independently of their case
I am using `ls` on MacOS 11.6.1. In the output, the Upper cases are displayed before the lower case. For example, I get the following output: ``` $ ls Blabla.txt GAGAS.txt asdf.txt blabla.txt ``` and would like to have instead: ``` $ ls asdf.txt blabla.txt Blabla.txt GAGAS.txt ``` Is this the normal...
I am using
ls
on MacOS 11.6.1. In the output, the Upper cases are displayed before the lower case. For example, I get the following output:
$ ls
Blabla.txt
GAGAS.txt
asdf.txt
blabla.txt
and would like to have instead:
$ ls
asdf.txt
blabla.txt
Blabla.txt
GAGAS.txt
Is this the normal default output of ls
? How can I have the output number 2?
ecjb
(475 rep)
Nov 28, 2023, 10:57 AM
• Last activity: Nov 28, 2023, 01:47 PM
96
votes
6
answers
79289
views
less searches are always case-insensitive
Trying to find out how to use case-insensitive searches in `less` I found [this on serverfault][1]. That seems to perfectly answer my question. The problem is: It doesn't work like that here (OpenSUSE 13.1; less 458). I had aliased `less` to `less -WiNS` but I changed that. But even calling it as `c...
Trying to find out how to use case-insensitive searches in
less
I found this on serverfault .
That seems to perfectly answer my question. The problem is: It doesn't work like that here (OpenSUSE 13.1; less 458).
I had aliased less
to less -WiNS
but I changed that. But even calling it as command less file
does not change anything. I have checked with ps
that there is no -i
option in the command line any more.
As the answer says the less
help (pressing h
) states that I can use -i
within less
, too. If I use that once then less
tells me it had changed to case-insensitive search (that is kind of correct: nothing changes). If I use it twice then less
tells me it had turned to case-sensitive search. And right, then it works as it should from the start. Giving -i
twice on the command line does not work, though.
What's up here?
Hauke Laging
(93688 rep)
Feb 22, 2014, 01:51 PM
• Last activity: Nov 20, 2023, 11:24 AM
2
votes
2
answers
5010
views
case insensitivity with sed search
In a unix script, I have the line ```sed -i "/$1/s/a/b" filename``` This finds lines containing the string $1 (which is given to the script as a parameter) and, in those lines, replaces "a" with "b". I would like this to be case-insensitive with respect to $1. For example, if $1 is "foo", then I wan...
In a unix script, I have the line
-i "/$1/s/a/b" filename
This finds lines containing the string $1 (which is given to the script as a parameter) and, in those lines, replaces "a" with "b".
I would like this to be case-insensitive with respect to $1. For example, if $1 is "foo", then I want the replacement to happen in all lines containing "foo" or "FOO" or "Foo", etc. What is the best way to do this?
(Note: The original version of this post omitted the first forward slash in the code, which is important context for understanding Kusalananda's answer.)
WillO
(117 rep)
Oct 5, 2023, 10:44 PM
• Last activity: Oct 6, 2023, 01:31 PM
0
votes
0
answers
378
views
Is building the Linux kernel on a case-insensitive filesystem possible?
Linux kernel source has some overlapping filenames which would collapse when put on a case insensitive filesystem. Here is the list as of 6.4.7: - in `include/uapi/linux/netfilter/`: - `xt_CONNMARK.h` and `xt_connmark.h` - `xt_DSCP.h` and `xt_dscp.h` - `xt_MARK.h` and `xt_mark.h` - `xt_RATEEST.h` an...
Linux kernel source has some overlapping filenames which would collapse when put on a case insensitive filesystem. Here is the list as of 6.4.7:
- in
include/uapi/linux/netfilter/
:
- xt_CONNMARK.h
and xt_connmark.h
- xt_DSCP.h
and xt_dscp.h
- xt_MARK.h
and xt_mark.h
- xt_RATEEST.h
and xt_rateest.h
- xt_TCPMSS.h
and xt_tcpmss.h
- in include/uapi/linux/netfilter_ipv4/
:
- ipt_ECN.h
and ipt_ecn.h
- ipt_TTL.h
and ipt_ttl.h
- in include/uapi/linux/netfilter_ipv6/
:
- ip6t_HL.h
and ip6t_hl.h
- in net/netfilter/
:
- xt_DSCP.c
and xt_dscp.c
- xt_HL.c
and xt_hl.c
- xt_RATEEST.c
and xt_rateest.c
- xt_TCPMSS.c
and xt_tcpmss.c
- in tools/memory-model/litmus-tests/
:
- Z6.0+pooncelock+poonceLock+pombonce.litmus
and Z6.0+pooncelock+pooncelock+pombonce.litmus
After the source tree is populated in a case-insensitive filesystem, one file from each of these pairs will overwrite the other. Obviously, it would not be possible to build the Linux kernel with netfilter enabled. Even if both versions of the files are saved under different names and the source modified to acknowledge these renames, the API would be broken, and who wants that?
Would it be possible to build the Linux kernel without netfilter support? What other challenges might arise in the process?
tpimh
(367 rep)
Aug 2, 2023, 10:10 AM
7
votes
3
answers
3032
views
How to change the casefold ext4 filesystem option of the root partition, if I only have ssh access
I need to enable the case insensitive filesystem feature (casefold) on ext4 of a Debian 11 server with a backported 6.1 linux kernel with the required options compiled in. The server has a swap partition of 2GB and a big ext4 partition for the filesystem, which it also boots from. I only have ssh ac...
I need to enable the case insensitive filesystem feature (casefold) on ext4 of a Debian 11 server with a backported 6.1 linux kernel with the required options compiled in.
The server has a swap partition of 2GB and a big ext4 partition for the filesystem, which it also boots from. I only have ssh access as root and cannot access the physial/virtual host itself, so I don't have access to (virtual) usb sticks or cdrom media.
What is the fastest way to enable the casefold feature? tune2fs doesn't want to do it because the fileystem is mounted.
Idea: Drop the swap, install a small rescue system in it, reboot into said rescue system, change the filesystem options of the root partition, reboot into the live partition and restore the swap. For this to work however I need to prepare an extra linux system just to do the tune2fs command needed.
Is there a better way? Any rescue systems I can already use and preconfigure for the required network settings after a reboot?
Daniel
(798 rep)
May 29, 2023, 08:11 AM
• Last activity: May 31, 2023, 07:16 AM
6
votes
1
answers
5923
views
How to enable new in kernel 5.2 case-insensitivity for ext4 on a given directory?
I saw that kernel 5.2 got handling of ext4 case-insensitivity per directory by flipping a `+F` bit in inode. > This EXT4 case-insensitive file-name lookup feature works on a > per-directory basis when an empty directory is enabled by flipping the > +F inode attribute. https://www.phoronix.com/scan.p...
I saw that kernel 5.2 got handling of ext4 case-insensitivity per directory by flipping a
+F
bit in inode.
> This EXT4 case-insensitive file-name lookup feature works on a
> per-directory basis when an empty directory is enabled by flipping the
> +F inode attribute.
https://www.phoronix.com/scan.php?page=news_item&px=EXT4-Case-Insensitive-Linux-5.2
But how to do that? Does any chmod handle that? My distributions doesn't look like it.
So how do I use this feature?
Krzysztof Krasoń
(205 rep)
Dec 26, 2019, 07:20 AM
• Last activity: May 29, 2023, 09:07 AM
0
votes
1
answers
280
views
Can you emulate Windows filesystem case semantics with ntfs-3g?
With NTFS on a Windows machine if you create a directory "ABC" and then try to create a directory "abc" it will be rejected because Windows considers it the same name. Now on Linux the standard ntfs-3g filesystem doesn't suffer this (NTFS, itself, allows for both... it's just Windows doesn't). I've...
With NTFS on a Windows machine if you create a directory "ABC" and then try to create a directory "abc" it will be rejected because Windows considers it the same name.
Now on Linux the standard ntfs-3g filesystem doesn't suffer this (NTFS, itself, allows for both... it's just Windows doesn't).
I've found that
-t lowntfs-3g -o ignore_case
will produce the error, but it does this by forcing everything to lower case. mkdir ABC
results in abc
.
Is there a way of using NTFS on Linux that follows what Windows would do? Retains the case for display purposes, but acts case insensitive for operations?
Stephen Harris
(49069 rep)
May 1, 2023, 01:18 AM
• Last activity: May 1, 2023, 05:31 AM
2
votes
1
answers
1727
views
How do I view the case-sensitive file names of iso9660/Joliet+UCS-3 volumes?
I have an ISO that I am trying to use to install software via Wine. I have the ISO mounted as a loopback device. The Windows installer keeps complaining that it cannot locate particular CAB files and it asks me to locate them. The file name that the installer software asks me to locate has mixed cas...
I have an ISO that I am trying to use to install software via Wine. I have the ISO mounted as a loopback device. The Windows installer keeps complaining that it cannot locate particular CAB files and it asks me to locate them. The file name that the installer software asks me to locate has mixed case, but when I mount the ISO under Linux all directory listings show the files as being all lowercase. If I set
-o check=relaxed
when I mount the iso, then I can ask for files in mixed case and Linux will 'find' them. But if I do a directory listing I still get all lowercase.
I guess the Windows installer package is either doing a directory listing or for whatever reason it is getting an all-lower-case version of the filename it is expecting.
I am thinking there are several paths forward:
1. Get Linux to show the mixed-case filenames as they are encoded in the Joliet extension
2. Extract the ISO into a native Linux filesystem in a way that preserves the original casing
3. Find a copy of Windows and use that to copy the files to a Windows native file system that Linux can also read and is case sensitive (NTFS).
4. Something involving Wine.
Some example commands:
% isoinfo -d -i example.iso
...
Joliet with UCS level 3 found
NO Rock Ridge present
% # When using isoinfo, filenames are all caps
% isoinfo -f -i example.iso
DIRNAME/DIRNAME/LONG_FILE_NAME.CAB
% # When using ls, filenames are all lowercase
% ls /mnt/iso/dirname/dirname
long_file_name.cab
Huckle
(1087 rep)
May 11, 2016, 04:16 AM
• Last activity: Aug 5, 2022, 07:47 AM
8
votes
2
answers
33333
views
bash - case-insensitive matching of variable
This syntax prints "linux" when variable equals "no": [[ $LINUX_CONF = no ]] && echo "linux" How would I use regular expressions (or similar) in order to make the comparison case insensitive?
This syntax prints "linux" when variable equals "no":
[[ $LINUX_CONF = no ]] && echo "linux"
How would I use regular expressions (or similar) in order to make the comparison case insensitive?
yael
(13936 rep)
Oct 2, 2017, 04:09 PM
• Last activity: Mar 22, 2022, 07:22 PM
3
votes
1
answers
1232
views
Are systemd directive names case sensitive?
systemd directives used in the unit files are in [the documentation](https://www.freedesktop.org/software/systemd/man/systemd.directives.html) listed using mixed case like `UMask` or `AccuracySec`. Is it actually necessary to follow this exact wording, or is it just good practice, but the parsing is...
systemd directives used in the unit files are in [the documentation](https://www.freedesktop.org/software/systemd/man/systemd.directives.html) listed using mixed case like
UMask
or AccuracySec
. Is it actually necessary to follow this exact wording, or is it just good practice, but the parsing is actually case insensitive? I could not find anything neither in [the documentation](https://www.freedesktop.org/software/systemd/man/index.html) nor in [the source code](https://github.com/systemd/systemd) .
To be more specific. This is an example Drop-In overriding the UMask
value:
[Service]
UMask=0027
Would the UMask
directive be correctly read if written with different case?
[Service]
umask=0027
Using UMask
as an example, because as far as I know the systemd directive name is the only place where the term is capitalized like this. The UNIX command name is umask
in all lowercase, which is not surprising. Even the systemd [documentation](https://www.freedesktop.org/software/systemd/man/systemd.exec.html#UMask=) spells the term when it’s not a command name in all lowercase.
> … The per-user **umask** may also be set via …
Glutexo
(171 rep)
Jan 21, 2022, 04:44 PM
8
votes
1
answers
8894
views
Case-insensitive completion in bash
I have a folder `~/TestFolder`. The current working directory is the home directory(`~`). I want to enter a partial command, for example `cd test`, and I want it auto filled to give the command `cd TestFolder` upon pressing Tab. How can I achieve this?
I have a folder
~/TestFolder
. The current working directory is the home directory(~
).
I want to enter a partial command, for example cd test
, and I want it auto filled to give the command cd TestFolder
upon pressing Tab.
How can I achieve this?
George Do.
(81 rep)
Jan 5, 2022, 10:05 AM
• Last activity: Jan 15, 2022, 03:05 PM
Showing page 1 of 20 total questions