Hot answers tagged

731

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


57

When a GUI terminal emulator prints out a string, it has to convert the string to font codepoints, send the codepoints to a font renderer, get back a bitmap and blit that bitmap to the display via the X server. The font renderer has to retrieve the glyphs and run them (did you know that Truetype/Opentype fonts are programs running inside a virtual machine ...


43

A tty is a native terminal device, the backend is either hardware or kernel emulated. A pty (pseudo terminal device) is a terminal device which is emulated by an other program (example: xterm, screen, or ssh are such programs). A pts is the slave part of a pty. (More info can be found in man pty.) Short résumé: A pty is created by a process through ...


37

The master side replaces the line (the pair of TX/RX wires) that goes to the terminal. The terminal displays the characters that it receives on one of the wires (some of those are control characters and make it do things like move the cursor, change colour...) and sends on another wire the characters corresponding to the keys you type. Terminal emulators ...


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

I find screen the most useful program for serial communication since I use it for other things anyway. It's usually just screen /dev/ttyS0 <speed>, although the default settings may be different for your device. It also allows you to pipe anything into the session by entering command mode and doing exec !! <run some program that generates output>....


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


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


25

Background The main reason why you need any program like minicom to communicate over a serial port is that the port needs to be set up prior to initiating a connection. If it weren't set up appropriately, the cat and echo commands would not do for you what you might have expected. Notice that once you run a program like minicom, the port is left with the ...


25

The output of programs is buffered, so if the connection is slow the program will be halted if the buffer fills up. If you use screen, it has a buffer as well that it uses to try and display to a connected session. But a program connected in the screen session will not be stopped if screen cannot update the remote terminal fast enough. Just like when a ...


23

Originally you had just dumb terminals - at first actually teletypewriters (similar to an electric typewriter, but with a roll of paper) (hence /dev/tty - TeleTYpers), but later screen+keyboard-combos - which just sent a key-code to the computer and the computer sent back a command that wrote the letter on the terminal (i.e. the terminal was without local ...


22

Simply by typing tty: $ tty /dev/pts/20 Too simple and obvious to be true :) Edit: The first one returns you also the pty of the process running grep as you can notice: $ ps ax | grep $$ 28295 pts/20 Ss 0:00 /bin/bash 29786 pts/20 S+ 0:00 grep --color=auto 28295 therefore you would need to filter out the grep to get only one result, which ...


21

There is a very limited security advantage in having requiretty on a server. If some non-root code is exploited (a PHP script, for example), the requiretty option means that the exploit code won't be able to directly upgrade its privileges by running sudo. There may be another way for the attacker to gain root, and of course the attacker will still be able ...


20

setsid sh -c 'exec command <> /dev/tty2 >&0 2>&1' As long as nothing else is using the other TTY (/dev/tty2 in this example), this should work. This includes a getty process that may be waiting for someone to login; having more than one process reading its input from a TTY will lead to unexpected results. setsid takes care of starting ...


19

The ls program uses isatty() to know whether fd 1 is a tty or something else (pipe, file, etc…). From man 3 isatty: int isatty(int fd); DESCRIPTION The isatty() function tests whether fd is an open file descriptor referring to a terminal Updade: Line 1538 in ls.c from coreutils (git revision 43a987e1): if (isatty (STDOUT_FILENO)...


19

When you “open a terminal”, you're starting a terminal emulator program, such as xterm, gnome-terminal, lxterm, konsole, … One of the first things the terminal emulator does is to allocate a pseudo terminal (often called a pseudo-tty, or pty for short). The pty is a pair of character device files: the pty master, which is the side that the terminal emulator ...


18

There is a standard control sequence to turn off cursor blinking on terminals. printf '\033[?12l' However many terminals do not implement this setting, so read on. There is a more widely implemented standard terminal setting for switching cursor visibility between high visibility, normal visibility and invisibility. Some terminals don't make a difference ...


18

A tty is a regular terminal device (the console on your server, for example). A pts is a psuedo terminal slave (an xterm or an ssh connection). man pts has a verbose description of pseudo terminals.


18

Edit: Since this answer, I wrote a dedicated article on my blog, for people who would be interested on more details. After a lot of reading, this is what I understood. Has ptmx any purpose besides allocating the slave part? Does it provide some kind of "intelligence", or the emulated terminal (xterm for instance) has all the intelligence of behaving ...


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


15

I found a way using a shell script here that put cat as a background process and a while loop that read the user input and echo it out to the port. I modified it to be more general and it fitted my purpose perfectly. #!/bin/sh # connect.sh # Usage: # $ connect.sh <device> <port speed> # Example: connect.sh /dev/ttyS0 9600 # Set up device ...


14

This gives you a solid yellow block (nonblinking) as a cursor: echo -n -e '\e[?17;14;224c' For more info check these references: Linuxgazette and EmacsWiki as well as the file /usr/src/linux/Documentation/VGA-softcursor.txt (if present on your system)


14

I know it is an old question, but a one-liner may help those who come here searching: cat /dev/ttyPSC9 | awk '{ print $0; system("")}' system("") does the trick, and is POSIX compliant. Non-posix systems: beware. There exists a more specific function fflush() that does the same, but is not available in older versions of awk. An important piece of ...


14

Meanwhile @Alexios have pretty well described all the reasons, I can mention several things, which relatively relieve the pain: use bitmap fonts (Terminal, Terminus — this is really great one), turn anti-aliasing off, or consider at least not using sub-pixel rendering, use KDE's terminal — konsole.


13

If UUCP is installed on the system, you may use the command cu, e.g. $ cu -l /dev/ttyS0 -s 9600


13

Indeed it is. The /dev/vcs* and /dev/vcsa* devices corresponds to the /dev/tty* devices (the virtual terminals). F1=tty1=vcs1/vcsa1 and so on. The vcs/vcsa is like tty for the "current" virtual terminal. As root, you can just cat these devices (e.g. cat /dev/vcs2), and see what's on the corresponding VT (e.g. /dev/tty2 the on on F2) like taking a ...


13

This is a bit of a complicated question. I'll try to answer your questions in turn, but first a general description: The scrollback buffer is implemented by your terminal emulator (xterm, Konsole, GNOME Terminal). It contains all the text that has been displayed on the screen, including both standard output and standard error from every program you run in ...


12

The purpose of watch is to show the results of a command full-screen and update continuously; if you're redirecting the output into a file and backgrounding it there's really no reason to use watch in the first place. If you want to just run a command over and over again with a delay (watch waits two seconds by default), you can use something like this: ...



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