Type the following command to install the pdftk (note it will install java too, if you do not like java, just use another tool):
$ sudo apt-get install pdftk
Decrypt a PDF called input.pdf with YOURPASSWORD-HERE password and create unencrypted output.pdf, enter:
pdftk input.pdf output output.pdf user_pw YOURPASSWORD-HERE
OR
pdftk input.pdf output output.pdf user_pw YOURPASSWORD-HERE owner_pw YOURPASSWORD-HERE
OR
pdftk input.pdf output output.pdf input_pw YOURPASSWORD-HERE
Where,
* input_pw password : Input PDF owner passwords
* user_pw password : Input PDF user passwords
* owner_pw password : Input PDF owner passwords same as input_pw.
How Do I Use qpdf To Remove The Password?
Type the following command to install the qpdf:
$ sudo apt-get install qpdf
Decrypt a PDF called input.pdf with YOURPASSWORD-HERE password and create unencrypted output.pdf, enter:
qpdf --password=YOURPASSWORD-HERE --decrypt input.pdf output.pdf
How Do I Use xpdf-utils To Remove The Password?
Type the following command to install the qpdf:
$ sudo apt-get install xpdf-utils
First, decrypt a PDF and create a postscript file, enter:
pdftops -upw YOURPASSWORD-HERE input.pdf
You will get input.ps file. This can be printed or open under Linux itself. But, you can convert it back .ps file (postscript)back to a PDF as follows:
ps2pdf input.ps
Please note that the ps2pdf command is part of ghostscript and it will get installed when you run xpdf-utils.
How Do I Use evince To Remove The Password?
Open a pdf file using evince itself, enter:
evince input.pdf
Enter your password. Once opened click on File > Print > Select "Print to file" > Select "PDF" as output format and click on Print. Source: http://www.cyberciti.biz
Monday, January 18, 2010
Sunday, January 10, 2010
Partition / Filesystem Mount Options - fstab file
Here is a sample /etc/fstab entry
/dev/cdrom /media/cdrom auto ro,noauto,user,exec 0 0
The fourth column in fstab lists all the mount options for the device or partition. This is also the most confusing column in the fstab file, but knowing what some of the most common options mean, saves you from a big headache. For more information, check out the man page of mount.
auto and noauto With the auto option, the device will be mounted automatically (at bootup). auto is the default option. If you don't want the device to be mounted automatically, use the noauto option in /etc/fstab. With noauto, the device can be mounted only explicitly.
user and nouser These are very useful options. The user option allows normal users to mount the device, whereas nouser lets only the root to mount the device. nouser is the default. If you're not able to mount your cdrom, floppy, Windows partition, or something else as a normal user, add the user option into /etc/fstab.
exec and noexec exec lets you execute binaries that are on that partition, whereas noexec doesn't let you do that. noexec might be useful for a partition that contains binaries you don't want to execute on your system, or that can't even be executed on your system. This might be the case of a Windows partition.
ro Mount the filesystem read-only.
rw Mount the filesystem read-write.
sync and async sync means it's done synchronously, this means that when you, for example, copy a file to the partition, the changes are physically written to the partition at the same time you issue the copy command.
However, if you have the async option in /etc/fstab, input and output is done asynchronously. Now when you copy a file to the partition, the changes may be physically written to it long time after issuing the command. async is default.
defaults Uses the default options that are rw, suid, dev, exec, auto, nouser, and async. Source: linuxpoison.blogspot.com
/dev/cdrom /media/cdrom auto ro,noauto,user,exec 0 0
The fourth column in fstab lists all the mount options for the device or partition. This is also the most confusing column in the fstab file, but knowing what some of the most common options mean, saves you from a big headache. For more information, check out the man page of mount.
auto and noauto With the auto option, the device will be mounted automatically (at bootup). auto is the default option. If you don't want the device to be mounted automatically, use the noauto option in /etc/fstab. With noauto, the device can be mounted only explicitly.
user and nouser These are very useful options. The user option allows normal users to mount the device, whereas nouser lets only the root to mount the device. nouser is the default. If you're not able to mount your cdrom, floppy, Windows partition, or something else as a normal user, add the user option into /etc/fstab.
exec and noexec exec lets you execute binaries that are on that partition, whereas noexec doesn't let you do that. noexec might be useful for a partition that contains binaries you don't want to execute on your system, or that can't even be executed on your system. This might be the case of a Windows partition.
ro Mount the filesystem read-only.
rw Mount the filesystem read-write.
sync and async sync means it's done synchronously, this means that when you, for example, copy a file to the partition, the changes are physically written to the partition at the same time you issue the copy command.
However, if you have the async option in /etc/fstab, input and output is done asynchronously. Now when you copy a file to the partition, the changes may be physically written to it long time after issuing the command. async is default.
defaults Uses the default options that are rw, suid, dev, exec, auto, nouser, and async. Source: linuxpoison.blogspot.com
Sunday, January 3, 2010
SWFTools
SWFTools is a collection of utilities for working with Adobe Flash files (SWF files). The tool collection includes programs for reading SWF files, combining them, and creating them from other content (like images, sound files, videos or sourcecode). SWFTools is released under the GPL.
The current collection is comprised of the programs detailed below:
* PDF2SWF A PDF to SWF Converter. Generates one frame per page. Enables you to have fully formatted text, including tables, formulas, graphics etc. inside your Flash Movie. It's based on the xpdf PDF parser from Derek B. Noonburg.
* SWFCombine A multi-function tool for inserting SWFs into Wrapper SWFs, contatenating SWFs, stacking SWFs or for basic parameter manipulation (e.g. changing size).
* SWFStrings Scans SWFs for text data.
* SWFDump Prints out various informations about SWFs, like contained images/fonts/sounds, disassembly of contained code as well as cross-reference and bounding box data.
* JPEG2SWF Takes one or more JPEG pictures and generates a SWF slideshow from them. Supports motion estimation compression (h.263) for better compression of video sequences.
* PNG2SWF Like JPEG2SWF, only for PNGs.
* GIF2SWF Converts GIFs to SWF. Also able to handle animated gifs.
* WAV2SWF Converts WAV audio files to SWFs, using the L.A.M.E. MP3 encoder library.
* AVI2SWF Converts AVI animation files to SWF. It supports Flash MX H.263 compression. Some examples can be found at examples.html. (Notice: this tool is not included anymore in the latest version, as ffmpeg or mencoder do a better job nowadays)
* Font2SWF Converts font files (TTF, Type1) to SWF.
* SWFBBox Allows to read out, optimize and readjust SWF bounding boxes.
* SWFC A tool for creating SWF files from simple script files. Includes support for both ActionScript 2.0 as well as ActionScript 3.0.
* SWFExtract Allows to extract Movieclips, Sounds, Images etc. from SWF files.
* AS3Compile A standalone ActionScript 3.0 compiler. Mostly compatible with Flex.
SWFTools has been reported to work on Solaris, Linux (both 32 as well as 64 bit), FreeBSD, OpenBSD, HP-UX, Solaris, MacOS X and Windows 98/ME/2000/XP/Vista. Source: Swfttools
The current collection is comprised of the programs detailed below:
* PDF2SWF A PDF to SWF Converter. Generates one frame per page. Enables you to have fully formatted text, including tables, formulas, graphics etc. inside your Flash Movie. It's based on the xpdf PDF parser from Derek B. Noonburg.
* SWFCombine A multi-function tool for inserting SWFs into Wrapper SWFs, contatenating SWFs, stacking SWFs or for basic parameter manipulation (e.g. changing size).
* SWFStrings Scans SWFs for text data.
* SWFDump Prints out various informations about SWFs, like contained images/fonts/sounds, disassembly of contained code as well as cross-reference and bounding box data.
* JPEG2SWF Takes one or more JPEG pictures and generates a SWF slideshow from them. Supports motion estimation compression (h.263) for better compression of video sequences.
* PNG2SWF Like JPEG2SWF, only for PNGs.
* GIF2SWF Converts GIFs to SWF. Also able to handle animated gifs.
* WAV2SWF Converts WAV audio files to SWFs, using the L.A.M.E. MP3 encoder library.
* AVI2SWF Converts AVI animation files to SWF. It supports Flash MX H.263 compression. Some examples can be found at examples.html. (Notice: this tool is not included anymore in the latest version, as ffmpeg or mencoder do a better job nowadays)
* Font2SWF Converts font files (TTF, Type1) to SWF.
* SWFBBox Allows to read out, optimize and readjust SWF bounding boxes.
* SWFC A tool for creating SWF files from simple script files. Includes support for both ActionScript 2.0 as well as ActionScript 3.0.
* SWFExtract Allows to extract Movieclips, Sounds, Images etc. from SWF files.
* AS3Compile A standalone ActionScript 3.0 compiler. Mostly compatible with Flex.
SWFTools has been reported to work on Solaris, Linux (both 32 as well as 64 bit), FreeBSD, OpenBSD, HP-UX, Solaris, MacOS X and Windows 98/ME/2000/XP/Vista. Source: Swfttools
Labels:
Audio-video,
Tips / Tricks
Monday, December 28, 2009
How to build .deb packages from tar.gz
Method 1
The common method is to use dh_make and dpkg-buildpackage to create a .deb package and install it. This is how we do it.
Step 1. Install required packages.
sudo apt-get install dh-make fakeroot build-essential autotools-dev
Step 1. Extract the contents of Tarball
tar -xvzf source.tar.gz
Step 2. Change directory to source folder
cd /path/to/source/folder
Step 3. Create control files, selecting the attributes of package.
dh_make
Step 4. Finally compile the package.
sudo dpkg-buildpackage -rfakeroot
Step 5. Install all the packages, created by dpkg-buildpackage
Method 2
Another method is to use checkinstall, which is quite easier.
Some packages may use different build tools, or you may want to build application with qmake, cmake or something else instead of make. Or just wanted to be able to remove package without troubles. Use checkinstall
Step 1. Install required packages.
sudo apt-get install checkinstall
Step 2. There are no harder steps. Build your package first, your build method may differ.
./configure && make
Step 3. At the end, replace the sudo make install command with following.
sudo checkinstall -D make install
Check install will also allow you to create package with custom meta-data, It will also create a deb package which you can keep for later use. Source: http://penguininside.blogspot.com
The common method is to use dh_make and dpkg-buildpackage to create a .deb package and install it. This is how we do it.
Step 1. Install required packages.
sudo apt-get install dh-make fakeroot build-essential autotools-dev
Step 1. Extract the contents of Tarball
tar -xvzf source.tar.gz
Step 2. Change directory to source folder
cd /path/to/source/folder
Step 3. Create control files, selecting the attributes of package.
dh_make
Step 4. Finally compile the package.
sudo dpkg-buildpackage -rfakeroot
Step 5. Install all the packages, created by dpkg-buildpackage
Method 2
Another method is to use checkinstall, which is quite easier.
Some packages may use different build tools, or you may want to build application with qmake, cmake or something else instead of make. Or just wanted to be able to remove package without troubles. Use checkinstall
Step 1. Install required packages.
sudo apt-get install checkinstall
Step 2. There are no harder steps. Build your package first, your build method may differ.
./configure && make
Step 3. At the end, replace the sudo make install command with following.
sudo checkinstall -D make install
Check install will also allow you to create package with custom meta-data, It will also create a deb package which you can keep for later use. Source: http://penguininside.blogspot.com
Monday, December 21, 2009
Ways To Kill Unresponsive Programs in Linux
Most Windows users know about the utility of the Ctrl + Alt + Del
keys when dealing with an unresponsive application. A program is said
to be unresponsive when it doesn’t respond to any user interaction and
neither does it perform its intended actions. There are plenty of jokes
surrounding the whole Ctrl + Alt + Del combination that brings up the
task manager in Windows and allows you to end unresponsive
applications. Things seldom go this far in the Linux world, however
claiming that such Linux unresponsiveness doesn’t occur would be a
plain lie.
The good thing about Linux is that you almost never have to hit the reset button due to unresponsive or hung applications. There are so many ways you can gain back control that you never have to resort to such extreme measures. In this article, we take a look at some of the ways you can deal with unresponsive applications on your Linux box.

