Tag Archive: Shell


Record Shell Output to a File

There are times when you need to post the outcome of a particular command(s) from a shell on a forum or somewhere else. It might be for troubleshooting or demonstration. However, copy-paste is not exactly a good option if your shell is filled with tons of information. Not to mention, you would spend a lot of time just selecting the text & then pasting it into a word processor. Wouldn’t life be easy if there would be a script which would gather all the data from a terminal & save it to a file? It does exist.

Before starting to run the command(s) whose output you wish to capture, enter;

$script -a filename

You will get,

[shuttertux@localhost ~]$ script -a filename

Script started, file is filename

[shuttertux@localhost ~]$

Now one can begin entering the required commands. Once done, type;

$exit

You’ll get,

[shuttertux@localhost ~]$ exit

exit

Script done, file is filename

[shuttertux@localhost ~]$

Now you can view the output file simply by,

$cat filename

Wasn’t that easy? Just remember, the output file is saved in your present working directory.

Screenshots are vital when reviewing an application or giving visual assistance to those problems whose solution is difficult to jot down in words. For starters, when you press the ‘Prt Scr’ i.e. ‘Print Screen’ keyboard button the computer will automatically print what is currently being displayed on the screen & prompt you to save it as a file. The Screenshot application found under GNOME provides further options to finetune screenshot capturing as per your needs. While this will work fine when you’re running under a GUI but what would you do if you want to take screenshot when you are in a shell(virtual console) or when your GUI is broken? The print screen button on your keyboard won’t work in at the command prompt. In such a case you’ll need to use the following command.

$ import -window root /home/ShutterTux/Pictures/screenshot.png

The above command will save the screenshot of the current screen without any delay into the ‘Pictures” directory of user ‘LaymanLinux’ with the file name as ‘screenshot.png’. The file saving location need not be necessarily pictures directory & you can give any location in your home directory. Do remember to change the name of the output screenshot file to avoid conflicts.

You can even issue the command with a delay;

$ delay 20; import -window root /home/ShutterTux/Pictures/screenshot2.png

The above command will take screenshot after 20 seconds and save it to the location entered by the user.

For further application of the import command, you can refer this page.

Command Line Interface is a bonus under GNU/Linux systems. With commands you can perform virtually any task & that too in a jiffy. If you dream of administering Linux system then having a strong grip over commands will help you a long way in your endeavor. In this article, I will walk through some basic commands which will come handy. Treat these commands as your foundation of Command Line Interface under Linux. Let’s begin!

Continue reading

By now, you might have started reading more about Linux. Whatever guide or article you read; I bet most if not all had commands at some point or the other. Being a novice, it is expected that you didn’t get head or tail of the commands. Now you ask, Does knowing commands is so essential to learn Linux. To give a quick answer – Yes & No!

Continue reading

Follow

Get every new post delivered to your Inbox.

Join 82 other followers

%d bloggers like this: