The ls command may be used in conjunction with grep to list files that start with an uppercase letter or have an uppercase filename.
┌──(john㉿DESKTOP-PF01IEE)-[~/Documents] └─$ ls | grep "^[A-Z]" Boomsrc Hope is the good thing(The Shawshank Redemption 1994). [JAmspaaSNzE].f140.m4a Hope is the good thing(The Shawshank Redemption 1994). [JAmspaaSNzE].f160.mp4 Hope is the good thing(The Shawshank Redemption 1994). [JAmspaaSNzE].mp4 The Delta Flyer is Attacked by the Borg Cube [Bpunt6Ffl3c].3gp The Delta Flyer is Attacked by the Borg Cube [Bpunt6Ffl3c].webm Wallpaper |
Another way to do this is with this one-liner, this will do this admirably.
┌──(john㉿DESKTOP-PF01IEE)-[~/Documents] └─$ ls -dlaH /home/john/Documents/*[[:upper:]]* drwxr-xr-x 3 john john 4096 Sep 22 08:22 /home/john/Documents/Boomsrc -rw-r--r-- 1 john john 4017633 Nov 8 2018 '/home/john/Documents/Hope is the good thing(The Shawshank Redemption 1994). [JAmspaaSNzE].f140.m4a' -rw-r--r-- 1 john john 2010731 Nov 8 2018 '/home/john/Documents/Hope is the good thing(The Shawshank Redemption 1994). [JAmspaaSNzE].f160.mp4' -rw-r--r-- 1 john john 6089523 Nov 8 2018 '/home/john/Documents/Hope is the good thing(The Shawshank Redemption 1994). [JAmspaaSNzE].mp4' -rw-r--r-- 1 john john 1906983 Aug 7 02:23 '/home/john/Documents/The Delta Flyer is Attacked by the Borg Cube [Bpunt6Ffl3c].3gp' -rw-r--r-- 1 john john 3808743 Aug 7 02:20 '/home/john/Documents/The Delta Flyer is Attacked by the Borg Cube [Bpunt6Ffl3c].webm' drwxrwxrwx 2 john john 20480 May 30 09:16 /home/john/Documents/Wallpaper |
This is not too hard to do at all.
And yet another example.
┌──(john㉿DESKTOP-PF01IEE)-[~/Documents] └─$ ls -lHd -- *[[:upper:]]* drwxr-xr-x 3 john john 4096 Sep 22 08:22 Boomsrc -rw-r--r-- 1 john john 4017633 Nov 8 2018 'Hope is the good thing(The Shawshank Redemption 1994). [JAmspaaSNzE].f140.m4a' -rw-r--r-- 1 john john 2010731 Nov 8 2018 'Hope is the good thing(The Shawshank Redemption 1994). [JAmspaaSNzE].f160.mp4' -rw-r--r-- 1 john john 6089523 Nov 8 2018 'Hope is the good thing(The Shawshank Redemption 1994). [JAmspaaSNzE].mp4' -rw-r--r-- 1 john john 1906983 Aug 7 02:23 'The Delta Flyer is Attacked by the Borg Cube [Bpunt6Ffl3c].3gp' -rw-r--r-- 1 john john 3808743 Aug 7 02:20 'The Delta Flyer is Attacked by the Borg Cube [Bpunt6Ffl3c].webm' drwxrwxrwx 2 john john 20480 May 30 09:16 Wallpaper |
There are a few ways to list files with uppercase characters in the filenames, but this should really help out. It is a very useful tip.
To list all words in the /usr/share/dict/words file that can be spelled with the letters A to F, use the command below. This prints them all in upper case.
┌──[jason@11000000.10101000.00000001.00000010]─[~] └──╼ ╼ $ grep -iP '^[a-eosi]{3,}+$' /usr/share/dict/words | tr [:lower:] [:upper:] AAA ABC ABCS AIDS AIS ASCII ASCIIS ABBAS ABBASID ABE ACADIA ADA ADAS ADDIE ADIDAS AIDA ASIA ASSAD ASSISI |
can u show me how to list files that contain an uppercase character please?