Saturday 20 October 2012

Ubuntu Tweak Will No Longer Be Developed

Comes as a very sad news but Ubuntu Tweak developer has decided to stop the development of Ubuntu Tweak. Tualatrix Chou writes in a blog post:

" I want to stop the development and maintenance of Ubuntu Tweak. This means you will not be able to use “Apps” (Since it is a web service), I will not response for the bug report, the last commit of the code will be: Add cache support for Apps, only available in Ubuntu 12.10, so sad".

While the developer writes the reason as If making free software is not free any more, why still doing this?, I found the whole post quite cryptic.

One of his friend mentions that Ubuntu Tweak, though being a great app has not been included in the official source which is a really depressing thing.


Read more...

Tuesday 16 October 2012

Practical ls Command Examples For Fun & Profit

The power of linux lies in the shell through which we can perform complex job in no time. While the directory listing command 'ls' seems to be very simple command, the linux shell provides the power to use switches and pipes to do anything from terminal. Check out this list with practically useful examples using ls.

Display all files including hidden files/folders

ls -a


Display one file/folder per line

ls -1


Count number of files & folders

ls -1 | wc -l


Human readable file sizes (eg. Mb or Gb)

ls -lh


Alphabetically sort the listing

ls -X


Only list the folders in current directory

ls -d */
ls -p | grep /




Display folders in current directory consisting certain patterns

ls -l D* | grep :$
ls -l *a* | grep :$


List files by descending order of modification time

ls -lt
ls -l --sort=time #alternative long version


List files by descending order of creation time

ls -lct


List files in reverse order

ls -ltr
ls -l --sort=time --reverse #alternative long version


List files in descending order of file size

ls -lSh
ls -lh --sort=size
ls -lSh1 *.avi #find largest AVI file
rm `ls -S1 | head -1` #delete largest file in current folder


List files in ascending order of file size

ls -lShr
ls -lh --sort=size --reverse #alternative long version


Display directories in recursive manner

ls -R


Display the files/folders created today

ls -l --time-style=+%F | grep `date +%F`


Display the files/folders created this year

ls -l --time-style=+%y | grep `date +%y`


Any more example that fires up in your mind? Feel free to share over here ;)


Read more...

Monday 15 October 2012

Useful Nautilus Shortcuts

Nautilus is a default file manager for GNOME Desktop and is used as the default file manager in several linux distros such as Ubuntu. I love nautilus because its simple, friendly, and clean, supports local as well as remote file systems over different protocols. Moreover, there are several useful shortcuts that make life easier while using nautilus.

Below is the list of the most helpful shortcuts for navigation and file management in the nautilus:

Ctrl + r: Refresh the current view

Ctrl + h: Toggle show/hide mode for hidden files

F9: Show/Hide the side pane

Ctrl + l: Activate location/url bar (You can then provide path to local or remote filesystems or quickly copy the absolute paths)

Alt + Up Arrow: Move up one directory level

Alt + Down Arrow: Move down one directory level (the directory to be entered should be selected for this to work)

Alt + Left Arrow: Go back to the previous folder in view

Alt + Right Arrow: Go forward

Ctrl + Shift + n: Create a new empty directory

Ctrl + (+ / -): Zoom in (+) or zoom out (-)

Ctrl + 0: Zoom to normal state

Alt + Enter: View selected file/folder properties

F2: Rename selected file/folder

Ctrl + Shift + Drag file/folder: Create symbolic link to file/folder

Ctrl + f: Search for files/folders

Ctrl + s: Select files based upon templates (eg. select all pdf files using *.pdf)

Ctrl + 1: Toggle view as icons

Ctrl + 2: Toggle view as lists

Ctrl + 3: Toggle compact view

Ctrl + w: Close current nautilus window

Ctrl + Shift + w: Current all open nautilus windows

Ctrl + T: Open new tab

Alt + HOME: Navigate to HOME folder

F6: Toggle between side pane and central pane

Know more shortcuts? Share as the comments :)


Read more...

Saturday 13 October 2012

How To Exclude Directory While Compressing With Tar

Quite a handy and useful tip here. Several times, you want to compress files and folders but there might be cases when you want to compress your data excluding some of the directories. Tar command makes the process easier by providing us a exclusion switch.

I was actually backing up data I had downloaded in the remote server and wanted a copy of backup tar file in my system as well. But all those images that resided in the folders deep inside were not necessary for me. So all I did was something like below:

adm@RServ:~$ tar cvf backup.tar test --exclude=image*


The above command effectively excludes all the sub directories from testdirectory having the string image (eg. image, images, images_old in my case) and creates the backup.tar file. Moreover, the --exclude switch also co-operates the regular expressions so you can specify the regex to filter the directories. As an example, the command below excludes the directories a, b, c, d, and e while creating the tarball.

adm@RServ:~$ tar cvf backup.tar test --exclude=[a-e]


You can exploit this switch for ease several times in your daily works. I hope this helps :)


Read more...

Empty Trash From Command Line In Ubuntu

CLI is such a sexy piece so why bother using GUI, even for cleaning up your trash. In this post, you will see how you can empty trash in Ubuntu from command line.

The trash you see in GUI is nothing but just the view for the files deleted by users which are temporarily moved to the special location of user's home directory. For any user, the trash location is ~/.local/share/Trash/. That is, whatever a user deletes gets saved in this location.

samar@samar-Techgaun:~$ rm -rf ~/.local/share/Trash/


I hope this becomes useful :)


Read more...

Enable Fingerprint Authentication In Ubuntu

So you got fingerprint reader in your device but have not been able to use it under ubuntu? Follow this How To to enable fingerprint authentication in ubuntu using the Fingerprint GUI from fingerprints reader integration team.

First make sure your fingerprint hardware is supported. You can check for the vendor and device ID by entering the following command:

samar@TG:~$ lsusb | grep -i finger | awk -F " " '{print $6}'
138a:0005
This link provides the list of the supported fingerprint readers.

Installation is easy. Fire up the terminal and enter the following commands:

sudo add-apt-repository ppa:fingerprint/fingerprint-gui
sudo apt-get update
sudo apt-get install libbsapi policykit-1-fingerprint-gui fingerprint-gui


You will have to restart the system or log out the session and login back to use and configure the fingerprint GUI.

Press Alt + F2 and type fingerprint-gui. From this GUI, you can configure and enroll your fingerprints.




Read more...

Add Google Search Support In Gnome-Terminal

Gnome-terminal is my favorite thing in my system and recently I came to know that I could add google search support in gnome-terminal which is totally awesome. Ubuntu Tweak already includes the google search support but if you want google search in your terminal without the whole ubuntu tweak, you can follow this guide.

All you need to do is add the PPA and you can easily install the gnome-terminal with google search support. Fire up the terminal and enter the following commands:

sudo add-apt-repository ppa:tualatrix/personal
sudo apt-get update
sudo apt-get install gnome-terminal




Credits: Ubuntu Tweak


Read more...

Friday 12 October 2012

Pinkie Pie Wins $60K In Pwnium2

The teenage hacker who goes by the handle "Pinkie Pie" once again successfully exploited the google chrome browser in the Pwnium 2 event held in HITB2012 conference in Kuala Luampur. With the goal to reward the exceptional vulnerability researchers, Google Chromium team had started Pwnium earlier this year and this is the second installment of Pwnium.

Google software engineer Chris Evans writes in a blog post:

" We’re happy to confirm that we received a valid exploit from returning pwner, Pinkie Pie. This pwn relies on a WebKit Scalable Vector Graphics (SVG) compromise to exploit the renderer process and a second bug in the IPC layer to escape the Chrome sandbox. Since this exploit depends entirely on bugs within Chrome to achieve code execution, it qualifies for our highest award level as a “full Chrome exploit,” a $60,000 prize and free Chromebook. "

