recentpopularlog in

dusko : shell   1021

« earlier  
Automated Folder Backup Shell-Script
This simple unix shell script automatically creates backups of a specific folder at regular hourly, nightly, weekly, and monthly intervals.
shell  script  backup  automation  snapshot 
19 hours ago by dusko
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.



Newsgroups: comp.terminals
Message-ID: <>
Lines: 57
Organization: University of Bradford, UK
References: <2pqn0d$>
Date: Tue, 3 May 1994 08:38:27 GMT
Subject: Re: Unknown VT220 Escape Sequences

Thomas Gellekum ( 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

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


: Thomas Gellekum,


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 
5 days ago by dusko
Draft of the ANSI C standard - Programming Language C, X3.???-1988.
Originally posted as a comment, here is a link ( 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.

. . . Integer constants


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

decimal-constant digit

octal-constant octal-digit

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

. . . Character constants


' c-char-sequence'
L' c-char-sequence'

c-char-sequence c-char

any member of the source character set except
the single-quote ', backslash \, or new-line character


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

\ octal-digit
\ octal-digit octal-digit
\ octal-digit octal-digit octal-digit

\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 
7 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 ( 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 
7 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 
9 days ago by dusko
Clear! (clear your terminal screen) |
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:

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:

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


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 
9 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 
10 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 
10 days ago by dusko
Things Every Hacker Once Knew | Lobsters
feoh (Jan 27, 2017)

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)

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)

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 
12 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 
12 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 
13 days ago by dusko
Back to the Future: Using a DEC VT220 from 1983 |
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 ( or TAB in vim.
vt100  vi  terminal  console  shell  commandline  cli  xterm  x11  xorg  computing  it  history  unix  vim  traditionalvi 
13 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 
15 days ago by dusko
tar and netcat - Hacker News
If security isn't a big consideration (read: you control both machines and the network), you go even faster with netcat.

On the receiving machine, in its destination directory:

nc -l 6789 | tar xvf -

And on the sending machine, from its source directory:

tar cvf - . | nc receiving-machine 6789

netcat varies a bit from distro to distro, so you may need to adjust these command lines a bit to get it to work.
tar  netcat  networking  unix  shell  script 
15 days ago by dusko
Rosetta Code - Similar Sites
Rosetta Code isn't the only project which aims to document tasks in multiple languages. Other projects do exist. Here's a list. Feel free to update and add to it.
unix  shell  script  sysadmin  c  programming  reference 
15 days ago by dusko
Announcing ncurses 6.2
The distribution includes the library and support utilities, including

captoinfo, a termcap conversion tool
clear, utility for clearing the screen
infocmp, the terminfo decompiler
tabs, set tabs on a terminal
tic, the terminfo compiler
toe, list (table of) terminfo entries
tput, utility for retrieving terminal capabilities in shell scripts
tset, to initialize the terminal
xterm  x11  xorg  terminal  reference  shell  script 
20 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!

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 
21 days ago by dusko
Introduction to C Shell Programming
csh  tcsh  shell  script  programming  unix  sysadmin  reference 
21 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:

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 
21 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 
21 days ago by dusko
terminal - Alternate screen on FreeBSD's sc and vt - Unix & Linux Stack Exchange
By default, FreeBSD's virtual terminals (sc and vt) don't restore previous terminal content when exiting from a full screen app. Is there a support for this functionality? I've tried following sequences:


but they clear the terminal (first one seems to start the alternate screen, and the second one to leave it, however it clears screen).


In FreeBSD 10.2, neither syscons nor vt support an alternate display buffer. It is not implemented in teken.


No - sc and vt are not really xterm-compatible. Likewise teken. The first two are essentially cons25 (25-line "SCO-like" console), and the last you might call xterm-compromise. The notion behind teken was to lessen distress of people who happen to be on the console and ssh to some other machine where cons25 is unknown. It amends some of the function keys, and some of the screen-updating.

In ncurses (, those have accurate terminal descriptions (with notes):

* cons25 (
* teken (

To get a better sense of the differences of teken from xterm, you might try running vttest (, e.g.,

vttest 25x80.80

(to avoid getting distracted by the lack of support for 80/132-column switching). For validating the terminal descriptions, tack ( was more useful.

If those terminals had supported alternate screen, there would be a note in the terminal database, and (likely) the smcup and rmcup capabilities would be filled out to demonstrate it.
xterm  shell  console  terminal  unix  freebsd 
21 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 
22 days ago by dusko
What to backup? | The FreeBSD Forums
I think instead of 'what to include', a better approach is 'what to exclude' from a backup.
backup  shell  script  freebsd 
22 days ago by dusko
vim tips.txt at master - GitHub -- Switching screens in an xterm *xterm-screens* *xterm-save-screen*
Switching screens in an xterm *xterm-screens* *xterm-save-screen*

(From comp.editors, by Juergen Weigert, in reply to a question)

:> Another question is that after exiting vim, the screen is left as it
:> was, i.e. the contents of the file I was viewing (editing) was left on
:> the screen. The output from my previous like "ls" were lost,
:> ie. no longer in the scrolling buffer. I know that there is a way to
:> restore the screen after exiting vim or other vi like editors,
:> I just don't know how. Helps are appreciated. Thanks.
:I imagine someone else can answer this. I assume though that vim and vi do
:the same thing as each other for a given xterm setup.

They not necessarily do the same thing, as this may be a termcap vs.
terminfo problem. You should be aware that there are two databases for
describing attributes of a particular type of terminal: termcap and
terminfo. This can cause differences when the entries differ AND when of
the programs in question one uses terminfo and the other uses termcap
(also see |+terminfo|).

In your particular problem, you are looking for the control sequences
^[[?47h and ^[[?47l. These switch between xterms alternate and main screen
buffer. As a quick workaround a command sequence like >
echo -n "^[[?47h"; vim ... ; echo -n "^[[?47l"
may do what you want. (My notation ^[ means the ESC character, further down
you'll see that the databases use \E instead).

On startup, vim echoes the value of the termcap variable ti (terminfo:
smcup) to the terminal. When exiting, it echoes te (terminfo: rmcup). Thus
these two variables are the correct place where the above mentioned control
sequences should go.

Compare your xterm termcap entry (found in /etc/termcap) with your xterm
terminfo entry (retrieved with "infocmp -C xterm"). Both should contain
entries similar to: >

PS: If you find any difference, someone (your sysadmin?) should better check
the complete termcap and terminfo database for consistency.

NOTE 1: If you recompile Vim with FEAT_XTERM_SAVE defined in feature.h, the
builtin xterm will include the mentioned "te" and "ti" entries.

NOTE 2: If you want to disable the screen switching, and you don't want to
change your termcap, you can add these lines to your .vimrc: >
:set t_ti= t_te=
xterm  terminal  shell  x11  xorg  tips  reference 
23 days ago by dusko
ansitest shell script
A useful little script that displays all the colors with their numbers.
shell  script  terminal  xterm  freebsd  x11  xorg  ansi 
24 days ago by dusko
Escape sequences with "echo -e" in different shells - Unix & Linux Stack Exchange
There's no such thing as a "Linux shell".

There's for instance the echo builtin of the /bin/sh shell as provided by the dash package on Debian (an operating system that can have Linux or FreeBSD as its kernel).


Note that at any time and in almost any shell, you can figure out which "echo" will be called by typing type echo or which echo. It's usually a shell builtin. So it depends on which "echo" is installed and on which shell you're using.


which echo should not be used, it likely won't tell you if you are using a builtin because which is usually an external binary. type is good, though.


Well spotted, though on my main shell (zsh), it's a builtin (as revealed by type which or which which). ;)
shell  sh  script  terminal  ascii  unix  reference  linux  bsd 
27 days ago by dusko
Less Known pkg(8) Features | 𝚟𝚎𝚛𝚖𝚊𝚍𝚎𝚗
pkg query "%t %n-%v" \
| sort -n \
| while read timestamp pkgname
echo "$(date -r $timestamp) $pkgname"
done | ( head; echo; tail )
freebsd  bsd  unix  shell  script  reference 
28 days ago by dusko
Take a screenshot from commandline (Example)
And you can do it even if you are not at the X session:

$ import -window root -resize 600 \
-display :0 /path/file.png

So you even could take a screenshot vía ssh:

$ ssh user@host "import -window root \
-resize 600 -display :0 png:-" > /tmp/myshot.png .

UPDATED: To simplify the ssh version, I removed the scp and redirect the output to a local file. The png:- indicates that the format is png and the the file -, which is the standard output.
x11  xorg  documentation  writing  tips  ssh  shell  cli 
28 days ago by dusko
Terminal codes (ANSI/VT100) - introduction [Bash Hackers Wiki]
These features require that certain capabilities exist in your termcap/terminfo. While xterm and most of its clones (rxvt, urxvt, etc) will support the instructions, your operating system may not include references to them in its default xterm profile. (FreeBSD, in particular, falls into this category.) If `tput smcup` appears to do nothing for you, and you don't want to modify your system termcap/terminfo data, and you KNOW that you are using a compatible xterm application, the following may work for you:

echo -e '\033[?47h' # save screen
echo -e '\033[?47l' # restore screen
shell  script  cli  terminal  ansi  unix  reference  vt100  freebsd  ascii 
4 weeks ago by dusko
« earlier      
per page:    204080120160

Copy this bookmark:

to read