How to: Tips and Tricks

Prepare videos for DVD authoring

If you need for some reason prepare mpeg files for DVD outside of DVD authoring application, here are two commands which can help you a lot.

Option 1 – ffmpeg

for i in *.mkv; do name=`echo $i | cut -d'.' -f1`; echo $name; ffmpeg -i $i -target pal-dvd -r 25 -s 720x576 -aspect 16:9 -b 5200k $name.mpeg; done

Option 2 – mencoder

for i in *.mp4; do name=`echo $i | cut -d'.' -f1`; echo $name; mencoder -oac lavc -ovc lavc -of mpeg -mpegopts format=dvd -vf scale=720:576,harddup -srate 48000 -af lavcresample=48000 -lavcopts vcodec=mpeg2video:vrc_buf_size=1835:vrc_maxrate=9800:vbitrate=2400:keyint=15:aspect=16/9:acodec=ac3:abitrate=192 -ofps 25 -o $name.mpeg $i; done

Find files containing searched text

If you want to search all files, which contains searched text, open terminal and type

grep -i -n 'searched text' *

It works also recursively

grep -i -r -n 'searched text' *

Chmod recursively directories and files

This will recursively search your directory tree (starting at dir 'dot') and chmod 777 all directories only.

find . -type d -exec chmod 777 {} \;

Similarly, the following will chmod all files only (and ignore the directories).

find . -type f -exec chmod 666 {} \;

Credit goes here.

Elementary Theme: Fix missing scrollbars in OpenOffice (LibreOffice)

If you are using Elementary theme you have probably noticed that OpenOffice (LibreOffice) is missing scrollbars. I found an easy solution for this bug, just follow these few steps.

1. Backup your original elementary gtkrc file

sudo cp /usr/share/themes/elementary/gtk-2.0/gtkrc /usr/share/themes/elementary/gtk-2.0/_gtkrc.bak

2. Edit elementary gtkrc file

sudo gedit /usr/share/themes/elementary/gtk-2.0/gtkrc

