HowTo – Tech Stuff https://gofedora.com How Tos, Tutorials, Tips and Tricks Thu, 18 Jun 2015 14:17:41 +0000 en-US hourly 1 https://wordpress.org/?v=4.9.4 Insanely Awesome Web Interface for Your Git Repos https://gofedora.com/insanely-awesome-web-interface-git-repos/ https://gofedora.com/insanely-awesome-web-interface-git-repos/#comments Tue, 22 May 2012 06:55:47 +0000 http://gofedora.com/?p=1128 … ]]> Almost 80-90 people visitย How To: Install and Configure GitWebย everyday in search of setting up a web interface for their git repositories. Though gitweb is nice, it’s a bit painful to setup and the web interface is not that appealing. The other day I received this email from Klaus Silveira

Hello Kulbir,
I saw your article about installing Gitweb and i decided to send this shameless self-promotion. Maybe you could try my open-source project, GitList https://github.com/klaussilveira/gitlist

I’m looking for beta testers and supporters. FLOSS. ๐Ÿ™‚

So, I thought I’ll just give it a try. Today, I got it working and was blown away by the amazing interface! It’s almost like a super simplified version of GitHub. I was so impressed that I immediately setup a demo website at git.gofedora.com for others to look at and fall in love :-)Another good thing about GitList is that it’s very simple to setup. Below is a step by step process to install and configure GitList to expose your public Git repositories to the internet.

What You Need?

You need the following packages before you can setup GitList.

Installing Required Packages

Most modern operating systems have the above mentioned packages installed by default. Even if you don’t have them already, you can use your OS package manager to install them quickly. To install on Fedora/RedHat/CentOS using yum, use the following command

[root@whitemagnet.com ~]$ yum install php git httpd

For Ubuntu/Debian, use the following command

[root@whitemagnet.com ~]$ apt-get install php git apache2

Assumptions

For setting up GitList, I am assuming the following directory paths and other variables.

  • Path to public Git repositories : /home/saini/code/public/
  • Path to Apache document root : /var/www/html/
  • Path to Git executable : /usr/bin/git (Use “which git” to find out for your OS)
  • Web URL for browsing git repos : mygit.example.com/gitlist/

Installing and Configuring GitList

Follow the following simple steps to install and configure GitList.

Step 1 : Clone GitList repository from GitHub to /var/www/html/gitlist/

[root@whitemagnet.com ~]$ cd /var/www/html/
[root@whitemagnet.com html]$ git clone git://github.com/klaussilveira/gitlist.git gitlist

Step 2 : Create cache directory and make it globally writable

[root@whitemagnet.com ~]$ cd gitlist
[root@whitemagnet.com gitlist]$ mkdir cache
[root@whitemagnet.com gitlist]$ chmod 777 cache

Step 3 : Configure GitList using config.ini

Open the config.ini (in gitlist directory) and set the option properly. Refer the sample shown below.

[git]
client = '/usr/bin/git' ; Your git executable path
repositories = '/home/saini/code/public/' ; Path to your repositories (with ending slash)

[app]
baseurl = 'http://mygit.exmaple.com/gitlist' ; Base URL of the application (without ending slash)

Step 4 : Make sure your Apache can read your .htaccess file in gitlist directory

GitList utilizes Apache’s mod_rewrite module to ย provide nice URLs. Make sure your Apache is configured to read .htaccess from the gitlist directory. Open your Apache config file (generally located at /etc/httpd/conf/httpd.conf or /etc/apache2/ports.conf) and look for the following

In this segment, make sure you have AllowOverride All as below.


# Other lines omitted
AllowOverride All
# Other lines omitted

Step 5 : Reload or restart Apache daemon if needed

[root@whitemagnet.com ~]$ apachctl -k restart (or apache2ctl -k restart for Ubuntu/Debian)

Step 6 : Get some sample repositories in your public repo directory

Get some sample repositories in your public repo directory from GitHub.

