recentpopularlog in

dusko : cli   1120

« earlier  
Almquist shell - Wikipedia
Almquist shell (also known as A Shell, ash and sh) is a lightweight Unix shell originally written by Kenneth Almquist in the late 1980s. Initially a clone of the System V.4 variant of the Bourne shell, it replaced the original Bourne shell in the BSD versions of Unix released in the early 1990s.

Derivative versions of ash are installed as the default shell (/bin/sh) on FreeBSD, NetBSD, DragonFly BSD, MINIX, and in some Linux distributions. MINIX 3.2 used the original ash version, whose test feature differed from POSIX. That version of the shell was replaced in MINUX 3.3. Android used ash until Android 4.0, at which point it switched to mksh.
sh  shell  commandline  cli  unix  netbsd  dragonflybsd  freebsd  bsd 
5 days ago by dusko
Notes about the control codes present in VT220, VT240, VT3x0, VT420, and later DEC terminals
Notes about the control codes present in VT220, VT240, VT3x0, VT420, and later
DEC terminals. These models all implement supersets of the VT100's features.

-====-====-====-====-====-====-====-====-====-====-====-

By special request, here are the controls for
"Visual Character and Line Attributes" in DEC terminals.

The sequence CSI Ps;Ps;Ps m (or 7-bit ESC [ Ps;Ps;Ps m)
allow visual attributes to be set for some characters.
The VT100 and/or VT102 could perform only a few attributes;
models beginning with the VT300 series could do more.

The values of "Ps" follow:

Ps Attribute Mode
---- ------------------ ------
0 all attributes off all
1 bold all
4 underline all
5 blinking all
7 negative image all
8 invisible VT300+
22 bold off VT300+
24 underline off VT300+
25 blinking off VT300+
27 negative image off VT300+
28 invisible off VT300+

Line attributes were set as follows:

Sequence Attribute Mnemonic Special
-------- --------------------------------- -------- ------------
ESC # 5 single-width, single-height line DECSWL
ESC # 6 double-width, single-height line DECDWL

ESC # 3 double-width, double-height line DECDHL (top half)
ESC # 4 double-width, double-height line DECDHL (bottom half)

Please observe that the VT320 is *not* a color terminal. It has only
a monochrome screen. The VT340 is a color terminal, but does not obey
the ISO-6249/ECMA-48 color controls (it can do ReGIS graphics colors,
as can the VT241).

As far as I know, the only DEC terminal to implement and actually be
able to display ISO-6249/ECMA-48 color controls is the VT525 (which
was actually made for DEC by Boundless).

Of course, many contemporary "VT320-emulator" software products do
implement ISO-6249/ECMA-48 color, as an enhancement. (This has led
to incorrect folklore that a real VT320 was a color terminal.)

These color controls are the 30-37 foreground, 40-47 background
arguments to the SGR control sequence.

...RSS

//////////////////////////////////////////////////////////////////////

Newsgroups: comp.terminals
Path: cs.utk.edu!emory!europa.eng.gtefsd.com!howland.reston.ans.net!EU.net
!uknet!bradford.ac.uk!M.T.Shipley
Message-ID: <1994May3.083827.1469@bradford.ac.uk>
Lines: 57
Organization: University of Bradford, UK
References: <2pqn0d$njb@urmel.informatik.rwth-aachen.de>
Date: Tue, 3 May 1994 08:38:27 GMT
From: M.T.Shipley@bradford.ac.uk (MT SHIPLEY)
Subject: Re: Unknown VT220 Escape Sequences

Thomas Gellekum (thomas@ghpc8.ihf.rwth-aachen.de) wrote:
:
: Moin moin,

: The TPU-editor on VMS uses some escape sequences for VT220 that aren't
: explained in the programmers manual. They tend to garble output in my
: VT220 Emulator here. Does anyone know what they are supposed to do?

: CSI 1;2'z
: CSI 0'z

DECELR - DEC Enable Locator Reports

CSI Ps ; Pu ' z

Ps
0 locator disabled (default)
1 locator reports enabled
2 one shot

Pu --- specifies coordinate units
0 default to character cells
1 device physical pixels
2 character cells

: CSI 1;3'{

DECSLE - Select Locator Events

CSI P...P ' {

P...P one or more selective parameters:

0 Respond only to explicit host requests
1 Report button down transitions
2 Do not report button down transitions
3 Report button up transitions
4 Do not report button up transitions


: Is there an authoritative list of possible responses to a primary DA
: request? The manual gives just examples, not a complete list.

: Please reply by e-mail, I don't normally read this group. I'll post a
: summary if there's interest.

Opps, reply for news, so you better read this :-)

