Linux.com

Community Blogs



How to remove duplicate files on Linux without wasting time

Here's how I do it, with a couple of simple scripts

 

 

Slackware Essentials

Being a new user to Slackware I want to share my experience  , the mistakes I made and the solutions I found.

p { margin-bottom: 0.08in; }

1. startx

In slackware the default run level is 3, which is a multi user mode. For most of the people , who are all the new users of linux may get afraid due to this run level. Because, it welcomes the user by showing shell with some cute messages. From the shell, firing "startx" will take the user to a user friendly GUI.

In order to start with GUI always, we need to edit the file "/etc/inittab" as a super user and change the run level to 4. We have the following choices,

0 = halt

1 = single user mode

2 = unused (but configured the same as runlevel 3)

3 = multiuser mode (default Slackware runlevel)

4 = X11 with KDM/GDM/XDM (session managers)

5 = unused (but configured the same as runlevel 3)

6 = reboot

One nice thing here is "root" account also can be opened in Xserver [ GUI ], which is not possible in some few distros like Fedora

 

2.Workspace:

In Xserver run level [ runlevel 4 ], we can have workspaces to classify the work we are doing. But, at the beginning[after fresh install] , if we open any window, that window task bar will appear in all workspaces.

In order to changes this, we need to play with settings. The flow is,

kde start menu -> computer-> system settings

From there we can change the things as we want. If you have more RAM space, you can enable all those 3D stuffs to enhance the system look wise.

 

3. Bluetooth

During installation of slackware, if the user enabled bluetooth daemon means , no problem, they can start to use blue tooth according to their needs.[browse,file transfer, accessing Internet etc].

By any chance if the user missed to enable means, it can be enabled by [as root user]

"/etc/rc.d/rc.bluetooth start"

we can do stop and restart the service, by giving "stop" and "restart" respectively instead of "start" in above command.

The most important thing is , that should be in executable mode. If not, it wont throw any error message, simply you will get your shell prompt in next line. So, be sure to check the permission mode using "ls -l", and if it don't have execute permission means make it as executable using, "chmod +x rc.bluetooth".

Until you finish till above step, whenever you try to start blue tooth manager, you may get

"Bluez daemon is not running,blueman manager can not continue".

after changing the mode, start the blue tooth service. Then the blue tooth manager can be used to communicate to the external blue tooth device[mobiles etc].

4. Accessing Internet using a LAN

In most of the linux distros if we plug in the LAN cable, distros will take care of most of the thing. Mostly we need to change the IP address,subnet mask and gateway address according to the user's local network. These changing also very easy to do using various tools came up with distro itself [Yast for examble in SUSE].

As usual, in Slackware it is a bit tricky. fire the command "netconfig" in the terminal as root user. A shell based menu welcomes you . That will ask some details to setup the connection for you. First it will ask for Hostname then it will ask for Domain Name. Enter these two according to your need. Then choose static IP option to configure the settings according to your local network. It will ask for ip address , netmask, and gateway address one by one. Enter these details. Then it will ask about nameserver. Choose yes then enter a nameserver address whatever nameserver you like. Generally, you can enter 4.2.2.2 for nameserver , if you dont know the DNS of your service provider. Thats it. The setup is over.

If you have some experience in Linux, you can directly change in the file

/etc/rc.d/rc.inet1.conf”

Then you need to reboot the system, since we changed some network related information. Remember,

"/etc/rc.d/rc.inetd restart "

this alone don't help.

 

5. Configuring USB modem in Slackware:

For this you need to have dialer scripts for your modem. Once you got the script, it is easy to configure the USB modem. The script for my USB MTS modem is,

[Dialer Defaults]

Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0

Modem Type = Analog Modem

Phone = #777

ISDN = 0

Username = This e-mail address is being protected from spambots. You need JavaScript enabled to view it

Init1 = ATZ

Password = MTS

Modem = /dev/ttyUSB0

Baud = 9600

Stupid Mode = yes

 

