How to print text messages into console [closed] - linux

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
When I compile and run example programs from OpenGL SuperBible under Linux no console window is created and as a result I can't see any text messages. Here by text messages I mean the output of printf function. This does happen under Windows - running exe opens a console window alongside the rendering window and all text messages appear in that console window.
How to I get console message printed into terminal window under Linux?

Run it in a terminal window, you'll then see the output.
If you don't see any output, check out the command line options (you'll probably have to pass -h or --helpor something as argument).

Related

How to offset carriage in $write function in verilog [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I would like to print using a built-in $write() function in verilog vcs on the same line twice, where the second write starts at a specified character position beginning from the column 0. Is it even possible? The pseudo-code would be something like:
$write("Hello world"); // Assuming printed from a new line
$write("Test",10); // Starts printing on the same line at 10th position from the beginning
The output console would look like:
Hello worlTest
You need to know the proper ASCII escape sequences for the terminal the output is going to. And not all terminal windows support the same codes or this feature at all. For example see the Move Cursor commands for the vt-100.
Other than that, you can manipulate a string before printing it.

How to wait for a program termination signal/attempt, and stop it from termination? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
I want to write a Bash script which will be "watching" some application. As soon as an attempt is made to close/terminate this application, the script will try to stop that termination operation for a few milliseconds, do some stuff and then terminate the application.
I am using Okular to read PDF files and annotate them. But the annotations are saved only in the Okular's docdata. However, if you save the file by using "Save As", the annotations are saved in the PDF file itself.
What I am trying to do is to intercept user's attempt to close Okular by clicking the "x" button on the window, and "Save as" the okular file, replacing the original, and then close the application.
This is meant to be a dirty hack to save annotations in PDF file, as this functionality is not provided in Linux by any good PDF "reader" (please don't name libreoffice or gimp, they're not readers).
If the application is killed with -9, you can do nothing about it, either inside the application or from outside.
The best you could do would be to write a script that users would invoke to cause the application to terminate. That script would be responsible for signaling the app that termination was imminent (via some IPC mechanism), wait for an acknowledgement that it's OK to proceed, and then terminate the app.

How to search word in linux terminal [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 9 years ago.
Improve this question
I have used terminal window for long time, There is a lot of stdout prints. Here I need command to search some word in history of linux terminal(stdout). like find option in text document.
To search through the commands you have executed run the following command
history |grep 'your search word goes in here'
In case you are using bash, you can also open the .bash_history file with any standard text editor and operate on it.
Well, i use screen for running the linux terminal.
There you can just do ctrl + a, followed by either / or ? and then the string to search in the stdout.
http://serverfault.com/questions/106388/screen-setup-tips
Check out the link to learn about screen, will make your life simpler!! :-)

OSX/Linux, slow down the output from terminal [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I'm printing to screen a long text file that scrolls very very quickly on my screen, is there a way to slow down the scrolling? In other words is there a system setting that controls the speed at which output is displayed to screen (OSX/Linux).
Simple answer: No.
Extended version: There are other solutions. You could pick from one of the following:
Use pipes. Using pipes allows you to redirect terminal output and to review it in your own speed. The appropiate symbol is |. Redirect the output to programs like less ore more. Both allow you to scroll through the output via pressing return, you can exit any time by pressing q. For instance, for handling a long directory listing, you could use
ls | more
Redirect your output into a file. If your output is cached in a file, it's persistent and allows you to open it with an editor of your choice to view (and edit) it. The symbol is >.
touch log.txt # create the file
ls > log.txt
nano log.txt # use nano text editor to view
script allows you to record entire terminal sessoins. This might be an overkill for your use-case, but is really useful. From the man page:
script makes a typescript of everything printed on your terminal. It is
useful for students who need a hardcopy record of an interactive session
as proof of an assignment, as the typescript file can be printed out
later with lpr(1).
Use less to page through files; you can page back and forth, search, etc.
xterm has limited control over scrolling speed; most other terminal emulators have none, because that's the wrong way to step through a file when you can use a program like less to filter the output.

How to set green screen in Ubuntu? [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
The default console in Ubuntu are white characters and purple background. I want to change it to green characters and black background, just like the old computer screens. I want to set all stuff to be green, including all files listed by "ls".(In the original console, different files may be shown in different colors, I do not want that).
What is more, how to set green characters in pure character environment? (Suppose I do not install X to my OS.)
Thanks a lot for your help.
Just edit your terminal profile.
gnome-terminal: Edit -> Profiles -> Edit
konsole: Settings -> Configure Profiles
Bash shows color in ls output using an alias. You can unset that command alias.
run unalias ls from command line, and colors in list command will become monochrome.
Add this line to your .bashrc file or .bashprofile so that it is set across your login sessions.
Changing console colors is very basic, a quick google will give you all steps what you need. For example this link.

Resources