Each running process has a unique process ID under Linux. If you know the process ID of the miscreant you can straightaway issue:
kill <processID>
to kill the misbehaving process. This should hopefully restore some sanity to your computer and you can switch back to the GUI using Ctrl + Alt + F7.

You can use the pkill command to kill using process name. As an example the following command would kill Firefox:
pkill firefox
Notice how you didn’t have to know or specify the process ID. Alternatively, you can use the pgrep command to get the process ID of any running process on the system. The process ID can then be used to kill or send other signals to the process.



There are a lot more to these commands than what can be covered in a
short write-up. ‘pkill’ for instance, lets you search for a process not
only by its name but by the user who owns the process, the time it was
started or lists all the processes that do not match a certain
criteria. In addition, these commands can be used to send other signals
to the processes as well. By default, SIGTERM is sent which may be
ignored by some processes in which case you can use the kill -9
<processID> to send a KILL signal. You can learn about all the
options by reading the manuals for the respective commands.
Right click the panel click “add to panel” then “Force Quit”. From now on, you are just just two clicks to killing any unresponsive app (presuming it occupies a clickable window).
In most Linux GUIs, just press toghether Ctrl-Alt-Esc to get a killing mouse pointer (just like xkill, but easier).
If you change your mind, just press Esc to abort killing and revert to a normal pointer.Source: www.makeuseof.com
The good thing about Linux is that you almost never have to hit the reset button due to unresponsive or hung applications. There are so many ways you can gain back control that you never have to resort to such extreme measures. In this article, we take a look at some of the ways you can deal with unresponsive applications on your Linux box.
Dealing with Linux Unresponsiveness – Using System Monitor
First and foremost you can use the familiar System Monitor tool. It looks a lot like the Windows Task manager, only it is better. Not only does it provide you with lots of information about the current state of the computer system, you can use the Processes tab to look for any misbehaving applications and choose to Kill or Stop the process. Both of these operations are very different in the Linux world: stop suspends the execution of the process and kill would close it completely.Using the ‘kill’ command
So far so good, however there are times when you cannot use the GUI altogether. Starting the System Monitor is out of question in such situations. In these situations, you can leverage the power of Linux command line to your advantage. You can enter these commands in a terminal if it is available or you can switch to a virtual terminal using Ctrl + Alt + F1 and logging in using the text mode.Each running process has a unique process ID under Linux. If you know the process ID of the miscreant you can straightaway issue:
kill <processID>
to kill the misbehaving process. This should hopefully restore some sanity to your computer and you can switch back to the GUI using Ctrl + Alt + F7.
Using the ‘pkill’ and ‘pgrep’ commands
If on the other hand you don’t know the process ID then you can either kill the process by its name or you can analyze all the running processes to diagnose the problem (using something like the top command).pkill firefox
Notice how you didn’t have to know or specify the process ID. Alternatively, you can use the pgrep command to get the process ID of any running process on the system. The process ID can then be used to kill or send other signals to the process.
Using the ‘xkill’ command
When using the GUI you can also use the xkill command which makes your mouse pointer all mighty and powerful After issuing the xkill command you can click on the application you want to kill and it will be gone and killed for you in a click!Using the ‘killall’ command
Last but not the least, there is the killall command. Terrifying as it may seem, it doesn’t kill all the processes running on the computer. Instead it is used to kill multiple instances of the same program. eg killall firefox will kill all windows and Firefox profiles that might be currently executing.Right click the panel click “add to panel” then “Force Quit”. From now on, you are just just two clicks to killing any unresponsive app (presuming it occupies a clickable window).
In most Linux GUIs, just press toghether Ctrl-Alt-Esc to get a killing mouse pointer (just like xkill, but easier).
If you change your mind, just press Esc to abort killing and revert to a normal pointer.Source: www.makeuseof.com
Sunday, December 20, 2009
How to mount external media in Linux via Console
Most of the modern Linux distros can easily detect & mount
external drives automatically. In extremely rare case they may fail to
mount. At such times, knowing how to manually mount the external drives
will come handy. This simple guide will show you to mount external
drives like pendrive, external hard-disks, card reader etc in Linux.
First insert the drive in the USB port & then issue the following command as root;
fdisk –l (That’s an ‘L’ not an ‘i’)
This will list all the storage devices attached to your computer including your internal hard-disk. Now look for an entry below your hard-disk & make a note of the device address. It would most probably be /dev/sdb1if you just have a single hard-disk installed in your computer.
In Linux, each device has is represented by a file. So before we can mount anything we need to create a location also known as mount point. So to mount the pendrive create a new folder “pendrive” under /media. You can give any name to the folder it doesn’t matter. This can be done by issuing,
mkdir /media/pendrive
Now that our mount point is created, we need to mount the pendrive at this point to make it accessible. So issue the following command;
mount “media address” “mount point”
In our example the media address is “/dev/sdb1″ & mount point is “/media/pendrive”. So the command to mount the pendrive in our case will be;
mount /dev/sdb1 /media/pendrive
After that your pendrive should be mounted at /media/pendrive & you can view its content by navigating through file manager or via issuing;
ls /media/pendrive
After your are done working with the external drive, it needs to be unmounted before you can unplug it from the USB. To unmount the pendrive issue;
umount /media/pendrive
Do remember to close all the active applications running from the external drive or the unmount will fail.
Source: linux.gauravlive.com
First insert the drive in the USB port & then issue the following command as root;
fdisk –l (That’s an ‘L’ not an ‘i’)
This will list all the storage devices attached to your computer including your internal hard-disk. Now look for an entry below your hard-disk & make a note of the device address. It would most probably be /dev/sdb1if you just have a single hard-disk installed in your computer.
In Linux, each device has is represented by a file. So before we can mount anything we need to create a location also known as mount point. So to mount the pendrive create a new folder “pendrive” under /media. You can give any name to the folder it doesn’t matter. This can be done by issuing,
mkdir /media/pendrive
Now that our mount point is created, we need to mount the pendrive at this point to make it accessible. So issue the following command;
mount “media address” “mount point”
In our example the media address is “/dev/sdb1″ & mount point is “/media/pendrive”. So the command to mount the pendrive in our case will be;
mount /dev/sdb1 /media/pendrive
After that your pendrive should be mounted at /media/pendrive & you can view its content by navigating through file manager or via issuing;
ls /media/pendrive
After your are done working with the external drive, it needs to be unmounted before you can unplug it from the USB. To unmount the pendrive issue;
umount /media/pendrive
Do remember to close all the active applications running from the external drive or the unmount will fail.
Source: linux.gauravlive.com
Manage Microsoft compiled html help files in Linux
If you’ve worked in Windows long enough, you have come across the .chm file format. This format is nothing more than a compressed html directory with an included index for easy viewing. Problem is, you can’t view these files in Linux without the help of another tool. And sometimes you want to be able view these files in another format. Well, fortunately the Linux development community has solved that problem by creating various tools to manage these .chm files.
In this tutorial you are going to learn how to view .chm files and convert them to both html and pdf documents. This tutorial will be using the Ubuntu distribution, but this task can be tackled with just about any distribution available.
View chm files
Before we get into converting these files, let’s see how to simply view them in Linux. Luckily there is a single, user-friendly tool for this task. The tool – Xchm. Xchm does one thing – view compiled html documents. This tool can display the contents tree (if one exists), allows you to navigate the document, change the fonts, and search the text.
To install this tool issue the following command:
sudo apt-get install xchm
Once installed, you can start the tool from the Office sub-menu of the Applications menu. When you start the tool up you should instantly notice how simple the interface is.
In Figure 1 Xchm is opened with a Microsoft TechNet document. As you can see, you can navigate around using any link included in the document as well as with the contents tree in the left pane.
But what if you want to edit that document or convert it to a pdf document? Simple – install two more applications.
Editing chm documents
In order to edit these documents you are going to need to convert them to html documents. This conversion is done with the CHMLIB tool. To install this issue the command:
sudo apt-get install libchm-bin
After this tool is installed you can make the conversions with a command like this:
extract_chmLib file.chm output_dir
Where file.chm is the chm file you want to convert and output_dir is the name of the directory you want to output the file to. Understand that the output_dir does not (nor should) already exist, because the command will create it for you.
When the command is issued all of the contents of the chm file will be extracted into the output_dir. From there you can go into the newly created directory and edit to your hearts content.
Converting to pdf
The next task is to convert the file to a pdf document. This is done with the help of the htmldoc application. First, install this with the command:
sudo apt-get install htmldoc
The html tool is a graphical tool that allows you to add as many html documents that you want and convert them all into a single pdf file. The user interface (see Figure 2) is very simple to use.
1. Click the Add Files button.
2. Navigate to the directory containing your html files.
3. Select the file(s) you want to add.
4. Check Web Page as the document type.
5. Click on the Output tab.
6. Check File and then give the file a name in the output path.
7. Check PDF as the output format.
8. Click the Generate button.
You can also deal with the various options in the other tabs, but generating a basic PDF from your html documents is fairly straight forward. Source: www.ghacks.net
In this tutorial you are going to learn how to view .chm files and convert them to both html and pdf documents. This tutorial will be using the Ubuntu distribution, but this task can be tackled with just about any distribution available.
View chm files
Before we get into converting these files, let’s see how to simply view them in Linux. Luckily there is a single, user-friendly tool for this task. The tool – Xchm. Xchm does one thing – view compiled html documents. This tool can display the contents tree (if one exists), allows you to navigate the document, change the fonts, and search the text.
To install this tool issue the following command:
sudo apt-get install xchm
Once installed, you can start the tool from the Office sub-menu of the Applications menu. When you start the tool up you should instantly notice how simple the interface is.
In Figure 1 Xchm is opened with a Microsoft TechNet document. As you can see, you can navigate around using any link included in the document as well as with the contents tree in the left pane.
But what if you want to edit that document or convert it to a pdf document? Simple – install two more applications.
Editing chm documents
In order to edit these documents you are going to need to convert them to html documents. This conversion is done with the CHMLIB tool. To install this issue the command:
sudo apt-get install libchm-bin
After this tool is installed you can make the conversions with a command like this:
extract_chmLib file.chm output_dir
Where file.chm is the chm file you want to convert and output_dir is the name of the directory you want to output the file to. Understand that the output_dir does not (nor should) already exist, because the command will create it for you.
When the command is issued all of the contents of the chm file will be extracted into the output_dir. From there you can go into the newly created directory and edit to your hearts content.
Converting to pdf
The next task is to convert the file to a pdf document. This is done with the help of the htmldoc application. First, install this with the command:
sudo apt-get install htmldoc
The html tool is a graphical tool that allows you to add as many html documents that you want and convert them all into a single pdf file. The user interface (see Figure 2) is very simple to use.
1. Click the Add Files button.
2. Navigate to the directory containing your html files.
3. Select the file(s) you want to add.
4. Check Web Page as the document type.
5. Click on the Output tab.
6. Check File and then give the file a name in the output path.
7. Check PDF as the output format.
8. Click the Generate button.
You can also deal with the various options in the other tabs, but generating a basic PDF from your html documents is fairly straight forward. Source: www.ghacks.net
Friday, December 18, 2009
Repair a corrupted filesystem in Ubuntu
You can repair a corrupted filesystem with the program "fsck".Thesystem utility fsck (for "file system check" or "file systemconsistency check") is a tool for checking the consistency of a filesystem in Unix and Unix-like operating systems such as Linux.
Note:-File systems must be unmounted, you cannotrepair them while they are running.So fsck must ALWAYS be run on anUNmounted filesystem.Running fsck on a mounted filesystem can do SEVEREdamage.
A quick fsck options overview:
Many options for fsck exist, but the most important are:
-f which performs a FAST check
-p which fixes minor problems without user interaction
-y which gives permission to correct every problem found
-n which indicates to only search (and not correct) problems
The most simple variant to run fsck is to force fsck on restart, and then restart your system:
sudo touch /forcefsck
The other option is to swich the system to runlevel 1 (logs-out anyuserRunning fsck on a mounted filesystem can do SEVERE damage), unmountall partitions. run fsck & repair, remount all drives, increase therunlevel to 3 and continue. Source: swik.net
Subscribe to:
Posts (Atom)

