Open10

Debian Deep Dive

ピン留めされたアイテム
黒ヰ樹黒ヰ樹

Debian Deep Dive

$ docker run -it debian

で人生変えたと言っても過言ではないぐらいDebianが好きなので完全に理解することにしました。

それでは https://gitlab.com/acefed/gitpod-bash を使用してやっていきます。
2021/02/12 buster-20210208
2021/08/02 buster-20210721
2022/02/05 bullseye-20220125

黒ヰ樹黒ヰ樹

Link

https://www.debian.org/

Debian

https://manpages.debian.org/

Debian Manpages

https://www.debian.org/doc/manuals/debian-reference/index.ja.html

Debian リファレンス(超おすすめ)

https://github.com/docker-library/docs/tree/master/buildpack-deps

DebianとUbuntuの開発用Buildpack

https://github.com/docker-library/docs/tree/master/alpine

AlpineのDocker

https://github.com/docker-library/docs/tree/master/ubuntu

Ubuntuの非開発用Docker

https://github.com/docker-library/docs/tree/master/debian

Debianの非開発用Docker(おすすめ)


Memo

※以下本当に.txt上のメモをコピペしただけのもの

ubuntu: xenial bionic focal groovy hirsute
ubuntu: 16.04 18.04 20.04 20.10 21.04
https://wiki.ubuntu.com/Releases

debian: jessie stretch buster bullseye sid
debian: 8 9 10 11 12
https://www.debian.org/releases/

警告 Warning:
注意 Caution:
ヒント Tip:
注記 Note:

TODO: 
TODO: binとsbinについて調べる。
TODO: sashやbusybox、alpineあたりで使えるコマンドから調べる。
TODO: diffutils findutils sed gpgv
TODO: openssh-client openssl patch
TODO: https://packages.debian.org/ja/buster/amd64/util-linux/filelist
TODO: more
TODO: invoke-rc.d policy-rc.d update-rc.d
TODO: deb-systemd-helper deb-systemd-invoke service
  alpine: ["free", "kill", "pkill", "pgrep", "pmap", "ps", "pwdx", "sysctl", "top", "uptime", "watch", "iostat", "mpstat"]
  procps: ["free", "kill", "pkill", "pgrep", "pmap", "ps", "pwdx", "skill", "slabtop", "snice", "sysctl", "tload", "top", "uptime", "vmstat", "w", "watch"]
  sysstat: ["sar", "iostat", "tapestat", "mpstat", "pidstat", "sadf", "cifsiostat"]
  systemd: ["journalctl", "loginctl", "networkctl", "systemctl", "systemd", "systemd-ask-password", "systemd-escape", "systemd-inhibit", "systemd-machine-id-setup", "systemd-notify", "systemd-sysusers", "systemd-tmpfiles", "systemd-tty-ask-password-agent", "bootctl", "busctl", "hostnamectl", "kernel-install", "localectl", "resolvectl", "systemd-analyze", "systemd-cat", "systemd-cgls", "systemd-cgtop", "systemd-delta", "systemd-detect-virt", "systemd-id128", "systemd-mount", "systemd-path", "systemd-resolve", "systemd-run", "systemd-socket-activate", "systemd-stdio-bridge", "systemd-umount", "timedatectl"]
  sudo apt-get update && sudo apt-get install -y --no-install-recommends procps
  sudo apt-get update && sudo apt-get install -y --no-install-recommends sysstat
  sudo apt-get update && sudo apt-get install -y --no-install-recommends systemd
  sudo apt-get update && sudo apt-get install -y --no-install-recommends fdisk
黒ヰ樹黒ヰ樹

Docker Pull

https://github.com/gitpod-io/workspace-images/tree/master/full

Gitpodで何も書かなかったらこれをPullしてくる。

$ docker pull gitpod/workspace-full

.gitpod.ymlで明示的に読み込む場合は

image: gitpod/workspace-full

Dockerfileを読んでみると

FROM buildpack-deps:focal

しているのでUbuntuのFocalを使用していることがわかる。

$ docker pull buildpack-deps:focal