[root@whitemagnet.com ~]$ cd /home/saini/code/public/
[root@whitemagnet.com ~]$ git clone git://github.com/kulbirsaini/intelligentmirror.git
[root@whitemagnet.com ~]$ git clone git://github.com/kulbirsaini/Railscasts-Sync.git
[root@whitemagnet.com ~]$ git clone git://github.com/zilkey/active_hash.git

That’s all! Now, go to http://mygit.example.com/gitlist to discover your public git repos via a cool web interface! Leave a comment if you face any issues.

]]>
https://gofedora.com/insanely-awesome-web-interface-git-repos/feed/ 26
My New Book on Squid Proxy Server (A Beginner’s Guide) https://gofedora.com/book-squid-proxy-server-beginners-guide/ Mon, 18 Apr 2011 03:32:19 +0000 http://gofedora.com/?p=1072 … ]]> I have not blogged since a long time mainly because I was a bit busy authoring a book Squid Proxy Server 3.1: Beginner’s Guide for Packt Publications. The book is an introductory guide to Squid (especially the new features in Squid-3 series) covering both the basic aspects as well as the in dept details for advanced users. The book focuses on learning by doing and provides example scenarios for the concepts discussed throughout the book. Access control configuration, reverse proxying, interception proxying, authentication and other features have been discussed in details with examples.

Checkout the links below:

]]>
News : Fedora 12 : Constantine Released [All you need to know] https://gofedora.com/news-fedora-12-constantine-released-all-you-need-to-know/ Wed, 18 Nov 2009 01:59:14 +0000 http://gofedora.com/?p=985 … ]]> Much awaited Fedora 12 : Constantine has been released and is available now! This post is more of a collection of things you need to know before you go all the way to download Fedora 12 and install or upgrade.

FAQs

Q. What is Fedora?
A. The Fedora Project page describes it in a short and nice way!

Q. I want to know everything about Fedora 12. Where do I find it?
A. You are probably asking for Fedora 12 Release Notes.

Q. Will it work on my machine?
A. What do you have? A server/desktop/laptop/netbook/xo/some-alien-hardware! It’ll work if your machine satisfies the hardware requirements.

Q. I have been using Fedora since long. What are the new features in Fedora 12?
A. Please browse Fedora 12 : Constantine Feature List page.

Q. Ok. I am convinced. From where can I download Fedora 12?
A. Nice! Please visit Download Page for download options. Checkout torrents or select mirror from Fedora mirrors.

Q. No. I don’t want that regular DVD. Do you have something different to offer?
A. Yup! Spins community is doing a wonderful job! Chose one from KDE, LXDE, XFCE, BrOffice, FEL, Games and Edu spins.

Q. I have downloaded the Fedora ISO. How do I install it?
A. There are different ways in which you can install Fedora on your system.

  1. If you don’t have CD/DVD drive, you can follow How To: Install Fedora without CD or DVD.
  2. You can install Fedora using a USB drive. Checkout LiveUSB creator.
  3. You can follow the traditional way. Install using CD/DVD.

Q. I already have Fedora installed on my system. Should I upgrade or re-install?
A. Browse Upgrading Your Current System page and find out yourself.

Q. I think I want to upgrade my Fedora 11 system to Fedora 12. How do I do it using Yum?
A. Learn how to do it from the Yum Guru himself Yum upgrading to fedora 12 from fedoraย 11 or browse this page on Fedora Docs.

Q. I have ATI graphics card. How do I install Catalyst Display Drivers?
A. Follow How To: Install ATI Catalyst (fglrx) Drivers.

Q. Hey, I am stuck! I need some help. Where should I ask?
A. There are different ways like Real Time Support via IRC, mailing lists, forums etc. in which you can get help on topics related to Fedora. Browse Get Help page to checkout different methods.