Execute the command, "pppsetup" . Slackware will welcome you with one shell menu. Just answer for the fields it is asking. It will be easy if you have your modem dialer script. Finish the setup.

Then open the file "/etc/ppp/options" as root. In that file change the line "/dev/some_thing/" to "/dev/ttyUSB0". [ That some thing is a device, which you chose during "pppsetup" . Mostly, "ttyUSB0" wont be there during configuration for the question, "what is your modem /dev/ttyS ? " . So, choose something as you wish that time , then change it now ]

Thats it. using "ppp-go" you can start the connection and using "ppp-stop" you can disconnect the connection. After disconnection, you will get the bytes you transferred. From that you can know your data usage too.

 

6.LILO

The LInux LOader , which is a default boot loader for Slackware. If you have some other OS and want to change something regarding booting the machine, this is the file you need to use. Once the changes you made with this file you can save and close the file. After that you should execute, the command “lilo” . Then only the changes will take effect. [ This is not the case with GRUB. If you change the file in "/boot/grub" , that is enough. No need to execute any commands. ] . Simple "lilo" will overwrite current MBR . So, if you want to install Slack ware boot loader lilo, in different place, they need to give "lilo -b /dev/xxx " . xxx- is the place that you want to install lilo.

 

7. will “shutdown -P now?” shutdown the system?

By seeing the command, if you say “yes”, am sorry. It won't. If you google for Slackware, in links you found , you can get something like, “the Slackware community does not modify the source or add and remove functions from software beyond the author's design. All packages are built using the original source code in which only official patches are applied”

An example for the above statement is, what we are dealing now.

From any runlevel if you issue “shutdown -P now” command in Slackware , the system will go to runlevel 1, it wont do shutdown.

But, with other distro which I used,[Fedora,SUSE,Mint] the same command will do a proper shutdown.

So, why is this difference in result when executing a same command?. Which functionality is implemented in the Kernel core?

Of cource the one, which is carried out by Slackware*. The other distros changed the functionality** which suits for the command name. At this point, we can realize the freedom by/for the Linux to change the code according to the users.

*,** - Discussed in linux.com forum and conformed by Linux Gurus



 

 

 

Working at the Telematics Freedom Foundation

In addition to the other things I was doing, I'm now the new (part time) program director of the Telematics Freedom Foundation, a non profit organization whose goal is to promote and develop "free as in freedom" hardware and software to protect civil rights. Wish me good luck and let me know your opinion about the foundation!

 

How to convert a video file to an iso to burn to dvd

I have been looking for this stuff for a while, and while it is out there, the documentation is fragmented. I am posting here the steps that I am using to create dvds from regular video files with completely free software. I use Linux, and I don't know if the tools are available in Windows or not. This tutorial is for linux. There are probably gui tools to do all of this stuff, but I have found that the command line tools are much more efficient and just work a lot better. They don't crash near as often, and give you a lot better errors if you have errors.

Use your package manager to install ffmpeg, dvdauthor, growisofs and genisoimage. You may want to install vlc just to test that the iso file is what you want before you burn it. I use debian, so my commands would be like this:

sudo apt-get install ffmpeg dvdauthor genisoimage growisofs vlc

Now, you have all the tools you need to convert your video file to an iso to burn to a dvd and it will play on regular dvd players.

Before you begin, it is best to do a

export VIDEO_FORMAT=NTSC

so that you don't get errors from dvdauthor. You can set this in /etc/profile if you want. Of course, if your default video format is PAL, replace NTSC with PAL.

There is a trick that I have found to getting widescreen movies to format right for the dvd, and that is to pass the "-aspect 16:9" option to ffmpeg. It will make the .mpg file look squished, but the dvd will burn correctly. This is why I recommend installing vlc to test the .iso file before you waste a dvd.

Ok, lets get to it!
Get you a video file. I have used all kinds, but mostly I convert .mkv files to mpg to use. I don't really care how you got the video file either.