buildpack-depsでUbuntuのFocalではなくDebianのBusterを使用するには

$ docker pull buildpack-deps:buster

なのでこれは.gitpod.ymlに書けば

image: buildpack-deps:buster

Gitpod上にないせいか時間がかかるものの問題なく読み込めるらしい。

Dockerfileを読んでみると

FROM debian:buster

しているのでDebianのBusterを使用していることがわかる。

makeなどをapt-getしているDebianがほしいわけではないので.gitpod.ymlにこう書く

image: debian:buster

これを使ってやっていきます。

$ docker pull debian:buster

Docker Pull Memo

buildpack-depsはDebianとUbuntuの開発用Buildpackでプログラミング言語をインストールする際必要になるパッケージがすでにapt-getされている。
nodeの公式イメージなど様々なDockerfileで呼び出されている。

https://github.com/nodejs/docker-node

curlはcurlなどを使用してインストールするよう記載があるソフトウェアで使える。
scmはさらにgitなど使用してインストールするよう記載があるソフトウェアで使える。
何も記載がないものは上記含めmakeなど含まれている。

DebianとUbuntuのslimパッケージはOS動かす上で必須ではない/usr/shareに同梱されているドキュメントの一部を取り除き容量を減らしている。

$ docker pull gitpod/workspace-full # focal
$ docker pull gitpod/workspace-full-vnc # focal + etc + vnc
$ docker pull gitpod/workspace-dotnet # focal + etc + dotnet_sdk
$ docker pull gitpod/workspace-dotnet-vnc # focal + etc + vnc + dotnet_sdk

$ docker pull buildpack-deps:buster-curl # curl
$ docker pull buildpack-deps:buster-scm # curl + scm
$ docker pull buildpack-deps:buster # curl + scm + etc

$ docker pull alpine:3.13 # alpine

$ docker pull debian:buster-20210208-slim # Date: 20210208 buster - usr_share
$ docker pull debian:buster-20210208 # Date: 20210208 buster
$ docker pull debian:buster-slim # buster - usr_share
$ docker pull debian:buster # buster

Gitpod Memo

https://dotnet.microsoft.com/download/dotnet/5.0

.NETのSDK。
Gitpodは .NET 5.0。VNCでアプリ開発できるが現在はおそらくWindowsアプリのみ。 .NET 6.0でXamarin対応してmacOSとLinuxでも使えるアプリ作れるかもしれない。

https://www.gitpod.io/docs/config-docker/

Gitpodでは基本的にDebian, Ubuntu, Alpineの公式イメージを使用することを前提に作られている。
が一応Amazon LinuxとLinux Mintも使用できるらしい。

https://github.com/gitpod-io/gitpod/blob/master/components/image-builder/workspace-image-layer/scripts/detect-distro.sh

問題なく動くか不明なのでおすすめはしない。

黒ヰ樹黒ヰ樹

1

image: debian:buster
tasks:
  - command: bash command.sh
#!/bin/bash
echo "Hello, World!"

Gitpod起動後すぐにBashコマンドをしてくれます。

$ bash command.sh
Hello, World!
黒ヰ樹黒ヰ樹

2

$ echo $PATH

パスが表示されました。OSでは基本的にこのディレクトリにあるコマンドを使用できます。

/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
# null
$ ls -R /usr/local/sbin
$ ls -R /usr/local/bin

