eXTReMe Tracker
Sep 252013
 

Before making any modification to any files, first create a backup of smb.conf file

sudo cp /etc/samba/smb.conf  /etc/samba/smb.conf.bak

The open the configuration file for editing:

sudo gedit /etc/samba/smb.conf

In the section identified as Share Definitions, insert this piece of code. The path string should be the path for folder you will be sharing. If you want others to have the ability to write to that directory -

sudo mkdir -p /path/to/shared/folder
sudo chown nobody.nogroup /path/to/shared/folder
[share]
    comment = Ubuntu File Server Share
    path = /path/to/shared/folder
    browsable = yes
    guest ok = no
    read only = no
    create mask = 0755

Once the configuration file has been saved, its time to restart the samba daemon

sudo restart smbd
sudo restart nmbd

Once the samba daemon has restarted, you need to add a list of users who can access samba folder.

sudo smbpasswd -a username

To access this directory from windows, open My Computer -> Tools -> Map Network Drive

Folder address for this share would be:

\\ip_address_of_your_server\share

NOTE: The folder is called share in the share definition. You can call it something else and edit the parameters based on the chosen share name.If you want to have access to this folder each time, make sure to save the password and check that option to reconnect at login.

 

 

Jan 112013
 

To get the stock quotes for NYSE listings create some file named stockval and add it to your PATH.

Then gedit the file with the text:

#!/bin/bash

p=`printf "curl -s 'http://download.finance.yahoo.com/d/quotes.csv?s=$1&f=l1'"`
price=`eval $p`;
echo $price

stock_quote_ticker

 

 

 

 

 

 

 

 

 

 

Make that file executable

chmod +x stockval

Close out, and open a terminal. If you have the path correctly configured, execute the stockval command using the company symbol as an argument and it returns the stock price on the line below.

stockval goog

732.15 << output
Sep 302012
 

There is a compose functionality out there:

Linux umlaut typing

For the Gnome Desktop:

  • go to System -> Preferences -> Hardware -> Keyboard on the Gnome menu
  • select the Layouts tab
  • click the Options… button
  • expand Compose key position
  • check the box Right Ctrl is Compose or Right Win-key is Compose

The Right Ctrl or the Right Win key are now a “compose key”. With it you can compose symbols by combining two characters. The double-quote then the letter “a” equals an umlaut-a (ä). Tap the compose key, then tap shift+quote for a double-quote, then tap the a-key.

  • ä is compose, then “, then a
  • ö is compose, then “, then o
  • ü is compose, then “, then u
  • ß is compose, then s, then s

The list of compose key sequences can be found at:

Compose key sequences

Content found at blog: http://idolinux.blogspot.com/

Kül

 

Aug 082012
 

Here’s a nifty little script I found.

You need to run it within the directory containing the wma files:

#!/bin/bash

current_directory=$( pwd )

#remove spaces
for i in *.wma; do mv "$i" `echo $i | tr ' ' '_'`; done

#Rip with Mplayer / encode with LAME
for i in *.wma ; do mplayer -vo null -vc dummy -af resample=44100 -ao pcm -ao pcm:waveheader $i && lame -m s audiodump.wav -o $i; done

#convert file names
for i in *.wma; do mv "$i" "`basename "$i" .wma`.mp3"; done

rm audiodump.wav

If you aren’t happy with underscores and want your spaces back, run this on the command line:

for i in `ls *.mp3`; do p=`echo $i | tr '_'  ' '`; mv $i "$p"; done

They will be in the proper format now, and google music compatible.

Jul 202012
 

In the newer versions of Linux, an open source driver is usually installed by default to run the graphic cards. However this driver can sometimes be absolutely messy, and it is essential to remove the Nouveau driver and install the binary driver from Nvidia.

However, if after you reboot into the service mode from grub menu, and try to install the NVIDIA-Linux-x86_64-xxx.run driver in the init 3 level, the program will kick you out saying that the Nouveau driver is still in use.

The way to disable the Nouveau drivers from kernel is to boot in the service mode and run the following commands:

echo options nouveau modeset=0 | sudo tee -a /etc/modprobe.d/nouveau-kms.conf
 update-initramfs -u

Once its done reconfiguring the kernel, you will need to reboot, and again get to service mode.

After that, get into init 3 mode, and install the NVIDIA-Linux-x86-64.xxx.run script. The installation should be successful at this point.

May 292012
 

Replace your ~/.vnc/xstartup file with the following content:

