Shell script save terminal (screen) outputs [closed] - linux

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 8 years ago.
Improve this question
I have a USB-Dongle that can recive radio signals (868Mhz).
This dongle coud be controlled over a screen terminal session:
screen /dev/ttyACM0
In this Terminal all 120sec appear strings:
T350B00B64C19
How can I save this strings in a variable to work with them.
Any ideas?

Starting screen with the -L option creates a log in the current working directory. I guess that should serve your requirements.
$ screen --help
...
-L Turn on output logging.
...
From man 1 screen:
-L tells screen to turn on automatic output logging for the windows.

If I understand correctly, you don't actually need screen; you just need to read from the serial device. For example:
while read data; do
# Work with value in $data
done < /dev/ttyACM0
Each call to read should block until the dongle writes another string to the serial device.
If you need to send commands to the device, you can also simply write the appropriate string to the same file:
printf "my-command" > /dev/ttyACM0
read response < /dev/ttyACM0

Related

Terminal output to a file using > [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 2 years ago.
Improve this question
I'm a beginner with bash/linux. I have a program that I have written using Visual Code Studio. I have been able to correctly compile the program and it return the output I was expecting. But I have forgotten the command to take that output and put it into a specific file.
Also, how would I find the pathway for that file, if it's not physically on my computer? I've ssh into a rasp pi on campus. So all the files are on the pi. Could it be as simple as copy paste?
I really think you should go over the basics of remote connection to a Linux machine, but to answer your question:
In order to redirect output from a command line utility (i.e. your program):
./[program_name] &> [output file]
using the &> operator will redirect both stdout and stderr to that file which I assume you want
In order to pull that file from remote:
scp [username]#[server_ip]:/[output file] ./
This assumes you actually have a user on that remote machine that you can ssh into

unlimited scrolling up from default linux command line [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 7 years ago.
Improve this question
I am looking to increase the default size of the scrolling up buffer from linux command line. It is a Debian server without gui.
I don't find related option in bashrc and I don't even know if there is other configuration file for the default prompt alt+f1 alt+f2 ...
You can change the scrollback-buffer size using kernel options as described here: https://wiki.archlinux.org/index.php/Scrollback_buffer .
However, if you are interested in the output of a command but at the same time you want to watch the command's progress interactively I suggest to use tee:
command | tee out.file
or if you want to append to a file use
command | tee -a out.file
tee is nice! use it! :)

Pipe One Serial Port to Another in Linux [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 7 years ago.
Improve this question
I am looking for a means to pipe one serial ports data (regardless of data type) to another serial port. In my case I am trying to take in data from one serial port and output it through a radio connected to another serial port in real time.
I already know what ports I am using and have looked up a program called socat, which should be able to handle it but there are no examples of how to do this and I have not been able to figure out how to do it.
Has anybody been able to use socat or a bash scipt/some other method to accomplish this in Linux??
I am running Ubuntu 14.04.
Assuming the serial port you are reading from is /dev/ttyS0, and the other you are writing to (where the radio is connected) is /dev/ttyS1 you shall simply do:
cat /dev/ttyS0 > /dev/ttyS1
or
dd if=/dev/ttyS0 of=/dev/ttyS1 bs=1
Of course before you should set all the serial ports' parameters using stty command.

How to log terminal keystrokes in ubuntu [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 8 years ago.
Improve this question
I want to log whatever is happening in my terminal in a text file . I want to save all session information in the log file. We can do this in putty. But I dont know how to achieve the same in simple terminal in ubuntu. Also, is it possible to use putty to open a terminal for localhost? I tried doing that . But does not work.
You can record your terminal session (assuming you're using Bash) by doing script.
You probably want script -k which records input and output.
So in all, doing something like script -k logfilename you will get what you want!

How do I "peek" at a running but detached screen? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 9 years ago.
Improve this question
I have a script that runs in the background on a detached screen but doesn't write to a log file. (screen -dmS somename somescript)
When I check on the script, I attach to it (screen -r somename) then detach when I'm done (C-a d).
Instead of attaching then detaching, is it possible to simply "peek" at what's on the screen?
Something similar to echo "$(screen -r somename)" that actually works?
The -X option sends a command to a running screen instance:
screen -r somename -X hardcopy
the hardcopy command writes a screen dump into hardcopy.N, where N is the index of the active screen.

Resources