$ ls -R /usr/sbin
$ ls -R /usr/bin
$ ls -R /sbin
$ ls -R /bin
[
"add-shell","addgroup","adduser","chgpasswd","chmem","chpasswd","chroot","cpgr","cppw","delgroup","deluser","dpkg-fsys-usrunmess","dpkg-preconfigure","dpkg-reconfigure","e2freefrag","e4crypt","e4defrag","faillock","fdformat","filefrag","groupadd","groupdel","groupmems","groupmod","grpck","grpconv","grpunconv","iconvconfig","invoke-rc.d","ldattach","mklost+found","newusers","nologin","pam-auth-update","pam_getenv","pam_timestamp_check","policy-rc.d","pwck","pwconv","pwunconv","readprofile","remove-shell","rmt","rmt-tar","rtcwake","service","tarcat","tzconfig","update-passwd","update-rc.d","useradd","userdel","usermod","vigr","vipw","zic",

"addpart","apt","apt-cache","apt-cdrom","apt-config","apt-get","apt-key","apt-mark","arch","awk","b2sum","base32","base64","basename","basenc","bashbug","captoinfo","catchsegv","chage","chattr","chcon","chfn","choom","chrt","chsh","cksum","clear","clear_console","cmp","comm","csplit","cut","deb-systemd-helper","deb-systemd-invoke","debconf","debconf-apt-progress","debconf-communicate","debconf-copydb","debconf-escape","debconf-set-selections","debconf-show","delpart","diff","diff3","dircolors","dirname","dpkg","dpkg-deb","dpkg-divert","dpkg-maintscript-helper","dpkg-query","dpkg-realpath","dpkg-split","dpkg-statoverride","dpkg-trigger","du","env","expand","expiry","expr",
"factor","faillog","fallocate","fincore","find","flock","fmt","fold","getconf","getent","getopt","gpasswd","gpgv","groups","head","hostid","i386","iconv","id","infocmp","infotocap","install","ionice","ipcmk","ipcrm","ipcs","ischroot","join","last","lastb","lastlog","ldd","link","linux32","linux64","locale","localedef","logger","logname","lsattr","lscpu","lsipc","lslocks","lslogins","lsmem","lsns","mawk","mcookie","md5sum","md5sum.textutils","mesg","mkfifo","namei","nawk","newgrp","nice","nl","nohup","nproc","nsenter","numfmt","od","pager","partx","passwd","paste","pathchk","perl","perl5.32.1","pinky","pldd","pr","printenv","printf","prlimit","ptx",
"realpath","renice","reset","resizepart","rev","rgrep","runcon","savelog","script","scriptlive","scriptreplay","sdiff","seq","setarch","setpriv","setsid","setterm","sg","sha1sum","sha224sum","sha256sum","sha384sum","sha512sum","shred","shuf","sort","split","stat","stdbuf","sum","tabs","tac","tail","taskset","tee","test","tic","timeout","toe","touch","tput","tr","truncate","tset","tsort","tty","tzselect","unexpand","uniq","unlink","unshare","update-alternatives","users","utmpdump","wall","wc","whereis","which","who","whoami","x86_64","xargs","yes","zdump",

"agetty","badblocks","blkdiscard","blkid","blkzone","blockdev","chcpu","ctrlaltdel","debugfs","dumpe2fs","e2fsck","e2image","e2label","e2mmpstatus","e2scrub","e2scrub_all","e2undo","findfs","fsck","fsck.cramfs","fsck.ext2","fsck.ext3","fsck.ext4","fsck.minix","fsfreeze","fstab-decode","fstrim","getty","hwclock","installkernel","isosize","killall5","ldconfig","logsave","losetup","mke2fs","mkfs","mkfs.bfs","mkfs.cramfs","mkfs.ext2","mkfs.ext3","mkfs.ext4","mkfs.minix","mkhomedir_helper","mkswap","pivot_root","raw","resize2fs","runuser","shadowconfig","start-stop-daemon","sulogin","swaplabel","swapoff","swapon","switch_root","tune2fs","unix_chkpwd","unix_update","wipefs","zramctl",

"bash","cat","chgrp","chmod","chown","cp","dash","date","dd","df","dir","dmesg","dnsdomainname","domainname","echo","egrep","false","fgrep","findmnt","grep","gunzip","gzexe","gzip","hostname","ln","login","ls","lsblk","mkdir","mknod","mktemp","more","mount","mountpoint","mv","nisdomainname","pidof","pwd","rbash","readlink","rm","rmdir","run-parts","sed","sh","sleep","stty","su","sync","tar","tempfile","touch","true","umount","uname","uncompress","vdir","wdctl","ypdomainname","zcat","zcmp","zdiff","zegrep","zfgrep","zforce","zgrep","zless","zmore","znew"
]

