Author Topic: Simplicity of Linux  (Read 35325 times)

Offline Rotten Johnny

Re: Simplicity of Linux
« Reply #105 on: September 22, 2018, 02:18:44 PM »
Mount an EXT3/4 drive read only, ensuring that filesystem journal is unaltered i.e. the read only mount is really a read-only mount, not just preventing user writes.
 
Code: [Select]
mount -t ext4 -o ro,noload /dev/blockdev /mnt/fiddle
I like beautiful melodies telling me terrible things -- Tom Waits

Free your mind...and your ass will follow.

Offline rorz0r

Re: Simplicity of Linux
« Reply #106 on: September 23, 2018, 11:58:04 AM »
Not to get onto the "Linux vs windows" thing but windows 10 now has a "windows subsystem for Linux" where they've basically mapped most of the Linux kernel operations to the windows kernel and done a bit of interop. You can basically just search the windows store for Linux and install whatever flavour you like. Basically it's a really easy way for a windows user to run most of the tools mentioned in this thread. A lot more convenient than dual booting and a lot more lightweight than VMs.

Sent from my SM-G950F using Tapatalk


Offline Rotten Johnny

Re: Simplicity of Linux
« Reply #107 on: September 25, 2018, 12:04:10 AM »
List all directories that contain a sub-directory

Code: [Select]
find ${base:-.} -type d | sed 's%/[^/]*$%%' | sort -u
I like beautiful melodies telling me terrible things -- Tom Waits

Free your mind...and your ass will follow.

Offline Rotten Johnny

Re: Simplicity of Linux
« Reply #108 on: December 24, 2018, 08:10:33 AM »
Embedding album art in FLAC media

My DAP doesn't display album art unless it's embedded in the media...

If you've got your albums stored in discrete folders and each folder contains folder.jpg, embed it in the individual FLAC files is as follows:
Code: [Select]
find . -name "*.flac" -type f -execdir metaflac --import-picture-from="folder.jpg" --show-tag="Title" {} \;
Similarly, removing said file:
Code: [Select]
find . -name "*.flac" -type f -execdir metaflac --remove --block-type=PICTURE {} \;
I like beautiful melodies telling me terrible things -- Tom Waits

Free your mind...and your ass will follow.

Offline Rotten Johnny

Re: Simplicity of Linux
« Reply #109 on: December 28, 2018, 12:33:37 PM »
Get a list of the sub-directories that contain one or more files whose name matches a particular pattern

Code: [Select]
find . -type f -name '*.flac' -printf '%h\0' | sort -zu | sed -z 's/$/\n/'
Replace *.flac with your poison.
I like beautiful melodies telling me terrible things -- Tom Waits

Free your mind...and your ass will follow.

Offline Rotten Johnny

Re: Simplicity of Linux
« Reply #110 on: December 28, 2018, 12:51:37 PM »
Get a list of the sub-directories that contain one or more files whose name matches a particular pattern and include the number of matching files:

Code: [Select]
#!/bin/bash
find . -type d | while read foldername; do
filecount=$(find "${foldername}" -type f -name '*.flac' | wc -l)
if test $filecount -gt 0
then
echo "${filecount} ${foldername}"
fi
done
« Last Edit: December 28, 2018, 11:53:25 PM by Rotten Johnny »
I like beautiful melodies telling me terrible things -- Tom Waits

Free your mind...and your ass will follow.

Offline Rotten Johnny

Re: Simplicity of Linux
« Reply #111 on: December 29, 2018, 01:07:03 AM »
Pull the md5sum of all FLAC files in a folder tree and append same to a text file

Code: [Select]
find -type f -name \*.flac -print0 | xargs -0 -n1 metaflac --with-filename --show-md5sum >> md5sums.txt

It'll generate a text file that looks something like this which is then easily pulled into a table to enable duplicate tracks to be found across your files:
Code: [Select]
./flaclib/B/Beth Orton - Kidsticks/01-Snow.flac:db08387254688d6c8b8043e5fd916fc4
./flaclib/B/Beth Orton - Kidsticks/02-Moon.flac:cc53b82c47e5d9463a09049defa7f241
./flaclib/B/Beth Orton - Kidsticks/03-Petals.flac:44be22679525000b335492a3f9244283
./flaclib/B/Beth Orton - Kidsticks/04-1973.flac:bfb97b9dc3d9c401b7e6772825afd044
./flaclib/B/Beth Orton - Kidsticks/05-Wave.flac:140428be1417050ca2959bb6a6d5c2ad
./flaclib/B/Beth Orton - Kidsticks/06-Dawnstar.flac:49d08bba73ae526874f022c163ea292b
./flaclib/B/Beth Orton - Kidsticks/07-Falling.flac:2119c0470d3bc77dc7a732b2f1e3653b
./flaclib/B/Beth Orton - Kidsticks/08-Corduroy Legs.flac:e57c2a83bf9914b07ce2a63e8d478a32
./flaclib/B/Beth Orton - Kidsticks/10-Kidsticks.flac:3b2f96afc30ee53cfeb5b781a79fdc15
./flaclib/B/Beth Orton - Kidsticks/09-Flesh and Blood.flac:042dc117ff9e00e0fae09b7d30b7283a
« Last Edit: January 20, 2019, 02:29:54 AM by Rotten Johnny »
I like beautiful melodies telling me terrible things -- Tom Waits

