01 May, 2010

How to take a Screenshot from the Command Line

There is no need of a graphical utility to take the screen shot of your desktop, no need to wonder how.. Lets try it with your terminal. Terminal is a powertool and solution to all the problems in linux

The advantage of using commandline tool is that if you need to take a screenshot in an environment, where you cannot run a graphical screenshot utility prefer this method.

1. Take a Screenshot from an X Terminal

Take the gnome terminal and type in as follows

   $ sleep 5; import -window root screen.png   
                       
                        The sleep command delays the process for five seconds before the screenshot is taken. This is the time to minimize windows, expand menus, or make other necessary adjustments before the screenshot is taken. By changing the sleep value you can control the delay before the screenshot is taken.                         

                        The import utility that is part of the ImageMagick suite of tools to take a screenshot of the entire window and name the image screen.png. If you want to grab a particular part of the screen, you also can use the -crop option to grab that specific area

                      $import -crop 500x400                  

And if you run import without -window your cursor will change to a crosshair, which you can drag over the area you want to capture. PNG is a recommended screenshot format, but ImageMagick supports a range of different formats, so you can use what you need. Type as below to see the man page to know more about import.

                            $ man import                              


2. Take a Screenshot from a Command-Line Terminal

               If you need to take a screenshot from a command-line console while X is running elsewhere on the system, adjust the command line and add a few additional features to it. This method is commonly used when you need a screenshot of an installation routine or a program running on an embedded device.To do this, first access the shell that runs behind the installer by pressing Ctrl-Alt-F3.This terminal is called tty3. It provides you with a simple shell in which you can run the commands to grab the shot.

                       Before you can run the command to grab the shot, find out the display number of the running X server. Every X server has a unique display number that is mapped to the particular user who is using X. You can find this by typing in the  terminal as follows

                        $ echo $DISPLAY                            

Let your display number returns :0.0, Then the command to grab the screenshot is:

 $ chvt 7; sleep 5; import -window root screen.png -display :0.0 ; chvt 3  

Three actions will take place following to this,

process of switching to the X terminal
grabbing the screenshot
switching back to your current command-line terminal.


The first command (chvt 7) switches to the X terminal say gnome (usually the 7th terminal is the X), and then the second command (sleep 5) pauses the process for two seconds to switch to the 7th terminal. Then the import command is used to grab the root window on display :0.0 and save the shot as screen.png. Finally, the terminal is switched back to terminal 2 (chvt 2).

You can change the virtual terminal by changing the number after the chvt.
Read rest of entry

21 April, 2010

Solving resolution problem in remastered Ubuntu

Before playing with some bloody configuration edits, lets try something simple.

Try pressing CTRL ALT + or CTRL ALT – from your desktop (+ will increase resolution, while – decreases the resolution). It will help you to switch between the available screen resolutions for your display..

If this teknik dont worked, try some simple configuration file editing…

Inorder to reconfigure your X server-the graphical system of Ubuntu it is safe to play from standing outside of X server. Try the following steps in order

1. logout

2. press ctrl+alt+F1 (starts a virtual terminal instead of the graphical system, here you will get a screen having a look of terminal. It will prompt for your user name and password)

3. As you know, we are going to change the settings of display. So it is better to backup your current display settings which is stored in xorg.conf type in as follows 

sudo cp /etc/X11/xorg.conf /etc/X11/xorg.conf.bak 

 4. We are going to edit the xorg.conf file now by opening it in vi editor. Type i

 sudo vi /etc/X11/xorg.conf (to edit the file)

5. go down to the Section “Monitor” hit i to insert text and write in (i key press will allow you to enter text): 

HorizSync 30-110 

VertRefresh 50-185 

look out the picture…

 

     6. Hit Esc and type wq (wq means read and quit)

7. press ctrl+alt+F7 (It will send you back to normal graphical system)

8. press ctrl+alt+backspace (to restart the X server, just to make sure)

Possibly your resolution problem may be solved by those configuration editing…
It works, since my friend tried it out and corrected his resolution problem…


 

 

Read rest of entry
 

Terminal Diary | techblog Copyright © 2009 Gadget Blog is Designed by jintu jacob Powered by Blogger