Now that you have a video file, you want to convert it to a dvd readable format, which is .mpg. We will use ffmpeg to do this, and this is how:

ffmpeg -i yourfile.mkv -target ntsc-dvd yournewfile.mpg

First, we call the program, "ffmpeg". The "-i" just declares your input file, and the "-target ntsc-dvd" defines the type of dvd we are making.

Depending on the size of the file you are converting, it could take a while. I usually convert 8+ GB files so it takes an hour or so.

If you have a widescreen movie, then you will want to declare "-aspect 16:9" in the command so that it will keep the widescreen format when you convert it to iso.

ffmpeg -i yourfile.mkv -target ntsc-dvd -aspect 16:9 yournewfile.mpg

We have that down now. We can convert regular and widescreen movies to a dvd friendly format. We aren't done with ffmpeg just yet. There is one more trick that has come up for me, and that is "-map".

When you have more than one audio track, ffmpeg will use the first one as default. It doesn't matter if it is your native tongue, it still uses it. We can change that with "-map".

Let's say we have a file with two audio tracks. One is german, one is english, and german is the first one. The video track is usually the first one (0.0), so we will define two maps because ffmpeg wants you to define all the maps that are being output, which is usually two.

The german audio will be (0.1) and the english audio will be (0.2). By default, with no specification, ffmpeg will use the german audio track because it is first. Here is how we specify for ffmpeg to use english:

ffmpeg -i yourfile.mkv -target ntsc-dvd -aspect 16:9 -map 0.0 -map 0.2 yournewfile.mpg

You notice that we defined the video track (0.0) and the english audio track (0.2). If your video only has one video track and one audio track, you don't need to use map at all.

Now, run the command (whichever one you need) and wait. When it is done, you should have a nice new .mpg file to play with. You should know that ffmpeg does much more than this, but that would exceed the scope of this tutorial. Maybe when I experiment more with video editing, I will explain more of ffmpeg in other tutorials.

We can move on to dvdauthor now.

Dvdauthor takes the .mpg files and creates a dvd file structure suitable for playing in dvd players. To create a simple structure from one of your .mpg files, you need to create a directory to put your dvd file structure in. I usually make a folder with the same name as the project I am working on.

mkdir dvd
dvdauthor -o dvd -t yournewfile.mpg

The "-o" switch defines the output folder, and the "-t" switch defines the title file. You will do this command for every file you want to put on your dvd. You can put as many as you want, as long as you have enough space on your disk.

When you add your files, you can then create a TOC (table of contents) so that genisoimage can read it to create the .iso file. That command is:

dvdauthor -o dvd -T

The "-o" switch once again defines the output folder, and the "-T" switch defines a TOC.

We are now ready to convert your dvd to an .iso file to burn.

The command we use to convert all of that is:

genisoimage -dvd-video -o yourimage.iso dvd

The "-dvd-video" switch tells genisoimage to create a dvd video image, and the "-o" switch is once again the output file. The last bit at the end is the folder that genisoimage will read from to create the .iso image.

Now, use vlc and open the file and see if it is what you wanted it to be. If not, go through the steps and see if you can't change something to get it right.

Once you have created the .iso image, you can use whatever you want to burn it, but I have been happy with growisofs. I find that command line burners are faster and just more convenient.

growisofs -dvd-compat -Z /dev/sr0=yourimage.iso

The "-dvd-compat" switch means maximum compatibility with dvd video players, and the "-Z" switch means open an initial session to burn onto. /dev/sr0 is your dvd burner, and yourimage.iso is the file you created.

Now, go watch your movie!

 

 

Hole in Fixefox 4 WebGL

I just read that firefox 4 has a hole in its WebGL application that allows screen shots of what a browser just displayed. This means all information on the page, password, names, etc.

This is an article that was post on the homepage of linux.com titled,"Hole Found in Firefox 4 WebGL Implementation". Here is a sample paragraph of the article.