とりあえずcdコマンドで移動してみる。

/$ cd home
/home$ cd ..
/$ cd home
/home$ cd ~
/$ cd home
/home$ cd -
/$ 
黒ヰ樹黒ヰ樹

3

$ bash --help
GNU bash, version 5.1.4(1)-release-(x86_64-pc-linux-gnu)
...

Bashの組み込みコマンドを確認できる方法が記載されているので試してみる。

$ bash -c help

cdなど新たにコマンドを確認できた。

[
"case","do","done","elif","else","esac","fi","for","function","if","in","select","then","until","while","time",

"alias","bg","bind","break","builtin","caller","cd","command","compgen","complete","compopt","continue","coproc","declare","dirs","disown","echo","enable","eval","exec","exit","export",
"false","fc","fg","getopts","hash","help","history","jobs","kill","let","local","logout","mapfile","popd","printf","pushd","pwd","read","readarray","readonly","return",
"set","shift","shopt","source","suspend","test","times","trap","true","type","typeset","ulimit","umask","unalias","unset","variables","wait"
]

上記コマンドは$ helpで確認できるものと同じです。

環境変数一覧。

$ export

$を押した後にTabキー2回押して表示できる環境変数一覧と分けてみた。

[
"HOME","HOSTNAME","OLDPWD","PATH","PWD","SHLVL","TERM",

"BASH","BASHOPTS","BASHPID","BASH_ALIASES","BASH_ARGC","BASH_ARGV","BASH_ARGV0","BASH_CMDS","BASH_COMMAND","BASH_LINENO","BASH_SOURCE","BASH_SUBSHELL","BASH_VERSINFO","BASH_VERSION",
"COLUMNS","COMP_WORDBREAKS","DIRSTACK","EPOCHREALTIME","EPOCHSECONDS","EUID","GROUPS","HISTCMD","HISTFILE","HISTFILESIZE","HISTSIZE","HOSTTYPE","IFS","LINENO","LINES",
"MACHTYPE","MAILCHECK","OPTERR","OPTIND","OSTYPE","PIPESTATUS","PPID","PS1","PS2","PS4","RANDOM","SECONDS","SHELL","SHELLOPTS","SRANDOM","UID","_"
]

組み込みコマンドtypeでcdとcat、archの切り分けをしてみましょう。

$ type arch
arch is /usr/bin/arch
$ type cat  
cat is /bin/cat
$ type cd
cd is a shell builtin

ほぼ全ての使用できるコマンドを把握できたのでようやく楽しめそうです。

3 Memo

ライブラリ用パスの確認

$ ls /etc/ld.so.conf.d/
libc.conf  x86_64-linux-gnu.conf
$ cat /etc/ld.so.conf.d/libc.conf
# libc default configuration
/usr/local/lib
$ cat /etc/ld.so.conf.d/x86_64-linux-gnu.conf
# Multiarch support
/usr/local/lib/x86_64-linux-gnu
/lib/x86_64-linux-gnu
/usr/lib/x86_64-linux-gnu
# null
$ /usr/local/lib
$ ls /usr/local/lib/x86_64-linux-gnu

