Hopefully an example ssh config will follow.
[WayBack] Jeroen Pluimers on Twitter: “Would you mind sharing a trimmed down version of your ~/.ssh/config file? The bits from your posts are a bit fragmented now, so I’ve lost the overview (:”
–jeroen
Posted by jpluimers on 2021/08/10
Hopefully an example ssh config will follow.
[WayBack] Jeroen Pluimers on Twitter: “Would you mind sharing a trimmed down version of your ~/.ssh/config file? The bits from your posts are a bit fragmented now, so I’ve lost the overview (:”
–jeroen
Posted in *nix, Communications Development, Development, Internet protocol suite, Power User, SSH, ssh/sshd, TCP | Leave a Comment »
Posted by jpluimers on 2021/08/10
*n*x:
# nslookup -type=TXT amazonses.com | grep "v=spf1" amazonses.com text = "v=spf1 ip4:199.255.192.0/22 ip4:199.127.232.0/22 ip4:54.240.0.0/18 ip4:69.169.224.0/20 ip4:76.223.180.0/23 ip4:76.223.188.0/24 ip4:76.223.189.0/24 ip4:76.223.190.0/24 -all"IWindows
C:\>nslookup -type=TXT amazonses.com | find "v=spf1" Non-authoritative answer: "v=spf1 ip4:199.255.192.0/22 ip4:199.127.232.0/22 ip4:54.240.0.0/18 ip4:69.169.224.0/20 ip4:76.223.180.0/23 ip4:76.223.188.0/24 ip4:76.223.189.0/24 ip4:76.223.190.0/24 -all"
These addresses use a compact CIDR notation to denote ranges of networks containing ranges of network IPv4 addresses.
(this is linux sendmail only)
Converting the nslookup outout to a CIDR based sendmail /etc/mail/access excerpt goes via a pipe sequence of multiple sed commands:
# nslookup -type=TXT amazonses.com | grep "v=spf1" | sed 's/\(^.*"v=spf1 ip4:\| -all"$\)//g' | sed 's/\ ip4:/\n/g' | xargs -I {} sh -c "prips {} | sed 's/$/\tRELAY/g'" 199.255.192.0 RELAY 199.255.192.1 RELAY ... 76.223.190.254 RELAY 76.223.190.255 RELAY
What happens here is this:
spf1 records using grep..*v=spf1 ip4:) and tail ( -all") of the output, see [WayBack] use of alternation “|” in sed’s regex – Super User. ip4: with newlines (so the output get split over multiple lines), see [WayBack] linux – splitting single line into multiple line in numbering format using awk – Stack Overflow.xargs with the sh trick to split the CIDR list into separate arguments, and prips (which prints the IP addresses for a CIDR); see:
xargs with sh: [WayBack] shell – Piping commands after a piped xargs – Unix & Linux Stack Exchangeprips: [WayBack] prips / Prips · GitLab and [WayBack] Sendmail Open Source FAQs 0 (PDF).cidrexpand (which requires Perl), see [WayBack] sendmail access file and cidrexpand and [WayBack] cidrexpand in sendmail | source code search engine$) with a tab followed by RELAY, see
You can append the output of this command to /etc/mail/access, then re-generate /etc/mail/access.db and restart sendmail; see for instance [WayBack] sendmail access.db by example | LinuxWebLog.com.
Without the xargs, the output would look like this:
# nslookup -type=TXT amazonses.com | grep "v=spf1" | sed 's/\(^.*"v=spf1 ip4:\| -all"$\)//g' | sed 's/\ ip4:/\n/g' 199.255.192.0/22 199.127.232.0/22 54.240.0.0/18 69.169.224.0/20 76.223.180.0/23 76.223.188.0/24 76.223.189.0/24 76.223.190.0/24
–jeroen
Posted in *nix, *nix-tools, Amazon SES, Amazon.com/.de/.fr/.uk/..., Cloud, Communications Development, Development, Infrastructure, Internet protocol suite, Power User, sendmail, SMTP, Software Development | Leave a Comment »
Posted by jpluimers on 2021/08/09
There is an autossh binary for Windows available on GitHub: [WayBack] GitHub – jazzl0ver/autossh: Windows binary for autossh v1.4c.
Combined with NSSM (which for instance you can install through [WayBack] Chocolatey Software | NSSM – the Non-Sucking Service Manager) you can not only automatically build and maintain an SSH connection, but also ensure the autossh process is up and running as a service without the need for an active logon.
This allows for SSH based tunnels from and to your Windows system.
For this usage scenario, there is no need for these tools any more:
Future research:
These are in part based on:
Download the most recent [WayBack] Releases · jazzl0ver/autossh · GitHub (see below for updates).
I used the 1.4g version: [WayBack] autossh.exe, then put on my Windows PATH.
Since it is on chocolatey ([WayBack] Chocolatey Software | NSSM – the Non-Sucking Service Manager 2.24.101.20180116), this will suffice:
choco install --yes nssm
Check the value of MaxAuthTries in /etc/ssh/sshd_config.
# grep MaxAuthTries /etc/ssh/sshd_configMaxAuthTries 1
The value needs to be at least 3 or higher for ssh-copy-id to work properly.
When changing the value, be sure to restart the sshd daemon.
Without a low value of
MaxAuthTriesin/etc/ssh/sshd_config,ssh-copy-idwill give an errorERROR: Received disconnect from myRemoteComputer port 2222:2: Too many authentication failures.See also these link via [WayBack ]“INFO: attempting to log in with the new key(s), to filter out any that are already installed” “Too many authentication failures” – Google Search:
Temporarily change the user shell to /bin/bash to allow [WayBack] ssh-copy-id to work at all.
This is explained in more detail by [WayBack] shell – ssh dissable login, but allow copy-id – Server Fault.
You need an ssh public and private key, then transfer this to your Windows client. You can for instance use these as a base:
For instance (where myLocalUser is the local user generate the key-pair for for, and myRemoteUser plus myRemoteComputer is the remote user and computer you want to autossh to):
ssh-keygen -t rsa -b 4096 -f %UserProfile%\.ssh\id_rsa_myLocalUser@%ComputerName%_autossh_myRemoteUser@myRemoteComputerssh-keygen -t ed25519 -f %UserProfile%\.ssh\id_ed25519_myLocalUser@%ComputerName%_autossh_myRemoteUser@myRemoteComputerSince git includes ssh-copy-id (which you need in the next step, it is at %Program Files%\Git\usr\bin\ssh-copy-id) and git is on chocolatey ([WayBack] Chocolatey Software | Git (Install) 2.23.0):
choco install --yes git.install --params "/GitAndUnixToolsOnPath /NoGitLfs /SChannel /NoAutoCrlf /WindowsTerminal"
Use bash with ssh-copy-id to transfer the generated public keys to a remote system (replace 2222 with the SSH port number on the remote computer; often it is just 22):
pushd %UserProfile%\.ssh bash -c "ssh-copy-id -i %UserProfile%\.ssh\id_rsa_myLocalUser@%ComputerName%_autossh_myRemoteUser@myRemoteComputer -p 2222 myRemoteUser@myRemoteComputer" bash -c "ssh-copy-id -i %UserProfile%\.ssh\id_ed25519_myLocalUser_%ComputerName%_autossh_myRemoteUser@myRemoteComputer -p 2222 myRemoteUser@myRemoteComputer" popd
This sounds overly complicated, but is the only way to incorporate the environment variables.
These two ssh commands should succeed; choose the one for which you prefer the rsa or ed25519 algorithm.
ssh -i %UserProfile%\.ssh\id_rsa_myLocalUser@%ComputerName%_autossh_myRemoteUser@myRemoteComputer -p 2222 myRemoteUser@myRemoteComputerssh -i %UserProfile%\.ssh\id_ed25519_myLocalUser_%ComputerName%_autossh_myRemoteUser@myRemoteComputer -p 2222 myRemoteUser@myRemoteComputerAfter this, try with autossh:
autossh -M 0 -o "ServerAliveInterval 30" -o "ServerAliveCountMax 3" -i %UserProfile%\.ssh\id_rsa_myLocalUser@%ComputerName%_autossh_myRemoteUser@myRemoteComputer -p 2222 myRemoteUser@myRemoteComputerautossh -M 0 -o "ServerAliveInterval 30" -o "ServerAliveCountMax 3" -i %UserProfile%\.ssh\id_ed25519_myLocalUser_%ComputerName%_autossh_myRemoteUser@myRemoteComputer -p 2222 myRemoteUser@myRemoteComputerThis disables the autossh port monitoring (the -M 0 option, but uses a combination of interval/count-max from ssh itself to monitor the connection (the -o "ServerAliveInterval 30" -o "ServerAliveCountMax 3" options).
Note that there is no default monitoring port, as it can be any one: [WayBack] linux – What is the default monitoring port for autossh? – Super User
a
Depending on which algorithm you like most, use either of the below 2 (replace 2222 with the SSH port number on the remote computer; often it is just 22):
ssh -i %UserProfile%\.ssh\id_rsa_myLocalUser@%ComputerName%_autossh_myRemoteUser@myRemoteComputer -p 2222 myRemoteUser@myRemoteComputerssh -i %UserProfile%\.ssh\id_ed25519_myLocalUser_%ComputerName%_autossh_myRemoteUser@myRemoteComputer -p 2222 myRemoteUser@myRemoteComputer
C:\Users\jeroenp>ssh-keygen -t ed25519 -f %UserProfile%\.ssh\id_ed25519_myUser_%ComputerName%_autossh_revue Generating public/private ed25519 key pair. Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in C:\Users\jeroenp\.ssh\id_ed25519_myUser_D10U003_autossh_revue. Your public key has been saved in C:\Users\jeroenp\.ssh\id_ed25519_myUser_D10U003_autossh_revue.pub. The key fingerprint is: SHA256:6qjzXhQtZpTzU6aryHMYuwVs5b4a/2COKxFGFQj0Eg4 jeroenp@D10U003 The key's randomart image is: +--[ED25519 256]--+ |E+ oo... | |o = .o. o | | + . *o.+ | | +. = o+ | | . .+ o So | | ...+ .. | | o.=B. | | o *@oo | | .*O*=.. | +----[SHA256]-----+ C:\Users\jeroenp>ssh-keygen -t rsa -b 4096 -f %UserProfile%\.ssh\id_rsa_myUser_%ComputerName%_autossh_revue Generating public/private rsa key pair. Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in C:\Users\jeroenp\.ssh\id_rsa_myUser_D10U003_autossh_revue. Your public key has been saved in C:\Users\jeroenp\.ssh\id_rsa_myUser_D10U003_autossh_revue.pub. The key fingerprint is: SHA256:WaWRoAnr4OuXAnc+MekpbdnNto71SgdMykp7XqylQr8 jeroenp@D10U003 The key's randomart image is: +---[RSA 4096]----+ | . ..... | | o o .+ | | . . o . o | | . o . + o | | . o.o S | |. .o*o . . | | o.*oO.o* . | | .o %ooO+o | | .= oE++o. | +----[SHA256]-----+
NSSM is really cool to run any application as a service: [WayBack] NSSM – the Non-Sucking Service Manager
nssm is a service helper which doesn’t suck. srvany and other service helper programs suck because they don’t handle failure of the application running as a service. If you use such a program you may see a service listed as started when in fact the application has died. nssm monitors the running service and will restart it if it dies. With nssm you know that if a service says it’s running, it really is. Alternatively, if your application is well-behaved you can configure nssm to absolve all responsibility for restarting it and let Windows take care of recovery actions.
nssm logs its progress to the system Event Log so you can get some idea of why an application isn’t behaving as it should.
nssm also features a graphical service installation and removal facility. Prior to version 2.19 it did suck. Now it’s quite a bit better.
After installing, everything is command-line based (I cut away some blank lines for readability):
C:\bin\bin>nssm --help NSSM: The non-sucking service manager Version 2.24-101-g897c7ad 64-bit, 2017-04-26 Usage: nssm [ ...] To show service installation GUI: nssm install [] To install a service without confirmation: nssm install [ ...] To show service editing GUI: nssm edit To retrieve or edit service parameters directly: nssm dump nssm get [] nssm set [] nssm reset [] To show service removal GUI: nssm remove [] To remove a service without confirmation: nssm remove confirm To manage a service: nssm start nssm stop nssm restart nssm status nssm statuscode nssm rotate nssm processes
If it is behind on [WayBack] autossh (see version history at [WayBack] autossh/CHANGES.txt), then just ask for a new version; usually it gets built and released quickly: [WayBack] Any plans for 1.4g? · Issue #3 · jazzl0ver/autossh · GitHub
[WayBack] Releases · jazzl0ver/autossh · GitHub at the time of writing:
–jeroen
Posted in *nix, *nix-tools, Communications Development, Development, Internet protocol suite, Power User, SSH, TCP | Leave a Comment »
Posted by jpluimers on 2021/07/29
Listing Listing information on all active interfaces on MacOS is a process involving multiple pieces, which then can be combined together.
This involves both the -l (list with optional criteria) and -u parameter (the up criterion) as per excerpts from the [Archive.is] ifconfig(8) [osx man page] / [WayBack] ifconfig Man Page – macOS – SS64.com:
NAME ifconfig -- configure network interface parameters SYNOPSIS ... ifconfig -l [-d] [-u] [address_family] ... DESCRIPTION The ifconfig utility is used to assign an address to a network interface and/or configure network interface parameters. The following options are available: ... address_family Specify the address family which affects interpretation of the remaining parameters. Since an interface can receive transmissions in differing protocols with different naming schemes, specifying the address family is recommended. The address or protocol fami- lies currently supported are ``inet'', ``inet6'', and ``link''. The default is ``inet''. ``ether'' and ``lladdr'' are synonyms for ``link''. ... The -l flag may be used to list all available interfaces on the system, with no other additional information. Use of this flag is mutually exclusive with all other flags and commands, except for -d (only list interfaces that are down) and -u (only list interfaces that are up).
Example:
ifconfig -l -u
Each interface on one line:
ifconfig -l -u | xargs -n1 echo
The problem is that on my system, it also lists bridges as active, whereas they are not:
# ifconfig -l -u | xargs -n1 echo lo0 en1 en2 en0 p2p0 awdl0 bridge0 utun0 en10 # ifconfig bridge0 bridge0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500 options=63<RXCSUM,TXCSUM,TSO4,TSO6> ether 6a:00:02:9a:23:f0 Configuration: id 0:0:0:0:0:0 priority 0 hellotime 0 fwddelay 0 maxage 0 holdcnt 0 proto stp maxaddr 100 timeout 1200 root id 0:0:0:0:0:0 priority 0 ifcost 0 port 0 ipfilter disabled flags 0x2 member: en1 flags=3<LEARNING,DISCOVER> ifmaxaddr 0 port 5 priority 0 path cost 0 member: en2 flags=3<LEARNING,DISCOVER> ifmaxaddr 0 port 6 priority 0 path cost 0 Address cache: nd6 options=201<PERFORMNUD,DAD> media: status: inactive
So this is where the MacOS and BSD documentation is inaccurate.
The above interfaces are many more than just ethernet or WiFi interfaces; there is a list at [WayBack] macos – What are en0, en1, p2p, and so on, that are displayed after executing ifconfig? – Stack Overflow by [WayBack] mcint:
In arbitrary order of my familarity / widespread relevance:
lo0is loopback.
en0at one point “ethernet”, now is WiFi (and I have no idea what extraen1oren2are used for).
fw0is the FireWire network interface.
stf0is an IPv6 to IPv4 tunnel interface to support the transition from IPv4 to the IPv6 standard.
gif0is a more generic tunneling interface [46]-to-[46].
awdl0is Apple Wireless Direct Link
p2p0is related to AWDL features. Either as an old version, or virtual interface with different semantics thanawdl.…
many VPNs will add additional devices, often “
utun#” or “utap#” following TUN/TAP (L3/L2)virtual networking devices.
More on AWDL at [WayBack] ios – What is AWDL (Apple Wireless Direct Link) and how does it work? – Stack Overflow.
Posted in *nix, *nix-tools, Apple, bash, Development, ifconfig, Mac OS X / OS X / MacOS, Power User, Scripting, Software Development | Leave a Comment »
Posted by jpluimers on 2021/07/28
There is a non-standard -r option to xargs that allows it to skip executing when there are no arguments at all.
On some operating systems, the -r is default.
MacOS has no -r, but does not execute xargs if there are no arguments given.
Posted in *nix, *nix-tools, bash, bash, Development, Power User, Scripting, Software Development, xargs | Leave a Comment »
Posted by jpluimers on 2021/07/27
This is a continuation of yesterdays
Listing information on all active interfaces on MacOS part 1: getting the active interface names.
It is based on ideas in these StackExchange posts:
I threw most of the implementation details in the ideas away, as they were way to much based on empirical trial and error, than proper research.
So I tried doing the research and came up with the things below.
By using the ipconfig command, you can get specific details for a NIC like an IPv4 (with the getifaddr) or DHCP (with the getpacket option to get the latest DHCP packet):
for i in $(ifconfig -l -u); do if ifconfig $i | grep -q "status: active" ; then echo $i; fi; done | xargs -n1 -I_nic_ sh -c 'echo "_nic_: $(ipconfig getifaddr _nic_)"'
or DHCP/BOOTP:
for i in $(ifconfig -l -u); do if ifconfig $i | grep -q "status: active" ; then echo $i; fi; done | xargs -n1 -I_nic_ sh -c 'echo "_nic_: $(ipconfig getpacket _nic_)"'
The latter returns a very long list, which I wanted to shorten into a more readable format.
You can find more information in the [Archive.is] ipconfig(8) [osx man page] / [WayBack] ipconfig Man Page – macOS – SS64.com excerpt:
Posted in *nix, *nix-tools, Apple, bash, Development, DNS, ifconfig, Mac OS X / OS X / MacOS, Power User, Scripting, Software Development | Leave a Comment »
Posted by jpluimers on 2021/07/21
On one of my Raspberry Pi boxes, somehow I could not access files over SFTP (SSH File Transfer Protocol) via FileZilla.
I would consistently get this error:
"Connection timed out after 20 seconds of inactivity"
Figuring the exact cause took a while.
TL;DR: SFTP uses an interactive non-login shell, then interprets the output from that shell. For that kind of shell, ensure few or none scripts run that output text.
Posted in *nix, *nix-tools, bash, bash, Communications Development, Conference Topics, Conferences, Development, Event, Internet protocol suite, Power User, Scripting, SFTP, Software Development, SSH, TCP | Leave a Comment »
Posted by jpluimers on 2021/07/19
[WayBack] windows – Is there any sed like utility for cmd.exe? – Stack Overflow
TL;DR: many people suggest to use PowerShell, but there is GNU sed in Chocolatey
The chocolatey part:
Instructions for building [WayBack] Gnu Sed as a native windows application
All patches under the same license as sources of [WayBack] Gnu Sed: [WayBack] GPLv3 or later
sed.exe was exactly the binary [WayBack] sed-windows/sed-4.5-x64.exe at cafe68124fb8f01db3fb1d9ea586f8f6a72d6917 · mbuilov/sed-windows · GitHubThe PowerShell part: read the other answers from the above question.
–jeroen
Posted in *nix, *nix-tools, CommandLine, Power User, PowerShell, RegEx, sed, Windows | Leave a Comment »
Posted by jpluimers on 2021/07/09
Based on
This scans the 192.168.1.0/24 network for SMB capable machines, and extracts information from them:
nmap -p139,445 --script smb-os-discovery 192.168.1.0/24
Note that experimenting this, I found out that nmap is also available on Chocolatey: [WayBack] Chocolatey Gallery | Nmap 7.70 (heck, since 2016, no less!).
I was hoping I wrote a little batch file around this, called find-smb-hosts.on.192.168.1.network.bat, because net view is working not so well on Windows 10 any more, but that failed, so here is the batch file:
@echo off :: only works from older versions than Windows 10 :: the delay is caused by the "net view" scanning the network :: the first for calls ping with the hostname :: the second for gets the IP and hostname without waiting for a ping result for /f "usebackq tokens=1* delims=\ " %%m in (`net view ^| findstr "\\"`) do ( for /f "usebackq tokens=2,3 delims=[] " %%h in (`ping -4 %%m -n 1 -w 1 ^| grep Pinging`) do ( echo %%i %%h ) ) goto :eof :: output of the first for without filtering (no starting newline): :: Server Name Remark :: :: ------------------------------------------------------------------------------- :: \\REVUE Samba 4.7.3-git.30.54c196e5d35SUSE-oS15.5-x86_64 :: \\VCS-CI :: The command completed successfully. :: output of the second for without filtering (including the starting newline): :: :: Pinging revue [192.168.1.62] with 32 bytes of data: :: Reply from 192.168.1.62: bytes=32 time<1ms TTL=64 :: :: Ping statistics for 192.168.1.62: :: Packets: Sent = 1, Received = 1, Lost = 0 (0% loss), :: Approximate round trip times in milli-seconds: :: Minimum = 0ms, Maximum = 0ms, Average = 0ms
The above batch file delivered many more results than this line:
nmap -p139,445 --script smb-os-discovery 192.168.71.1/24 | grep -w "\(report\|Computer name\)"
–jeroen
Posted in *nix, *nix-tools, nmap, Power User | Leave a Comment »
Posted by jpluimers on 2021/06/28
From [WayBack] How to rename a VM through SSH on ESXi ? |VMware Communities (numbering and code highlighting mine):
Kindly find the below:
- Backup the virtual machine
- Power down the virtual machine
- Remove the virtual machine from the vSphere host inventory
- Open an SSH console session to the vSphere host
- Navigate to the storage directory containing the virtual machine: For example:
cd /vmfs/volumes/<datastore_name>/<original_vmname>- Rename the primary
.vmdkconfiguration files:vmkfstools -E "<original_vmname>.vmdk" "<new_vmname>.vmdk"- Rename the
.vmxconfiguration file:mv "original_vmname.vmx" "new_vmname.vmx"- Edit the virtual machine .vmx configuration file (Be sure to properly update the directory and file name of the
.vswpswap file reference):vi "new_vmname.vmx"- Rename any remaining files in the virtual machine’s folder as needed:
- Rename the
.vmxfconfiguration file:mv "original_vmname.vmxf" "new_vmname.vmxf"- Rename the
.nvramconfiguration file:mv "original_vmname.nvram" "new_vmname.nvram"- Rename the
.vsdconfiguration file:mv "original_vmname.vsd" "new_vmname.vmsd"- Rename the virtual machine folder: Move up one directory level to the parent folder (
cd ..) then rename the virtual machine directory:mv "original_directory" "new_directory"- Add the newly-named virtual machine to the host’s inventory (the newly renamed
.vmxconfiguration file)- Power on the newly renamed virtual machine
- Answer “I moved it” to the virtual machine question prompt (not “I copied it”)
- Review the virtual machine and all files/folders to make sure it is named as desired and functioning properly
Note: There are other methods to allow for renaming, but this method is fairly quick and easy. It should work on all editions of vSphere from free to Enterprise Plus.
The “Answer question” prompt where you should selected “I moved it”:
->
On a site note, I need to figure uit how to set the ESXi shell prompt to show the current path like pwd does (with symlink names in it instead of the followed symlink targets):
[root@ESXi-X9SRI-3F:~] cd /vmfs/volumes/EVO860_250GB/ [root@ESXi-X9SRI-3F:/vmfs/volumes/5c9bd516-ef1f6d4c-f1b1-0025907d9d5c] pwd /vmfs/volumes/EVO860_250GB
The ESXi shell is based on busybox, in fact it uses the ash variety:
[root@ESXi-X9SRI-3F:/vmfs/volumes/5c9bd516-ef1f6d4c-f1b1-0025907d9d5c] `readlink -f \`which readlink\`` | grep ^BusyBox BusyBox v1.29.3 (2018-11-02 15:37:50 PDT) multi-call binary. BusyBox is copyrighted by many authors between 1998-2015. [root@ESXi-X9SRI-3F:/vmfs/volumes/5c9bd516-ef1f6d4c-f1b1-0025907d9d5c] type chdir chdir is a shell builtin
This seemed to work fine:
[root@ESXi-X9SRI-3F:/vmfs/volumes/5c9bd516-ef1f6d4c-f1b1-0025907d9d5c] PS1="[\u@\h:`pwd`] " [root@ESXi-X9SRI-3F:/vmfs/volumes/EVO860_250GB]
But in faxt fails, as it only takes a pwd value once, and not every time the prompt is evaluated:
[root@ESXi-X9SRI-3F:/vmfs/volumes/EVO860_250GB] cd .. [root@ESXi-X9SRI-3F:/vmfs/volumes/EVO860_250GB] pwd /vmfs/volumes [root@ESXi-X9SRI-3F:/vmfs/volumes/EVO860_250GB]
So I need to re-visit these links:
BusyBox has two shells, ash and hush. To see which one you have, run
type chdir: ash has it as a builtin (synonymous withcd), hush doesn’t. Both have an optional prompt expansion feature. Ash’s is enabled by activating theASH_EXPAND_PRMTfeature at compile time, while hush requiresFEATURE_EDITING_FANCY_PROMPT.When that feature is present, in ash the value of
PS1is expanded like a double-quoted string:$foo,$(command)and`command`constructs are expanded.Some backslash escapes are processed (in ash, after substitutions). They are a subset of bash’s.
\!: line history count\a: bell\b: backspace\e,\E: escape\f: form feed\h: host name\n: newline\r: carriage return\t: tab\u: user name (only withFEATURE_GETUSERNAME_AND_HOMEDIR)\v: vertical tab\w: current directory, with~for the home directory (only withFEATURE_GETUSERNAME_AND_HOMEDIR)\W: current directory (unabbreviated)\xHHor\XHHwhere HH are two hexadecimal digits: a character given by its hex code\[…\]: the enclosed text doesn’t count for width calculation purposes(If you’re looking at the source code, this happens in
parse_and_put_promptinlibbb/lineedit.c.)
–jeroen
Posted in *nix, *nix-tools, BusyBox, ESXi6, ESXi6.5, ESXi6.7, Power User, Virtualization, VMware, VMware ESXi | Leave a Comment »