#!/bin/sh
unset SESSION_MANAGER
exec /etc/X11/xinit/xinitrc[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
startxfce4
May 092012
 

If you are going for a complete reinstall of OS and you need to get a list of packages you have at present, so that you can reinstall them after you have installed Linux from scratch, run the following:

#!/bin/bash
sudo dpkg --get-selections | awk '{ ORS=" "; print $1; }' > packagelist.txt

This saves the everything to packagelist.txt. Mind blown!

 

Dec 282011
 

To monitor the instantaneous network usage, execute the ifstat command in bash. You may need to acquire it from a repository if you don’t have it already.

sudo apt-get install ifstat

To display usage on eth0, with a 5 second delay, just once:

ifstat -i eth0 5 1

You can change the number of seconds, and the number of times you want the output displayed. If you don’t specify the count, it will go on forever until you ctrl-c out of it.

So here is a script that displays the download rates in MB/s and upload rates in KB/s every 5 seconds until you hit ctrl-c.

while :
do
# Press ctrl-c to exit
x=`ifstat -i eth0 5 1 | tail -1 | tr '\t' ' '`;  #tail -1 takes the DL and UL speeds in KB/S
x1=`echo $x | cut -d ' ' -f1`; x2=`echo $x | cut -d ' ' -f2`;
x1=$(echo "scale=3; $x1/1024" | bc); # Convert DL rate to MB/S
printf "D: %0.3f MB/s\t U: %0.3f KB/s\n" "$x1" "$x2"
done
Dec 062011
 

The newer releases of Ubuntu and Linux Mint have started getting stuck during LiveCD installation or after distribution/kernel upgrade.  Usually the point where it gets stagnant is when it reaches this line:

kernel_thread_helper+0x7/0x10

Nothing happens past that point. A solution or a workaround to this is to insert the nolapic acpi=off switch in the grub boot line. There are 3 ways to do this:

1: If you are starting a fresh install from a CD and the installation pauses at the kernel_thread_helper line, you need to restart your computer.

When you boot from your installation CD, choose F6 before you continue trying out the LiveCD. This give you boot option at the bottom of your screen.

At the very end of the line add nolapic acpi=off and hit enter to continue booting from LiveCD. In most cases this should work.

2. The same problem may arise when you do a distribution upgrade or even a kernel upgrade. In that case you need to change your grub.cfg file. Follow these steps:

sudo nano /boot/grub/grub.cfg

Enter your sudo password and it will bring you to your grub menu configuration.

Look for the section that read similar to this:

menuentry 'Ubuntu, with Linux 2.6.38-11-generic' --class ubuntu --class gnu-linux --class gnu --class os {
 recordfail
 set gfxpayload=$linux_gfx_mode
 insmod part_msdos
 insmod ext2
 set root='(hd0,msdos6)'
 search --no-floppy --fs-uuid --set=root 337e2841-fc82-61b3-84be-5a9c71ae43b8
  linux   /boot/vmlinuz-2.6.38-11-generic root=UUID=337e2841-fc82-61b3-84be-5a9c71ae43b8 ro quiet splash vt.handoff=7
 initrd  /boot/initrd.img-2.6.38-11-generic
 }

You want to change the line that I have identified above to read:

linux   /boot/vmlinuz-2.6.38-11-generic root=UUID=337e2841-fc82-61b3-84be-5a9c71ae43b8 ro quiet splash vt.handoff=7 nolapic acpi=off

After adding these switches to the boot menu option, press ctrl-X, then save and exit.

This is for a permanent change if you can boot using an older kernel.

3: If you cannot login to an older kernel or recovery mode because of the kernel_thread_helper error,  you have to press “e” (without the quotation marks)  to edit the boot options when you get the grub menu.

For the kernel you want to use, edit the end of the line that reads

linux   /boot/vmlinuz-2.6.38-11-generic root=UUID=337e2841-fc82-61b3-84be-5a9c71ae43b8 ro quiet splash vt.handoff=7

to

linux   /boot/vmlinuz-2.6.38-11-generic root=UUID=337e2841-fc82-61b3-84be-5a9c71ae43b8 ro quiet splash vt.handoff=7 nolapic acpi=off

Press Enter and you should be able to boot.

Nov 092011
 

Some .avi files tend to have an out of sync audio track, some can’t be scrolled through (forward/reverse), while others might show an message that says the index file needs to be recreated.

Solution is to create a copy of that file that has an index recreated and remove the original and save the copy and all the usual replacement methods.

mencoder -idx files1.avi -ovc copy -oac copy -o file2.avi

Here file1.avi is the input file, and file2 is the output file with corrected index.

May 112011
 

For the first time I was able to get VNC to work with Ubuntu with Gnome session instead of a xterm on gray background. The steps involved were exactly the same as I was following earlier, with one exception: the setup of xstartup in the ~/.vnc folder.

For your xstartup file in ~/.vnc (the “.vnc” folder in

your home directory), you need the following:

#—————————–

#!/bin/sh

# Uncomment the following two lines for normal desktop:

# unset SESSION_MANAGER

# exec /etc/X11/xinit/xinitrc

[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup

[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources

xsetroot -solid grey

vncconfig -iconic &

xterm -geometry 80×24+10+10 -ls -title “$VNCDESKTOP Desktop” &

gnome-session &

# twm &

#————————

instead of uncommenting the lines as the script suggests, you change the window manager to gnome-session

make sure restart vnc4server

The line which got Gnome working was “gnome-session &”

========================================

Now for all the steps involved (works in Karmic Koala Alpha 2, Ubuntu 9.10, kernel 2.6.30-10)

1. Install ssh server, ssh client, VNC viewer, VNC server, and xinetd

sudo apt-get install openssh-server openssh-client vnc4server xinetd vncviewer

2. Setup the ssh password for your login

ssh-keygen

3. Test out the ssh server by typing in

ssh localhost or ssh your_login@your_ip_address

4. Then create a vnc password

sudo vncpasswd ~/.vncpasswd

5. Edit the xstartup file in ~/.vnc directory

For your xstartup file in ~/.vnc (the “.vnc” folder in

your home directory), you need the following:

—————————–

#!/bin/sh

# Uncomment the following two lines for normal desktop:

# unset SESSION_MANAGER

# exec /etc/X11/xinit/xinitrc

[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup

[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources

xsetroot -solid grey

vncconfig -iconic &

xterm -geometry 80×24+10+10 -ls -title “$VNCDESKTOP Desktop” &

gnome-session &

# twm &

————————

instead of uncommenting the lines as the script suggests, you change the window manager to gnome-session

6. Create a VNC desktop

vnc4server :1 -geometry 1024×768

7. Then to tunnel into your VNC desktop, first create a SSH tunnel by logging into SSH with the comand:

ssh -L 5901:your_ip_address:5901 your_username@your_ipaddress

8. Finally, load up your VNC desktop

vncviewer localhost:1

And now you are ready to use connect to your machine remotely and use administer the computer remotely.

P.S: If you are using a firewall (hardware or software, you need to get enable port forwarding and unblock ports 22 and 5900-5999 on the Ubuntu machine to allow SSH and VNC to be accessed.

May 112011
 

Running scripts in serial order on a multi-core machine will take quite a bit of time. If the tasks are repetitive, the command can be run under GNU Parallel.

You can install it on RPM or Debian based distribution from the GNU Parallel repository. Install the binary that fits your flavour of Linux. Please note that even though the latest release of GNU Parallel has a flavour of Linux associated with it, it runs on most of the older AND newer distributions. For instance I was able to install the April 21st 2011 release of amd_64 RPM on a RHEL5 machine, and it ran just fine for that 8 core machine.

After installation you can try it out on a sample directory by running:

ls -d */ | sed ‘s/\///g’ | parallel zip -r -q {}.zip {}

This will recursively zip all the directories within a given folder, in parallel. By default, it will use up the maximum number of cores, but you can check the man pages of parallel to check how to employ N number of processors to run the task in parallel.

ls *.jpg | parallel convert {} -resize 75% -quality 80% {}

If you have imagemagick installed, you could save a whole bunch of space by converting some of the high-res images to a slightly lower resolution. The above example will resize the images to 75% of their original size with 80% quality. The original images will be overwritten by the resize and downsampled ones. While this is running, you can fire up htop in another terminal window to watch all the processors working in parallel.

Nov 172009
 

I followed the procedure outlined by UbuntuGeek, but some of the things are little different – at least when I installed it today.

First, you’ll need to add the repository which contains the deb for Chrome.

sudo gedit /etc/apt/sources.list

Assuming you are running Karmic Koala (Ubuntu 9.10), you’ll need to add the following two lines towards the end of that file.

deb http://ppa.launchpad.net/chromium-daily/ppa/ubuntu karmic main
deb-src http://ppa.launchpad.net/chromium-daily/ppa/ubuntu karmic main

Next, you’ll have to retrieve the PGP keys for this repository.

sudo add-apt-repository ppa:chromium-daily/ppa

Update the sources,

sudo apt-get update

And then instal Chrome

sudo apt-get install chromium-browser

After the installation is successful, you can launch the browser, and import settings from Mozilla Firefox. However, Firefox needs to be closed when the importing of options and favourites is taking place. When Chrome restarts, it will have options configured like you had them in Firefox. The are no add-ons that I could find for Chrome, though – Adblock Plus and Video Download Helper are the two plugins that would make me stick with Firefox for a while.