Q. I like this Fedora thing. Can I help?
A. There are several ways in which you can help Fedora Project. The simplest way is to help others! Other methods can be ‘Write Documentation’, ‘Design for Fedora’, ‘Spread the Word’ or ‘Write Code’ ๐Ÿ™‚ Checkout Join Fedora page.

]]>
How To: Save yourself from stupid Tech Support Questions https://gofedora.com/how-to-save-stupid-tech-support-questions/ https://gofedora.com/how-to-save-stupid-tech-support-questions/#comments Thu, 24 Sep 2009 18:57:16 +0000 http://gofedora.com/?p=928 … ]]> Almost every other geek is pwned by his friends or people he/she knows by their stupid tech support questions. And sometime they drag you to the limits that you get frustrated enough to shoot yourself and bang your head onto your computer screen ๐Ÿ˜› How on earth can someone be so stupid ๐Ÿ˜› But luckily I found a Pidgin Plugin called STFW(Search The F**king Web). This is one really awesome plugin I have seen recently and I (and most other geeks) needed something like this for ages ๐Ÿ™‚

What it does?

When somebody asks you a question, you can reply back with relevant keywords from the message you received prefixed with the command /stfw. The plugin will automatically convert the keywords to a URL understood by the site Let Me Google That For You (lmgtfy.com) and asker will get a URL like this http://lmgtfy.com/?q=what+is+http.

How to use?

The Download, installation and usage instruction can be seen on plugin page. So, when someone ask you “Wireless not working on my laptop”, just reply back with the following message

/stfw Wireless not working on my laptop

C’mon guys, ask me tech support questions ๐Ÿ˜›

]]>
https://gofedora.com/how-to-save-stupid-tech-support-questions/feed/ 7
How To: Install PHP 5.3 on CentOS 5.1 or RHEL 5.1 https://gofedora.com/how-to-install-php-on-centos-red-hat-rhel/ https://gofedora.com/how-to-install-php-on-centos-red-hat-rhel/#comments Tue, 22 Sep 2009 20:54:34 +0000 http://gofedora.com/?p=922 … ]]> PHP 5.2 and PHP 5.3 has tons of functionalities which are not provided by PHP 5.1 and PHP 5.1 is the most recent version of PHP available in CentOS 5.1 and RHEL 5.1 via updates. Also, its difficult for people to upgrade OS(s) on production servers frequently and especially if the servers are running absolutely fine, it doesn’t really make sense to upgrade just for the heck of it. One more reason for no upgrades is the OS choices provided by many hosting companies. But a lot of CMS(s) and softwares are now recommending at least PHP 5.2 for an extended feature set.

I tried a lot of repos for CentOS including RPM Fusion, RPM Forge, EPEL etc., but none of them could provide even PHP 5.2. In some corner of my mind, I had a faint idea of Remi Collet publishing updates about Remi repository. Did a quick google search and found out that PHP 5.3 is actually available in the repository ๐Ÿ˜€

So, if you are really in need of PHP5.3 on your CentOS/RHEL 5.1 or lesser, head over to Repository Configuration Page and follow the instructions.

Note: The repository is not enabled on install (enabled=0). You need to enable it in /etc/yum.repos.d/remi.repo.

Once installed and enabled, you can update PHP, MySQL from remi repository using the following command

[root@fedora ~]$ yum update php php-* mysql-*

Warning: Drupal is still not totally compatible with PHP5.3 and if you run Drupal sites, be sure to investigate things before upgrading.

]]>
https://gofedora.com/how-to-install-php-on-centos-red-hat-rhel/feed/ 20
How To: New Mail Notification https://gofedora.com/how-to-new-email-notification/ https://gofedora.com/how-to-new-email-notification/#comments Wed, 16 Sep 2009 19:27:18 +0000 http://gofedora.com/?p=890 … ]]> mbooth commented on one of my last post (How To: GNOME GMail Notifier) informing that he/she uses mail-notification. I was curious to check it out for mail via IMAP and I found it way more useful as compared to Gnome Gmail Notifier. I especially like the option to configure it to check the mails every ten seconds. Thats way cool for anxious people like me ๐Ÿ™‚ Keeping in mind the huge advantages of mail-notification, I thought of writing an howto for configuring it ๐Ÿ™‚

