Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
Surely you don't mean every single output? Many processes run in the background. Terminals send control codes. A single file containing all output would:
a) Likely get very large very fast so is apt to fill up the filesystem.
b) Likely impact your performance for all the writes.
c) Be unusable because you'd not know which command sent which output.
Is it possible what you really want is to save output from a given user's session? If so you should explore the "screen" command. You could launch this is the user's .bashrc or .profile.
For individual commands you can use the "tee" command to send output to different devices:
e.g. "ls -l |tee ls.out" from a terminal session would display the ls -l output on the screen and also send that output to the file ls.out.
It's an unattended terminal running certain process. No hardware display attached so I need a way to record what's been happening at the output for diagnosis. I don't expect the output to be any big unless weirdness takes control.
Can't /dev/tty1 be simply redirected to a file for the session lifespan?
Are you trying to record what happens on a particular terminal session? If yes, then you can use script command. Basically you need to run the script command and it will log everything that will happen on that particular terminal. It will keep recording until you type exit. Once you will type exit it will create a file typescript in the location where you currently are (pwd). You can schedule this via cronjob. File will only get created once you will type exit. You can even rotate the file via cronjob.
One nice option is:
-f Flush output after each write. This is nice for telecooperation:
One person does 'mkfifo foo; script -f foo' and another can
supervise real-time what is being done using 'cat foo'.
If real-time monitoring and logging is what you want, then the GNU screen application may also work well. It is a bit of a trick to get an application launched in it at boot time, but once it is launched, and if it is set up in multi-user mode, you can allow arbitrary numbers of concurrent users, and log everything to a file. I do this all the time with a particular application that is intended to run perpetually, but has an interactive console component that a whole group of people need to access from any where with SSH.