Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »

Activity for alx‭

Type On... Excerpt Status Date
Edit Post #290009 Post edited:
Find only files
7 months ago
Edit Post #290009 Post edited:
7 months ago
Edit Post #290009 Initial revision 7 months ago
Answer A: Rename multiple files which have a variable suffix
```sh find . -type f -print0 \ | grep -z -- '-min.jpg-[[:alnum:]]$' \ | while IFS= read -r -d '' f; do find "$f" -print0 \ | sed -z 's/-min.jpg-[[:alnum:]]$/-min.jpg/' \ | xargs -0 mv "$f"; done; ``` Or, if you prefer a one-liner: ```sh find . -type f -print0 | grep -z -- '...
(more)
7 months ago
Edit Post #289999 Post edited:
7 months ago
Edit Post #289999 Post edited:
7 months ago
Edit Post #289999 Post edited:
7 months ago
Edit Post #289999 Post edited:
7 months ago
Edit Post #289999 Initial revision 7 months ago
Answer A: How to run a command on a list of files?
In some cases, when you want to apply a pipeline or a complex command to each file, I find it useful to use `while read`: ```sh find . -type d \ | while read d; do find $d -type f -maxdepth 1 \ | head -n3; done; ``` Hardened version: ```sh find . -type d -print0 \ | while IFS= read -...
(more)
7 months ago
Comment Post #288436 `generate_lists | xargs some_program` works just as well, and it can pack several arguments into a single program invocation, being faster. In fact, find(1) is just a special case of `generate_lists`, so xargs(1) works in both cases better (the syntax is way simpler).
(more)
7 months ago
Comment Post #289936 Step 2 is conflating two functions: - Finding all files in every dir. - Filtering the previous step to just keep the first 3. The former should be `find $dir -type f -maxdepth 1`. The latter should be `head -n3`, maybe coupled with a `sort`, depending on what we understand by "first".
(more)
7 months ago
Comment Post #289936 ```sh $ dpkg -l | grep -e moreutils -e fd-find ii fd-find 8.7.0-3+b1 amd64 Simple, fast and user-friendly alternative to find ii moreutils 0.67-1 amd64 addition...
(more)
7 months ago
Comment Post #289936 ```sh $ find . ./l1 ./l1/l2 ./l1/l2/f2 ./l1/l2/f5 ./l1/l2/f4 ./l1/l2/d0 ./l1/l2/d0/f2 ./l1/l2/d0/f5 ./l1/l2/d0/f4 ./l1/l2/d0/f3 ./l1/l2/d0/f1 ./l1/l2/d0/f0 ./l1/l2/f3 ./l1/l2/d5 ./l1/l2/d5/f2 ./l1/l2/d5/f5 ./l1/l2/d5/f4 ./l1/l2/d5/f3 ./l1/l2/d5/f1 ./l1/l2/d5/f0 ./l1/l2/d4 ./l1...
(more)
7 months ago
Comment Post #289899 Thanks! That makes sense.
(more)
7 months ago
Edit Post #289933 Post edited:
remove superfluous sort
7 months ago
Edit Post #289933 Post edited:
oops; we need to sort before head(1).
7 months ago
Edit Post #289933 Post edited:
sort last
7 months ago
Edit Post #289934 Post edited:
7 months ago
Edit Post #289934 Post edited:
7 months ago
Edit Post #289934 Post edited:
7 months ago
Edit Post #289934 Post edited:
7 months ago
Edit Post #289934 Post edited:
7 months ago
Edit Post #289934 Post edited:
7 months ago
Edit Post #289934 Post edited:
7 months ago
Edit Post #289934 Initial revision 7 months ago
Answer A: How to identify and separate standalone applications from libraries in Linux package lists?
This answer is not directly usable under Arch, since I don't know the tools there. I show you a way to do it on Debian, which may inspire you to find a similar way in Arch. With apt-file(1), you can list the files that a package provides. From that list, you can see if the package provides files...
(more)
7 months ago
Edit Post #289933 Post edited:
7 months ago
Edit Post #289933 Post edited:
7 months ago
Edit Post #289933 Post edited:
7 months ago
Edit Post #289933 Post edited:
7 months ago
Edit Post #289933 Post edited:
7 months ago
Edit Post #289933 Post edited:
7 months ago
Edit Post #289933 Post edited:
7 months ago
Edit Post #289933 Initial revision 7 months ago
Answer A: How to list the first x files in each directory
Here's my approach: ```sh find l1 -type d \ | while read d; do find $d -maxdepth 1 -type f \ | head -n3; done; ``` If your middle directories also contain files, it will also show them (of course, only the first 3). This is what it shows for me in a tree similar to yours, where I add...
(more)
7 months ago
Edit Post #289931 Post edited:
7 months ago
Edit Post #289931 Post edited:
7 months ago
Edit Post #289931 Post edited:
7 months ago
Edit Post #289931 Post edited:
7 months ago
Edit Post #289931 Post edited:
7 months ago
Edit Post #289931 Post edited:
7 months ago
Edit Post #289931 Post edited:
7 months ago
Edit Post #289931 Post edited:
7 months ago
Edit Post #289931 Post edited:
7 months ago
Edit Post #289931 Post edited:
7 months ago
Edit Post #289931 Post edited:
7 months ago
Edit Post #289931 Post edited:
7 months ago
Edit Post #289931 Post undeleted 7 months ago
Edit Post #289931 Post deleted 7 months ago