$ ls /usr/lib/x86_64-linux-gnu
$ ls /lib/x86_64-linux-gnu
[
"libacl.so.1","libacl.so.1.1.2253","libapt-pkg.so.6.0","libapt-pkg.so.6.0.0","libapt-private.so.0.0","libapt-private.so.0.0.0","libattr.so.1","libattr.so.1.1.2448","libblkid.so.1","libblkid.so.1.1.0","libcrypto.so.1.1","libdb-5.3.so","libdebconfclient.so.0","libdebconfclient.so.0.0.0","libffi.so.7","libffi.so.7.1.0","libgcrypt.so.20","libgcrypt.so.20.2.8","libgmp.so.10","libgmp.so.10.4.1","libgnutls.so.30","libgnutls.so.30.29.1","libgssapi_krb5.so.2","libgssapi_krb5.so.2.2",
"libhogweed.so.6","libhogweed.so.6.4","libidn2.so.0","libidn2.so.0.3.7","libk5crypto.so.3","libk5crypto.so.3.1","libkrb5.so.3","libkrb5.so.3.3","libkrb5support.so.0","libkrb5support.so.0.1","liblz4.so.1","liblz4.so.1.9.3","libmount.so.1","libmount.so.1.1.0","libnettle.so.8","libnettle.so.8.4","libnsl.so.2","libnsl.so.2.0.1","libp11-kit.so.0","libp11-kit.so.0.3.0","libpcre2-8.so.0","libpcre2-8.so.0.10.1","libpcreposix.so.3","libpcreposix.so.3.13.3",
"libseccomp.so.2","libseccomp.so.2.5.1","libsemanage.so.1","libsmartcols.so.1","libsmartcols.so.1.1.0","libssl.so.1.1","libstdc++.so.6","libstdc++.so.6.0.28","libsystemd.so.0","libsystemd.so.0.30.0","libtasn1.so.6","libtasn1.so.6.6.0","libtic.so.6","libtic.so.6.2","libudev.so.1","libudev.so.1.7.0","libunistring.so.2","libunistring.so.2.1.0","libuuid.so.1","libuuid.so.1.3.0","libxxhash.so.0","libxxhash.so.0.8.0","libzstd.so.1","libzstd.so.1.4.8",
"audit","e2fsprogs","engines-1.1","gconv","krb5","perl-base",

"ld-linux-x86-64.so.2","libBrokenLocale-2.31.so","libBrokenLocale.so.1","libSegFault.so","libanl-2.31.so","libanl.so.1","libaudit.so.1","libaudit.so.1.0.0","libbz2.so.1","libbz2.so.1.0","libbz2.so.1.0.4","libc.so.6","libcap-ng.so.0","libcap-ng.so.0.0.0","libcom_err.so.2","libcom_err.so.2.1","libcrypt.so.1","libcrypt.so.1.1.0","libdl-2.31.so","libdl.so.2","libe2p.so.2","libe2p.so.2.3","libext2fs.so.2","libext2fs.so.2.4","libgcc_s.so.1","libgpg-error.so.0","libgpg-error.so.0.29.0","libkeyutils.so.1","libkeyutils.so.1.9",
"liblzma.so.5","liblzma.so.5.2.5","libm-2.31.so","libm.so.6","libmemusage.so","libmvec-2.31.so","libmvec.so.1","libnsl-2.31.so","libnsl.so.1","libnss_compat-2.31.so","libnss_compat.so.2","libnss_dns-2.31.so","libnss_dns.so.2","libnss_files-2.31.so","libnss_files.so.2","libnss_hesiod-2.31.so","libnss_hesiod.so.2","libpam.so.0","libpam.so.0.85.1","libpam_misc.so.0","libpam_misc.so.0.82.1","libpamc.so.0","libpamc.so.0.82.1","libpcprofile.so","libpcre.so.3","libpcre.so.3.13.3","libpthread.so.0",
"libresolv-2.31.so","libresolv.so.2","librt-2.31.so","librt.so.1","libselinux.so.1","libsepol.so.1","libss.so.2","libss.so.2.0","libthread_db-1.0.so","libthread_db.so.1","libtinfo.so.6","libtinfo.so.6.2","libtirpc.so.3","libtirpc.so.3.0.0","libutil-2.31.so","libutil.so.1","libz.so.1","libz.so.1.2.11",
"ld-2.31.so","libc-2.31.so","libpthread-2.31.so",
"security"
]

https://manpages.debian.org/buster/dash/dash.1.en.html

BashではなくDashが紐付いており一部コマンドが使用できない可能性があるのでそういった場合は上記manページで確認してください。

なんとなくdashと入力しターミナルが壊れた場合は

$ bash

を試してみたら直るかも。

ちなみにAlpineはBashのほかBusyBoxのAshが入っています。
bash => Bash => Bourne Again Shell
dash => Dash => Debian Almquist shell
ash => Ash => Almquist Shell

黒ヰ樹黒ヰ樹

4

