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!
Notices
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.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Hi, I want to open a logfile.log then execute several cmds at cmdline one at a time. The output should be log to logfile.log. Finally, when finish all the cmds, I want to save/close the logfile.log. My question, can I do this on linux?
If you want things to be more automated, you could redirect stdio to logfile.log. You could also use "tee" to split output to both the console and the logfile.
Yes, it is possible and you can do it using script command as follows:
Code:
script -f <filename>
filename will be the name of the file in which you want to save the output. -f option is used to specify the filename. Once you execute this command it will show a message as below:
Quote:
Script started, file is <filename>
Again, filename will be the name you have given with script command above. This command will log everything that will type in the terminal. Remember this is only valid for the terminal you are working on. If you open up another terminal at the same time then it will not be ablicable to that terminal.
Yes, it is possible and you can do it using script command as follows:
Code:
script -f <filename>
filename will be the name of the file in which you want to save the output. -f option is used to specify the filename. Once you execute this command it will show a message as below:
Again, filename will be the name you have given with script command above. This command will log everything that will type in the terminal. Remember this is only valid for the terminal you are working on. If you open up another terminal at the same time then it will not be ablicable to that terminal.
I hope this helps.
Thank you. But I tried as you mentioned the above script -f modesense.log, then I executed sg_modes ... after that, I vi modesense.log, and I see nothing. Do I have to close the logfile?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.