ls
Go.ipynb Untitled1.ipynb java.ipynb rust.ipynb Untitled.ipynb java-ryoji-20211025.ipynb python.ipynb typescript.ipynb
echo "abc" | tee abc.txt && stat abc.txt
abc File: abc.txt Size: 4 Blocks: 24 IO Block: 4096 regular file Device: 38h/56d Inode: 10003282 Links: 1 Access: (0664/-rw-rw-r--) Uid: ( 1000/ ryoji) Gid: ( 1000/ ryoji) Access: 2021-10-25 21:40:37.145779673 +0900 Modify: 2021-10-25 21:42:38.355751530 +0900 Change: 2021-10-25 21:42:38.355751530 +0900 Birth: -
cat abc.txt | sed 's/b/d/g'
adc
tr abc XYZ < abc.txt #translate
XYZ
whoami
ryoji
uname --all
Linux ubuntu 5.4.0-84-generic #94-Ubuntu SMP Thu Aug 26 20:27:37 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
echo "first-name last-name" | awk '{print $2}'
last-name
find . -maxdepth 1 -name 'j*.ipynb' -type f | xargs jq '.metadata.kernelspec'
{ "display_name": "Java", "language": "java", "name": "java" } { "display_name": "Java", "language": "java", "name": "java" }
du #disk usage
300 ./.ipynb_checkpoints 632 .
df / #disk file system
Filesystem 1K-blocks Used Available Use% Mounted on /dev/sda5 229484764 184497236 33307336 85% /
wc --chars abc.txt #word count
4 abc.txt
sha1sum abc.txt
03cfd743661f07975fa2f1220c5194cbaff48451 abc.txt
date
Mon Oct 25 22:09:41 JST 2021
uuidgen
c61fff27-3fbb-4da1-8598-0f20282aaafc
openssl rand -hex 1 #random 0 up to 255
8c
echo "8c" | tr [:lower:] [:upper:] | xargs echo "obase=10; ibase=16; " | bc
140
cat << EOF > a.yaml
items:
- part_no: A4786
descrip: Water Bucket (Filled)
price: 1.47
quantity: 4
EOF
yq e '.items[0]' a.yaml
part_no: A4786 descrip: Water Bucket (Filled) price: 1.47 quantity: 4
curl --head https://google.com
HTTP/2 301 location: https://www.google.com/ content-type: text/html; charset=UTF-8 date: Mon, 25 Oct 2021 13:33:55 GMT expires: Wed, 24 Nov 2021 13:33:55 GMT cache-control: public, max-age=2592000 server: gws content-length: 220 x-xss-protection: 0 x-frame-options: SAMEORIGIN alt-svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000
factor 360
360: 2 2 2 3 3 5
date
Mon Oct 25 22:38:04 JST 2021
if [ -s abc.txt ]
then
echo "abc isn't an empty file"
else
echo "abc is an empty file"
fi
abc isn't an empty file
for i in $(seq 0 5)
do
echo "$i"
done
0 1 2 3 4 5
for ((i=0; i < 4; i++))
do
echo $i
done
0 1 2 3
# ##*/ extracts the filename from a full path
n=$(ls *.yaml)\
&& echo "${n##*/}"\
&& n=$(basename "${n##*/}" .yaml)\
&& echo $n
a.yaml a
foo="1,2 3 4"
txt=(${foo//,/ })
IFS=' ' read -r -a arr <<< "$txt"
for ((i = 0; i < ${#arr[@]}; i++))
do
echo "${arr[$i]}"
done
for e in "${arr[@]}"
do
echo "$e"
done
1 2 3 4 1 2 3 4
for
$ ls *.zip | parallel unzip {}
$ find . -type f -name "*.zip" -exec unzip '{}' \;
cd /home/ryoji/image-slicer/
IFS=$'\n'
files=$(ls -1 high_school_math_slices/ | grep jpg | sort)
for e in $files
do
parent=$(echo $e | sed -e 's/\([0-9]\)_.*/\1/')'.jpg'
echo -e "<img src=\"$e\">\t<img src=\"$parent\">" >> high-school-math.tab
done
cat a.tar.gz | xxd | head
00000000: 612e 7961 6d6c 0000 0000 0000 0000 0000 a.yaml.......... 00000010: 0000 0000 0000 0000 0000 0000 0000 0000 ................ 00000020: 0000 0000 0000 0000 0000 0000 0000 0000 ................ 00000030: 0000 0000 0000 0000 0000 0000 0000 0000 ................ 00000040: 0000 0000 0000 0000 0000 0000 0000 0000 ................ 00000050: 0000 0000 0000 0000 0000 0000 0000 0000 ................ 00000060: 0000 0000 3030 3030 3636 3400 3030 3031 ....0000664.0001 00000070: 3735 3000 3030 3031 3735 3000 3030 3030 750.0001750.0000 00000080: 3030 3030 3135 3600 3134 3133 3535 3432 0000156.14135542 00000090: 3030 3300 3031 3132 3335 0020 3000 0000 003.011235. 0... xxd: Broken pipe
echo -n "iVBORw0KGgoAAAANSUhEUgAAABAAAAAPBAMAAAAfXVIcAAAAD1BMVEV63/39//w5TVIZFhXDjXbHNiz1AAAARUlEQVR4nJTJUQ3AIAwG4aMzsBYD9FdQEfjXtJBiYPf0JYeHJKUTC8CShYNjaMwas4xoJNHrgKdo7H0x3ovTP3wBAAD//9u1Bcrd6KY0AAAAAElFTkSuQmCC"\
| base64 -d | base64
iVBORw0KGgoAAAANSUhEUgAAABAAAAAPBAMAAAAfXVIcAAAAD1BMVEV63/39//w5TVIZFhXDjXbH Niz1AAAARUlEQVR4nJTJUQ3AIAwG4aMzsBYD9FdQEfjXtJBiYPf0JYeHJKUTC8CShYNjaMwas4xo JNHrgKdo7H0x3ovTP3wBAAD//9u1Bcrd6KY0AAAAAElFTkSuQmCC
cat ./a.yaml |
awk '{print $2}' |
while read -r first
do
echo "${first}" |
tr 012345678 999999999
done
part_no: Water 9.99 9
ssh-keygen --help
unknown option -- - usage: ssh-keygen [-q] [-b bits] [-C comment] [-f output_keyfile] [-m format] [-t dsa | ecdsa | ecdsa-sk | ed25519 | ed25519-sk | rsa] [-N new_passphrase] [-O option] [-w provider] ssh-keygen -p [-f keyfile] [-m format] [-N new_passphrase] [-P old_passphrase] ssh-keygen -i [-f input_keyfile] [-m key_format] ssh-keygen -e [-f input_keyfile] [-m key_format] ssh-keygen -y [-f input_keyfile] ssh-keygen -c [-C comment] [-f keyfile] [-P passphrase] ssh-keygen -l [-v] [-E fingerprint_hash] [-f input_keyfile] ssh-keygen -B [-f input_keyfile] ssh-keygen -D pkcs11 ssh-keygen -F hostname [-lv] [-f known_hosts_file] ssh-keygen -H [-f known_hosts_file] ssh-keygen -K [-w provider] ssh-keygen -R hostname [-f known_hosts_file] ssh-keygen -r hostname [-g] [-f input_keyfile] ssh-keygen -M generate [-O option] output_file ssh-keygen -M screen [-f input_file] [-O option] output_file ssh-keygen -I certificate_identity -s ca_key [-hU] [-D pkcs11_provider] [-n principals] [-O option] [-V validity_interval] [-z serial_number] file ... ssh-keygen -L [-f input_keyfile] ssh-keygen -A [-f prefix_path] ssh-keygen -k -f krl_file [-u] [-s ca_public] [-z version_number] file ... ssh-keygen -Q -f krl_file file ... ssh-keygen -Y find-principals -s signature_file -f allowed_signers_file ssh-keygen -Y check-novalidate -n namespace -s signature_file ssh-keygen -Y sign -f key_file -n namespace file ... ssh-keygen -Y verify -f allowed_signers_file -I signer_identity -n namespace -s signature_file [-r revocation_file]
tar -cvf a.tar.gz a.yaml && tar -xvf a.tar.gz -C . #tar+gunzip
a.yaml a.yaml
ssh -p 4118 ryoji@localhost
ssh: connect to host localhost port 4118: Connection refused
netstat -tulpn
(Not all processes could be identified, non-owned process info will not be shown, you would have to be root to see it all.) Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 127.0.0.1:53 0.0.0.0:* LISTEN - tcp 0 0 0.0.0.0:46485 0.0.0.0:* LISTEN - tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN - tcp 0 0 127.0.0.1:50999 0.0.0.0:* LISTEN 41916/python tcp 0 0 0.0.0.0:57559 0.0.0.0:* LISTEN - tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN - tcp 0 0 127.0.0.1:8888 0.0.0.0:* LISTEN 41840/python tcp 0 0 127.0.0.1:37561 0.0.0.0:* LISTEN 41916/python tcp 0 0 0.0.0.0:25 0.0.0.0:* LISTEN - tcp 0 0 0.0.0.0:33401 0.0.0.0:* LISTEN - tcp 0 0 127.0.0.1:38907 0.0.0.0:* LISTEN 42030/node tcp 0 0 127.0.0.1:48571 0.0.0.0:* LISTEN 41896/gophernotes tcp 0 0 127.0.0.1:52347 0.0.0.0:* LISTEN 41896/gophernotes tcp 0 0 127.0.0.1:36893 0.0.0.0:* LISTEN 41910/python3 tcp 0 0 0.0.0.0:57149 0.0.0.0:* LISTEN - tcp 0 0 127.0.0.1:40671 0.0.0.0:* LISTEN - tcp 0 0 127.0.0.1:37217 0.0.0.0:* LISTEN 41896/gophernotes tcp 0 0 0.0.0.0:2049 0.0.0.0:* LISTEN - tcp 0 0 127.0.0.1:43173 0.0.0.0:* LISTEN 42030/node tcp 0 0 127.0.0.1:52133 0.0.0.0:* LISTEN 41916/python tcp 0 0 127.0.0.1:34695 0.0.0.0:* LISTEN 42030/node tcp 0 0 127.0.0.1:33095 0.0.0.0:* LISTEN 41916/python tcp 0 0 127.0.0.1:43113 0.0.0.0:* LISTEN 41896/gophernotes tcp 0 0 127.0.0.1:33291 0.0.0.0:* LISTEN 41910/python3 tcp 0 0 127.0.0.1:33771 0.0.0.0:* LISTEN 41910/python3 tcp 0 0 127.0.0.1:54347 0.0.0.0:* LISTEN 41910/python3 tcp 0 0 127.0.0.1:47819 0.0.0.0:* LISTEN 41896/gophernotes tcp 0 0 127.0.0.1:6379 0.0.0.0:* LISTEN - tcp 0 0 127.0.0.1:52781 0.0.0.0:* LISTEN 41910/python3 tcp 0 0 127.0.0.1:45487 0.0.0.0:* LISTEN 42030/node tcp 0 0 127.0.0.1:54895 0.0.0.0:* LISTEN 42030/node tcp 0 0 127.0.0.1:36143 0.0.0.0:* LISTEN 41916/python tcp 0 0 127.0.0.1:35599 0.0.0.0:* LISTEN 41910/python3 tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN - tcp 0 0 127.0.0.1:56817 0.0.0.0:* LISTEN 41916/python tcp6 0 0 :::1716 :::* LISTEN 6607/kdeconnectd tcp6 0 0 127.0.0.1:56469 :::* LISTEN 41907/java tcp6 0 0 :::36533 :::* LISTEN - tcp6 0 0 ::1:53 :::* LISTEN - tcp6 0 0 :::22 :::* LISTEN - tcp6 0 0 :::45911 :::* LISTEN - tcp6 0 0 ::1:631 :::* LISTEN - tcp6 0 0 ::1:8888 :::* LISTEN 41840/python tcp6 0 0 :::25 :::* LISTEN - tcp6 0 0 127.0.0.1:43483 :::* LISTEN 41907/java tcp6 0 0 127.0.0.1:50175 :::* LISTEN 41907/java tcp6 0 0 127.0.0.1:47391 :::* LISTEN 41907/java tcp6 0 0 127.0.0.1:46241 :::* LISTEN 41907/java tcp6 0 0 :::2049 :::* LISTEN - tcp6 0 0 :::54337 :::* LISTEN - tcp6 0 0 ::1:6379 :::* LISTEN - tcp6 0 0 :::56397 :::* LISTEN - tcp6 0 0 :::111 :::* LISTEN - udp 0 0 0.0.0.0:4500 0.0.0.0:* - udp 0 0 0.0.0.0:37715 0.0.0.0:* - udp 0 0 0.0.0.0:5353 0.0.0.0:* - udp 0 0 0.0.0.0:38439 0.0.0.0:* - udp 0 0 0.0.0.0:47086 0.0.0.0:* - udp 0 0 127.0.0.1:53 0.0.0.0:* - udp 0 0 0.0.0.0:111 0.0.0.0:* - udp 0 0 0.0.0.0:500 0.0.0.0:* - udp 0 0 0.0.0.0:631 0.0.0.0:* - udp 0 0 0.0.0.0:2049 0.0.0.0:* - udp 0 0 0.0.0.0:59513 0.0.0.0:* - udp 0 0 0.0.0.0:52130 0.0.0.0:* - udp6 0 0 :::45471 :::* 25836/firefox udp6 0 0 :::5353 :::* - udp6 0 0 :::40576 :::* - udp6 0 0 :::40772 :::* 25836/firefox udp6 0 0 :::49075 :::* 25836/firefox udp6 0 0 ::1:53 :::* - udp6 0 0 :::111 :::* - udp6 0 0 :::41466 :::* - udp6 0 0 :::33275 :::* 25836/firefox udp6 0 0 fe80::857c:b4ed:da2:546 :::* - udp6 0 0 :::57901 :::* - udp6 0 0 :::1716 :::* 6607/kdeconnectd udp6 0 0 :::59159 :::* - udp6 0 0 :::51185 :::* - udp6 0 0 :::2049 :::* - udp6 0 0 :::43268 :::* 25836/firefox udp6 0 0 :::52799 :::* 25836/firefox udp6 0 0 :::53035 :::* 25836/firefox
docker ps -a | head
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 26f2be46d51f 5c25aaeaa996 "/bin/sh -c 'cargo b…" 8 weeks ago Exited (1) 8 weeks ago suspicious_fermat ba458bfbfb99 be4e3ffba3c1 "/bin/sh -c 'cargo b…" 8 weeks ago Exited (101) 8 weeks ago competent_lovelace 1edb38cf5c73 d0727d18c097 "/bin/sh -c 'gradle …" 3 months ago Exited (1) 3 months ago infallible_wozniak 8aa3abeaecd1 8cbaea90e92f "java -jar /app/spri…" 3 months ago Exited (130) 3 months ago tender_leavitt f2ec1d9baa52 8cbaea90e92f "java -jar /app/spri…" 3 months ago Exited (130) 3 months ago magical_pare 2d8c65442138 8cbaea90e92f "java -jar /app/spri…" 3 months ago Exited (130) 3 months ago practical_tu a694ad4e6ec3 8cbaea90e92f "java -jar /app/spri…" 3 months ago Exited (130) 3 months ago jolly_sutherland e28e78a99265 8cbaea90e92f "java -jar /app/spri…" 3 months ago Exited (130) 3 months ago bold_heisenberg 805e143bd573 8cbaea90e92f "java -jar /app/spri…" 3 months ago Exited (130) 3 months ago agitated_ellis
$ kubectl config view
apiVersion: v1
clusters:
- cluster:
insecure-skip-tls-verify: true
server: https://35.228.189.126:6443
name: kubernetes
contexts:
- context:
cluster: kubernetes
user: kubernetes-admin
name: kubernetes-admin@kubernetes
current-context: kubernetes-admin@kubernetes
kind: Config
preferences: {}
users:
- name: kubernetes-admin
user:
client-certificate-data: REDACTED
client-key-data: REDACTED
pwd
/home/ryoji/jupyter
mkdir -p "b"
cd /home/ryoji/jupyter
ln -s b c
if [ "$(pwd)" = "/home/ryoji/jupyter" ]
then
# --include="*/"
rsync -avh --progress\
--include="java*.ipynb"\
--exclude="*" ./ c
fi
sending incremental file list ./ java-ryoji-20211025.ipynb 42.78K 100% 9.55MB/s 0:00:00 (xfr#1, to-chk=1/3) java.ipynb 42.78K 100% 40.80MB/s 0:00:00 (xfr#2, to-chk=0/3) sent 85.78K bytes received 57 bytes 171.68K bytes/sec total size is 85.57K speedup is 1.00
ls b/* -1
b/java-ryoji-20211025.ipynb b/java.ipynb
PDF commands
$ pdfcrop 1300_math_formulas.pdf
$ pdftk 1300_math_formulas-crop.pdf burst
$ for pdf in pg_*.pdf
do
echo "${pdf##*/}"
n=$(basename "${pdf##*/}" .pdf)
convert -density 300 "${pdf}" -resize 36% "png/${n}-%03d.png"
done
$ mogrify -format jpg -background white -alpha remove -alpha off -quality 75% *.png
$ rename 's/pg_/m1k3-pg_/g' *.jpg
---
$ pdfimages -all -p a.pdf
$ pdftotext a.pdf
$ for png in *.png
do
echo "${png##*/}"
tesseract -l eng "${png}" ./eng/"${png##*/}"
done
FFmpeg
$ ffmpeg -i oo3.mp4 -vf scale=700:-1 -r 10 screenshot-3.gif
$ ffplay https://upload.wikimedia.org/wikipedia/commons/transcoded/d/dc/Galton_box.webm/Galton_box.webm.480p.vp9.webm
systemctl status thinkfan
● thinkfan.service - simple and lightweight fan control program Loaded: loaded (/lib/systemd/system/thinkfan.service; enabled; vendor preset: enabled) Active: failed (Result: exit-code) since Tue 2021-10-26 00:23:36 JST; 28min ago Process: 1230 ExecStart=/usr/sbin/thinkfan $DAEMON_ARGS (code=exited, status=4) Oct 26 00:23:36 ubuntu thinkfan[1230]: /sys/devices/platform/coretemp.0/hwm…tory Oct 26 00:23:36 ubuntu thinkfan[1230]: /sys/devices/platform/coretemp.0/hwm…tory Oct 26 00:23:36 ubuntu thinkfan[1230]: /sys/devices/platform/coretemp.0/hwm…tory Oct 26 00:23:36 ubuntu thinkfan[1230]: /sys/devices/platform/coretemp.0/hwm…tory Oct 26 00:23:36 ubuntu thinkfan[1230]: /sys/devices/platform/coretemp.0/hwm…tory Oct 26 00:23:36 ubuntu thinkfan[1230]: readconfig: Error getting temperature. Oct 26 00:23:36 ubuntu thinkfan[1230]: Refusing to run without usable confi…ile! Oct 26 00:23:36 ubuntu systemd[1]: thinkfan.service: Control process exited…SION Oct 26 00:23:36 ubuntu systemd[1]: thinkfan.service: Failed with result 'ex…de'. Oct 26 00:23:36 ubuntu systemd[1]: Failed to start simple and lightweight f…ram. Hint: Some lines were ellipsized, use -l to show in full.
journalctl -b -u thinkfan --since yesterday
-- Logs begin at Sun 2021-10-17 09:31:40 JST, end at Tue 2021-10-26 00:55:36 JST. -- Oct 26 00:23:36 ubuntu systemd[1]: Starting simple and lightweight fan control program... Oct 26 00:23:36 ubuntu thinkfan[1230]: thinkfan 0.9.1 starting... Oct 26 00:23:36 ubuntu thinkfan[1230]: WARNING: Using default fan control in /proc/acpi/ibm/fan. Oct 26 00:23:36 ubuntu thinkfan[1230]: /sys/devices/platform/coretemp.0/hwmon/hwmon2/temp3_input: No such file or directory Oct 26 00:23:36 ubuntu thinkfan[1230]: /sys/devices/platform/coretemp.0/hwmon/hwmon2/temp4_input: No such file or directory Oct 26 00:23:36 ubuntu thinkfan[1230]: /sys/devices/platform/coretemp.0/hwmon/hwmon2/temp1_input: No such file or directory Oct 26 00:23:36 ubuntu thinkfan[1230]: /sys/devices/platform/coretemp.0/hwmon/hwmon2/temp5_input: No such file or directory Oct 26 00:23:36 ubuntu thinkfan[1230]: /sys/devices/platform/coretemp.0/hwmon/hwmon2/temp2_input: No such file or directory Oct 26 00:23:36 ubuntu thinkfan[1230]: readconfig: Error getting temperature. Oct 26 00:23:36 ubuntu thinkfan[1230]: Refusing to run without usable config file! Oct 26 00:23:36 ubuntu systemd[1]: thinkfan.service: Control process exited, code=exited, status=4/NOPERMISSION Oct 26 00:23:36 ubuntu systemd[1]: thinkfan.service: Failed with result 'exit-code'. Oct 26 00:23:36 ubuntu systemd[1]: Failed to start simple and lightweight fan control program.
crontab -l
no crontab for ryoji
cat /etc/fstab | head -n 14 #mount points
# /etc/fstab: static file system information. # # Use 'blkid' to print the universally unique identifier for a # device; this may be used with UUID= as a more robust way to name devices # that works even if disks are added and removed. See fstab(5). # # <file system> <mount point> <type> <options> <dump> <pass> # / was on /dev/sda5 during installation UUID=06031935-5dad-47c4-99ee-0bbef6a66588 / ext4 errors=remount-ro 0 1 # swap was on /dev/sda6 during installation UUID=19984fa7-4281-4fb4-9297-1c1da6c834d1 none swap sw 0 0 # /dev/mapper/cryptswap1 none swap sw 0 0 UUID=c4d2a396-42cc-47ab-8562-9ce100cf6816 /var/lib/docker ext4 defaults,noatime 0 0 UUID=2cade63a-7be9-4b16-9217-46d4b9158d2c /media/dev ext4 defaults,user,noatime,exec 0 0
ifconfig docker0
docker0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500 inet 172.17.0.1 netmask 255.255.0.0 broadcast 172.17.255.255 inet6 fe80::42:60ff:fee7:bde5 prefixlen 64 scopeid 0x20<link> ether 02:42:60:e7:bd:e5 txqueuelen 0 (Ethernet) RX packets 0 bytes 0 (0.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 5 bytes 568 (568.0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lspci | egrep -i --color 'network|ethernet'
00:19.0 Ethernet controller: Intel Corporation 82579LM Gigabit Network Connection (Lewisville) (rev 04) 03:00.0 Network controller: Intel Corporation Centrino Advanced-N 6205 [Taylor Peak] (rev 34)
lshw -class network
WARNING: you should run this program as super-user. *-network description: Ethernet interface product: 82579LM Gigabit Network Connection (Lewisville) vendor: Intel Corporation physical id: 19 bus info: pci@0000:00:19.0 logical name: enp0s25 version: 04 serial: 28:d2:44:44:7d:47 capacity: 1Gbit/s width: 32 bits clock: 33MHz capabilities: cap_list ethernet physical tp 10bt 10bt-fd 100bt 100bt-fd 1000bt-fd autonegotiation configuration: autonegotiation=on broadcast=yes driver=e1000e driverversion=3.2.6-k firmware=0.13-3 latency=0 link=no multicast=yes port=twisted pair resources: irq:28 memory:f2500000-f251ffff memory:f253b000-f253bfff ioport:6080(size=32) *-network description: Wireless interface product: Centrino Advanced-N 6205 [Taylor Peak] vendor: Intel Corporation physical id: 0 bus info: pci@0000:03:00.0 logical name: wlp3s0 version: 34 serial: a4:4e:31:d1:cd:3c width: 64 bits clock: 33MHz capabilities: bus_master cap_list ethernet physical wireless configuration: broadcast=yes driver=iwlwifi driverversion=5.4.0-84-generic firmware=18.168.6.1 ip=192.168.100.102 latency=0 link=yes multicast=yes wireless=IEEE 802.11 resources: irq:33 memory:f1c00000-f1c01fff WARNING: output may be incomplete or inaccurate, you should run this program as super-user.
chmod 0700 abc.txt && stat abc.txt\
&& chmod 0664 abc.txt\
&& chmod +x abc.txt && stat abc.txt\
&& chmod -x abc.txt && stat abc.txt
File: abc.txt Size: 4 Blocks: 24 IO Block: 4096 regular file Device: 3ah/58d Inode: 10003282 Links: 1 Access: (0700/-rwx------) Uid: ( 1000/ ryoji) Gid: ( 1000/ ryoji) Access: 2021-10-25 21:44:17.157383860 +0900 Modify: 2021-10-25 21:42:38.355751530 +0900 Change: 2021-10-26 01:23:25.824830846 +0900 Birth: - File: abc.txt Size: 4 Blocks: 24 IO Block: 4096 regular file Device: 3ah/58d Inode: 10003282 Links: 1 Access: (0775/-rwxrwxr-x) Uid: ( 1000/ ryoji) Gid: ( 1000/ ryoji) Access: 2021-10-25 21:44:17.157383860 +0900 Modify: 2021-10-25 21:42:38.355751530 +0900 Change: 2021-10-26 01:23:25.832831101 +0900 Birth: - File: abc.txt Size: 4 Blocks: 24 IO Block: 4096 regular file Device: 3ah/58d Inode: 10003282 Links: 1 Access: (0664/-rw-rw-r--) Uid: ( 1000/ ryoji) Gid: ( 1000/ ryoji) Access: 2021-10-25 21:44:17.157383860 +0900 Modify: 2021-10-25 21:42:38.355751530 +0900 Change: 2021-10-26 01:23:25.836831229 +0900 Birth: -
chown 1001:1001 abc.txt
chown: changing ownership of 'abc.txt': Operation not permitted
cat /etc/passwd | head -n 2 #useradd
root:x:0:0:root:/root:/bin/bash daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin
env | sort | tail -7
SDKMAN_CANDIDATES_API=https://api.sdkman.io/2 SDKMAN_CANDIDATES_DIR=/home/ryoji/.sdkman/candidates SDKMAN_DIR=/home/ryoji/.sdkman SDKMAN_PLATFORM=linuxx64 SDKMAN_VERSION=5.12.4 SHLVL=0 _=/usr/bin/env
export NUM=1;
echo $NUM;
1
NUM=2 printenv NUM
2
echo $NUM
1
ip addr show docker0
4: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default link/ether 02:42:c9:ab:88:61 brd ff:ff:ff:ff:ff:ff inet 172.17.0.1/16 brd 172.17.255.255 scope global docker0 valid_lft forever preferred_lft forever
which deno
/home/ryoji/.cargo/bin/deno
ps aux | head -n 4
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND root 1 1.5 0.1 168468 12548 ? Ss 19:54 0:11 /sbin/init splash root 2 0.0 0.0 0 0 ? S 19:54 0:00 [kthreadd] root 3 0.0 0.0 0 0 ? I< 19:54 0:00 [rcu_gp]
cat /etc/hosts
127.0.0.1 localhost 127.0.1.1 ubuntu # The following lines are desirable for IPv6 capable hosts ::1 localhost ip6-localhost ip6-loopback ff02::1 ip6-allnodes ff02::2 ip6-allrouters
dig yahoo.co.jp
; <<>> DiG 9.16.1-Ubuntu <<>> yahoo.co.jp ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 37037 ;; flags: qr rd ra; QUERY: 1, ANSWER: 8, AUTHORITY: 0, ADDITIONAL: 1 ;; OPT PSEUDOSECTION: ; EDNS: version: 0, flags:; udp: 512 ;; QUESTION SECTION: ;yahoo.co.jp. IN A ;; ANSWER SECTION: yahoo.co.jp. 163 IN A 183.79.250.123 yahoo.co.jp. 163 IN A 182.22.25.124 yahoo.co.jp. 163 IN A 182.22.25.252 yahoo.co.jp. 163 IN A 183.79.219.252 yahoo.co.jp. 163 IN A 183.79.217.124 yahoo.co.jp. 163 IN A 182.22.16.251 yahoo.co.jp. 163 IN A 183.79.250.251 yahoo.co.jp. 163 IN A 182.22.28.252 ;; Query time: 80 msec ;; SERVER: 192.168.100.1#53(192.168.100.1) ;; WHEN: Thu Oct 28 20:15:43 JST 2021 ;; MSG SIZE rcvd: 168
docker network inspect bridge
[ { "Name": "bridge", "Id": "af34c9cd68d18c2ac326c6faded174f7f45685d3d0f7ec488bc7be9722cd3556", "Created": "2021-10-28T19:55:05.352829424+09:00", "Scope": "local", "Driver": "bridge", "EnableIPv6": false, "IPAM": { "Driver": "default", "Options": null, "Config": [ { "Subnet": "172.17.0.0/16", "Gateway": "172.17.0.1" } ] }, "Internal": false, "Attachable": false, "Ingress": false, "ConfigFrom": { "Network": "" }, "ConfigOnly": false, "Containers": {}, "Options": { "com.docker.network.bridge.default_bridge": "true", "com.docker.network.bridge.enable_icc": "true", "com.docker.network.bridge.enable_ip_masquerade": "true", "com.docker.network.bridge.host_binding_ipv4": "0.0.0.0", "com.docker.network.bridge.name": "docker0", "com.docker.network.driver.mtu": "1500" }, "Labels": {} } ]
ip route
default via 192.168.100.1 dev wlp3s0 proto dhcp metric 600 169.254.0.0/16 dev wlp3s0 scope link metric 1000 172.17.0.0/16 dev docker0 proto kernel scope link src 172.17.0.1 linkdown 172.18.0.0/16 dev br-e1604f91b0da proto kernel scope link src 172.18.0.1 linkdown 172.19.0.0/16 dev br-e4a69edd1eb4 proto kernel scope link src 172.19.0.1 linkdown 172.20.0.0/16 dev br-d89fe5f13325 proto kernel scope link src 172.20.0.1 linkdown 172.21.0.0/16 dev br-6d2f1b776d01 proto kernel scope link src 172.21.0.1 linkdown 172.22.0.0/16 dev br-17ceecb1cb0a proto kernel scope link src 172.22.0.1 192.168.100.0/24 dev wlp3s0 proto kernel scope link src 192.168.100.102 metric 600
ryoji@ubuntu:~$ sudo iptables -L
Chain DOCKER (6 references)
target prot opt source destination
ACCEPT tcp -- anywhere 172.22.0.2 tcp dpt:4444
ACCEPT tcp -- anywhere 172.22.0.3 tcp dpt:5900
docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES b9a94b4a9211 selenium/node-chrome-debug:3.141.0 "/opt/bin/entry_poin…" About a minute ago Up About a minute 0.0.0.0:5900->5900/tcp selenium_chrome-node_1 557f254f7ffe selenium/hub:3.141.0 "/opt/bin/entry_poin…" About a minute ago Up About a minute 0.0.0.0:4444->4444/tcp selenium_selenium-hub_1
ryoji@ubuntu:~$ ping 172.21.0.1
PING 172.21.0.1 (172.21.0.1) 56(84) bytes of data.
64 bytes from 172.21.0.1: icmp_seq=1 ttl=64 time=0.108 ms
64 bytes from 172.21.0.1: icmp_seq=2 ttl=64 time=0.090 ms
^C
--- 172.21.0.1 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1014ms
rtt min/avg/max/mdev = 0.090/0.099/0.108/0.009 ms
ryoji@ubuntu:~$ ping 172.22.0.1
PING 172.22.0.1 (172.22.0.1) 56(84) bytes of data.
64 bytes from 172.22.0.1: icmp_seq=1 ttl=64 time=0.114 ms
^C
--- 172.22.0.1 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.114/0.114/0.114/0.000 ms
ryoji@ubuntu:~$ ping 172.22.0.2
PING 172.22.0.2 (172.22.0.2) 56(84) bytes of data.
64 bytes from 172.22.0.2: icmp_seq=1 ttl=64 time=0.112 ms
^C
--- 172.22.0.2 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1029ms
rtt min/avg/max/mdev = 0.101/0.106/0.112/0.005 ms
ryoji@ubuntu:~$ ping 172.22.0.3
PING 172.22.0.3 (172.22.0.3) 56(84) bytes of data.
64 bytes from 172.22.0.3: icmp_seq=1 ttl=64 time=0.087 ms
^C
--- 172.22.0.3 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2030ms
rtt min/avg/max/mdev = 0.087/0.099/0.111/0.009 ms
ryoji@ubuntu:~$ ping 172.22.0.4
PING 172.22.0.4 (172.22.0.4) 56(84) bytes of data.
From 172.22.0.1 icmp_seq=1 Destination Host Unreachable
^C
--- 172.22.0.4 ping statistics ---
4 packets transmitted, 0 received, +3 errors, 100% packet loss, time 3062ms
pipe 4
id
uid=1000(ryoji) gid=1000(ryoji) groups=1000(ryoji),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),113(lpadmin),128(sambashare),131(kvm),132(ubridge),133(libvirtd),145(wireshark),991(microk8s),997(docker)
kind: ConfigMap
apiVersion: v1
metadata:
name: config
namespace: metallb-system
data:
config: |
address-pools:
- name: default
protocol: layer2
addresses:
- 192.168.49.50 - 192.168.49.60
ip route
default via 192.168.100.1 dev wlp3s0 proto dhcp metric 600 169.254.0.0/16 dev wlp3s0 scope link metric 1000 172.17.0.0/16 dev docker0 proto kernel scope link src 172.17.0.1 linkdown 192.168.49.0/24 dev br-9384eda79fdc proto kernel scope link src 192.168.49.1 192.168.99.0/24 dev vboxnet2 proto kernel scope link src 192.168.99.1 linkdown 192.168.100.0/24 dev wlp3s0 proto kernel scope link src 192.168.100.102 metric 600
ryoji@ubuntu:~$ sudo iptables -L
Chain DOCKER (2 references)
target prot opt source destination
ACCEPT tcp -- anywhere 192.168.49.2 tcp dpt:32443
ACCEPT tcp -- anywhere 192.168.49.2 tcp dpt:8443
ACCEPT tcp -- anywhere 192.168.49.2 tcp dpt:5000
ACCEPT tcp -- anywhere 192.168.49.2 tcp dpt:2376
ACCEPT tcp -- anywhere 192.168.49.2 tcp dpt:ssh
$ mtr yahoo.co.jp
nslookup speedwifi-next.home
;; Got recursion not available from 192.168.100.1, trying next server Server: fe80::8a10:8fff:fe5a:2ebb%3%3 Address: fe80::8a10:8fff:fe5a:2ebb%3#53 Non-authoritative answer: Name: speedwifi-next.home Address: 192.168.100.1 ;; Got recursion not available from 192.168.100.1, trying next server Name: speedwifi-next.home Address: fe80::8a10:8fff:fe5a:2ebb
netstat --route
Kernel IP routing table Destination Gateway Genmask Flags MSS Window irtt Iface default speedwifi-next. 0.0.0.0 UG 0 0 0 wlp3s0 link-local 0.0.0.0 255.255.0.0 U 0 0 0 wlp3s0 172.17.0.0 0.0.0.0 255.255.0.0 U 0 0 0 docker0 192.168.49.0 0.0.0.0 255.255.255.0 U 0 0 0 br-9384eda79fdc 192.168.100.0 0.0.0.0 255.255.255.0 U 0 0 0 wlp3s0
route | grep wlp3s0
default speedwifi-next. 0.0.0.0 UG 600 0 0 wlp3s0 link-local 0.0.0.0 255.255.0.0 U 1000 0 0 wlp3s0 192.168.100.0 0.0.0.0 255.255.255.0 U 600 0 0 wlp3s0
For example, add NAPT settings that let it go from the internet to a server with a local address.
Find the global address of the gateway.
Theoretically this request will be forwarded to port 22 of one of my docker services.
ssh -p 34567 user@111.239.178.96
ryoji@ubuntu:~$ sudo pmap 36900
36900: w
00005567d18f5000 32K r---- w
00005567d18fd000 336K r-x-- w
00005567d1951000 43388K r---- w
00005567d43b0000 20K r---- w
00005567d43b5000 4K rw--- w
00005567d4499000 47088K rw--- [ anon ]
00007f28b5e68000 6148K rw--- [ anon ]
00007f28b6469000 3076K rw--- [ anon ]
00007f28b6a0d000 8K rw--- [ anon ]
00007f28b6a0f000 148K r---- libc-2.31.so
00007f28b6a34000 1504K r-x-- libc-2.31.so
00007f28b6bac000 296K r---- libc-2.31.so
00007f28b6bf6000 4K ----- libc-2.31.so
00007f28b6bf7000 12K r---- libc-2.31.so
00007f28b6bfa000 12K rw--- libc-2.31.so
00007f28b6bfd000 16K rw--- [ anon ]
00007f28b6c01000 4K r---- libdl-2.31.so
00007f28b6c02000 8K r-x-- libdl-2.31.so
00007f28b6c04000 4K r---- libdl-2.31.so
00007f28b6c05000 4K r---- libdl-2.31.so
00007f28b6c06000 4K rw--- libdl-2.31.so
00007f28b6c07000 60K r---- libm-2.31.so
00007f28b6c16000 668K r-x-- libm-2.31.so
00007f28b6cbd000 604K r---- libm-2.31.so
00007f28b6d54000 4K r---- libm-2.31.so
00007f28b6d55000 4K rw--- libm-2.31.so
00007f28b6d56000 28K r---- libpthread-2.31.so
00007f28b6d5d000 68K r-x-- libpthread-2.31.so
00007f28b6d6e000 20K r---- libpthread-2.31.so
00007f28b6d73000 4K r---- libpthread-2.31.so
00007f28b6d74000 4K rw--- libpthread-2.31.so
00007f28b6d75000 16K rw--- [ anon ]
00007f28b6d79000 12K r---- libgcc_s.so.1
00007f28b6d7c000 72K r-x-- libgcc_s.so.1
00007f28b6d8e000 16K r---- libgcc_s.so.1
00007f28b6d92000 4K r---- libgcc_s.so.1
00007f28b6d93000 4K rw--- libgcc_s.so.1
00007f28b6d94000 8K rw--- [ anon ]
00007f28b6dc8000 4K ----- [ anon ]
00007f28b6dc9000 8K rw--- [ anon ]
00007f28b6dcb000 4K r---- ld-2.31.so
00007f28b6dcc000 140K r-x-- ld-2.31.so
00007f28b6def000 32K r---- ld-2.31.so
00007f28b6df8000 4K r---- ld-2.31.so
00007f28b6df9000 4K rw--- ld-2.31.so
00007f28b6dfa000 4K rw--- [ anon ]
00007ffc0eb38000 136K rw--- [ stack ]
00007ffc0eba1000 12K r---- [ anon ]
00007ffc0eba4000 4K r-x-- [ anon ]
ffffffffff600000 4K --x-- [ anon ]
total 104068K
ryoji@ubuntu:~$ ldd .local/bin/w
linux-vdso.so.1 (0x00007ffd61da7000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f624afe2000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f624afbf000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f624ae70000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f624ae6a000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f624ac78000)
/lib64/ld-linux-x86-64.so.2 (0x00007f624daf5000)