Home » Questions » Computers [ Ask a new question ]

How to extract text from the current shell?

How to extract text from the current shell?

When I want to ask question on Linux platform, I would always need to provide the screenshot of current shell.But taking snapshot,uploading, linking costs much, is there any command to extract text directly from the current shell?

Asked by: Guest | Views: 57
Total answers/comments: 1
Guest [Entry]

"You could just use the script command.

Taken from the manual:

The script utility makes a typescript
of everything printed on your terminal.
It is useful for students who
need a hardcopy record of an inter-
active session as proof of an
assignment, as the typescript file can
be printed out later with lpr(1).

If the argument file is given, script
saves all dialogue in file. If no
file name is given, the typescript is
saved in the file typescript.

If the argument command is given,
script will run the specified command
with an optional argument vector
instead of an interactive shell.

Example (information in typescript file):

Script started on Mon Nov 2 21:13:17 2009
bash-3.2$ pwd
/Users/ricbax
bash-3.2$ ps
PID TTY TIME CMD
395 ttys000 0:00.02 -bash
425 ttys000 0:00.00 script
426 ttys001 0:00.01 /bin/bash -i
bash-3.2$ exit
exit

Script done on Mon Nov 2 21:13:44 2009"