How-To find process ID

To find the process ID from a running process use this command:

echo `ps aux | awk '/pst/ && \!/awk/ {print $2}'`

Replace "pst" with the process name you are looking for

Converte Desktop recording file .ogv to mpeg format

GKT-recordmydesktop.png

If you make a recording of your desktop using gtk-recordMyDesktop you get a screencast file in .ovg format. With memcoder you can convert that easy to a mpeg format using this command.

mencoder infile.ogv -oac lavc -ovc lavc -lavcopts abitrate=160 -o outfile.mpeg

Log your running torrents

Torrent-Logo.png

Synposis

This is a solution for torrent downloaders with btdownloadcurses and the machines has to be rebooted. The script saves all running downloads every X minutes to a file. After reboot you can easily start the torrent-downloads again.

Summery

How To Resize images with command line

Photo-Edit-Logo.png

If you want to resize your photos it's simple to use resize tool in gThumb. Unfortunately gThumb deletes all the EXIF data like date and time the photo was taken.

To keep all EXIF data I use convert (from imagemagic)

find ./ -iname *.JPG" -maxdepth 0 -exec convert {} -resize 50% ./resized/{} \;

How To Kill Pulseaudio when audio stucks

PulseAudio-Logo.png

Steps to kill pulsaudio.
Solution for when there is no sound and the soundservers is blocked by pulseaudio

On my desktop machine I have frequently a problem with Pulseaudio. After playing a flash movie (Youtube) it happens very often that I have no audio anymore on my Moviplayers like Movie Player or VLC.

The solution for this problem is to kill all Pluseaudio processes.

How To Resize multiply images to prefered size

Photo-Edit-Logo.png

If you want to resize multiply images to a other (smaller) size you can use this command.

It's not recommend to enlarge pictures because that will have a negative effect on the quality of the enlarged image.

time find ./ -maxdepth 1 -iname '*.jpg' -exec convert '{}' -resize 500 '../big/{}' \;

* time: gives you the time the command was busy. This is optional.

How To add subtitles to a movie and save is to a new file

VLC-Logo.png

Add subtiltes to a new outputfile.
incl. resizeable subtitles, percentage from picture hight. So it can be shown on the Philips media player

mencoder -fontconfig -subfont-text-scale 3 -ovc lavc INPUT-FILE.avi -sub "SuBFILE.srt" -oac copy -o OUTPUT-FILE.avi

How To Add subtitles in Mplayer

MPlayer-Logo.png

Playing a movie with "hot" added subtitles.

Use this command:

mplayer -fontconfig -subfont-text-scale 3 INPUT-FILE.avi -sub "SuBFILE.srt"

How-To Find and Replace in multiply files on the command line

Xterm.png

Find and Replace in multiply files.

including a Back-Up

perl -pe "s/mouse/chicken/g" -i.bak $FILES;

Or no Back-up

perl -pe  "s/mouse/chicken/g" -i $FILES;

# -e execute this command
# -p loop over each line and print
# -i inplace edit, make a backup file

How To Rename filenames

Xterm.png

This is about rename (mp3) files with the command line in Linux to a nice format.

Change the first character of each word tot uppercase
Suppose your filename is something like:

04 - cymballistic - blues for sarah.mp3

and you want to change that to:

04 - Cymballistic - Blues For Sarah.mp3

Use this command.