Chromium team has already released the patched and updated google chrome in less than 10 hours after the exploit was confirmed. The Stable channel has been updated to 22.0.1229.94 for Windows, Mac, and Linux which contains the fix for the security exploit discovered by Pinkie Pie


Read more...

Wednesday 3 October 2012

Keccak Wins The SHA-3 Competition

After five years of competition, National Institute of Standards and Technology (NIST) has announced the winner of SHA-3 competition. The Keccak has been selected as the standard for SHA-3 algorithm among the 64 entries made for SHA-3 cryptographic algorithm announced by NIST back in November 2, 2007.

After three rounds of competitions, the finalists were five hash algorithms. On December 9, 2010, NIST announced five third-round candidates – BLAKE, Grøstl, JH, Keccak and Skein, to enter the final round of the competition. And, the winner is Keccak.

Keccak was designed by a team of cryptographers from Belgium and Italy, they are:

  • Guido Bertoni (Italy) of STMicroelectronics,
  • Joan Daemen (Belgium) of STMicroelectronics,
  • Michaël Peeters (Belgium) of NXP Semiconductors,
  • Gilles Van Assche (Belgium) of STMicroelectronics.


The NIST team praised the Keccak algorithm for its many admirable qualities, including its elegant design and its ability to run well on many different computing devices. The clarity of Keccak’s construction lends itself to easy analysis, and Keccak has higher performance in hardware implementations than SHA-2 or any of the other finalists.

Keccak has the added advantage of not being vulnerable in the same ways SHA-2 might be,” says NIST computer security expert Tim Polk. “An attack that could work on SHA-2 most likely would not work on Keccak because the two algorithms are designed so differently.

Though SHA-2 is still considered to be still secure enough for general usage, SHA-3 is thought to provide a new security tool for system and protocol designers, and that may create opportunities for security in networks that did not exist before.

If you are interested in quick summary about the pseudocode of Keccak, you can read the summary of Keccak.


Read more...

Tuesday 2 October 2012

Binary, Hex, Octal and Decimal Conversion Under Linux

Base conversions are easy with linux CLI. No need of fancy GUI-based calculator to perform base conversions when there is our favorite linux terminal.

We will be using bc, a calculator language that supports arbitrary precision numbers with interactive execution of statements. We will exploit the pipelining feature of shell and will let the bc process our query to convert the numbers from one base to other.

From binary to decimal

The syntax is obvious and we will follow the similar syntax for all the conversions. In this first example, we are converting the binary number 1101101 from input base binary to decimal(obase defaults to decimal unless specified).

samar@samar-Techgaun:~$ echo "ibase=2;1101101" | bc
109


From octal to decimal

samar@samar-Techgaun:~$ echo "ibase=8;1101101" | bc
295489


From Hexadecimal to decimal

samar@samar-Techgaun:~$ echo "ibase=16;A1F3DF" | bc
10613727


From N-base to decimal

All you need to do is provide the appropriate ibase value (eg. ibase=4 for 4-base to decimal conversion).

samar@samar-Techgaun:~$ echo "ibase=16;A1F3DF" | bc
10613727


As seen in all the examples above, the conversion to decimal numbers does not require you to specify the obase as obase defaults to decimal. The same thing applies for ibase i.e. ibase defaults to decimal base by default as seen in the examples below.

Now lets try some conversion with decimal numbers as the input base.

From decimal to binary

samar@samar-Techgaun:~$ echo "obase=2;109" | bc
1101101


From decimal to octal

samar@samar-Techgaun:~$ echo "obase=8;295489" | bc
1101101


From decimal to hexadecimal

samar@samar-Techgaun:~$ echo "obase=16;10613727" | bc
A1F3DF


From decimal to N-base

All you need to do is provide the appropriate obase value (eg. obase=4 for decimal to 4-base conversion).

samar@samar-Techgaun:~$ echo "obase=4;121" | bc
1321


Below are few more examples of base conversions to clarify the use of the command.

From binary to octal

samar@samar-Techgaun:~$ echo "ibase=2;obase=8;1111" | bc
17


From hexadecimal to binary

samar@samar-Techgaun:~$ echo "ibase=16;obase=2;AFBE" | bc
1010111110111110


I hope this is helpful ;-)


Read more...

Friday 28 September 2012

Mozilla Announces First Beta Release Of Persona

Persona is finally ready for use. Today, Mozilla is going to announce the first public beta release of Persona, a login management system that eliminates per-site passwords in websites while being safe, secure and easy to use. Mozilla Persona is a completely decentralized and secure authentication system for the web based on the open BrowserID protocol. To get started with Mozilla Persona, you'll have to signup here. FYI, Persona was first introduced as BrowserID.

Persona is now ready to use for authentication and will be available from today to the public as the first beta release. It works in all major smartphone, tablet, and desktop browsers and the user experience has been thoroughly reviewed and polished.

Available in more than 25 languages, Persona does not need any API keys and it will always remain free. Persona is an open source project and you can easily use persona with your site. Persona is safe, secure, and built on top of public key cryptography. Instead of a password, the user's browser generates a cryptographic "identity assertion" that expires after a few minutes and is only valid on a single site. Because there are no site-specific passwords, websites using Persona don't have to worry about securely storing or potentially losing a password database.

The sites such as OpenPhoto and Times Crossword are already using Mozilla Persona in their websites.



Persona is built upon BrowserID protocol. Once popular browser vendors implement BrowserID, they will no longer need to rely on Mozilla to log in. You can easily integrate Persona in few minutes. Persona is already getting integrated in different applications.

Lets see how successful will be Mozilla Persona, its success depends upon the adoption by websites and applications and then the subsequent use by the users.

Want to read more?

Announcing the Beta release of Persona

Mozilla Persona Documentation

New API for Persona


Read more...

Ubuntu 12.10 Beta 2 Released

The ubuntu developers have just released the Beta 2 of Ubuntu 12.10 Quantal Quetzal which gives the preview of the next version of ubuntu. The final ubuntu 12.10 release is scheduled for 18th October this year. The Beta 2 release is intended to give the preview of how the final release of Quantal Quetzal will be like. The previous beta 1 release was released on 6th September.



As always, Ubuntu has chosen the Quetzal as codename for Ubuntu 12.10. According to Wikipedia, Quetzals are strikingly colored birds in the trogon family. They are found in forests and woodlands, especially in humid highlands, with the five species from the genus Pharomachrus being exclusively Neotropical, while the single Euptilotis species is almost entirely restricted to western Mexico.

Like we heard earlier, Ubuntu 12.10 releases are no longer available as Live CD.

Download Quantal Quetzal 12.10 Beta 2 Release


Read more...

Thursday 27 September 2012

GNOME 3.6 Released

The GNOME project has released its third update v. 3.6 to its 3.X series. This latest version of GNOME 3 includes a number of new features and enhancements, as well as many bug fixes and minor improvements. Together, they represent a significant upgrade to the GNOME 3 user experience.

Andreas Nilsson, President of the GNOME Foundation, said: “The GNOME Foundation is proud to present this latest GNOME release, and I would like to congratulate the GNOME community on its achievement.” He described the release as “an important milestone in our mission to bring a free and open computing environment to everyone.

