I am trying to open a shell (xterm) and interact with it (write commands and read the shell’s output) Here is a sample of code which won’t work: When I execute this program an “xterm” window opens and the “ls” command is not entered. Only when I close the window I get a “-1” printed and nothing is read from
Tag: terminal
Clear screen in a Linux terminal using assembly?
Is there a way to clear the screen in a terminal window with nasm? By clear the screen, I mean emulate the Ctrl-L hotkey. Remove all text from the window. Answer In Bash: In C: How do I find the string:
Track the time a command takes in UNIX/LINUX?
In UNIX/LINUX, is there an easy way to track the time a command takes? Answer Yes, use time <command>, such as Consult man time for more options. Link.
Run Another Program in Linux from a C++ Program
Okay so my question is this. Say I have a simple C++ code: Now say I have this program that I would like to run in my program, call it prog. Running this in the terminal could be done by: Is there a way to just do this from my simple C++ program? For instance Any feedback would be very
split for words separated with semicolon
I have some string like 1;2;3;4;5 I want to be able to iterate over this string taking each word one by one. For the first iteration to take 1 the next to take 2 and the last 5. I want to have something like this but I do not know how to fill the myvar Answer
How to run process in terminal with reading only permission for given directory
I am trying to run a process in my terminal but I don’t trust the application that much. Is there is a way to run that application with just read permission from selected directory? I am using macOS. Answer As knittl told, you can use chroot for making jail. For the more complex things, MAC have MAC, (mean OS X
Is it possible to make stdout and stderr output be of different colors in XTerm or Konsole?
Is it even achievable? I would like the output from a command’s stderr to be rendered in a different color than stdout (for example, in red). I need such a modification to work with the Bash shell in the Konsole, XTerm, or GNOME Terminal terminal emulators on Linux. Answer Here’s a solution that combines some of the good ideas already
re-initialize / reconnect a terminal after network interruption
I have what is probably a very simple terminal related question. I’m running Ubuntu 8.10 Intrepid Ibex, using Gnome, and I often open a terminal-based ssh session only to have it dropped at some point later on. Once the session is dropped the terminal becomes unusable, obviously because the network connection has been dropped. Is there a way to re-initialize