Hot answers tagged

16

You'd use tput for that: tput setaf 1 echo This is red tput sgr0 echo This is back to normal This can be used to build a pipe: red() { tput setaf 1; cat; tput sgr0; } echo This is red | red The basic colours are respectively black (0), red (1), green, yellow, blue, magenta, cyan and white (7). You'll find all the details in the terminfo(5) manpage.


12

Here's a little script that does just that. Save this as color in a directory in your $PATH (for example, ~/bin if that's in your $PATH): #!/usr/bin/env perl use strict; use warnings; use Term::ANSIColor; my $color=shift; while (<>) { print color("$color").$_.color("reset"); } Then, pass your text through the script, giving . as the pattern ...


6

With zsh: autoload colors; colors for color (${(k)fg}) eval "$color() {print -n \$fg[$color]; cat; print -n \$reset_color}" And then: $ echo "while" | blue while


5

The string you get 4;rgb:8b8b/cdcd/0000 is not really the output of the echo command but a side effect of the echoed string being sent to your terminal emulator and the latter reacting to it by outputting these characters, just like if you typed them. The shell is unaware of it and that's the reason why attempting to capture the output results in empty ...


5

Terminals are controlled by escape sequences that are sent in-line with the character data to be displayed. That is how, for example, echo -e '\e[34m' will turn the text on many terminals blue. It's echoing some characters to the terminal—they happen to be an escape sequence which sets the foreground color. The terminal was messed up by being instructed to ...


4

man wall will give you what you need. You execute wall with either a filename, or you pipe content to it. For example, either, wall file.name to broadcast the content of the file file.name or echo "Dive\!" | wall to send the message Dive! Update: As Stephen points out in this answer, later versions of wall can send messages by simply typing, wall ...


3

You simply use wall; running it as root will ensure every terminal displays the message. wall Your attention please\! Older versions of wall only accept a file name on their command-line, or a message piped in: echo Your attention please\! | wall


3

Most of the terminals you are likely to use implement escape sequences for saving and restoring the cursor position. Those are the sc (save cursor) and rc (restore cursor) capabilities in the terminal description, which you can use via tput (just like cup): tput sc tput cup 50 10 echo some stuff echo more stuff tput rc However, if your program writes ...


3

That happened because the output you produced included codes that your terminal interface interpreted as control codes. This is normally resolved with either reset or stty sane.


3

Perhaps you cannot have what you are asking. From the terminal's standpoint: screen is a full-screen (no pun) application just like vi or less. the terminal implements scrolling and an alternate screen. when the terminal is in alternate-screen mode, it does not add to its scrollback area as it would in normal mode. in gnome-terminal (and perhaps some ...


3

Actually, the picture does not show any line-drawing characters. Running reset would (usually) help with that. But reset also repairs the terminal modes, somewhat more reliable than stty sane: If you use stty sane, that will fix problems with the terminal modes for echo and carriage return, but on Unix platforms (i.e., AIX, HPUX and Solaris) that sets ...


2

You can use the tee command to send output to the screen and write the same contents to a file. make | tee output.txt If you want to append to the target file (like the >> output.txt redirection) instead of overwriting it, you should add the -a option to tee: make | tee -a output.txt


2

tput can handle expressions (for instance in sgr and setaf) which the typical shell-scripter would find less than usable. To get an idea of what is involved, see the output from infocmp with the -f (formatting) option applied. Here is one of examples using those strings from xterm's terminfo descriptions: xterm-16color|xterm with 16 colors, ...


2

An alternative, if you have a fairly recent pinentry/gpg2 (tested with 0.9.7 and 2.1.11 respectively on Arch Linux), is to use http://elpa.gnu.org/packages/pinentry.html. Install pinentry from M-x list-packages, then put allow-emacs-pinentry in your .gnupg/gpg-agent.conf and put (setenv "INSIDE_EMACS" (format "%s,comint" emacs-version)) ...


2

Another common remedy for this problem is to type Ctrl-VCtrl-O at the shell prompt. The first puts the shell into "literal" mode so that it won't modify the following character, which is the terminal reset command understood by almost all common terminal types. You might need to echo this instead, on some terminals.


2

So there are a few open source fonts targeting programmers that support ligatures, namely FiraCode Hasklig Monoid Iosevka However, very few opensource terminals that run natively on Linux yet support this. But you can find an current list in the FiraCode docs Black Screen (slow in browser terminal emulator that runs on node) Konsole (terminal editor ...


2

In the Edit > Preferences menu of xfce4-terminal you can disable the scrollbar. If you set the scrollback value to 1, it will disable scrolling back using the scroll wheel on your mouse. I'm using xfce4-terminal 0.6.3, the default version for Ubuntu 14.04.


2

You are describing the feature of VTE (used in XFCE Terminal) which translates wheel-mouse scrolling into up/down cursor-keys when using the alternate-screen. That happens if you are running screen in something like xterm. You can avoid that by preventing screen from using the terminal's alternate screen feature. For example (see How to disable alternate ...


2

sshd is the daemon. You'd want to use the -q flag with the client (ssh). When connecting to your home machines, include the -q flag in the ssh command (i.e. ssh -q user@host). Alternatively, if that doesn't work, you could try redirecting stderr to /dev/null by connecting to your home machines like ssh user@host 2> /dev/null.


1

Set LogLevel INFO in your server /etc/ssh/sshd_config. It should hide the most of messages. Also search for other occurrences of this option in that file.


1

ccze uses the curses output mode by default. (n)curses is a screen drawing library typically used by fullscreen applications. It switches to the terminal emulator's so-called "alternate screen" which does not have a scrollbar buffer, and the contents of the other, "normal screen" is restored upon exit. Instead of this, you should use its ansi output format ...


1

.bashrc is sourced by default. -bash-4.1$ echo 'echo I was read' >> ~/.bashrc -bash-4.1$ script asdf Script started, file is asdf I was read bash-4.1$ exit Script done, file is asdf


1

Add the -i option: clamscan -r --bell -i /


1

If you have history set up, you can use history | grep cd to see your recent cd commands.  You should be able to use them to figure out where you were working last time.


1

There is a terminfo entry which is (ab)used for this purpose, and has been the subject of more than one bug report suggesting that it be applied to various terminal descriptions. Referring to terminfo(5): has_status_line hs hs has extra status line from_status_line fsl fs return ...


1

The Alt key is often used as a meta modifier. Cursor- and function-keys are referred to as special keys since they may send multiple characters — and the characters which are sent can be altered. Some users, e.g., for bash expect that pressing Alt will send a key prefixed by the escape character. The documented "meta" feature (see terminfo(5)) deals ...


1

According to the Emacs wiki, the recommended TERM setting for ansi-term is "eterm-color". That terminal description is provided by ncurses; you probably would have to use the package with the complete terminfo database for platforms which make a distinction, e.g., Debian with ncurses-base and ncurses-term. The eterm-color description provides 16 colors, ...


1

There is simple TUI command to configure whether you are configuring the network on Server or on Local System. Use the below command and follow the steps-: $ sudo nmtui After configure the network. Activate the network. Restart the network service. $ sudo systemctl restart network


1

You can also use xtermcontrol --get-colorN for the first 16 colors. Alas it doesn't support the entire 256 color palette.


1

dtach is a wafer-thin terminal session manager, now forked on github, or doubtless easily installed via the ports or package system for your operating system. (Of historical interest may also be the dislocate example script distributed with expect.)



Only top voted, non community-wiki answers of a minimum length are eligible