Highlights for this release include:
  • Big improvements to notifications, including a redesigned Message Tray, smarter notifications, and other tweaks and refinements.
  • An enhanced Activities Overview with an improved layout.
  • A greatly enhanced Files application, with functional file search, a new Recent location, redesigned interface and lots of bug fixes and handy new features.
  • Integrated Input Sources, which makes inputting different character sets (eg. Japanese or Chinese) fast and easy.
  • Accessibility on demand, meaning that universal access features like the Orca screen reader can be enabled with the push of a button.
  • A new Lock Screen. This provides an attractive view when the device is locked, plus handy functionality like media controls and notifications.
Wanna read more?

GNOME 3.6 Released: Evolution in the making

GNOME 3.6 Release Notes

Getting GNOME


Read more...

Saturday 15 September 2012

Things To Do On The Ocassion Of Software Freedom Day

If you are FOSS enthusiast then you are possibly seeking for some ideas to celebrate Software Freedom Day in different way. I have come up with some ideas I could think of doing on the ocassion of software freedom day today.

Software Freedom Day (SFD) is annually celebrated on the third saturday of September with the aim of increasing awareness of Free Software and its virtues, and encouraging its use. SFD was first observed in 28th of August back in 2004 and since 2006, it is observed on the 3rd saturday of september. Software Freedom International acts as the central legal body for organizing software freedom day and each local team is responsible for organizing the local chapters of Software Freedom Day.

Software Freedom Day is not just about attending an event that is organized locally in your area. Rather, you can do anything that hits your mind to celebrate software freedom day. Below are some of the ideas in my mind.

  • Attend local SFD events
  • You can attend the local SFD events being organized today. You can find the local events through SFD 2012 events map. Locate the nearby event and attend it. Maybe you will find someone to discuss with :)

  • Listen to the SFD and other FOSS songs
  • Download the SFD song or FSF song on your favorite music gadget and listen to them the whole day. You can also listen the musics at MUSOpen.org.

  • Listen to the free audio and video speeches from FSF and GNU
  • You can listen to several audio and video speeches related to the free software foundation and GNU movements which are available at audio-video.gnu.org. Quite a good way to pass the time while getting to know about FSF, GNU and related events.

  • Watch some open source movies and documentaries
  • You can download and watch the open-source or free-content films for time pass. You can also watch the movies and documentaries. Some of them are Revolution OS, Freedom Fry, The Codebreakers, Code Rush, Still This 1, Still This 2, The Code, Arduino documentary and few others you can find on net. If you got any suggestions, do drop them as comments.

  • Run an install fest anywhere possible
  • You could run the installation fest and help your friends and relatives install different linux distros. It can be anywhere. I mean anywhere. You can do it in your own home, in your school, and in your office. After all, its fun to motivate your friends and relatives to use open source softwares if they are not already using them. Literate the people who are around you. Believe me its fun.

  • Try finding bug on some open source softwares
  • Grab some open source softwares; it can be desktop app or web app. Try finding bugs or errors in them and report them. You have just helped to improve one of the open source softwares and your contribution will be counted for sure :). If you are geek enough, try finding some critical bugs and vulnerabilities. It can be kind of tough and challenging task but its always fun to do so.

  • Do some blogging about software freedom and free and open source softwares
  • If you got your own blog or website, make some entries related to software freedom. You could include the event you just visited or you could discuss about the free and open source softwares available in the market. If you don't have blog already, start today. Its a good day itself to start blogging on open source softwares.

  • Write some code snippets and useful little softwares
  • If you are a good programmer, why not write and distribute the small software projects by today itself. You could do small stuffs like command line file transfer app, nepali calendar or anything you can think of. Try to develop some local software that will be useful for you and your community.

  • Join any beginner IRC channel and help the beginners
  • Search for some IRC channels in freenode or other networks and try helping the beginners. You can preferably choose the IRC channels related to linux, programming, hacking, and open source softwares and then dedicate some hours of your day to help other people.

  • Donate some amount to your favorite open source softwares
  • Got some bucks to spare? Why not donate some amount to your favorite open source software. This can be very motivating to the developers of open source softwares.

Any other idea that hits your mind? Share as the comment :)

And at last, happy software freedom day to all the freedom lovers :)


Read more...

Friday 14 September 2012

How To Find The Location Of Command In Linux

Sometimes you need to find the pathnames or locations of commands you use frequently. In this post, I am going to discuss two useful commands that are useful for locating Linux commands.

The first command to locate the Linux commands is which. This command returns the pathnames of the files or links. However, it does not follow the symbolic links.

samar@Techgaun:~$ which bash
/bin/bash

You can also find the pathnames of multiple commands at once using which command.

samar@Techgaun:~$ which -a bash cat ls iftop
/bin/bash
/bin/cat
/bin/ls
/usr/sbin/iftop

The other command is type command which is useful to determine if a command is an alias, a built-in command or an independent command.