"This approach allows an attacker to create and save screenshots of what the browser has displayed. This includes all data, not just WebGL content. In their proof of concept, the researchers manage to extract "snapshots" of the graphics card's memory that was previously used to display web pages. The vulnerability is specific to the WebGL implementation in Firefox 4 and does not occur in Google Chrome."

http://www.h-online.com/security/news/item/Hole-found-in-Firefox-4-WebGL-implementation-1262177.html

The security hole is fixed in firefox 5. Users of firefox 4 can disable WebGL or upgrade to the beta version of firefox 5. To do this, type: about:config in your firefox url box, scroll to line named WebGL.disabled. Select it, right click and choose toggle to change it to "true".

 

openSUSE Weekly News 179 is out!

We are pleased to announce the new openSUSE Weekly News Issue 179.

In this Issue:

  • New Leadership inside the Medical team
  • Google Summer of Code Reports
  • Roadmap to systemd
  • openSUSE Strategy voting
  • and many more ...

You can download it there:

We hope you enjoy the reading :-)

If you want to help us collecting interesting articles for the openSUSE Weekly News, so you can all your stuff into our new ietherpad: http://os-news.ietherpad.com/2.

Found Bugs? Please place it in our Bugtracker: http://developer.berlios.de/bugs/?group_id=12095

Features, Ideas and Improvements can placed in our Featuretracker: http://developer.berlios.de/feature/?group_id=12095

Older content can be found there.

Flattr this

 

JRE plugin not installed on Firefox

I just went through some interesting experience to share with folks around getting your plugins to work with typical open source Browsers , like Aurora 6.2(Firefox). Read this carefully , it has changed....  this was a real time sync for someone that thought they new the ropes, but , things had changed..

All over the net are posts to do a softlink to 

/usr/java/latest/plugin/i386/ns7/libjavaplugin_oji.so

 

But.. this is no longer the module to use , even though it's still there in the Distro, it has changed for Oracle JRE releases. My version is :

[root@localhost latest]# ./bin/java -version
java version "1.6.0_26"
Java(TM) SE Runtime Environment (build 1.6.0_26-b03)
Java HotSpot(TM) Client VM (build 20.1-b02, mixed mode, sharing)

Instructions and website:

http://www.java.com/en/download/help/linux_install.xml#rpm

Firefox or Mozilla

To configure the Java Plugin follow these steps:

  1. Exit Firefox browser if it is already running.
  2. Uninstall any previous installations of Java Plugin.
    Only one Java Plugin can be used at a time. When you want to use a different plugin, or version of a plugin, remove the symbolic links to any other versions and create a fresh symbolic link to the new one.
  3. Create a symbolic link to the libnpjp2.so file in the browser plugins directory
    • Go to the plugins sub-directory under the Firefox installation directory
      cd /plugins
    • Create the symbolic link ln -s /lib/i386/libnpjp2.so

    Note: If you are upgrading your Java version then before creating new symbolic link you should remove old symbolic link to enable latest downloaded Java.

    To remove old symbolic link:
    type cd /plugins
    rm libjavaplugin_oji.so

 

 

Creating an EBS backed Debian Squeeze Linux AMI for Amazon EC2

Following on from my post on how to create an S3 backed custom AMI for AWS EC2, I thought I would jot down the steps to go through if you wanted to make use of persistent disk storage by using Amazon’s Elastic Block Storage (EBS).

In my recipe I decided to use as a base AMI, the original S3 image that I rolled in my previous post:

After starting up an AWS instance using the S3 custom AMI I created, I went through the following process. – There are better ways to approach this, but this is a good starting point for anyone that is starting to experiment with the AWS platform.

Inside the AWS Dashboard create yourself an EBS volume. – This will be the one that will be used to build your future EBS machine image

Make a note of the block device id that the Dashboard assigns to your EBS volume once it has finished the provisioning process, you will need this in order to mount the EBS volume inside the S3 Instance that you have already booted up (You can find this under ‘Attachment Information’ in the Dashboard). It will be on here that you will run debootstrap,etc to build the EBS image.

