General statistics
List of Youtube channels
Youtube commenter search
Distinguished comments
About
Lawrence D’Oliveiro
DistroTube
comments
Comments by "Lawrence D’Oliveiro" (@lawrencedoliveiro9104) on "File Globbing In Linux" video.
Sometimes you need to feed the files to a command one at a time. This works with bash: for i in {1..10}; do echo file${i}.txt; done Sometimes you need leading zeroes on the numbers. This also works with bash: for i in {01..10}; do echo file${i}.txt; done If you are using a more minimal shell (e.g. dash) that doesn’t do “{..}” pattern expansion, there is always the “seq” command: for i in $(seq 1 10); do echo file${i}.txt ; done If you want the leading zeroes, seq won’t do them, so try the “printf” command: for i in $(seq 1 10); do echo file$(printf %02d ${i}).txt ; done
6
7:10 If you want to use regexes to match file names, you can do so with the “find” command. That’s a very useful command, by the way; worth doing an episode on, I think.
2
I use “find -exec” all the time.
1
@___9136 That’s for acting on the results of the find. -exec is useful for applying a custom filter.
1
I like to use the xscreensaver package: https://packages.debian.org/buster/xscreensaver
1
The name dates from UNIX. Linux inherited a lot of old UNIX culture.
1
“!” being POSIX is more likely to be supported by other shells besides Bash.
1
@___9136 dash seems to be a good, minimal, POSIX-compliant shell. Nobody should be using tcsh or csh-derivative shells any more.
1
That’s not the way I pronounce it.
1
As an exercise, how would you write a wildcard to match dotfiles in your home directory? These are the various files/directories containing user preferences for apps that you run. Their names begin with a dot, so they are normally excluded from directory listings. However, if you type something like “ls -ld ~/.*”, it will also show the useless “.” and “..” entries that clutter every Unix/Linux directory. How do you exclude these? The answer is: ls -ld ~/.[!.]*
1
@serge5046 That won’t work if you just want directories, though: du -ks ~/.[!.]*/
1
Hint: the “reg” in “regex” is short for for “regular”.
1