Install Mail Notification

Installing something can’t be simpler. Just use the following command as root

[root@fedora ~]$ yum install mail-notification

Configuring mail-notification is very simple. Its as easy as it can get but there are tricks for special cases like Gmail forย  Google Apps hosted websites.

Launch Mail Notification

Mail notification loses a point here. It doesn’t show up in any of the menus. You have to launch it from command line. You can launch mail-notification from System -> Preferences -> Mail Notification (Thanks mbooth for correcting). Or use the following command as normal user to launch mail notification

[saini@fedora ~]$ mail-notification -p

Configure Status Icon Behaviour

On mail notification properties windows, select Status Icon tab and choose the appropriate behaviour.

Mail Notification Status Icon Action

New Message Popup Settings

Now go to Message Popups tab, and select appropriate options. If you don’t enable popups, using mail notification doesn’t really make sense (though none can prevent you from doing so ๐Ÿ™‚ ). Keeping popus stacked is good because it shows you all messages in case you get more than one new mails in an interval. Also, you can configure the expiration time for the popups.

Mail Notification Message Popups Settings

Add New Mailbox

Now select General tab and click of Add button. Mail-notification supports checking new mails from Evolution, Gmail, Yahoo! Mail, Windows Live Mail, any IMAP and POP3 Server and moreover your system mailbox ๐Ÿ™‚ Select Gmail for mailbox type. Enter username and password for Gmail account.

Mail Notification Supported Mailboxes

Mail Notification Add Gmail Account

Now move over to Details tab and set delay between checking mails. I keep it 10 seconds ๐Ÿ™‚

Mail Notification Gmail Account Settings

Add a Google Apps Hosted Email Account

This is totally optional ๐Ÿ™‚ Now we’ll add a Google Apps hosted account. This is a bit tricky. For mailbox type, you’ll have to select Gmail. For username, you’ll have to provide your email address.

Mail Notification Add Google Apps Hosted Account

Also, the mailbox name has to be modified in this case to make things work. Move over to Details tab and change mailbox name to your email address.

Mail Notification Google Apps Hosted Account Settings

Add a new IMAP mailbox (Gmail)

This is totally optional ๐Ÿ™‚ Keep mailbox type as IMAP. IMAP Server has to be imap.gmail.com . Username and password are same as Gmail Account.

Note: For this mailbox to work, you’ll have to enable IMAP in settings tab in Gmail.

Mail Notification Gmail IMAP Account

Now move over to Connection tab. Connection for Gmail IMAP has to be SSL enabled. So, select “SSL/TLS on separate port” and make sure the port number is 993.

Mail Notification Gmail IMAP Account Connection Settings

Well thats all you need to do for configuring things for getting new mail notifications lightning fast ๐Ÿ™‚ Now sit back and relax until someone sends you a mail ๐Ÿ™‚

The only major disadvantage that I found with mail-notification is that it doesn’t stay in notification area all the time. It appears only when there is a new mail.

]]>
https://gofedora.com/how-to-new-email-notification/feed/ 14
How To: Configure Dual Display with ATI Radeon (fglrx) https://gofedora.com/how-to-configure-dual-display-ati-radeon-fglrx-xinerama/ https://gofedora.com/how-to-configure-dual-display-ati-radeon-fglrx-xinerama/#comments Mon, 14 Sep 2009 21:34:08 +0000 http://gofedora.com/?p=877 … ]]> As promised in my last post (News: ATI Catalyst Display Drivers 9.9 Released), I am back with a post on configuring dual display with ATI Radeon HD Graphics Card and proprietary catalyst (fglrx) drivers from ATI.

Hardware Used

Graphics Card: ATI Radeon HD 3200 (256MB, onboard)
Monitor 0: ViewSonic VG1930WM 1440×900 (19″ LCD, Connected via DVI port)
Monitor 1: Samsung SyncMaster 793S 1280×1024 (17″ CRT, Connected via VGA port)