/dev/nullあるか確認してなかったので確認しておく。

$ ls /dev
console  core  fd  full  mqueue  null  ptmx  pts  random  shm  stderr  stdin  stdout  tty  urandom  zero

まずはcatコマンドでファイルの表示。せっかくなのでOS情報を確認してみます。

$ cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 11 (bullseye)"
NAME="Debian GNU/Linux"
VERSION_ID="11"
VERSION="11 (bullseye)"
VERSION_CODENAME=bullseye
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

Debian GNU/Linux 10 (buster)で間違いないことがわかりました。

odコマンドで表示してみましょう。

$ od -ta /etc/os-release
0000000   P   R   E   T   T   Y   _   N   A   M   E   =   "   D   e   b
0000020   i   a   n  sp   G   N   U   /   L   i   n   u   x  sp   1   1
0000040  sp   (   b   u   l   l   s   e   y   e   )   "  nl   N   A   M
0000060   E   =   "   D   e   b   i   a   n  sp   G   N   U   /   L   i
0000100   n   u   x   "  nl   V   E   R   S   I   O   N   _   I   D   =
0000120   "   1   1   "  nl   V   E   R   S   I   O   N   =   "   1   1
0000140  sp   (   b   u   l   l   s   e   y   e   )   "  nl   V   E   R
0000160   S   I   O   N   _   C   O   D   E   N   A   M   E   =   b   u
0000200   l   l   s   e   y   e  nl   I   D   =   d   e   b   i   a   n
0000220  nl   H   O   M   E   _   U   R   L   =   "   h   t   t   p   s
0000240   :   /   /   w   w   w   .   d   e   b   i   a   n   .   o   r
0000260   g   /   "  nl   S   U   P   P   O   R   T   _   U   R   L   =
0000300   "   h   t   t   p   s   :   /   /   w   w   w   .   d   e   b
0000320   i   a   n   .   o   r   g   /   s   u   p   p   o   r   t   "
0000340  nl   B   U   G   _   R   E   P   O   R   T   _   U   R   L   =
0000360   "   h   t   t   p   s   :   /   /   b   u   g   s   .   d   e
0000400   b   i   a   n   .   o   r   g   /   "  nl
0000413

spはスペース、nlは改行。

AWKでHello, World!

$ awk 'BEGIN { print "Hello, World!" }'
Hello, World!

PerlでHello, World!

$ perl -e 'print "Hello, World!\n";'
Hello, World!
黒ヰ樹黒ヰ樹

4.1

今回はパッケージを一切追加しないが忘備録として書いておく。

root権限があればパッケージを追加できる。BusyBoxを追加する場合は以下の通り。

$ apt-get update && apt-get install busybox

-y --no-install-recommendsオプションをつけることでRecommended packagesを除いた最も少ないパッケージをインストールすることが出来る。

-y --install-suggestsオプションをつけることでSuggested packagesを含めた最も多いパッケージをインストールすることが出来る。

$ apt-get update && apt-get install busybox
...
Reading package lists... Done

ここまでがapt-get updateの処理。

Reading package lists... Done
...
Setting up busybox (1:1.30.1-6+b3) ...

ここまでがapt-get install busyboxの処理。

vimを使ってみる。emacsやnanoは入ってない。viでも同じものを呼び出せる。

$ vim --help
VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Oct 01 2021 01:51:08)
...

起動

$ vim

iキーを押したあとHello, World!と入力。

ちゃんと入力されたことを確認したらEscキーを押す。

:を押したあとにw abc.txtと入力。

:w abc.txt

問題なく保存できた。

vim上でコマンドも試しておく。

:!echo 127

vimの終了。

:q

間違って追記してしまい保存せず終了する場合は

:qa!

一安心。

vim

Gitpod上のDebianで起動したvim

Gitpod上のAlpineで起動したvi

$ less /etc/os-release

テキストビューア。ターミナルログとは別途起動してくれる。
ただmoreコマンドと異なり全て読み終えても自動的に終了しないため終了するときはqキーを押す。

黒ヰ樹黒ヰ樹

