Hot answers tagged

729

A terminal is at the end of an electric wire, a shell is the home of a turtle, tty is a strange abbreviation and a console is a kind of cabinet. Well, etymologically speaking, anyway. In unix terminology, the short answer is that terminal = tty = text input/output environment console = physical terminal shell = command line interpreter Console, ...


134

A terminal or a console is a piece of hardware, using which a user can interact with a host. Basically a keyboard coupled with a text screen. Nowadays nearly all terminals and consoles represent "virtual" ones. The file that represents a terminal is, traditionally, called a tty file. If you look under the "/dev" directory of a UNIX system, you'll find a lot ...


59

From the documentation: /dev/tty Current TTY device /dev/console System console /dev/tty0 Current virtual console In the good old days /dev/console was System Administrator console. And TTYs were users' serial devices attached to a server. Now /dev/console and /dev/tty0 represent current display and usually are the same. You can override ...


50

Often times when in a Unix/Linux terminal (Bash) for example you'll use the commands more or less or cat to view a file. When you do this and the file isn't meant to be viewed (such as /bin/ls) you'll get output like this:                  What's going on here is that you just ...


47

You can verify what timeout the kernel uses for virtual console blanking via: $ cat /sys/module/kernel/parameters/consoleblank 600 This file is read-only and the timeout is specified in seconds. The current default seems to be 10 minutes. You can change that value with entering the following command on a virtual console (if you are inside an xterm you ...


43

You can use tput reset. Besides reset and tput reset you can use following shell script. #!/bin/sh echo -e \\033c This sends control characters Esc-C to the console which resets the terminal. Google Keywords: Linux Console Control Sequences man console_codes says: The sequence ESC c causes a terminal reset, which is what you want if the screen ...


39

Within the same window, you can simply type bash to start a new one. This is equivalent to closing the window and re-opening a new one. Alternatively, you can type source ~/.bashrc to source the .bashrc file.


36

/dev/console is a virtual set of devices which can be set as a parameter at boot time. It might be redirected to a serial device or a virtual console and by default points to /dev/tty0. When multiple console= options are passed to the kernel, the console output will go to more than one device. /dev/tty0 is the current virtual console /dev/tty[1-x] is one of ...


31

It is the kernel. Keep in mind the keyboard is hardware and everything that happens there passes through the kernel; in the case of VT switching, it handles the event completely itself and does not pass anything on to userspace (however, I believe there is an ioctl related means by which userspace programs can be notified of a switch occurring involving ...


30

MinTTY - here. It makes Cygwin entirely usable on Windows. I would be lost without it. Based on the original PuTTY code, but integrates straight into Cygwin (and in fact, is bundled with Cygwin). Start it with, C:\cygwin\bin\mintty.exe - Or where-ever you installed it. The '-' is key. There are a few other useful additions for Cygwin as well, one ...


25

SHORT explanation: The console is a terminal - i.e a system has got one console and potentially multiple terminals. The console is typically the primary interface for managing a computer, eg while it is still booting up. A terminal is a session which can receive and send input and output for command-line programs. The console is a special case of these. ...


23

This shows because one getty process is running on each virtual console (VC) between tty1 and tty6. You can access them by changing your active virtual console using Alt-F1 through Alt-F6 (Ctrl-Alt-F1 and Ctrl-Alt-F6 respectively if you are currently within X). For more information on what a TTY is, see this question, and for information on virtual consoles,...


22

There is no real need to disable "extra" TTYs as under systemd gettys are generated on demand: see man systemd-getty-generator for details. Note that, by default, this automatic spawning is done for the VTs up to VT6 only (to mimic traditonal Linux systems). As Lennart says in a blog post1: In order to make things more efficient login prompts are now ...


20

chvt allows you to change your virtual terminal. From man chvt: The command chvt N makes /dev/ttyN the foreground terminal. (The corresponding screen is created if it did not exist yet. To get rid of unused VTs, use deallocvt(1).) The key combination (Ctrl-)LeftAlt-FN (with N in the range 1-12) usually has a similar effect.


19

/dev/vcs[a]<n> will only get you the last screen-full even if you've scrolled up, but the selection ioctl()s as used by gpm will allow you to dump the currently displayed screen even when you've scrolled up. So you can can do: sleep 3; perl -e ' require "sys/ioctl.ph"; # copy: ioctl(STDIN, &TIOCLINUX, $arg = pack("CS5", 2, 1, 1, 80, 25, 2));...


18

If you are wanting to change your colours in the console, that is outside X, then you can specify colours in your .bashrc, like so: if [ "$TERM" = "linux" ]; then echo -en "\e]P0222222" #black echo -en "\e]P8222222" #darkgrey echo -en "\e]P1803232" #darkred .... fi Where you are defining black as #222222 See this post for the details: ...


18

Bash has a precommand hook. Sort of. preexec () { clear } preexec_invoke_exec () { [ -n "$COMP_LINE" ] && return # do nothing if completing [ "$BASH_COMMAND" = "$PROMPT_COMMAND" ] && return # don't cause a preexec for $PROMPT_COMMAND local this_command=`history 1 | sed -e "s/^[ ]*[0-9]*[ ]*//g"`; # obtain ...


17

try using tee? | tee log.txt instead of > log.txt


17

If you use the Linux console, the best way I found is: in /etc/default/console-setup put, for example CHARMAP="UTF-8" CODESET="Lat7" FONTFACE="Terminus" FONTSIZE="28x14" Another way is to use setfont: setfont /usr/share/consolefonts/Lat7-Terminus28x14.psf This works for my Debian; it may be different for you. In Debian, you can also run dpkg-...


16

That's the way that the terminal represents the raw keycode of the Up key sent to it by the keyboard. Basically, your shell would normally intercept the keypress, but there's nothing to do that at the login prompt. So the character that you typed gets printed to the console just like any other letter (or number, or whatever).


15

Newer kernels use KMS by default, so you should move away from appending vga= to your grub line as it will conflict with the native resolution of KMS. However, it depends upon the video driver you are using: the proprietary Nvidia driver doesn't support KMS[1], but you can work around it. You should be able to get full resolution in the framebuffer by ...


15

A linux kernel should store an on-screen log for your vts in the corresponding /dev/vcsa*[ttynum] device. It is why the following works: echo hey >/dev/tty2 dd bs=10 count=1 </dev/vcs2 ...which prints... hey The corresponding /dev/vcsa[ttynum] device will store an encoded version of the formatted text on-screen, whereas the /dev/vcs[...


14

When you press a key on your keyboard, it sends a numeric code to the computer, called a scan code. The scan code tells the computer which key was pressed; for example, on a typical US keyboard, the A key sends the scan code 30 when you press it (and 158 when you release it). The keyboard driver reports these codes directly to applications when the keyboard ...


14

There are various ways by which you can make log. But the first and the foremost thing is what actually you want to put in your log. You can do that in various ways: Tee command splits the output of a command so that it can be seen on the display and also be saved in a file. command | tee log.txt The above command will display the output to terminal as ...


14

Filippo Valsorda has a solution for OS X that incorporates iTerm 2, tmux, and mosh. His solution uses a single window/tab to connect to a remote shell. The shell survives disconnects (e.g., connection failure, IP changes, laptop reboots) and supports scrollback with a touchpad, copy-paste, and colors. Caveats are that you must build mosh from source, ...


13

Try using this: setterm -blank


13

Keyboards send events to the computer. An event says “scan code nnn down” or “scan code nnn up”. At the other end of the chain, applications running in a terminal expect input in the form of a sequence of characters. (Unless they've requested raw access, like the X server does.) When you press A, the keyboard sends the information “scan code 38 down”. The ...


12

On most Linux systems, the Ctrl+Alt+Del key sequence action is configured in either /etc/inittab or /etc/init/control-alt-delete.conf. Usually, this will reboot the system, but you could modify the command to halt the system instead. In /etc/inittab: ca::ctrlaltdel:/sbin/shutdown -t3 -h now Or /etc/init/control-alt-delete.conf: start on control-alt-...


12

It is called 'keyboard auto repeat rate' and you can set it with kbdrate Mine is set to: $ sudo kbdrate Typematic Rate set to 10.9 cps (delay = 250 ms) You can set same with: $ sudo kbdrate -r 10.9 -d 250 Typematic Rate set to 10.9 cps (delay = 250 ms) Check the manual page for exact options: man kbdrate Unsure where the default setting is done, but ...


12

That's what col -b is for: $ printf 'a\bb\n' | col -b | od -tc 0000000 b \n 0000002 $ printf 'aaa\b\b\bbb\n' | col -b | od -tc 0000000 b b a \n 0000004 The sed equivalent would be something like: bs=$(printf '\b') sed "s/^[^$bs]*/&\ \ /;:1 s/\n.\{0,1\}\(.*\n\)\([^$bs]\)/\2\ \1/;s/\(.\{0,1\}\)\n\(.*\n\)$bs/\ \1\2/;t1 s/\n//g" Dating to ...



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