Types of Dual Display

  • Mirror: Both screens have same content, identical refresh rate and resolution.
  • Clone: Both screens have same content but refresh rates and resolutions can be different.
  • Horizontal: Both screens can have different content, refresh rates and resolution. Screen 1 is left or right of Screen2.
  • Vertical: Same as horizontal. The only difference is that Screen1 is above or below Screen2.

In this post, we are interested in Horizontal setup with xinerama on. This way we can have two desktops allowing full screen modes on both of them and allowing us to drag and drop windows from one screen to the other.

Install ATI Drivers

If you don’t have ATI drivers installed already, follow this How To: Install ATI Catalyst (fglrx) Drivers on Fedora 11 (works for any version of ATI Catalyst drivers).

Generate xorg.conf file

If you don’t see the xorg.conf file at /etc/X11/xorg.conf, then you need to generate it to proceed to next step. Use the following command as root to generate one

[root@fedora ~]$ Xorg -configure

This command will generate the default xorg.conf file at /root/xorg.conf.new. Copy it to /etc/X11/xorg.conf.

[root@fedora ~]$ cp /root/xorg.conf.new /etc/X11/xorg.conf

Backup xorg.conf file

Backup your original xorg.conf file so that you can restore it in case the configuration doesn’t work the way you expected.

[root@fedora ~]$ cp /etc/X11/xorg.conf /etc/X11/xorg.conf.backup

Generate Configuration for Dual Display

Now we are ready to generate the configuration for dual display. Use the following command with appropriate arguments (in accordance with your hardware configuration)

# --screen-layout will place second screen on left of your first screen. Other possible values are right,above,below.
# --xinerama=on option enables you to have two different desktops and one of them being passive.
# You can drag and drop windows from one desktop to the other. Task bars appear only on one of the desktops.
[root@fedora ~]$ aticonfig --initial=dual-head --screen-layout=left --xinerama=on
# --resolution=_screen_number_,widthxheight
[root@fedora ~]$ aticonfig --resolution=0,1440x900 --resolution=1,1280x1024
# Set horizontal sync and vertical refresh rates for both monitors.
[root@fedora ~]$ aticonfig --hsync=0,30-60 --hsync=1,30-60 --vrefresh=0,30-60 --vrefresh=1,30-60

You can download my xorg.conf file via this link.

Reboot or Logout and Login Again

If you just setup your ATI drivers and configured the dual display, you need to reboot so that fglrx module can be loaded properly. If you rebooted after setting up the drivers, just logout and login again to checkout your dual display ๐Ÿ™‚ If everything works fine, say thanks to me and if not blame ATI ๐Ÿ˜›

Adjust DPI for Normal Font Size

I faced a problem with my font sizes being too big while using xinerama. It was easy to fix by adjusting DPI. Go to System -> Preferences -> Appearance. Go to Fonts tab. Click Details located near the bottom right corner. On that window, try descreasing the “Dots Per Inch” value. Mine worked fine with 85 DPI.

Below is an image of my dual display setup. Click to enlarge.

Dual Display Configuration ViewSonic Samsung Using ATI Radeon Catalyst (fglrx)

]]>
https://gofedora.com/how-to-configure-dual-display-ati-radeon-fglrx-xinerama/feed/ 12
How To: GNOME GMail Notifier https://gofedora.com/gnome-gmail-notifier/ https://gofedora.com/gnome-gmail-notifier/#comments Wed, 09 Sep 2009 01:14:34 +0000 http://gofedora.com/?p=831 … ]]> GNOME GMail (Google GMail) Notifier is an awesome tool for GNOME/Linux users if you are addicted to checking mails every few minutes. GMail Notifier solves a bit of your problems by notifying about multiple gmail accounts. One more plus point is that it can display GMail Notifications for new mails in accounts for which you are using Google Apps. Below is a step by step howto on installing and configuring GMail Notifier in Fedora (may apply to other distros as well).

