Tag Info

Hot answers tagged

469

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, ...


91

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 ...


40

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 ...


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 ...


28

/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 ...


23

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 ...


21

If you're using OS X's Terminal.app, it will capture Page up/down keypresses and just scroll the window contents, as if you used the scroll bar. You can use Shift+Page up/down to send them to the application inside the terminal. Using that, you should be able to scroll by a page at a time using: Control+B [ Arrows keys or Shift+Page up/down Control+C when ...


17

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: ...


15

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.


15

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 ...


15

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


15

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 ...


14

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 ...


14

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).


13

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.


13

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 ...


12

Try using this: setterm -blank


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 ...


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 ...


11

Try: # loadkeys US From a terminal, it does not make sense to run this over ssh as the keyboard you use over ssh is the local one and the ssh client sends the keys after they have already been interpreted according to your local keymap. And it won't even work if you try. You can find all the available console keymaps in /usr/share/kbd/keymaps.


11

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 ...


11

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 ...


10

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. ...


10

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 ...


9

If your shell is bash, add clear_console or reset to ~/.bash_logout. If your shell is zsh, add that command to ~/.zlogout. You might want to run this only when the shell is a login shell on a Linux console, e.g. if [[ "`tty`" = /dev/tty[1-9] && $(ps -o comm= -p $PPID) = login ]]; then clear_console fi As the system administrator, you can ...


9

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 ...


9

You can use the command dmesg -n1 to prevent all messages, except panic messages, from appearing on the console. To make this change permanent, modify your /etc/sysctl.conf file to include the following setting (the first 3 is the important part). kernel.printk = 3 4 1 3 See this post for information on the kernel.printk values.


8

I've implemented and tested the following configuration, which works fine on sles10, my workhorse at the moment. In /etc/init.d/boot.local add setterm -blank it looks like that is all it takes. Thanks for Uku Loskit and Gilles for the push in the right direction.


8

Use magic SysRq key combinations. Try pressing Alt+SysRq+K to kill the boot sequence. This might let the boot sequence progress until you get a login prompt, but it probably won't. If it doesn't, press the magic more-or-less-safe reboot combination: Alt+SysRq+S (sync), Alt+SysRq+U (unmount), Alt+SysRq+B (reBoot). Once your computer reboots, at the boot ...


8

For convenience. It lets multiple users log in on the console (e.g. you can have a console running as root and one as non-root). It lets you start an X session on one and have another with a text mode session, and yet another with an SVGA application. Apart from SVGA which isn't really relevant nowadays, having X or screen makes multiple consoles mostly ...



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