Once the EBS volume is available you will see an entry like this in the dash:

Next, click the ‘Attach’ button in the AWS Dashboard as follows:

Upon clicking the Attach button you will be asked which Instance you want to attach the EBS volume to. – You need to select the Instance ID of your S3 backed AMI you just started.

Once everything is attached you will see an entry like:i-aws-instance-id:/dev/sdX. ie: i-a62bc123:/dev/sdf (attached). Notice that the ‘available‘ changes to ‘In Use‘ once you complete the attachment process. ( the ‘sdf’ is the block device id you will need to note down for the next step.)

Now on your running S3 AMI login and execute the following command as root to build an ext3 filesystem on the now attached EBS volume

 

mkfs.ext3 -F /dev/sdX

remember to set your TERM id to something valid before starting the copy_into_chroot, otherwise the LOCALE will fail

 

export TERM=vt220

You need to grab the latest compatible kernel sources from S3 as well. – Which ones you need will depend on if you are rolling a 32-bit or 64-bit AMI.

You can get them by pointing your browser to http://s3.amazonaws.com/ec2-downloads/ (or using curl from your instance) and grep’ing for the required Xenu modules,i.e:ec2-modules-2.6.21.7-2.fc8xen-ec2-v1.0-x86_64.tar, if you are building the 64-bit version.

Next run mkdir /EBSmountpoint

Next run debootstrap to pull down a netinstall of Debian Squeeze into the mountpoint we just created called /EBSmountpoint

debootstrap –arch [i386|amd64] squeeze /EBSmountpoint http://ftp.debian.org

Once this has finished, create a directory to unzip your kernel sources into:

mkdir 64bitmodules

then untar the downloaded source in that directory

cd 64bitmodules

tar xvf ec2-modules-2.6.21.7-2.fc8xen-ec2-v1.0-x86_64.tar

this should create a lib directory inside 64bitmodules, which you can then copy intolib/modules inside your /EBSmountpoint directory