Install GNOME GMail Notifier

You can download and install it from GNOME GMail notifier home page or just use yum

[root@fedora ~]$ yum install gnome-gmail-notifier

Launch Gmail Notifier

If installation was successful, go to Applications -> Internet -> Gmail Notifier.

GNOME Gmail Notifier

Open Preferences

Right click on Email icon in taskbar and click Preferences.

GNOME Gmail Notifier Select Prefreneces

Select Preferences

Set inbox update time to 1 minute. Check display notifications for new messages and errors. Also select a sound to play for new mails.

GNOME Gmail Notifier Prefreneces

Add GMail Account

Click Add on preferences window and add your GMail account.

GNOME Gmail Notifier Add GMail Account

Add Mail Account (Google Apps) (Optional)

If you don’t know what Google Apps is, leave this step. If you do know, then add your mail account.

GNOME Gmail Notifier Add Google Apps Account

Check Mail

If you can’t wait for 1 minutes to see GMail Notifier in action, just right click on email icon in taskbar and click Check Mail.

GNOME Gmail Notifier Check New Mails

Mail Notifications

Whenever you get a new mail, you’ll have bubble like the one in image below and a sound will also be played.

GNOME Gmail Notifier New Mail Notification

Enjoy the notifications ๐Ÿ™‚

]]>
https://gofedora.com/gnome-gmail-notifier/feed/ 10
How To: Install and Use Twython (Python Wrapper for Twitter API) https://gofedora.com/how-to-install-use-twython-python-wrapper-for-twitter-api/ https://gofedora.com/how-to-install-use-twython-python-wrapper-for-twitter-api/#comments Sat, 05 Sep 2009 07:49:51 +0000 http://gofedora.com/?p=826 … ]]> As promised in my previous post, here is a brief howto on getting started with twython. The main advantage of Twython over several other python (or any other language) wrappers for Twitter API is that it works even when you are behind your organizations proxy.

Download Twython

You can download latest version of twython from twython page on github. You can either clone using git (if you have git installed) or can click the download button.

Install Twython

Once you are done with extracting the downloaded tar file. Change directory to twython and run these command as root.

[root@fedora ~]$ git clone git://github.com/ryanmcgrath/twython.git
[root@fedora ~]$ cd twython/dist
[root@fedora dist]$ tar -xvzf twython-0.8.tar.gz
[root@fedora dist]$ cd twython-0.8/
[root@fedora dist]$ python setup.py build
[root@fedora dist]$ python setup.py install

Use Twython from Python Interpreter

Below is a direct copy paste lines from my interpreter. See how things are working (learning by doing).

[saini@bordeaux ~]$ python
Python 2.6 (r26:66714, Mar 17 2009, 11:44:21) 
[GCC 4.4.0 20090313 (Red Hat 4.4.0-0.26)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> # first of all, import twython module
>>> import twython
>>> # Authenticate your twitter account with your twitter username
... # and password with twitter.setup method.
>>> client = twython.setup('Basic','myusername','mypassword')
>>> client.authenticated
True
>>> #Lets update our current status on twitter with some cool message.
>>> client.updateStatus('Testing #twython. The coolest #TwitterAPI :)')
>>> # Now go and check your current status on twitter. Surprised!!!
>>> # Get your or anyone's followers
>>> client.getFollowersIDs(screen_name='gofedora')
>>> # Output truncated.
>>> # Get help for any function.
>>> print client.createFriendship.__doc__
createFriendship(id = None, user_id = None, screen_name = None, follow = "false")

	Allows the authenticating users to follow the user specified in the ID parameter.
	Returns the befriended user in the requested format when successful. Returns a
	string describing the failure condition when unsuccessful. If you are already
	friends with the user an HTTP 403 will be returned.

	Parameters:
		** Note: One of the following is required. (id, user_id, screen_name)
		id - Required. The ID or screen name of the user to befriend.
		user_id - Required. Specfies the ID of the user to befriend. Helpful for disambiguating when a valid user ID is also a valid screen name. 
		screen_name - Required. Specfies the screen name of the user to befriend. Helpful for disambiguating when a valid screen name is also a user ID. 
		follow - Optional. Enable notifications for the target user in addition to becoming friends. 
>>> 

So now you are ready to do wonders with twython. Write your own code and blog/brag about it ๐Ÿ™‚

]]>
https://gofedora.com/how-to-install-use-twython-python-wrapper-for-twitter-api/feed/ 4
How To: Recover Deleted Files in Linux Using Photorec https://gofedora.com/how-to-recover-deleted-files-linux-using-photorec/ https://gofedora.com/how-to-recover-deleted-files-linux-using-photorec/#comments Mon, 31 Aug 2009 21:04:08 +0000 http://gofedora.com/?p=739 … ]]> Frequently I get messages like “I have accidentally deleted my project. Is there any way to recover it in Linux?” or “I worked really hard on that program and managed to deleted it right before submission ๐Ÿ™ How do I recover?”. Well I didn’t really have any idea on “How to actually recover deleted files in Linux”.

