33
votes
Accepted
What does “Case sensitivity is a function of the Linux filesystem not the Linux operating system” mean?
Here, you're running:
ls te*
Using a feature of your shell called globbing or filename generation (pathname expansion in POSIX), not of the Linux system nor of any filesystem used on Linux.
te* is ...
22
votes
Accepted
bash - case-insensitive matching of variable
Standard sh
No need to use that ksh-style [[...]] command, you can use the standard sh case construct here:
case $LINUX_CONF in
([Nn][Oo]) echo linux;;
(*) echo not linux;;
esac
Or naming ...
21
votes
less searches are always case-insensitive
You can start less and ignore case by passing the -i option. This ignores case unless the search string has an upper-case character. Here is the summary on less from the Ubuntu help page:
-i or --...
18
votes
What does “Case sensitivity is a function of the Linux filesystem not the Linux operating system” mean?
As Vojtech explained, NTFS is case sensitive. Trying it on a FAT file system will work, but only if you use a case-folding variant, i.e. msdos on Linux (I don’t know if there’s an equivalent on WSL). ...
13
votes
How to change the casefold ext4 filesystem option of the root partition, if I only have ssh access
Thanks to @Marcus Müller I was able to do it. The trick is to add tune2fs into the initrd image and to call it during boot.
Create the script for initramfs-utils:
cat > /usr/share/initramfs-tools/...
12
votes
less searches are always case-insensitive
Quick guide in 2 steps:
Do your search:
:/put search lowercase word here after slash
Then after all the case sensitive matches are highlighted:
:-i
This will highlight all matches regardless of case....
10
votes
How to uppercase the command line argument?
Alternatively, you could switch to ksh or zsh which have had case conversion support for decades (long before bash's ${var^^} added in 4.0), though with a different syntax:
#! /bin/ksh -
typeset -u ...
10
votes
Accepted
How to enable new in kernel 5.2 case-insensitivity for ext4 on a given directory?
First you need recent enough software:
Linux kernel >= 5.2 for the kernel-side support in EXT4
userland tools: e2fsprogs >= 1.45 (eg: on Debian 10 which ships only version 1.44 this requires ...
10
votes
What does “Case sensitivity is a function of the Linux filesystem not the Linux operating system” mean?
That's because NTFS is also case sensitive, but Windows hides it from users. FAT is case insensitive, you can check by trying to create test and Test directories in the same directory:
$ ls
test
$ ...
10
votes
Case-insensitive completion in bash
Bash
Add the following to your ~/.bashrc-file:
bind -s 'set completion-ignore-case on'
This enables case-insensitive completion in bash, as explained by Gilles' answer in
How to make cd arguments case ...
10
votes
Accepted
How to change the casefold ext4 filesystem option of the root partition, if I only have ssh access
I like your approach; it's clean in that it doesn't require modification of the data on your main system.
And, yes, I think that if you want to run tune2fs then by a large margin, the easiest solution ...
9
votes
less searches are always case-insensitive
You can pass parameter to the less command when you open your file, and all your searches will be case insensitive.
$ less -i <file_name>
or you can modify your .bashrc file so it your less ...
9
votes
Accepted
Using wildcard in 'ls' command to find files containing uppercase letters only
[A-Z] doesn't mean upper case. It means letters from A to Z, which may include lower-case letters. Usually you should use [[:upper:]] instead. (This works in Bash even without extglob.)
What ...
9
votes
Accepted
convert only the first column in a file to lower case
Here's a simple approach:
$ awk -F'[ ]' '{$1=tolower($1)}1' file
mumdfw2as123v USER=wladmin MOUNTPOINT=/apps
mumfw2as97v.mrshmc.com USER=wladmin ...
7
votes
How can I find all lines containing two specified words, case-insensitively?
$ grep -Fiw cat <file | grep -Fiw elephant
Cat is smaller than elephant
Elephant is larger than cat
We first extract all lines from the file file that contains the word cat and then narrow down ...
5
votes
Ignore case in Find command
find "$file_dir1" "$file_dir2" \
-name '[sS][eE][aA][rR][cC][hH][pP][aA][tT][tT][eE][rR][nN]*'
That is we replace letters like x with the [xX] bracket expression which matches on either x or X, ...
5
votes
Case insensitive directory search?
In bash:
shopt -s nullglob nocaseglob
set -- [a]bc/
if [ "$#" -gt 0 ]; then
echo 'There is at least one directory called "abc" (case ignored):'
printf '\t%s\n' "$@&...
5
votes
awk case insensitive with gsub
This is an attempt at answering the original version of the question. The requirements have changed since.
That's one thing the GNU implementation of sed is good at:
$ sed -E 's/(^|\s)(son|daughter|...
4
votes
How can I find all lines containing two specified words, case-insensitively?
with GNU sed:
sed -n '/cat/I {/elephant/I p}' file
or perl
perl -ne 'print if /cat/i and /elephant/i' file
or a single grep
grep -i -e 'cat.*elephant' -e 'elephant.*cat' file
4
votes
case insensitive, list files in directory, ending in .jpg
Note that it's not ls that expands wildcards, it's the shell.
bash can make all its globs case insensitive with the nocaseglob option, but contrary to ksh93 or zsh doesn't have a glob operator for ...
4
votes
case insensitive, list files in directory, ending in .jpg
Short answer
No. But then ls does not have a way to list file ending .jpg case sensitive or note. It is the shell that converts the *.jpg into a list of files, and passes this list to ls. Try echo *....
4
votes
Accepted
Is it possible to disable ext4 case sensitivity?
There are patches currently under development to implement case insensitivity for ext4.
https://lwn.net/Articles/762826/
https://marc.info/?l=linux-ext4&m=154430575726827&w=2
They were ...
4
votes
Using regular expressions in "less"
Pretty sure you can get around that by using -i or +i in order to set less to default.
4
votes
Accepted
Create a folder with all possible combinations of characters and numbers
With shells with csh-style brace-expansion support:
mkdir example.{t,T}{x,X}{t,T}
With zsh, you can shorten it to:
mkdir example.{tT}{xX}{tT}
if you enable the braceccl option (which I wouldn't ...
4
votes
awk case insensitive with gsub
One way (will work in all the awk implementations) would be to lowercase the second column but uppercase the only first character; then check if the contents of those were matched, then update the ...
4
votes
Accepted
awk case insensitive with gsub
I'd use a hash lookup instead of a regexp comparison and *sub() for efficiency and robustness (in case you decide to use a string that contains regexp metachars or backreferences or can be a substring ...
4
votes
Accepted
zsh case-insensitive globbing
Especially for your case where the glob is $top/**/*.jpg, I would not turn the caseglob option off (same as turning nocaseglob on¹) globally, as that affects all path components in glob patterns:
$ ...
4
votes
Are systemd directive names case sensitive?
Yes, the directive names are case sensitive.
tl;dr
You can empirically check this by setting the value and then running systemctl show to list all directives set for the unit.
The default state ...
4
votes
Accepted
How can I turn off git bash for Windows case-insensitive behavior?
You need to revert two settings, nocaseglob and nocasematch:
The documentation (man bash) writes,
nocaseglob If set,bash matches filenames in a case-insensitive fashion when performing pathname ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
case-sensitivity × 72bash × 14
linux × 8
filenames × 7
shell-script × 6
grep × 5
filesystems × 5
find × 5
shell × 4
awk × 4
zsh × 4
ls × 4
wildcards × 4
sort × 4
sed × 3
files × 3
regular-expression × 3
rename × 3
ext4 × 3
macos × 3
autocomplete × 3
string × 3
less × 3
hfs+ × 3
text-processing × 2