Martin

: Thomas Gellekum, thomas@ghpc8.ihf.rwth-aachen.de

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

There are two distinct ways to issue a reset command to a VT220 terminal.

Mnemonic Command Sequence Explanation
-------- ------------------- ------------------ -----------------------------

DECSTR Soft terminal reset Escape [ ! p sets terminal to power-up
default states

RIS Hard terminal reset Escape c replaces all terminal set-up
parameters with NVR values or
power-up default values if
NVR values do not exist.

("VT220 Programmer Pocket Guide" EK-VT220-HR-001, page 33)

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
terminal  console  commandline  cli  shell  unix  vt100  reference 
6 days ago by dusko
Draft of the ANSI C standard - Programming Language C, X3.???-1988.
Originally posted as a comment, here is a link (http://web.archive.org/web/20030222051144/http://home.earthlink.net/~bobbitts/c89.txt) to what appears to be a draft of the former mentioned standard, the ANSI C standard. It is my understanding that the drafts can be viewed for free, as @pmg has noted as well.

. . .

3.1.3.2 Integer constants

Syntax

integer-constant:
decimal-constant integer-suffix<opt>
octal-constant integer-suffix<opt>
hexadecimal-constant integer-suffix<opt>

decimal-constant:
nonzero-digit
decimal-constant digit

octal-constant:
0
octal-constant octal-digit

hexadecimal-constant:
0x hexadecimal-digit
0X hexadecimal-digit
hexadecimal-constant hexadecimal-digit

nonzero-digit: one of
1 2 3 4 5 6 7 8 9

octal-digit: one of
0 1 2 3 4 5 6 7

hexadecimal-digit: one of
0 1 2 3 4 5 6 7 8 9
a b c d e f
A B C D E F

. . .

3.1.3.4 Character constants

Syntax

character-constant:
' c-char-sequence'
L' c-char-sequence'

c-char-sequence:
c-char
c-char-sequence c-char

c-char:
any member of the source character set except
the single-quote ', backslash \, or new-line character
escape-sequence

escape-sequence:
simple-escape-sequence
octal-escape-sequence
hexadecimal-escape-sequence

simple-escape-sequence: one of
\' \" \? \\
\a \b \f \n \r \t \v

octal-escape-sequence:
\ octal-digit
\ octal-digit octal-digit
\ octal-digit octal-digit octal-digit

hexadecimal-escape-sequence:
\x hexadecimal-digit
hexadecimal-escape-sequence hexadecimal-digit
. . .

The single-quote ', the double-quote , the question-mark ?, the
backslash \ , and arbitrary integral values, are representable
according to the following table of escape sequences:

single-quote ' \'
double-quote " \"
question-mark ? \?
backslash \ \\
octal integer \ octal digits
hexadecimal integer \x hexadecimal digits

The double-quote and question-mark ? are representable either by
themselves or by the escape sequences \" and \? respectively, but the
single-quote ' and the backslash \ shall be represented, respectively,
by the escape sequences \' and \\ .

The octal digits that follow the backslash in an octal escape
sequence are taken to be part of the construction of a single
character for an integer character constant or of a single wide
character for a wide character constant. The numerical value of the
octal integer so formed specifies the value of the desired character.

The hexadecimal digits that follow the backslash and the letter x
in a hexadecimal escape sequence are taken to be part of the
construction of a single character for an integer character constant
or of a single wide character for a wide character constant. The
numerical value of the hexadecimal integer so formed specifies the
value of the desired character.
c  programming  terminal  console  shell  xterm  cli  unix 
8 days ago by dusko
c - Where can I find the C89/C90 standards in PDF format? - Stack Overflow
Just a little background from GCC's online documentation to help clarify what exactly the key terms are:

The original ANSI C standard (X3.159-1989) was ratified in 1989 and published in 1990. This standard was ratified as an ISO standard (ISO/IEC 9899:1990) later in 1990. There were no technical differences between these publications, although the sections of the ANSI standard were renumbered and became clauses in the ISO standard. This standard, in both its forms, is commonly known as C89, or occasionally as C90, from the dates of ratification.

Originally posted as a comment, here is a link (http://web.archive.org/web/20030222051144/http://home.earthlink.net/~bobbitts/c89.txt) to what appears to be a draft of the former mentioned standard, the ANSI C standard. It is my understanding that the drafts can be viewed for free, as @pmg has noted as well.
c  programming  terminal  console  shell  xterm  cli  unix 
8 days ago by dusko
Text-Terminal-HOWTO
This document was originally written for real text terminals which were like monitors (with keyboards), but could only display text with a command line interface (no pictures). They were widely used to access mainframe computers in the late 1970's and 1980's but use of them declined in the 1990's and they are seldom used anymore. However much of this howto also applies to command-line interfaces on Linux PC's which are in wide use today. It's not about the user programs one might run on the command line, but about setting up, managing, and understanding the interface itself Such as using a monitor as a virtual (text-only) console, using a text-window in a GUI such as xterm, connecting to a remote computer over a network via ssh, telnet, etc., or even using software on another PC to turn it into a serial-port text-terminal. All these 4 methods are known as "text-terminal emulation". But unfortunately, the main emphasis in this howto is real text terminals and the coverage of emulation is inadequate for the first 3 methods of emulation mentioned above. The Keyboard-and-Console-HOWTO filled much this gap but it was written for Linux 2.0 and now needs rewriting (or merging into this Text-Terminal howto). A new author is needed that has time to do all this. For the seldom used real text-terminals, it explains how they work, explains how to install and configure them, and provides some info on how to repair them. This HOWTO also provides a brief overview of modern GUI terminals.
console  terminal  commandline  cli  howto  xterm  unix 
9 days ago by dusko
A day without X
Don’t wanna be a PITA, but you’re still using an xterm in all your examples :)

Hehe. I know, but I wasn’t sure how to take screenshots on the TTY.

You can make screenshot of what you run in a framebufer tty with fbgrab or fbshot.

. . .

For viewing images, as I mentioned earlier, I use fbi (through framebuffer). For videos there isn’t anything better than using some old DXR3-like card with TV output.
terminal  console  cli  shell  x11  xorg 
9 days ago by dusko
Further Reading - Blessed 1.15.1 documentation
These are often written in the C language, and directly map the “Control Sequence Inducers” (CSI, literally \x1b[ for most modern terminal types) emitted by most terminal capabilities to an action in a series of case switch statements.
terminal  xterm  commandline  cli  shell  console  unix  c  programming 
10 days ago by dusko
Clear! (clear your terminal screen) | Linux.org
The Ctrl-l shortcut only works as a shortcut for the "clear" command if you have readline {see *} set to use the default emacs input option. But it doesn't work if you set the vi input mode - at least not when in edit mode.

{* NOTE: readline is a utility that is used by bash and other shells to get input from the user.}

I use the following line in my .bashrc, which puts readline into vi input mode:
Code:

set -o vi

In the vi input mode, the Ctrl+l keybind is only available when in 'command' mode. So you have to hit <esc> and then Ctrl-l. Which is not really very helpful. It would also be handy to have it available in 'insert' mode too.

The good news is - you can easily add a keybind for Ctrl-l for 'insert' mode by adding the following line to your .bashrc:
Code:

bind -m vi-insert "\C-l":clear-screen

Alternatively, instead of editing .bashrc - you could create or edit .inputrc, which is a config file used by readline:

set editing-mode vi
$if mode=vi

# Set up a Ctrl+l key-bind for vi's insert-mode
set keymap vi insert
Control-l: clear-screen

# Set up a Ctrl+l key-bind for command mode
# Note: This key-bind is already defined in vi mode
# I've put it here as an example of how to create a
# vi command-mode shortcut
set keymap vi command
Control-l: clear-screen

$endif

Either method works. I edited .bashrc because it involved less typing and because I pretty much use bash exclusively.

But if you tend to switch between using different shells.
e.g. Bash, zsh, ksh, csh etc.
Then putting the settings into .inputrc will apply those settings to ANY shell that uses readline. In other words - no matter what shell you are using, your keybinds/settings for readline will always be the same.
Whereas .bashrc only applies to bash.

There are many different bits of functionality and options available in readline. So if there are any key-binds/shortcuts to functionality that you feel you are missing in either vi or emacs mode, you can easily set up a new keyboard shortcut - as I have done for clear-screen in the vi insert mode.
xterm  terminal  x11  xorg  shell  console  cli  unix  reference  traditionalvi  vi 
10 days ago by dusko
command line - What protocol/standard is used by terminals? - Unix & Linux Stack Exchange
Properly-written Unix programs don't emit these escape sequences directly. Instead, they use one of the libraries mentioned above, telling it to "move the cursor to position (1,1)" or whatever, and the **library** emits the necessary terminal control codes based on your TERM environment variable setting. This allows the program to work properly no matter what terminal type you run it on.
xterm  terminal  commandline  cli  shell  console  x11  xorg  unix  utf8  unicode  ansi  ascii 
11 days ago by dusko
terminal - Using printf with escape sequences? - Unix & Linux Stack Exchange
Do you know that printf does not support hex backslash escapes? Your code is not portable as it relies on non-POSIX features.
xterm  terminal  cli  unix  reference 
11 days ago by dusko
ANSI Codes and Colorized Terminals
In terms of digital representation ANSI and ASCII are different sets of characters, ASCII using only 7 bits for representing a character and ANSI using 8 bits.
ansi  ascii  reference  xterm  terminal  shell  console  cli  unix 
11 days ago by dusko
The TTY demystified
Occasionally, you may come across a UNIX system where the backspace key doesn't work. This happens when the terminal emulator transmits a backspace code (either ASCII 8 or ASCII 127) which doesn't match the erase setting in the TTY device. To remedy the problem, one usually types stty erase ^H (for ASCII 8) or stty erase ^? (for ASCII 127). But please remember that many terminal applications use readline, which puts the line discipline in raw mode. Those applications aren't affected.
terminal  unix  commandline  cli  console  computing  it  history  sysadmin  x11  xorg  xterm 
12 days ago by dusko
Unprintable ACSCII characters and TTYs
What happens when typing special "control sequences" like <ctrl-h>, <ctrl-d> etc.?

For convenience, "^X" means "<Ctrl-X>" in the following (ignoring the fact that you usually might use the lower case x).

About a possible origin of the "^"-notation, see also an article in a.f.c, <62097@bbn.BBN.COM> (local copy).
ascii  ansi  xterm  terminal  cli  x11  xorg  unix 
13 days ago by dusko
Text File formats – ASCII Delimited Text – Not CSV or TAB delimited text
See http://en.wikipedia.org/wiki/Unit_separator and
http://en.wikipedia.org/wiki/Delimiter#ASCII_Delimited_Text

In summary ASCII Delimited Text is using the last 4 control characters (28-31) for their purpose as field and record delimiters and not using CSV (Comma Separated Values)
csv  tsv  ascii  data  programming  plaintext  text  terminal  cli  reference 
13 days ago by dusko
Things Every Hacker Once Knew | Lobsters
feoh (Jan 27, 2017)
(https://lobste.rs/s/qph9hd/things_every_hacker_once_knew#c_ysbnmg)

Now this article I can get behind! While I often find Mr. Raymond’s opinion pieces objectionable and occasionally out and out wrong, but in my view his work really shines when he strives to educate, and this article is a great example.

I wish there were a bit more depth on UUCP, but overall - great article. Thanks for posting it.

. . .

Dutch feoh (Jan 27, 2017)
(https://lobste.rs/s/qph9hd/things_every_hacker_once_knew#c_kxffor)

My sentiments exactly. I stopped visiting his sites a few years ago; the signal to bombast ratio was just too low for me. If it weren’t for postings on aggregators, I’d miss great articles like this.

. . .

Screwtape (Jan 27, 2017)
(https://lobste.rs/s/qph9hd/things_every_hacker_once_knew#c_e5jnti)

A TTY-related fact that wasn’t mentioned in the article:

To control text-formatting on an ANSI-compatible terminal (or emulator), you can send it terminal control sequences like \e[1m to enable bold or whatever. Paper-based terminals didn’t have control-sequences like that, but people still figured out ways to do formatting. For example, if you printed a letter, then sent backspace (Ctrl-H, octet 0x08) and printed the same letter again, it would be printed with twice as much ink, making it look “bold”. If you printed a letter, then sent backspace and an underscore, it would look underlined.

The original Unix typesetting software took full advantage of this trick. If you told it to output a document (say, a manpage) to your terminal (as opposed to the expensive typesetting machine in the corner), it would use the BS trick to approximate the intended formatting.

This worked great, up until the invention of video display terminals, where the backspace trick just replaced the original text, instead of adding to it. So people wrote software to translate the backspace-trick into ANSI control codes... software like less(1).
unix  terminal  shell  console  commandline  cli  ascii  ansi  it  computing  history  reference  rs232serialport 
13 days ago by dusko
Things Every Hacker Once Knew | Hacker News
bogomipz on Jan 27, 2017 [-]
>"It becomes immediately obvious why, eg, ^[ becomes escape. Or that the alphabet is just 40h + the ordinal position of the letter (or 60h for lower-case). Or that we shift between upper & lower-case with a single bit."

I am not following, can you explain why ^[ becomes escape. Or that the alphabet is just 40h + the ordinal position? Can you elaborate? I feel like I am missing the elegance you are pointing out.

soneil on Jan 27, 2017 [-]
If you look at each byte as being 2 bits of 'group' and 5 bits of 'character';

00 11011 is Escape
10 11011 is [

So when we do ctrl+[ for escape (eg, in old ansi 'escape sequences', or in more recent discussions about the vim escape key on the 'touchbar' macbooks) - you're asking for the character 11011 ([) out of the control (00) set.

Any time you see \n represented as ^M, it's the same thing - 01101 (M) in the control (00) set is Carriage Return.

Likewise, when you realise that the relationship between upper-case and lower-case is just the same character from sets 10 & 11, it becomes obvious that you can, eg, translate upper case to lower case by just doing a bitwise or against 64 (0100000).

And 40h & 60h .. having a nice round number for the offset mostly just means you can 'read' ascii from binary by only paying attention to the last 5 bits. A is 1 (00001), Z is 26 (11010), leaving us something we can more comfortably manipulate in our heads.

I won't claim any of this is useful. But in the context of understanding why the ascii table looks the way it does, I do find four sets of 32 makes it much simpler in my head. I find it much easier to remember that A=65 (41h) and a=97 (61h) when I'm simply visualizing that A is the 1st character of the uppercase(40h) or lowercase(60h) set.
unix  terminal  shell  console  commandline  cli  ascii  ansi  it  computing  history 
13 days ago by dusko
bash - How to display control characters (^C, ^D, ^[, ...) differently in the shell - Unix & Linux Stack Exchange
When you type control characters in the shell they get displayed using what is called ** "caret notation" **.

Escape for example gets written as ^[ in caret notation.
----

When you press Ctrl+X, your terminal emulator writes the byte 0x18 to the master side of the pseudo-terminal pair.

What happens next depends on how the tty line discipline (a software module in the kernel that sits in between the master side (under control of the emulator) and the slave side (which applications running in the terminal interact with)) is configured.

A command to configure that tty line discipline is the stty command.

When running a dumb application like cat that is not aware of and doesn't care whether its stdin is a terminal or not, the terminal is in a default canonical mode where the tty line discipline implements a crude line editor.

Some interactive applications that need more than that crude line editor typically change those settings on start-up and restore them on leaving. Modern shells, at their prompt are examples of such applications. They implement their own more advanced line editor.
terminal  xterm  shell  x11  xorg  console  commandline  cli  unix 
14 days ago by dusko
Back to the Future: Using a DEC VT220 from 1983 | iSticktoit.net
Where is the freakin‘ Esc key!?

That is the one thing that buggs me: As vi user, I heavily depend on the ESC key, but the VT220 doesn’t have one. In VT100 mode, using F11 is quite simple, but you’ll miss out on the enhancements made in the VT220. CTRL-3 is the only way to generate a raw ESC character there. As many other people have done before me, I remapped ESC to jj (http://vim.wikia.com/wiki/Avoid_the_escape_key) or TAB in vim.
vt100  vi  terminal  console  shell  commandline  cli  xterm  x11  xorg  computing  it  history  unix  vim  traditionalvi 
14 days ago by dusko
vt220 ESC key -- how to, if it doesn't? - Google Groups
> A used vt220 we just acquired does not send ESC when the
> usual function key (F11?) is pressed, despite our best
> "there's-got-to-be-a-way-right?" efforts with the setup menus.

There are (I think) three ways:

(1) Get rid of all brain-damaged software that thinks that hooking to
the escape key is a good idea. ESC is for computer->terminal
interactions, not for fucking around to make a 'neato keen'
program that won't work on _the_ industry standard ASCII terminal.

(2) Press <ctrl> and '[' simultaneously.

(3) [not verified] Set the terminal to 'vt100' mode; the F11 key will
then work.
vt100  terminal  xterm  x11  xorg  cli  unix  it  computing  history 
14 days ago by dusko
Convert maildir to mbox
So how did I convert the maildir to mbox? I used formail which is provided by procmail.

for i in maildir/cur/*;do formail -I "Status: RO" <"$i" >>mbox;done
for i in maildir/new/*;do formail -I Status: <"$i" >>mbox;done

You will want to do that for each maildir (don’t forget the .Subfolder directories). And remember each “folder” or maildir would be a different mbox file. So if you wanted to save sent mail as well …

for i in maildir/.Sent/cur*;do formail -I "Status: RO" <"$i" >>sent;done
for i in maildir/.Sent/new/*;do formail -I Status: <"$i" >>sent;done
mailserver  email  reference  howto  terminal  cli  shell  unix  script  sysadmin 
16 days ago by dusko
tmux - Making vim use the alternate screen - Super User
Confirm this as follows (remember that ^[ must be entered as a control character, e.g. Ctrl-v followed by Escape):

less /etc/hosts # should use alternate screen (desired)

less -X /etc/hosts # should leave it's output on screen (undesired)

echo -n "^[[?1049h"; less -X /etc/hosts; echo -n "^[[?1049l"
# should use alternate screen (desired)

If that last command gives the desired behaviour with less. Try the same approach with vim:

echo -n "^[[?1049h"; vim /etc/hosts; echo -n "^[[?1049l"
# should use alternate screen (desired)
xterm  terminal  tmux  screen  vim  vi  cli  x11  xorg  unix  script  reference  howto 
17 days ago by dusko
linux - Using the "alternate screen" in a bash script - Stack Overflow
For C console application:

ncurses

Wikipedia:

ncurses (new curses) is a programming library that provides an API which allows the programmer to write text-based user interfaces in a terminal-independent manner.

less uses this library.

A hello world program from here, to compile it in gcc, flag -lncurses is needed.

#include <ncurses.h>

int main()
{
initscr(); /* Start curses mode */
printw("Hello World !!!"); /* Print Hello World */
refresh(); /* Print it on to the real screen */
getch(); /* Wait for user input */
endwin(); /* End curses mode */

return 0;
}
xterm  terminal  unix  bsd  linux  x11  xorg  cli  reference 
21 days ago by dusko
How to make Less indicate location in percentage - Stack Overflow
man -P 'less -s -M +Gg' man

This can be effected permanently by putting

export MANPAGER='less -s -M +Gg'

in one of your shell configuration files (above syntax is for Bash and ZSH). Now, for example, man man displays the percentage as you wanted!
Warning

You should not put the +Gg in the LESS variable! For example, doing

export LESS='-M +Gg'

will cause problems when reading very large files. For example,

yes | LESS='-M +Gg' less

does not work very well.
unix  commandline  cli  terminal  shell  reference  tips 
22 days ago by dusko
True Colour (16 million colours) support in various terminal applications and terminals · GitHub
Terminal Colors

There exists common confusion about terminal colors. This is what we have right now:

Plain ASCII
ANSI escape codes: 16 color codes with bold/italic and background
256 color palette: 216 colors + 16 ANSI + 24 gray (colors are 24-bit)
24-bit true color: "888" colors (aka 16 milion)

...

Terminals that parse ANSI color sequences, but approximate them to 256 palette

xterm (but doing it wrong: "it uses nearest color in RGB color space, with a usual false assumption about orthogonal axes")
terminal  xterm  shell  cli  colour  reference  ansi  ascii 
22 days ago by dusko
ANSI Escape Codes
ANSI Escape Sequences

Standard escape codes are prefixed with Escape:

Ctrl-Key: ^[
Octal: \033
Unicode: \u001b
Hexadecimal: \x1b
Decimal: 27

Followed by the command, usually delimited by opening square bracket ([) and optionally followed by arguments and the command itself.

Arguments are delimeted by semi colon (;).
ansi  ascii  commandline  cli  shell  terminal  xterm  x11  xorg  reference 
22 days ago by dusko
Backup script with tar | The FreeBSD Forums
...

Depending on the filesystem I think you should also seriously look into dump(8) and restore(8). There are some serious advantages over using those two instead of a tarball.

For example (the main reason I personal favor it): support for incremental backups as well as interactive restores. When I need a file from a dump dump (some pun intended ;)) I merely use restore with the -i parameter. I then use the normal commands I'm used to for navigating through a Unix filesystem (cd, ls, etc.) and when I found the file I need I tag it and start the restore.

That beats having to think about using tar correctly to dig up one specific file (or a directory, or..).

Maybe food for thought?

Obviously: this only works when you're using UFS. When using ZFS then you shouldn't be using tar in the first place in my opinion, because there are much better (and more efficient) ways than this.

...

There are some, not so obvious, caveats when using ZFS's send/receive. The most important one is not being able to restore the files to non-ZFS fileystems (at least not without using a ZFS intermediate). The same could be said for dump/restore (it only works on UFS). In this respect a tar(1) archive is more general and can be unpacked on most, if not all, systems. As with pretty much all things UNIX, there's more than one way to skin a cat.
backup  shell  script  tar  freebsd  zfs  reference  cli  unix 
23 days ago by dusko
What's the correct way to use ANSI escape sequences to edit terminal content "in place"? - Unix & Linux Stack Exchange
The behavior on \e[2J differs across terminals. Some, e.g. Xterm clear the screen as you expect.
xterm  terminal  cli  ansi  ascii  x11  xorg  tips 
23 days ago by dusko
Alternate screen buffer in Xterm/FreeBSD - Google Groups
...
As Tom Dickey already mentioned, \e[?1049 better reflects the combined
save-cursor, clear-screen and change-to-alternate operations.
xterm  terminal  cli  x11  xorg 
23 days ago by dusko
#2633 (Subshell don't save the output of the commands (ctrl+o clear the terminal)) – Midnight Commander
@Zmiter, as correctly identified by @fjoe:

The problem is that "ti" and "te" capabilities are missing in FreeBSD xterm (they are specified only for TERM=xterm-clear).

So there are 3 possibilities: (1) FreeBSD fixes xterm, (2) FreeBSD carries a patch for mc, or (3) we integrate the patch and make sure it's active only on FreeBSD (Andrew has just proposed such a patch).
xterm  terminal  cli  x11  xorg  freebsd 
23 days ago by dusko
FreeBSD SSH terminal windows - Super User
...
Replace :tc=xterm-new: with :tc=xterm-clear: so that it says:

xterm-256color|xterm alias 3:\
:Co#256:pa#32767:\
:AB=\E[48;5;%dm:AF=\E[38;5;%dm:tc=xterm-clear:

Then run:

cap_mkdb -f /usr/share/misc/termcap /etc/termcap
xterm  terminal  cli  x11  xorg  freebsd 
23 days ago by dusko
TERM=xterm lacking smcup and rmcup (alternate screen) - Google Groups
Hello
I want to criticize an approach taken in FreeBSD regarding the
alternate screen. It's not available in newcons. One person wrote
that's because Tekken doesn't have such feature, and newcons
implements Tekken.

That's maybe fine. However, newcons doesn't have it's own termcap. It
uses TERM=xterm, which normally has rmcup and smcup. Some smart person
thus decided to remove those codes from TERM=xterm. You see what this
leads to? No alternate screen on X11.

Why doesn't newcon create it's own termcap entry? Why nobody cares
about trashed xterm screens when fullscreen applications are exiting.
In my software I've wrote a special function to handle FreeBSD nuance (https://github.com/psprint/zsh-cmd-architect/blob/master/zca#L65-L81):

---- snip ----
# Reason for this function is that on some systems
# smcup and rmcup are not knowing why left empty
_zca_alternate_screen() {
[ "$_zca_has_terminfo" -ne "1" ] && return
[[ "$1" = "1" && -n "$terminfo[smcup]" ]] && return
[[ "$1" = "0" && -n "$terminfo[rmcup]" ]] && return

case "$TERM" in
*rxvt*)
[ "$1" = "1" ] && echo -n $'\x1b7\x1b[?47h'
[ "$1" = "0" ] && echo -n $'\x1b[2J\x1b[?47l\x1b8'
;;

By: Sebastian Gniazdowski
06/01/2016
xterm  terminal  cli  x11  xorg  freebsd 
23 days ago by dusko
Xterm 'alt screen' behavior - Google Groups
It's all designed to work together; if you are using the termcap-only version of titeInhibit, it does indeed not work well, since titeInhibit cannot modify the terminfo to get rid of the ^[[2J.
xterm  terminal  cli  x11  xorg  reference  tips 
23 days ago by dusko
unix - What commands can I use to reset and clear my terminal? - Super User
Use the right tool for each job:

Use clear to clear the terminal window.

Use reset to reset your terminal when it gets messed up by control sequences.

Use cat only when you want to stream a whole lot of data from one place to another uninterrupted.

Use a pager program such as less or most to view pages of output.

Use tail -f /var/log/foo.log /var/log/bar.log to watch several different log files.

With GNU tail, the -F option is better because it can continue following the file even when a new file appears in its place, as is common for log files.
unix  terminal  cli  x11  xorg  xterm  bsd  linux  freebsd 
24 days ago by dusko
« earlier      
per page:    204080120160

Copy this bookmark:





to read