A few days back I was designing the new logo for Videocache in Inkscape. After finishing the design, I saved the svg file carefully. And deleted other images which I embedded in the logo. A few moments later I realized that I just screwed up myself by deleting all those files as the svg file is now good for nothing.

I searched a lot on recovering files in Linux but in vain. Then a friend (bitgeek) told me about Photorec. I managed to recover all the files using photorec. I thought it would be a good idea to let others know and spread a good word about Photorec. Below is a step by step howto on using Photorec to recover your files.

What is Photorec?

From Photorec website,

PhotoRec is file data recovery software designed to recover lost files including video, documents and archives from Hard Disks and CDRom and lost pictures (thus, its ‘Photo Recovery’ name) from digital camera memory. PhotoRec ignores the filesystem and goes after the underlying data, so it will still work even if your media’s filesystem has been severely damaged or re-formatted.

For This HowTo

Lets say I had a file download_arrow.png in /home/saini/Desktop which I have removed accidentally. Login as root and create a directory recover which will be used to store all the recovered files.

Install testdisk/PhotoRec

Photorec comes as a part of testdisk package in Fedora (I hope its same for other distributions as well). Use yum to install testdisk.

[root@fedora-tips ~]$ yum install testdisk

Launch Photorec

Once you are done with installation. Open a terminal and launch photorec (as root).

[root@fedora-tips recover]$ photorec

Select Hard Disk

If you have more than one hard disk in your system, select the one from which you have deleted the file(s).

PhotoRec Hard Disk Selection

Select Partition Type

If your hard disk has Linux partitions, then select [Intel].

PhotoRec Partition Selection

Select Filetype Option

Move to [File Opt] and press enter. Here you can disable all file types by pressing ‘s’ . Use space to toggle the check button. Now since we removed a png file, we are going to check only png file type.

PhotoRec Filetype Selection

Select Options

Photorec also has a list of different options. Under normal circumstances you don’t need to modify them

PhotoRec Option Selection

Select Partition

Move the selector to the partition from which you have removed the file. Then press enter on search.

PhotoRec Partition Selection

Select Filesystem Type

If you are using Linux, its going to be ext2/ext3/ext4. So the default selection is file.

PhotoRec Partition Selection

Select Space for Analysis

Select free if you didn’t write to that partition after removing the particular file otherwise select whole.

PhotoRec Space Selection

Select a Directory to Recover Files

Now select the path where the recovered files will be stored. Then press ‘Y’.

PhotoRec Recovery Directory Selection

Recovery Progress

Photorec will show how many files it has recovered.

PhotoRec Recovery Progress

All recovered file will be stored in the directory selected above. Open them in a file browser and you’ll get the removed file there. I hope this howto will help you recovering files you accidentally delete ๐Ÿ™‚

]]>
https://gofedora.com/how-to-recover-deleted-files-linux-using-photorec/feed/ 22