Free your mind...and your ass will follow.

Offline Rotten Johnny

Re: Simplicity of Linux
« Reply #112 on: December 29, 2018, 11:58:43 AM »
Replace a newline (\n) using sed

Code: [Select]
sed ':a;N;$!ba;s/\n/INSERT_REPLACEMENT_STRING_HERE/g' source_file > target_file
I like beautiful melodies telling me terrible things -- Tom Waits

Free your mind...and your ass will follow.

Offline Rotten Johnny

Re: Simplicity of Linux
« Reply #113 on: January 06, 2019, 10:19:17 AM »
Recursively delete empty sub-directories within current directory tree

Code: [Select]
find . -type d -empty -delete
I like beautiful melodies telling me terrible things -- Tom Waits

Free your mind...and your ass will follow.

Offline Rotten Johnny

Re: Simplicity of Linux
« Reply #114 on: January 16, 2019, 08:00:44 PM »
Delete all files having a specific extension where the filename does not begin with the digits 0-9:

Code: [Select]
find . -name "[^0-9]*.flac" -type f -exec rm {} \;
I like beautiful melodies telling me terrible things -- Tom Waits

Free your mind...and your ass will follow.

Offline Rotten Johnny

Re: Simplicity of Linux
« Reply #115 on: January 20, 2019, 10:39:29 PM »
Update all github repos

Code: [Select]
find . -type d -name .git -exec sh -c "cd \"{}\"/../ && pwd && git pull" \;
I like beautiful melodies telling me terrible things -- Tom Waits

Free your mind...and your ass will follow.

Offline Rotten Johnny

Re: Simplicity of Linux
« Reply #116 on: January 21, 2019, 11:04:39 AM »
Rename and move all files stored in CD1, CD2, CDx subfolders to ../x-filename

Run this from the parent folder you're looking to process:
Code: [Select]
find . -type d -iname "CD?" -exec ~/renameandmove.sh "{}" \;
Contents of renameandmove.sh (save in your home folder and chmod +x renameandmove.sh)

Code: [Select]
#!/bin/bash

# prepends a number to all files in folder and then moves them to parent folder.
#run this from the parent folder you're looking to process: find . -type d -iname "CD?" -exec ~/renameandmove.sh "{}" \;

DIRECTORY=$1
PREFIX=${DIRECTORY: -1}
cd "$DIRECTORY"
for FILE in *; do mv "$FILE" "$PREFIX-$FILE"; done
mv * ..
I like beautiful melodies telling me terrible things -- Tom Waits

Free your mind...and your ass will follow.

Offline Tricky

  • Trade Count: (+1)
  • AVForums Junior Member
  • *
  • Posts: 45
  • Total likes: 2
  • Compulsive fixer of things
Re: Simplicity of Linux
« Reply #117 on: January 21, 2019, 02:58:14 PM »
Downloading numerous numbered (or lettered) files over http using Curl. Useful for things like lecture slides and easier than writing a shell script, as http doesn't usually support using wildcards for downloading multiple items.

Code below will download "numbered_file1.pdf", "numbered_file2.pdf" and so on into the working directory.

Code: [Select]
curl -O "http://whatever/static/files/numbered_file[1-20].pdf"

Offline chrisc

  • Trade Count: (+126)
  • AVForums Grandmaster
  • *****
  • Posts: 10,346
  • Total likes: 208
  • Cape Town Hi-Fi Club - get better sound
Re: Simplicity of Linux
« Reply #118 on: January 21, 2019, 05:06:59 PM »
The Devialet Chat forum and also Computer Audio are touting the benefits of Audio Linux.

Must have a look at this
Even duct tape can’t fix stupid… but it can muffle the sound

Offline BWS

  • Administrator
  • Trade Count: (+3)
  • *****
  • Posts: 16,078
  • Total likes: 25
  • Keep calm and play Fortnite
Re: Simplicity of Linux
« Reply #119 on: January 22, 2019, 11:10:55 AM »
Not just for audio
In the word : Scent, is it the S or the C that is silent?