3. Search and replace (If You're using Elementary 2.1 click here)

Find around ln 57

GtkRange       ::slider-width       = 8

 

Replace with

GtkRange       ::slider-width       = 10

 

Find around ln 64

GtkScrollbar       ::has-backward-stepper       = 0
GtkScrollbar       ::has-forward-stepper        = 0

 

Replace with

GtkScrollbar       ::has-backward-stepper       = 1
GtkScrollbar       ::has-forward-stepper        = 1

 

Find around ln 68

GtkScrolledWindow       ::scrollbars-within-bevel       = 1

 

Replace with

GtkScrolledWindow       ::scrollbars-within-bevel       = 0

4. Save gtkrc.

5. Log out and log back in. Now you can try to open OpenOffice. You should see your scrollbars.

Credit goes here.

UPDATE 17.01.2011

Here is the modifiet gtkrc file. Simply follow these steps:

cd && wget http://howto.blbosti.com/files/elementary-libreoffice/gtkrc.tar.gz
tar xf gtkrc.tar.gz
sudo cp /usr/share/themes/elementary/gtk-2.0/gtkrc /usr/share/themes/elementary/gtk-2.0/gtkrc.bak
sudo cp gtkrc /usr/share/themes/elementary/gtk-2.0/gtkrc

Then log out and log in and voila…

UPDATE 14.03.2011 – Elementary 2.1

There were changes in Elementary 2.1 gtkrc, so the scrollbar disappears after an update. You need to edit the gtkrc file again.

Search and replace:

Find around line 67

GtkScrollbar        ::has-backward-stepper              = 0
GtkScrollbar        ::has-forward-stepper               = 0

Replace with

GtkScrollbar        ::has-backward-stepper              = 1 
GtkScrollbar        ::has-forward-stepper               = 1

Find around line 74

GtkScrolledWindow    ::scrollbars-within-bevel           = 1

Replace with

GtkScrolledWindow    ::scrollbars-within-bevel           = 0

OPTIONAL STEP

It is good to change scrollbar width, because of horizontal scrollbar in In Calc / Spreadsheet

Bottom – original scrollbar width (6), and deformed icons and sheet tabs.
Top – changed scrollbar width to 10 and sheets are now readable and icons visible. You can change the icon width.. find your optional width.

Elementary scrollbar in Open/Libre Office

To change the scrollbar width find around line 70

GtkScrollbar        ::slider-width                      = 6

Replace with

GtkScrollbar        ::slider-width                      = 10

 

If You don't want to edit your file, paste these lines into terminal window.

cd && wget http://howto.blbosti.com/files/elementary-libreoffice/gtkrc-elementary2.1.tar.gz
tar xf gtkrc-elementary2.1.tar.gz
sudo cp /usr/share/themes/elementary/gtk-2.0/gtkrc /usr/share/themes/elementary/gtk-2.0/gtkrc.bak
sudo cp gtkrc /usr/share/themes/elementary/gtk-2.0/gtkrc

gtkrc file to download

Mount a remote SSH folder in Ubuntu (cmd and GUI)

Connecting to a server across the internet is much more secure using SSH. There is a way that you can mount a folder on a remove server using the SSHFS service (based on the SSH File Transfer Protocol).

Open terminal and follow these steps:

1. Install sshfs

sudo apt-get install sshfs

2. Add yourself to the fuse group

sudo adduser yourname fuse

3. Log out and in again

4. Create a directory to mount the remote folder in (eg. in your home directory or in /media…)

mkdir ~/yourmountdirectory

5. Mount the remote server

sshfs username@host:/remotepath ~/yourmountdirectory

You'll be prompted to save the server key and for your remote password.

Now you should be able to cd into the directory and start using it as if it was local.

6. To unmount sshfs enter this command

fusermount -u ~/yourmountdirectory

More »

Change mouse cursor theme in Ubuntu with Compiz enabled (10.04 and higher)

There is a bug in the Compiz package in Ubuntu 10.04 Lucid Lynx (in Maverick Meerkat too) that doesn't allow you to fully change the mouse cursor theme. You only get the new cursor theme in some windows. But you can still change the mouse cursor theme in Ubuntu, even if you have Compiz enabled.

1. Go to /usr/share/icons and locate the exact folder name for the mouse cursor theme you want to use – remember it! For the Elementary theme, the folder name would be "DMZ-Black"

2. Now you need to edit the /usr/share/icons/default/index.theme file. Press ALT + F2 and enter:

gksu gedit /usr/share/icons/default/index.theme

Comment line with "Inherits=DMZ-White" and under this line add an identical line with the exact name of the mouse cursor theme you got in step 1. The final index.theme should look like this:

[Icon Theme]
#Inherits=DMZ-White
Inherits=DMZ-Black

UPDATE: Second way

Press ALT+F2 and run gconf-editor and go to desktop > gnome > peripherals > mouse and edit cursor_theme. Here you can enter theme name you got in step 1.

3. Restart Compiz by pressing Alt + F2 and entering:

compiz --replace

or simply Log out and Log in.

Via webupd8.org

Umount CIFS problem: Reboot and Shutdown

If You mount samba shares using cifs method like I, You probably have met with delays at shutdown or restart.

[18.312000] CIFS VFS: Server not responding
[18.312000] No response for cmd 5 mid 8

To avoid this delay it is necessary to umount all samba shares before rebooting or shutdown your computer. There are many solutions to fix this problem, but no one did not work for me when i am connected via wifi. So I made two simple launchers for Reboot (init 6) and Shutdown (init 0). More »

Ubuntu: Bash completion does not work with apt-get

If for some reason does not work bash completion in terminal (using the TAB key), look inside the file bash.bashrc. Open terminal and type:

sudo gedit /etc/bash.bashrc

At the line 31 you can find this entry.

# enable bash completion in interactive shells
#if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
#    . /etc/bash_completion
#fi

Uncomment it and save file.

# enable bash completion in interactive shells
if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
    . /etc/bash_completion
fi

Ubuntu: Make ALSA default instead of PulseAudio

PulseAudio has still problems with some applications and it always adds a little latency and that's the reason, why so many people still prefer ALSA. This howto shows you, how to remove PulseAudio, add alsa-mixer applet to the panel and associate hotkeys for volume change.

1. Remove PulseAudio

This will uninstall PulseAudio, delete the configuration files and uninstall it's dependencies; gstreamer-10-pulseaudio, libpulse-browse0, libpeexdsp1, pulseaudio-esound-compat, pulseaudio-module-udev, pulseaudio-module-x11, pulseaudio-utils, rtkit and gnome-desktop (don't worry, it is dummy package):

sudo apt-get purge pulseaudio

2. Install alsa-mixer (volume) applet

PulseAudio removes volume applet, so you need new volume applet. For getting it to work, you need to intall the following packages: python, python-notify, python-gtk2, python-alsaaudio and xfce4-mixer or gnome-alsamixer (i preffer xfce4-mixer).

sudo apt-get install python python-notify python-gtk2 python-alsaaudio python-eggtrayicon xfce4-mixer

More »

Ubuntu server: install Alsa sound and MOC (Music On Console)

1. To install Alsa sound (alsa-base, alsa-utils, alsa-tools and libasound2) enter this command:

sudo apt-get install alsa alsa-tools

2. Add yourself to the group audio:

sudo adduser yourusername audio

3. Reboot to take effect

sudo init 6

4. Alsamixer is sometimes muted by default, so you might need to unmute it. Run alsamixer:

alsamixer

Use arrows up and down to change volume, left and right to change source. To mute/unmute press M.

Note: Alsamixer might look different in any machine. It depends on your sound device (sound card). Please, read audio source labels. For example: PCM in Virtualbox is on fifth place instead of the second in VMWare.

Alsamixer in VMWare

alsamixer

Alsamixer in Virtualbox

alsamixer virtualbox

To quit press Q.

If any error occurs, look here. More »