various command line snippets

6 05 2010

Linux is fun. I love using the commandline, so every now and then when I come up with a command that I use more than once or it just took forever to figure it out I toss it in a file for future reference. They could be simple, short snippets or long piped out commands. Well they might not be perfect but they have served their purpose, so maybe some one else can use them.

# recursively make everything r/w
chmod -R 0777 *

# start a http server using python accessible at http://localhost:8000
python -m SimpleHTTPServer

# find playlist and ls in m3u text file
find . -iname ‘*.m3u’ -print0 | xargs -0 ls >> m3u

# find all playlist and delete
find . -iname ‘*.m3u’ -print0 | xargs -0 rm

# strip ID3v1 tags
find -name \*.mp3 -type f -print0 | xargs -0 id3v2 -s

# ls hidden files
ls -a | grep -v ^d | grep [.][a-zA-Z0-9] | cut -d. -f2

# find all albumart jpgs and rename to folder.jpg
IFS=$’\t\n’; for i in $( find . -iname ‘*.jpg’ ); do echo “Renaming” $i; mv $i ${i%/*}/folder.jpg; done

# lsmod but just the names no depends
lsmod | cut -c1-22

# join all avi in a directory
mencoder *.avi -o out.avi -ovc copy -oac copy

# mount a squashfs
mount filesystem.squashfs somefolder -t squashfs -o loop

# convert video to smv for my Philips GoGear 4GB, requires smv_encode, google it
smv_encode -g 220×176 -f 24 -n 5 -r -1 -q 60 “some_ffmpeg_supported_video” “some_video.smv”

# open links in thunderbird in firefox
gconftool-2 -s /desktop/gnome/url-handlers/http/command ‘/usr/bin/firefox %s’ –type String
gconftool-2 -s /desktop/gnome/url-handlers/https/command ‘/usr/bin/firefox %s’ –type String


Actions

Information

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s




Follow

Get every new post delivered to your Inbox.