Hot answers tagged

166

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


91

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


85

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


78

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.


60

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


48

SHORT explanation: The console is a terminal. 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. A ...


43

Here's a one-off fix: sudo sh -c 'dumpkeys |grep -v cr_Console |loadkeys'


41

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


37

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 from the kbd package: setfont /usr/share/consolefonts/Lat7-Terminus28x14.psf This works for my Debian; it may be different for you. In Debian, you can ...


36

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


36

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.


36

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


35

I've had an occasion where none of the usual tricks, reset or stty sane, worked (after accidentally calling print on a python bytearray). I had success with method 2 listed on this helpful blog. I've since created a most helpful alias: alias fix='echo -e "\033c"'


34

A TTY (i.e. TeleTYpewriter) is a special device that lets people who are deaf, hard of hearing, or speech-impaired use the telephone to communicate, by allowing them to type text messages. A TTY is required at both ends of the conversation in order to communicate. OR TTY is terminal which is used to type text message. Shell :the outside protective covering ...


34

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


34

Running a ruby script on every login doesn't sound like my idea of a good time. But if it's colours you want you won't be disappointed by lolcat https://github.com/busyloop/lolcat DISCLAIMER: I have since set this up on my SSH banners throughout my home cluster :) Looks great with some text piped in from figlet


28

There are already two great answers, but Ī̲’d like to add information about the phrase “virtual terminal”. Generally, it means something that provides appearance/functionality of a terminal, i. e. a terminal-emulator in broad sense. But in early days of Linux (1994–95) is was used synonymously with “virtual console” (several unrelated user interfaces), by ...


25

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, but you can work around it. You should be able to get full resolution in the framebuffer by editing ...


25

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


25

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


24

Why does UNIX/Linux provide multiple terminal emulators [on the console]? For the same reason your GUI terminal emulator likely supports tabs (e.g. GNOME Terminal), and if not (e.g. rxvt), then for the same reason launching a second GUI terminal app instance doesn't just pull the first one to the foreground and exit, forcing you to use the first instance. ...


23

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


22

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


22

(I noticed a complaint that kbdrate might have a max limitation. Not sure how true it still is). I use xset r rate 250 60 to accomplish speedups to my liking. I happen to put that in my ~/.i3/config (for i3wm) but I used to have it working in my ~/.xinitrc for startx to pick up. The xset invocation should apply to everything running in X. (I’d be curious ...


21

Just use source ~/.bashrc or . ~/.bashrc


21

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


20

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


20

This question is a bit old, but I was looking for something similar, and found it here. It creates a second session that shares windows with the first, but has its own view and cursor. tmux new-session -s alice tmux new-session -t alice -s bob If the sharing is happening between two user accounts, you may still have to mess with permissions (which it ...


20

I refactored Tobu's answer to change only the absolutely necessary: sudo sh -c 'dumpkeys -k|grep -v Incr_Console|grep -v Decr_Console|grep -v Last_Console|loadkeys' NB: As said this is a one-off fix, and will probably be gone after a reboot.


20

Text-mode graphics + jokes can be implemented using installing ponysay + fortune. The ponysay package by default displays a string picking up a random poney. Then for basic use, you do: fortune | ponysay or: fortune | ponythink From ArchWiki: For full 256-colored cowsay-like art use ponysay (version 3.0 has 422 ponies). The syntax is $ ponysay ...


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