| Blue Sky | @kaushikc.bsky.social |
| Blue Sky | @kaushikc.bsky.social |
I like this system
1) Check which node_modules directories will be removed recursively
find . -name "node_modules" -type d -prune
2) Remove all node_modules directories recursively
find . -name "node_modules" -type d -prune -exec rm -rf {} +
# Run command on each file
find . -type f -exec chmod 644 {} \;
# Copy all PDFs to a backup directory
find . -name "*.pdf" -exec cp {} /path/to/backup/ \;
# Find files containing 'password' and show filename
find . -type f -exec grep -l "password" {} \;
# Search for IP addresses in all .log files
find . -name "*.log" -exec grep -H "[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}" {} \;
# Find by filetype
find . -name "*.txt"
# Files modified in last 7 days
find . -mtime -7
# Files accessed more than 30 days ago
find . -atime +30
# Files modified in last 24 hours
find . -mmin -1440
# Copy all .jpg files to backup directory
find . -name "*.jpg" -exec cp {} /backup/ \;
# Finding a string from a directories recursively
find . -type f -exec sh -c 'echo "=== $1 ==="; strings "$1" 2>/dev/null | grep "pass"' sh {} \;
3) All Audio files from a channel
yt-dlp -i -f "bestaudio" --extract-audio --audio-format flac --audio-quality 0 --merge-output-format flac -o "~/Downloads/YT_Channel/%(uploader)s/%(title)s.%(ext)s" "ChannelURL"
1) Single Audio
yt-dlp -f "bestaudio" --extract-audio --audio-format flac --audio-quality 0 "videoURL" -o "~/Downloads/%(title)s.%(ext)s"
2) Playlist Audio
yt-dlp -i -f "bestaudio" --extract-audio --audio-format flac --audio-quality 0 --merge-output-format flac -o "~/Downloads/YouTube_Playlist/%(playlist_title)s/%(playlist_index)s - %(title)s.%(ext)s" "playlistURL"
Yt-dlp commands
1) Single video
yt-dlp -f "bestvideo+bestaudio" --merge-output-format mkv "https://www.youtube.com/watch?v=videoID"
2) Playlist
yt-dlp -i -f "bestvideo+bestaudio/best" --merge-output-format mkv -o "~/Downloads/YouTube_Playlist/%(playlist_title)s/%(playlist_index)s - %(title)s.%(ext)s" "https://www.youtube.com/playlist?list=PLaylistID""
3) All videos from a channel
yt-dlp -i -f "bestvideo+bestaudio/best" --merge-output-format mkv -o "~/Downloads/YT_Channel/%(uploader)s/%(title)s.%(ext)s" "https://www.youtube.com/c/ChannelName"
If your folders are messy, in my case it's usually Desktop or Downloads folder. I use this command from terminal
$ cd your/folder/path
$ tree -lha > tree.txt
It creates a text file output and lists all the files and folders which I find more visually useful for re-organising data on my computer