cp -r 64bitmodules/* /EBSmountpoint/lib/modules

Next copy the two ec2 scripts. You’ll recognise these next few steps from my last post on Custom AMI’s, the copy_into_chroot.sh, shellscript contains additional configuration parameters that I have passed to the Debian image before it gets converted into an Amazon Machine Image.

 

cp /etc/init.d/ec2-get-credentials /EBSmountpoint/etc/init.d/

cp /etc/init.d/ec2-ssh-host-key-gen /EBSmountpoint/etc/init.d/

 

 

cp copy_into_chroot.sh /EBSmountpoint/

 

chroot /EBSmountpoint /bin/bash

mount -t proc none /proc

mount -t devpts none /dev/pts

 

 

execute copy_into_chroot.sh from inside your chroot environment.

type ‘exit‘ to leave your chroot

On your S3 Instance umount  your EBS filesystem, as your almost ready to fire it up!!

create snapshot of EBS (make note of the EBS snap id)

Next register your EBS backed image, specifying the id of the snapshot you just took (snap-1ab23c45).

ec2-register –private-key=/ec2_creds/pk-.pem –cert=/ec2_creds/cert-.pem –region=EU-WEST-1 -a x86_64 -b /dev/sda1=snap-1ab23c45:20:false -d “Matts EBS backed Squeeze test” -n “SqueezeEBS” –kernel=”aki-780d250c” –ramdisk=”ari-7f0d250b” (the 20 after the snap id is the volume size, so it must match your AMI image size).

This will send you back an ami-id to use when starting an instance, this is done in the same way as an Instance-store AMI, although you will notice that instead of ‘instance-store‘ it will now display ‘ebs‘.

What you will notice starting and stoping this Instance is that any changes that you make will be preserved and available on start, which might suit some peoples requirements.

Hope someone finds these pointers useful.

Matt Palmer  - 6th June 2011

 

 

openSUSE Weekly News 178 is out!

We are pleased to announce our new openSUSE Weekly News 178.

In this Issue:

  • First step towards 12.1 with Milestone 1
  • Andreas Jaeger: Factory Progress 2011-06-03
  • Sebastian Kügler: kollaboration in at platform 11
  • Linus Torvalds: Linux 3.0-rc1
  • and many more ...

You can download it there:

We hope you enjoy the reading :-)

If you want to help us collecting interesting articles for the openSUSE Weekly News, so you can all your stuff into our new ietherpad: http://os-news.ietherpad.com/2.

Found Bugs? Please place it in our Bugtracker: http://developer.berlios.de/bugs/?group_id=12095

Features, Ideas and Improvements can placed in our Featuretracker: http://developer.berlios.de/feature/?group_id=12095

Older content can be found there.

Flattr this

 

What I know I Give

I have been playing around with my systems, understanding their benefits, and in the process, broke them to a small extent. There are no howstos that I could refer to and there was no knowledge of what failed and why. All I had was a sense of exploration. 

When there is a problem, there is always a solution. All it takes is a little patience and SLOW reading. OF course, you can just reinstall the system if you like and do things the long and cheap way, if you have backups. However, the best part about living is to challenge yourself. Now, I don't usually do things via command line, but with a little exposer, the only thing in the way is time.

To start things off, one of my  ubuntu systems was in the updating process. It finished with no errors, as usual. A day later, the system would not boot. All I got was the grub2> prompt. I figured there had to be something wrong with the file system. The /var/log was viewed and from the last line read, the "init" was missing. Assuming that all I had to do  was replace it, this did not sound easy. I did a little digging around and uncovered some information about installing the kernel. The instructions unfortunately were not easy to follow.

With little choice, it was decided to just do it. Before the installation of the kernel was initiated, there was one method I did not try, running fsck.

When the update was executing something was accidently misplaced. Which means, the file system needs to be restructured. I booted my PC by using a liveCD of my distro, mounted the partition of my OS and ran #sudo fsck /dev/sdx1. 

Once that finished, the system said that all was finished with not errors. I booted my system with my hard drive and all was well. 

In conclusion, when faced with a system failure, remember the last thing you did before it happened, ALWAYS. Then read the syslog in /var/log folder to get more details on what happened. Understanding what the log says, you can take the more appropriate route into repairing your system. NOTE: If the system says it is missing something, and you did not delete anything, simply, as your first step, run fsck on your partition. 

I will return with another howto.

 

Calibre dropped down from openSUSE Repositories

We dropping down all Calibre Packages from all openSUSE Repositories.

Since a February 2009 the openSUSE Packagers are packaging calibre for openSUSE. The first comitted Version was 0.4.134, and was comitted by Thomas Schraitle. Since that Version we have done some little things to integrate calibre better into the openSUSE Distribution. Since that time it was possible to provide packages for all actual published openSUSE Versions.

With the start of publishing 0.8.x the Developerteam switched to bleeding edge version of python. We now have that python version into our Factory Repository, but not into 11.4. In short that means, that we can't provide any calibre version for published openSUSE versions.

Yesterday i've chatted with the main developer Kovid Goyal, and explained him the trouble. But sadly he isn't interested to support us in that, through not using bleeding edge.

So we decided to drop down the calibre package from the Documentation:Tools Repository and from openSUSE:Factory, because it looks like the Project aren't interested to help us out. The removing of the packages should done this week.

I'm sorry to write that, 'cause i liked this piece of Software.

 
Page 4 of 116

Upcoming Training Courses

  1. LF411 Embedded Linux Development
    24 Jun » 28 Jun - Silicon Valley
    Details
  2. LF331 Developing Linux Device Drivers
    05 Aug » 09 Aug - Virtual
    Details
  3. LF320 Linux Kernel Internals and Debugging
    12 Aug » 16 Aug - Virtual
    Details

View All Upcoming Courses


Who we are ?

The Linux Foundation is a non-profit consortium dedicated to the growth of Linux.

More About the foundation...

Frequent Questions

Join / Linux Training / Board