samar@Techgaun:~$ type gedit
gedit is /usr/bin/gedit
samar@Techgaun:~$ type grep
grep is aliased to `grep --color=auto'
samar@Techgaun:~$ type -t iftop
file

You can play more with the type command. I hope this helps :)


Read more...

Wednesday 12 September 2012

Disable Guest Account Login In Ubuntu 12.04

Security is an important issue and I do not want anyone to access my machine, not even as the guest. Like almost every operating systems, I could see guest logon option in Ubuntu 12.04 which was turned on by default. This post provides the steps to enable or disable the guest account login in Ubuntu 12.04.

Fire up your terminal and type the following command:

samar@samar-Techgaun:~$ sudo nano /etc/lightdm/lightdm.conf

Now add a new line at the end containing the string as below:

allow-guest=false

Now reboot your system or type the following in your terminal:
samar@samar-Techgaun:~$ sudo /etc/init.d/lightdm restart

The guest account will no longer be active. If you want to enable the guest login again, just remove the line you added or change the value to true. I hope this helps :)


Read more...

How To Fix Bootmgr Missing In UNetBootin

Sometimes while working with the LiveUSBs using UNetBootin, you might face the issue that says the Bootmgr is missing and it also says, Press Ctrl + ALT + DELETE TO Restart. This post will help you to fix this particular issue.

First off, format your USB as a FAT32 since it happens commonly because your USB drive is formatted as NTFS and UNetBootin seems to have issues with NTFS filesystems. If formatting to FAT32 also does not work, then try formatting as FAT filesystem.

If you still get boot errors from USB, it is possible that the partition is not marked as active. Assuming you're on windows, you can use the diskpart tool to make the partition active. See the process below:

list disk

The above command will display the disks and their sizes as well. Choose the appropriate disk as below:

select disk 1

Replace the value 1 in above command to select the correct USB drive. Then again list the partitions but usually you can select the partition for USBs as below and then activate it:

select partition 1
active

The active command will mark the currently selected partition as active. Now reboot and enjoy booting from LiveUSB.


Read more...

Tuesday 11 September 2012

How To Enable Native PDF Viewer In Firefox 15

Firefox 14 added a native HTML5 and javascript based PDF reader to read PDF files within the browser but it is disabled by default in Firefox 15 since it is not totally ready. If you don't mind few minor glitches, you can experience the native PDF viewer in Firefox 15 through about:config

Browser developers are integrating many functionalities in the browsers themselves. PDF viewer is no exception and Mozilla is still working for fully functional PDF viewer based on HTML5 and javascript which is called as pdf.js. Pdf.js is still in Beta phase and Mozilla has not declared it as 100% usable so it is disabled by default in firefox 15.

Type about:config in the URL bar (and ignore warning if it appears). Then search for pdfjs. A particular preference pdfjs.disabled will be listed on the search result whose value is by default set to true.

You will just need to double click on this preference row and it will be set to false. This will enable the native PDF viewer in Firefox 15.


You'll possibly have to restart your browser to see the effect in action.

I have been using the native PDF viewer and haven't faced any glitches or problem still. I hope this is helpful :)


Read more...

Ubuntu Desktop Edition No More In LiveCD

The ubuntu team has announced that they have dropped the LiveCD option for Ubuntu and now onwards Ubuntu will be available as a single 800MB image that can be used from USB or DVD.

The mailing list reads "For the client, this release now has a consolidated Ubuntu image. There is no longer a traditional CD sized image, DVD or alternate image, but rather a single 800MB Ubuntu image that can be used from USB or DVD. This change does not affect Ubuntu Server, which remains a traditional CD sized image.

That is, starting from Ubuntu 12.10 "Quantal Quetzal", we will have a single 800 MB disk image that can only be used with USB or DVD. The decision does not seem to affect Ubuntu's user base since DVDs and USBs are getting cheaper and LiveUSBs are being popular these days.


Read more...

Monday 3 September 2012

Preventing Accidental Overwriting Of Files In Bash Shell

How many times has this happened to you? It used to happen once in a while with me. A Linux user learns to use the redirection operators such as '>' and '>>' but accidental overwriting starts to become common in commands you use and shell scripts you write.

The accidental overwriting of files that happens unintentionally is known as clobbering and it commonly happens while using the '>' redirection operator.

samar@Techgaun:~$ mycmd > myfile

In the above example, the mycmd clobbers any existing data in the myfile file if that file exists already. Worse things may happen sometime. Imagine accidentally typing

samar@Techgaun:~$ mycmd > /etc/passwd

instead of possibly using other redirection operators (like >> or <). Thankfully, you could recover /etc/passwd from either /etc/passwd- or /var/backups/passwd.bak if you hadn't rm'd these files.

To prevent such accidental overwriting, we can set the noclobber environment variable. Below is a session of enabling this variable:

samar@Techgaun:~/Desktop/test$ echo "www.techgaun.com" > myfile
samar@Techgaun:~/Desktop/test$ echo "Overwriting techgaun.com" > myfile
samar@Techgaun:~/Desktop/test$ set -o noclobber
samar@Techgaun:~/Desktop/test$ echo "Retrying to overwrite" > myfile
-bash: myfile: cannot overwrite existing file

As seen above, you have to turn on the noclobber variable using the set -o noclobber command in your shell. However, you might want to intentionally overwrite contents of certain files even when the noclobber is turned on.

samar@Techgaun:~$ mycmd >| myfile

Notice the >| in place of your normal > redirection operator. Using this operator, you can however overwrite the existing files even if the noclobber is turned on.

If you want to turn off the noclobber variable, type the following:

samar@Techgaun:~$ set +o noclobber

You can also permanently turn on the noclobber by the following command:

samar@Techgaun:~$ echo "set -o noclobber" >> ~/.bashrc

Moreover, such accidental overwriting can be prevented by enabling the interactive mode which is available in most of the linux commands. For example, you can write the alias for many commands that are likely to cause accidental overwriting. See some examples of aliases below:

samar@Techgaun:~$ alias rm=rm -i
samar@Techgaun:~$ alias mv=mv -i

You could even keep these aliases in your ~/.bashrc file permanently. Enabling such interactive modes by default in the commands that are more likely to cause accidental overwriting can prevent clobbering in many cases.

I hope this proves useful to you :)


Read more...

Sunday 2 September 2012

How To Search Manual Pages In Linux

Linux system consists of hundreds of binaries, several syscalls, and other stuffs that do have manual page. What if you want to locate or find the commands by searching through the manual pages? In this post, I am going to talk about one such useful command to search through the manual page names and short descriptions.

The command I am talking about is the apropos command. The best way to learn any linux command is to read its corresponding manual and go through the help (-h or --help) so lets poke through the help of apropos itself.

samar@Techgaun:~$ apropos -h
Usage: apropos [OPTION...] KEYWORD...

  -d, --debug                emit debugging messages
  -v, --verbose              print verbose warning messages
  -e, --exact                search each keyword for exact match
  -r, --regex                interpret each keyword as a regex
  -w, --wildcard             the keyword(s) contain wildcards
  -a, --and                  require all keywords to match
  -l, --long                 do not trim output to terminal width
  -C, --config-file=FILE     use this user configuration file
  -L, --locale=LOCALE        define the locale for this search
  -m, --systems=SYSTEM       use manual pages from other systems
  -M, --manpath=PATH         set search path for manual pages to PATH
  -s, --section=SECTION      search only this section
  -?, --help                 give this help list
      --usage                give a short usage message
  -V, --version              print program version

Mandatory or optional arguments to long options are also mandatory or optional
for any corresponding short options.

The --regex option is enabled by default.

Report bugs to cjwatson@debian.org.

Particularly, the -e switch is quite useful to filter out your search. See the example below:

samar@Techgaun:~$ apropos -e tar
bf_tar (1)           - shell script to write a tar file of a bogofilter direc...
bf_tar-bdb (1)       - shell script to write a tar file of a bogofilter direc...
git-tar-tree (1)     - Create a tar archive of the files in the named tree ob...
lz (1)               - gunzips and shows a listing of a gzip'd tar'd archive
mxtar (1)            - Wrapper for using GNU tar directly from a floppy disk
ptar (1)             - a tar-like program written in perl
tar (1)              - The GNU version of the tar archiving utility
tar (5)              - format of tape archive files
tgz (1)              - makes a gzip'd tar archive
uz (1)               - gunzips and extracts a gzip'd tar'd archive

Each command has its associated short description and the apropos command searches the short description section of appropriate manual page for the provided keyword. You can also specify the search keywords in the form of regular expression for more flexibility. I hope this command counts as useful one :)


Read more...

Saturday 1 September 2012

Access Linux Filesystems In Windows Using Linux Reader

Earlier today, I had to access my HDD in Windows 7 through USB bridge which I had been using as an internal hard disk for my laptop but unfortunately it didn't. A quick googling revealed a very useful tool by Diskinternals.

Linux Reader is a free software from Diskinternals which excel in building recovery software solutions. Linux reader supports several filesystems used by Linux OS. Below is the list of supported filesystems:

  • Ext2/3/4
  • ReiserFS, Reiser4
  • HFS, HFS+
  • FAT, exFAT
  • NTFS, ReFS
  • UFS2

The program provides for read-only access and does not allow you to make records in file system partitions. This guarantees that the interference in an alterative file system will not affect the work of Linux later. Apart from this, it is necessary to note, that it gives you an opportunity to use common Windows Explorer for extracting data. A preview option for pictures is one more pleasant point, which is worth mentioning. While saving, it ignores file security policies. It means that it is possible to access absolutely any file on a Linux disk from Windows.

More details on Diskinternal's site

Download Linux Reader


Read more...

Thursday 30 August 2012

How To Enable SPDY 3 In Firefox 15

Firefox 15 now supports version 3 of SPDY, an open networking protocol designed to reduce latency of web pages but is not turned on by default. This post will provide the instruction to enable SPDY 3.

Type in address bar, about:config and then search for spdy. Now you will see a particular preference name network.http.spdy.enabled.v3 which is by default set to false.

All you have to do is double click on that preference name to change its value to true. This will enable version 3 of SPDY in your firefox 15.


Note that SPDY v3 will bring support for flow control, update the compression dictionary, and remove wasted space from certain frames, along with other minor bug fixes.

Also, note that the version 3 of SPDY is included for the first time in firefox 15 and might not be fully stable.


Read more...

How To Automatically Start Firefox In Private Browsing Mode

In this post, I will provide the instructions for few of the methods to automatically start firefox in private browsing mode.

Method 1


Go to Edit -> Preferences and then select the Privacy tab. From the History dropdown list, choose the Firefox will Use custom settings for history and then check the Always use the private browsing mode option.


Method 2


The second method involves changing the firefox configuration which can be accessed by typing about:config in the address bar. The first method described above essentially changes one particular preference name browser.privatebrowsing.autostart in background and this second method involves doing that background job manually on our own.


Once you open about:config configuration page, search for private and from the resulting list, modify the boolean value of browser.privatebrowsing.autostart to true by double clicking on it.

I hope this helps. If you got any other method, please drop it as a comment. :)


Read more...

Firefox 15 Released With Support For SPDY 3

The stable firefox 15 has been released yesterday on August 28 with several enhancements and changes on user interface, plugins and performance.

Among the changes, Firefox 15 provides a support for version 3 of SPDY, an open networking protocol developed at google labs with the aim of reducing the latency of web pages. Other notable changes are WebGL enhancements, including compressed textures for better performance and Optimized memory usage for add-ons.

Several other changes have been added to make firefox more superior choice for general users and developers. Few more supports for HTML5 has been also added. You can read the Firefox release notes and complete list of changes.

You can download firefox 15 for your appropriate device from HERE.


Read more...

Ubuntu "Precise Pangolin" 12.04.1 LTS Released

After few months of release of Precise Pangolin, the Canonical and ubuntu developers have finally released the version 12.04.1 of Long Term Support (LTS) of Ubuntu for desktop, server, cloud and core products.

For your information, each new LTS version is released every 2 years. Starting with Ubuntu 12.04 LTS, both desktop and server versions will receive 5 years support. Earlier versions received 3 years support for desktop version and 5 years support for server version.

Among all the changes, the most notable one is the support for Calxeda ECX-1000 SoC family for supporting low-energy hyper-scale data centre servers.

The Ubuntu Cloud Archive also makes its debut - essentially an online software repository from which administrators can download the latest versions of OpenStack for use with the latest long-term support (LTS) release of Ubuntu.

Certified 12.04.1 Ubuntu Cloud images are now available on Amazon Web Services and will soon be posted to Windows Azure as well.

You can follow the detailed Release Announcement and Change Summary for Ubuntu 12.04.1 LTS.

You can download Ubuntu 12.04 LTS from HERE.


Read more...

Tuesday 28 August 2012

Gimp 2.8 Updated With More Features

The GNU Image Manipulation Program, GIMP, has been released with several new features and fixes. GIMP 2.8 features is equipped with several useful features including single-window mode which is probably one of the highly requested features and the latest v. 2.8.2 provides few more bug fixes and updates.

GIMP developers had released the stable release of GIMP back in May and GIMP release note states that the new release is a result of 3 years of collaborative inputs from the people all around the world.


Among all the improvements, the single window mode feature is one of the most awaited features. You can now toggle between the default multi-window mode and the new single-window mode through the Single-window mode checkbox in the Windows menu. In single-window mode, GIMP will put dockable dialogs and images in a single, tabbed image window.

There are several additions and improvements in user interface, tools and plugins. Likewise, several API has been refactored to ease the script development easier and better. Also, the GIMP license has been changed to (L)GPLv3+ from now onwards.

Similarly, several bugs have been fixed including the most notable ones such as not being able to remember JPEG saving options, slow canvas redraw and not showing page setup options on Windows.

GIMP is available for download from ftp://ftp.gimp.org/pub/gimp/v2.8/. You can also choose any other mirror suitable for you.

The release note provides a information on installation of GIMP 2.8.

You can also install GIMP 2.8 on Ubuntu 12.04 using PPA. Fire up the terminal and just type the following commands:

sudo add-apt-repository ppa:otto-kesselgulasch/gimp
sudo apt-get update
sudo apt-get install gimp


Read more...

Hack Attack The Networks With Yersinia

Yersinia is a network attack tool that takes advantages of inherent weaknesses of several protocols to attack the network using different attack vectors. Yersinia can prove as a solid tool for analyzing and testing the deployed networks and systems for possible weaknesses.

The protocols implemented for testing using Yersinia are:

  • Spanning Tree Protocol (STP)
  • Cisco Discovery Protocol (CDP)
  • Dynamic Trunking Protocol (DTP)
  • Dynamic Host Configuration Protocol (DHCP)
  • Hot Standby Router Protocol (HSRP)
  • IEEE 802.1Q
  • IEEE 802.1X
  • Inter-Switch Link Protocol (ISL)
  • VLAN Trunking Protocol (VTP)

Yersinia supports number of attacks in all of the above listed network protocols and hence can be used (or misused) to test any network.

The tool works on several operating systems such as OpenBSD 3.4 (with pcap libraries >= 0.7.2), Linux 2.4.x and 2.6.x, Solaris 5.8 64bits SPARC, Mac OSX 10.4 Tiger (Intel), etc.

Installation on ubuntu: Fire up the terminal and type:

sudo apt-get install yersinia

To download yersinia for other distros, go through the Download section of yersinia.


Read more...

Monday 27 August 2012

PhalconPHP - A PHP Framework Available As An Extension

Phalcon framework, a new approach on PHP frameworks. PhalconPHP is an interesting PHP framework delivered as a C extension providing high performance and lower resource consumption.

What is Phalcon


Phalcon is an open source, full stack framework for PHP 5 written as a C-extension, optimized for high performance. You don’t need learn or use the C language, since the functionality is exposed as PHP classes ready for you to use. Phalcon is loosely coupled, allowing you to use its objects as glue components based on the needs of your application.

For compilation, follow the following steps:

# git clone git://github.com/phalcon/cphalcon.git
# cd cphalcon/release
# export CFLAGS="-O2 -fno-delete-null-pointer-checks"
# phpize
# ./configure --enable-phalcon
# make
# sudo make install

Then, add extension to your php.ini

extension=phalcon.so

And finally restart the webserver.

Useful Links

PhalconPHP on GitHub

Interesting review on PhalconPHP

PhalconPHP Documentation

PHP MVC framework benchmark at ruilog.com

PHP MVC framework benchmark at laruence.com


Read more...

Install XAMPP 1.8 From PPA In Ubuntu

Since apache friends has released the v. 1.8 of XAMPP for linux and windows, its important you guys upgrade your XAMPP. In this post, you will find the instructions to install XAMPP 1.8 from PPA.

The most important updates of v. 1.8.0 of XAMPP are: Apache 2.4.2, MySQL 5.5.25a, PHP 5.4.4, and phpMyAdmin 3.5.1. Since the software components are updated, I strongly recommend to upgrade your XAMPP.
All you have to do is follow the following steps in order:

sudo add-apt-repository ppa:upubuntu-com/xampp
sudo apt-get update
sudo apt-get install xampp

Alternatively, you can download the tar file for XAMPP from Apache Friends and follow their instructions to install XAMPP 1.8.0. In case you're looking for upgrading your previous XAMPP installation, be sure to follow this How To.

I hope this helps :)


Read more...

How To Manually Install Flash Player 11 In Linux

This post will provide a step by step instructions for installing flash player 11 plugin in ubuntu 11.04 and other different versions and distros. This will be helpful for everybody who are having trouble with the software center like I had.


Make sure no firefox process is running and then fire up the terminal and type the following commands in order:

mkdir -p ~/flash && cd ~/flash

wget http://archive.canonical.com/pool/partner/a/adobe-flashplugin/adobe-flashplugin_11.2.202.238.orig.tar.gz

tar -zxvf adobe-flashplugin_11.2.202.238.orig.tar.gz

sudo cp -r libflashplayer.so /usr/lib/firefox/plugins

sudo cp -r usr/* /usr

Once you have finished copying the shared object and other necessary files in their respective target directories, you can open the firefox and you're good to go. :)


Read more...

Monday 20 August 2012

Build A Sample Custom Packet [Embedded Systems]

This code snippet was my submission for embedded systems assignment from the embedded system black book by Dr. K.V.K.K. Prasad. It is in no way a real packet and is not meant to represent the IP layer.


Question: Write a C program that takes the filename as input and generates packets of 100 bytes. Develop a simple packet format of your own.

Compilation:

gcc -Wall -lm -o custom_packet custom_packet.c

//custom_packet.c
//      
//eg: ./custom_packet /home/samar/Desktop/cs_rules.txt
//Compilation: gcc -Wall -lm -o custom_packet custom_packet.c
//Custom Packet: Header -> 20 bytes and Data -> 80 bytes
//Find me on http://www.techgaun.com

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>

typedef struct
{
        int8_t fragment_offset;
        int8_t ttl;
        int32_t source_ip;
        int32_t dest_ip;
} custom_packet_header;

typedef struct
{
        custom_packet_header header;
        char data[80];
} custom_packet;

long int get_file_size(char fname[])
{
        int fd;
        int count;
        if ((fd = open(fname, O_RDONLY)) == -1)
        {
                perror("Error reading the file\n");
                exit(EXIT_FAILURE);
        }
        
        struct stat buf;
    fstat(fd, &buf);
    count = buf.st_size;
        close(fd);
        return count;
}

int decimalip2numeric(int a, int b, int c, int d)
{
        return (a * 16777216 + b * 65536 + c * 256 + d);
}

/*char * numericip2decimal(int num)
{
        char strs[4];
        strs[0] = (char *) num / 1677;
}*/

int main(int argc, char **argv)
{
        FILE *fp;
        //char fname[256];      //255 bytes is the limit of filename in extN filesystems
        custom_packet * packets;
        long int fsize;
        int num_of_packet, i;
        if (argc != 2)
        {
                printf("Usage: %s filename\n", argv[0]);
                exit(1);
        }
        
        fsize = get_file_size(argv[1]);
        num_of_packet = ceil((double)fsize / 80.0);
        printf("%ld => %d",fsize, num_of_packet);
        
        if ((fp = fopen(argv[1], "rb")) == NULL)
        {
                perror("Error opening the file");
                exit(1);
        }
        
        packets = (custom_packet *) malloc(sizeof(custom_packet) * num_of_packet);
        for (i = 0; i < num_of_packet; i++)
        {               
                packets[i].header.source_ip = decimalip2numeric(127, 0, 0, 1); //storing source ip as 127.0.0.1 for now
                packets[i].header.dest_ip = decimalip2numeric(127, 0, 0, 1); //storing dest ip as 127.0.0.1 for now
                packets[i].header.ttl = 127;
                packets[i].header.fragment_offset = i;
        }
        i = 0;
        while (!feof(fp))
        {
                fread((void *)packets[i].data, 80, 1, fp);
                i++;
        }
        
        fclose(fp);
        
        printf("\n\n----- Printing all the crafted packets -----\n\n");
        for (i = 0; i < num_of_packet; i++)
        {
                printf("[---- Packet Fragment no. %d ----", packets[i].header.fragment_offset);
                printf("\nSource IP -> %d\nDestination IP -> %d\nTime to live -> %d\n", packets[i].header.source_ip, packets[i].header.dest_ip, packets[i].header.ttl);
                printf("Packet data -> %s", packets[i].data);
                printf("\n---- End of Packet no. %d ----]\n\n", packets[i].header.fragment_offset);
        }
        
        return 0;
}



Read more...

Friday 17 August 2012

Bypass Android Pattern Lock In Easy Steps

Android devices has this security feature known as pattern lock which prevents the access of other people in your device. One of the senior members at XDA has revealed a way to bypass this pattern lock feature completely.

There have been several attempts on finding different methods for bypassing pattern unlocking in the android devices. Early methods were tracking the smudges on the screen and guessing since human are more likely to use the patterns they have already seen.

This method, posted in XDA developers forum by m.sabra, requires the USB debugging to be enabled in the android device and then you can use ADB (Android Debug Bridge), a part of Android SDK to easily bypass the pattern unlock with few lines of commands. The user has revealed two methods for bypassing this, the first one involves running few SQLite queries and the second one requires deleting the associated key.

You will need to download the Android SDK in order to continue with this hack.

Method 1:

adb shell
cd /data/data/com.android.providers.settings/databases
sqlite3 settings.db
update system set value=0 where name='lock_pattern_autolock';
update system set value=0 where name='lockscreen.lockedoutpermanently';
.quit

AND/OR

Method 2:

adb shell rm /data/system/gesture.key

You can either choose one of the methods or perform both of the methods (method 1 first and method 2 second). Be sure to reboot once you perform any of the above mentioned methods.



Users have said that this method is not working on the latest Android Jelly Bean and other custom ROMs such as Cyanogen Mod. But, earlier android versions are vulnerable to this hack.

Even if the USB debugging is disabled, you can still run these methods if custom recovery was installed in the android device. You will have to mount the working partition. Just go to 'Mounts and Storage' and mount /data. Then you can follow the above methods to bypass the lock.


Read more...

Monday 13 August 2012

Screen Recording Software Solutions For Linux

Windows users have several options to choose from when it comes to the desktop recording (and only paid ones are good generally) but Linux users have fewer options but robust, simple, and best of all, free and open source desktop screen recording tools that we can trust on.

Below are some of the screen recording tools you might want to try:

recordMyDesktop


recordMyDesktop is a desktop session recorder for GNU/Linux written in C. recordMyDesktop itself is a command-line tool and few GUI frontends are also available for this tool. There are two frontends, written in python with pyGtk (gtk-recordMyDesktop) and pyQt4 (qt-recordMyDesktop). recordMyDesktop offers also the ability to record audio through ALSA, OSS or the JACK audio server. Also, recordMyDesktop produces files using only open formats. These are theora for video and vorbis for audio, using the ogg container.

Installation under debian and ubuntu:

sudo apt-get install gtk-recordmydesktop

XVidCap


XVidCap is a small tool to capture things going on on an X-Windows display to either individual frames or an MPEG video. It enables you to capture videos off your X-Window desktop for illustration or documentation purposes.It is intended to be a standards-based alternative to tools like Lotus ScreenCam.

sudo apt-get install xvidcap

Istanbul


Istanbul is a desktop session recorder for the Free Desktop. It records your session into an Ogg Theora video file. To start the recording, you click on its icon in the notification area. To stop you click its icon again. It works on GNOME, KDE, XFCE and others. It was named so as a tribute to Liverpool's 5th European Cup triumph in Istanbul on May 25th 2005.

sudo apt-get install istanbul

Vnc2Flv


Vnc2flv is a cross-platform screen recording tool for UNIX, Windows or Mac. It captures a VNC desktop session (either your own screen or a remote computer) and saves as a Flash Video (FLV) file.

Wink


Wink is a Tutorial and Presentation creation software, primarily aimed at creating tutorials on how to use software (like a tutor for MS-Word/Excel etc). Using Wink you can capture screenshots, add explanations boxes, buttons, titles etc and generate a highly effective tutorial for your users. It requires GTK 2.4 or higher and unfortunately is just a freeware(could not find any source code for it).

Screenkast


Screenkast is a screen capturing program that records your screen-activities, supports commentboxes and exports to all video formats.

If you got any more suggestions, please drop the comment. :)


Read more...

Download Youtube Videos From Command-Line With Youtube-dl

youtube-dl is a small command-line program to download videos from YouTube.com and few more sites. All it requires is the Python interpreter version 2.5 or higher, and it is not platform specific.

This small tool is simple and offers everything you would love to have, but not the GUI. It supports several websites listed as below:

Supported sites

YouTube.com.
YouTube.com playlists (playlist URLs in "view_play_list" form).
YouTube.com searches
YouTube.com user videos, using user page URLs or the specifc "ytuser" keyword.
metacafe.com.
Google Video.
Google Video searches ("gvsearch" keyword).
Photobucket videos.
Yahoo! video.
Yahoo! video searches ("ybsearch" keyword).
Dailymotion.
DepositFiles.
blip.tv.
vimeo.
myvideo.de.
The Daily Show / Colbert Nation.
The Escapist.
A generic downloader that works in some sites.

You can download the tool from GitHub. For more information about the tool, check the documentation. The standalone executable for windows is also available for download from the same github repository.


Read more...

Sunday 12 August 2012

Rootbeer - High Performance GPU Computing in JAVA

Good news for JAVA guys that the high performance GPU compiler has been released that aims to bring high performance GPU computing to the Java Programming Language with the minimal effort from the developer.

Rootbeer is more advanced than CUDA or OpenCL Java Language Bindings. With bindings the developer must serialize complex graphs of objects into arrays of primitive types. With Rootbeer this is done automatically. Also with language bindings, the developer must write the GPU kernel in CUDA or OpenCL. With Rootbeer a static analysis of the Java Bytecode is done (using Soot) and CUDA code is automatically generated.

Rootbeer was created using Test Driven Development and testing is essentially important in Rootbeer. Rootbeer is 20k lines of product for and 7k of test code and all tests pass on both Windows and Linux. The Rootbeer test case suite covers every aspect of the Java Programming language except:
1. native methods
2. reflection
3. dynamic method invocation
4. sleeping while inside a monitor.

This means that all of the familar Java code you have been writing can be executed on the GPU.

GitHub of Rootbeer



Read more...

Thursday 9 August 2012

Slalom Canoe 2012 Google Doodle Trick

Google has been releasing the doodles with the Olympic themes and the latest one is the Slalom Canoe doodle. If you guys have not been trying these doodles, you are missing the obvious fun. In this post, I'll reveal a very very simple trick to obtain extremely short timing so that you guys can share in fb and boast with your friends :D

Most of the people have been using the HTML inspection and editing to have an awesome statistics in the doodle. The trick is to use the "Inspect Element" feature of the browsers and edit the values of different HTML elements that wrap the scores and stars.

However, many non-techies might have found that method to be cumbersome so here's even more simpler trick. The trick here is to note the system time you start canoeing and once you are near to the end of race, edit your system time to retain the value, for example, only 1 second ahead of system time you had noted while you were starting.

If you don't know how to change system time, windows users can access through the bottom right part of the Desktop where your system time is displayed and linux users should right-click and select preferences in one of the panels containing time.

You can even leave the slalom canoe tab as it is and continue your other tasks and once you feel you are to the end of the race, adjust the system time so that the difference from starting time is minimal (as you need).


The best thing about this trick is its simplicity and clean nature which leaves no trail for finding the cheating (of course, unless you decide to have too low time or negative time).

Note that this is cheating and is discouraged though :D

Original credits to Brisha for this trick.


Read more...

Saturday 28 July 2012

Download Windows Binaries For Python Packages

Someone from the University of California has made it easier for windows python users to install python extension packages easily by providing several 32-bit and 64-bit windows binaries for several scientific open source python libraries.

If you can't figure out your way in installing python libraries, you can download the binaries for several libraries from HERE.

Most binaries are built from source code found on PyPI or in the projects public revision control systems. Definitely the page to be bookmarked for the windows python'ers if you want to easily install python libraries :)


Read more...

How To Easily Install EasyInstall In 64 bit Windows

Easy Install(easy_install) is a python module (easy_install) bundled with setuptools that lets you automatically download, build, install, and manage Python packages. Easy Install gives you a quick and painless way to install packages remotely by connecting to the cheeseshop or even other websites via HTTP. It is somewhat analogous to the CPAN and PEAR tools for Perl and PHP, respectively. This How To will guide you in installing the easy_install utility easily in windows.

First download the ez_setup.py file.

Run the above script by typing in command prompt the following:

python.exe ez_setup.py


Once the script finishes, new directory "Scripts" will be created in the python installation directory and it will contain the easy_install.exe file in that directory.

Now all you have to do is add the Scripts path to system's Environment Variables to access this tool easily.

Right click on computer, go to properties, Advanced System Settings, Environment Variables, System Variables and edit the "Path" variable by adding correct path to the Scripts directory.

I hope this helps :)


Read more...

Friday 27 July 2012

Determine Your SATA Disk Model And Vendor In Ubuntu

Sometimes you need to determine the model and vendor of your hard disk and here is the small tips on how to find those information.

All you have to do is type one of the following commands for the respective outputs:
cat /sys/class/block/sda/device/model

cat /sys/class/block/sda/device/vendor
I hope this becomes useful sometimes. :)


Read more...

Wednesday 18 July 2012

Why Alias Command With Itself

Aliasing the command to itself to suppress the original functionality of the command and provide it new added sets of functionality can come quite handy for linux users and administrators.

If you have been using linux shell for a while, I'm pretty sure you are now familiar with the `ls` command, if not I think you have just learnt to use man pages. Probably you've been using `ls -l` command to list files with the files size as well. Too bad, you won't just be able to instantly make the sense of the file size displayed using this command so why not alias `ls` command to always provide human readable file sizes. So here is my alias:

alias ls='ls -lh'


This is what I always want to see as the output with `ls` command. The same kind of alias can be used with `du` and `df` commands. There are number of other cases where aliasing a command with itself is good choice.

Another example is the less command. By default, you need to press q to exit less which can be quite annoying if the entire content can fit in a single screen. However, adding -F flag will gracefully quit after displaying the content if the content fits in a single screen. So I have my alias for less as below:

alias lesss='less -F'


If something shoots in your mind, feel free to share here as a comment :)


Read more...

Russian Hacker Bypasses Apple's App Store

A Russian hacker known as ZonD80 has discovered a method to retrieve apps from in-app for iOS apps free of cost. The best thing about this bypassing method is that this method does not require the i-device to be jailbroken. This method works on most of the major iOS versions from 3.0 to 6.0.

The step by step guide on using this method is available at the russian website HERE. The Russian guy has also setup a website called www.in-appstore.com.

Original Link

Watch Video About This Method

HERE is the copy of the instructions to follow.

*Take care while using this trick. I've not tested it and don't know if there are any security implications as the side effect of this bypass method.


Read more...

Friday 13 July 2012

Fast Share Your Files Using Python Script

If you were unaware, there is a command line switch for python that lets you the python library module as a script and I'm sharing a small trick on how you can easily share your files with other computers over LAN/Internet by running a python module that lets you run the tiny web server. Isn't it great when you don't have Samba?

Fire up the terminal, change to the desired directory you wish to share and type the following command:

python -m SimpleHTTPServer


Be cautious with the cases of characters of module 'SimpleHTTPServer' else you'll never find your mistake with this command :D

Once you've run the above command, the HTTP server will start to listen on the port 8000 (by default) so the other parties will just have to open up their favorite web browser and type the correct address followed with the colon and port 8000(eg. 192.168.1.21:8000)

I hope this proves useful sometimes. :)


Read more...

Stack-based Directory Switching For Easy Reversal

So how many times have you used the `cd` command repeatedly to go back and forth of two or more directories. Probably you are already familiar to the `cd -` command which lets you switch between the current and the previous directory. But, many times this current and previous directory switching restriction will not suffice and hence a better option in such case is to use the `pushd` command instead of `cd`.

For example, just use the `pushd somedirA`, `pushd somedirB`, ... and like that. Now if you need to switch back, you can just use `popd` command and you'll be switching back easily. The `pushd` command saves the current directory path and then cds to the supplied path.

If you dig more, you'll come to know about the -n and -N switches you can combine with these commands so I will let you explore on this. Also, you can use the `dirs` command to view the stack of directories. If you are some computer student or enthusiast, you have already gotten an idea from a famous data structure called stack. Anyway, I hope this comes handy sometimes like it does to me :)


Read more...

Friday 6 July 2012

Fix "trying to overwrite '*', which is also in package *"

Today I was updating few stuffs in edubuntu and dpkg was continually throwing me the problem while trying to install kdelibs-data. The error read as "trying to overwrite 'A', which is also in package X" and the fix was pretty straightforward but still I thought it would help someone out there.

Below is the exact error I was getting while trying to install kdelibs5-data from the deb file.

dpkg: error processing /var/cache/apt/archives/
kdelibs5-data_4%3a4.4.5-0ubuntu1.2_all.deb (--unpack):
trying to overwrite '/usr/share/polkit-1/actions
/org.kde.kcontrol.kcmremotewidgets.policy', which is also in package kdebase-runtime-data 4:4.6.5-0ubuntu1


The fix was pretty simple. Add the --force-overwrite switch in the dpkg command as below:

dpkg -i --force-overwrite kdelibs5-data_4.4.5-0ubuntu1.2_all.deb


I hope this comes useful sometimes.


Read more...

Sunday 24 June 2012

Flash Punisher Plugin For Counter Strike Server [New Release]

Recently I wrote a small AMX Mod X plugin that kills the player who throws flashbangs in counter strike and this post provides the plugin and source code of the plugin for the download.

Why this plugin

Well there are probably few other flash bang punishment plugins already available for download but all I needed was a minimal plugin that would just kill the flashbanger and prevent the effect of the flashbang to other players.

At the first look, the plugin may sound stupid but we play a lot of aa_dima map and few players were continually throwing the flashbangs. There are several maps which are meant to be played by making use of shooting skills that the use of flashbangs. But some people never understand.

I chose to have death as the punishment because that would be the worst punishment any player would expect. And, they will surely be not throwing flashbangs in next rounds.

Download flash_kill.amxx

Or check the Github Repos of Flash Punisher.

Installation is similar to other plugins. Copy the flash_kill.amxx file to cstrike/addons/amxmodx/plugins/ and add a new line "flash_kill.amxx" (without quotes) in the cstrike/addons/amxmodx/configs/plugins.ini.

CVARS:
tg_flashpunish 0 - prevent the killing of player on throwing flashbang.
tg_flashpunish 1 - the plugin shows its effect i.e. the player dies on throwing flashbang.

I hope this plugin becomes useful to some of you guys. :)


Read more...

Saturday 16 June 2012

IP Address Based Restriction Using Htaccess File

Sometimes you need to restrict access to files in your webserver to certain IP address or IP range only. In such case, you can apply a simple .htaccess rule and this post provides an information on how to make IP based restriction Using .htaccess.

First, be sure to enable use of htaccess in apache in your distro.



An example of .htaccess file that will block requests from all IP addresses but the subnet of 192.168.0.0/16 is as below:

<limit GET>
order deny,allow
deny from all
allow from 192.168
</limit>

Similarly, an example of .htaccess file that will allow requests from all IP addresses but the subnet of 192.168.0.0/16 is as below:

<limit GET>
order allow,deny
allow from all
deny from 192.168
</limit>

You can also specify the individual IP addresses instead of the entire subnet according to your need. Also, note that there should be no space after the comma between allow,deny.

Once you create the .htaccess file, make sure you've provided proper permission to it.

samar@Techgaun:/var/www/samar$ chmod 0644 .htaccess

Once you have made the .htaccess file and provided the proper permission, you might need to restart the apache server(but per directory .htaccess does not require reloading the apache in most cases) so that new configurations will show an effect.

samar@Techgaun:/var/www/samar$ sudo service apache2 reload

I hope this comes handy :)


Read more...

Friday 15 June 2012

NCell Introduces Ncell Sapati For Credit Based Recharge

Everytime ncell introduces a new service, it understands what its customer are looking for. Sometimes Recharging your phone becomes imposslible due to outreach of shop , sometime it may be late night or too early , reaching for the card sounds tough. But now ncell has extended it service by introducing Ncell sapati.

To get Ncell sapati of Rs. 20 as main balance, you will have to dial *9988#. You will be charged an extra amount of Rs. 2(Exclusive of VAT and additional taxes) while using this service.

More information is available through IVR by dialing 9980 or play the audio below to hear the full instruction.





This service will come handy lots of time to lots of customers so I welcome this service introduced by Ncell. :)


Read more...

How To Enable Use Of Htaccess In Apache In Ubuntu

This How To provides a detail on how to enable use of .htaccess file in apache in ubuntu and the similar flavors of linux distribution.

To enable use of .htaccess, you can edit the /etc/apache2/sites-available/default file. Search for the portion which contains the following lines or something similar to that(The bold line is almost always present):

<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>

All you have to do is change the bold line above to:

<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>

Now you will need to restart the apache service so that the effect of change in configuration takes place. Enter the following command to restart the apache service:

samar@Techgaun:~$ sudo service apache2 reload

Now your .htaccess files will start to work in ubuntu. :)


Read more...

Recover Deleted Files From An NTFS Volume Using Ntfsundelete

Ntfsundelete is a part of ntfsprogs, a suite of NTFS utilities based around a shared library. It lets us recover the deleted files from any NTFS volumes without making any changes in the NTFS volume itself.

Generally when a file is deleted from disks, it is some kind of pointer to the physical file that gets deleted and the actual content still remains in the disk unless it is overwritten by new files so it is possible to recover those files.

ntfsundelete has three modes of operation: scan, undelete and copy. By default, it will run in the scan mode which simply reads an NTFS volume and looks for the files that have been deleted.



To use ntfsundelete, you'll have to install the ntfsprogs suite with following command in ubuntu and debian-based distros:

samar@Techgaun:~$ sudo apt-get install ntfsprogs

You'll have to first figure out which drive you want to recover. A handy command for this is:

samar@Techgaun:~$ sudo fdisk -l

Once you know the NTFS volume you want to recover, you can first run the scan mode to list the filenames that can be recovered.

samar@Techgaun:~$ sudo ntfsundelete /dev/sda4

The optional -f switch can be specified for the forceful scanning. There is a nice percentage field which gives the information on how much of the file can be recovered. You can apply the time and percentage filters to scan specific files. For example, you can use the following command to search for the files which can be recovered 100%

samar@Techgaun:~$ sudo ntfsundelete -p 100 /dev/sda4

And, you can apply the time filter to list the files altered/deleted after the specified time. For example, following command will scan and list the files deleted in the last 14 days.

samar@Techgaun:~$ sudo ntfsundelete -p 100 -t 2d /dev/sda4

Other suffices you can use are d, w, m, y for days, weeks, months or years ago respectively.

Once you get the files to be recovered, you can use the -u switch to undelete or recover the files. An example of recovering files by pattern matching is as below:

samar@Techgaun:~$ sudo ntfsundelete -u -m *.jpg /dev/sda4

Similarly you can recover by providing inode or inodes range using the -i switch. You can get the inode values from the first column in the scan mode.

samar@Techgaun:~$ sudo ntfsundelete -u -i 161922 /dev/sda4


Read more...