$ bash -c "echo a;bahs;echo b;bhas" >>file 2> >( tee -a file >&2 )
bash: line 1: bahs: command not found
bash: line 1: bhas: command not found
$ cat file
a
bash: line 1: bahs: command not found
b
bash: line 1: bhas: command not found
stderr output with filter
$ bash -c "echo a;bahs;echo b;bhas" >>file 2> >( tee -a file 2>&1 | grep -v bahs >&2 )
bash: line 1: bhas: command not found
# or
$ rm -rf file; bash -c "echo a;bahs;echo b;bhas" >>file 2> >( tee -a file | grep -v bahs >&2 )
bash: line 1: bhas: command not found
$ cat file
a
bash: line 1: bahs: command not found
b
bash: line 1: bhas: command not found
or
$ bash -c "set -e; echo a;bahs;echo b;bhas" >>cmd.out 2> >( tee -a cmd.out >&2 )
bash: line 1: bahs: command not found
$ cat cmd.out
a
bash: line 1: bahs: command not found
$ wget --recursive \ # -r
--user=admin \
--password=admin \ # --ask-password
--auth-no-challenge \ # optional
--no-host-directories \ # -nH
--no-parent \ # -np
--reject '*.html*' \
--directory-prefix=./ \ # -P
--include-directories=local-dir \ # -I
http://example.com/remote-dir
# or
$ wget --recursive \ # -r
--no-parent \ # -np : will not crawl links in folders above the base of the URL
--convert-links \ # -k : convert links with the domain name to relative and uncrawled to absolute
--random-wait --wait 3 --no-http-keep-alive \ # do not get banned
--no-host-directories \ # -nH : do not create folders with the domain name
--execute robots=off --user-agent=Mozilla/5.0 \ # I AM A HUMAN!!!
--level=inf --accept '*' \ # -l : do not limit to 5 levels or common file formats
--reject="index.html*" \ # use this option if you need an exact mirror
--cut-dirs=0 \ # replace 0 with the number of folders in the path, 0 for the whole domain
$URL
$ apropos editor | head
Git::SVN::Editor (3pm) - commit driver for "git svn set-tree" and dcommit
INIFILE (1) - OpenLink Virtuoso Opensource ini File Editor
atobm (1) - bitmap editor and converter utilities for the X Window System
bitmap (1) - bitmap editor and converter utilities for the X Window System
bmtoa (1) - bitmap editor and converter utilities for the X Window System
ed (1) - line-oriented text editor
editor (1) - Nano's ANOther editor, an enhanced free Pico clone
editres (1) - a dynamic resource editor for X Toolkit applications
ex (1) - Vi IMproved, a programmers text editor
gedit (1) - text editor for the GNOME Desktop
batch commands
batch rename
$ l
total 4.0K
-rw-r--r-- 1 marslo marslo 10 Feb 21 00:43 a.b
$ rename -v 's/\./_/g' *
a.b renamed as a_b
$ l
total 4.0K
-rw-r--r-- 1 marslo marslo 10 Feb 21 00:43 a_b
$ for file in sw.ras.*; do mv "$file" "${file/ras./}"; done
/usr/local/bin/rename in OSX
$ /usr/local/bin/rename -v 's/_xyz.com//g' *.txt
'a_xyz.com.txt' renamed to 'a.txt'
'b_xyz.com.txt' renamed to 'b.txt'
'c_xyz.com.txt' renamed to 'c.txt'
'd_xyz.com.txt' renamed to 'd.txt'
'e_xyz.com.txt' renamed to 'e.txt'
'f_xyz.com.txt' renamed to 'f.txt'
'g_xyz.com.txt' renamed to 'g.txt'
'h_xyz.com.txt' renamed to 'h.txt'
-LLL # just a particular way to display the results
-H ldap://wspace.mydomain.com # the URL where the LDAP server listens
-x # use simple authentication, not SASL
-D 'user1' # the account to use to authenticate to LDAP
-w 'user1password' # the password that goes with the account on the previous line
-E pr=1000/noprompt # ask the server for all pages, don't stop after one
-b 'ou=mydomain,dc=wspace,dc=mydomain,dc=com' # the base of the search. We don't want results from e.g. 'ou=blah,dc=wspace,dc=mydomain,dc=com'
'(&(objectClass=person)(uidNumber=*))' # Ask for any entry that has attributes objectClass=person and uidNumber has a value
SAMAccountName uid uidNumber # Show only these attributes
$ ls -altrh /usr/local/bin/nc
lrwxrwxrwx 1 root root 22 Mar 14 03:14 /usr/local/bin/nc -> /etc/alternatives/nmap
$ sudo update-alternatives --config nmap
There are 2 programs which provide 'nmap'.
Selection Command
-----------------------------------------------
*+ 1 /usr/bin/ncat
2 /usr/bin/netcat
Enter to keep the current selection[+], or type selection number: 2
check
# by using netcat
$ nc -zv google.com 443
Connection to google.com (142.251.214.142) 443 port [tcp/https] succeeded!
# by using nact
$ ncat -zv google.com 443
Ncat: Version 7.70 ( https://nmap.org/ncat )
Ncat: Connected to 142.251.214.142:443.
Ncat: 0 bytes sent, 0 bytes received in 0.07 seconds.
$ ls -altrh $(which -a nc)
lrwxrwxrwx 1 root root 22 Jun 1 04:02 /usr/bin/nc -> /etc/alternatives/nmap
$ sudo alternatives --config nmap
There are 2 programs which provide 'nmap'.
Selection Command
-----------------------------------------------
*+ 1 /usr/bin/netcat
2 /usr/bin/ncat
Enter to keep the current selection[+], or type selection number: 1