5

$ mkdir xyz

ディレクトリを作成する。

$ dpkg -l > xyz/00.txt

パッケージ一覧をファイルに標準出力する。
パッケージ追加した後複数ファイル出力しておきdiffコマンドを使うと何を入れたか把握しやすくなる。

$ more xyz/00.txt

簡易的なテキストビューア。
catコマンドと異なり1画面ずつ表示してくれる。

$ gzip -k xyz/00.txt

ファイルを圧縮するコマンド。ディレクトリはできない。
-kオプションで元のファイル00.txtが保持され、00.txt.gzファイルがあらたにできる。

$ gunzip -l xyz/00.txt.gz
         compressed        uncompressed  ratio uncompressed_name
               4128               15231  73.1% xyz/00.txt

展開しても元ファイルに上書きされるだけなので-lオプションで圧縮率の確認をしておく。
なかなかの圧縮率を誇ることがわかった。

$ tar -cvzf xyz.tar.gz xyz

ディレクトリの圧縮、展開もできるコマンド。
-cオプションでtarアーカイブして-zオプションでgzip圧縮している。

$ tar -tf xyz.tar.gz
xyz/
xyz/00.txt.gz
xyz/00.txt

展開しても元ディレクトリに上書きされるだけなので-tオプションでアーカイブ中身の確認をしておく。

またxyz/00.txt.gzのようなgzip圧縮されているテキストファイルは展開しなくても$ zcatコマンドで読むことができる。

gzipパッケージに同梱されているファイル一覧はインターネットで調べたほうが早いと思う。

https://packages.debian.org/buster/amd64/gzip/filelist

amd64であるかどうかは$dpkg -lのArchitectureを確認するか

$ arch

でサーバーのアーキテクチャを表示できる。
x86_64はamd64である。
またアーキテクチャ、パッケージをはじめとしたDocker公式イメージの詳細については以下のページで確認できる。
少し重いので注意。

https://github.com/docker-library/repo-info/blob/master/repos/debian/local/buster.md

黒ヰ樹黒ヰ樹

6

先程確認した$ archのヘルプを表示してみよう。

$ arch --help
Usage: arch [OPTION]...
Print machine architecture.

      --help     display this help and exit
      --version  output version information and exit

GNU coreutils online help: <https://www.gnu.org/software/coreutils/>
Report any translation bugs to <https://translationproject.org/team/>
Full documentation <https://www.gnu.org/software/coreutils/arch>
or available locally via: info '(coreutils) arch invocation'

どうやらcoreutilsに含まれるコマンドらしい。
せっかくなのでdpkgからgrepコマンドで検索してみることにする。

$ dpkg -l | grep coreutils
ii  coreutils               8.32-4+b1                    amd64        GNU core utilities

パイプ|を使用しdpkgコマンドで出力した内容をgrepコマンドに渡して検索することができた。
GNU core utilitiesと呼ばれるパッケージを使用しているらしい。

https://www.gnu.org/software/coreutils/manual/

今までいくつか出てきたコマンド、例えばlsやcatも同様にGNU core utilitiesから提供されているもので、非常に多くのLinuxで使用されている自由なソフトウェアである。ありがとうRMS。

なので大量のコマンドがありどれを覚えたらいいか分からない場合まずはGNU core utilitiesのマニュアルで確認できるコマンドから始めたらいいかもしれない。
もちろんBashなどで使われている組み込みコマンドechoやcdも同じぐらい重要ですが。

マニュアルは拡張子html, txt, pdf, html.gz, txt.gz, dvi.gz, tar.gz, texi.tar.gzで提供しているのでスマホでhtml見づらかったらpdf、txtの容量が大きいときは圧縮されたtxt.gzファイルをgzipに含まれるテキストビューアで読むといいかも。

https://www.gnu.org/manual/blurbs.html

coreutilsのほか今まで紹介してきたbash, grep, gzip, tarのほか、後日紹介するsedやdiffなどもGNUパッケージである。ありがとうFSF。
ちなみにDebianに同梱されているAWKはgawkではなくmawkです。