首先,安装imagemagick

sudo apt install imagemagick

将多个图片合并到一个pdf文件

convert "*.{png,jpeg}" -quality 100 outfile.pdf
convert "IMG*.png" -quality 100 outfile.pdf

如果出现错误信息:
convert-im6.q16: attempt to perform an operation not allowed by the security policy `PDF'
则修改相应权限。

 sudo vi /etc/ImageMagick-6/policy.xml


<policy domain="coder" rights="none" pattern="PDF" />
修改为
<policy domain="coder" rights="read|write" pattern="PDF" />

再执行

convert "IMG*.png" -quality 100 outfile.pdf

以下为示例,把AA BB CC DD替换为真实数据即可。

sed -i '0,/^/s/^/\xAA\xBB\xCC\xDD/' test.pcm

 sed -i '0,/^/s/^/\xd4\xc3\xb2\xa1\x02\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x01\x00\x00\x00/' dump.pcap 

The file has a global header containing some global information followed by zero or more records for each captured packet, looking like this:

  • Global Header
  • Packet Header
  • Packet Data

Global Header

typedef struct pcap_hdr_s {
          guint32 magic_number;   /* magic number */
          guint16 version_major;  /* major version number */
          guint16 version_minor;  /* minor version number */
          gint32  thiszone;       /* GMT to local correction */
          guint32 sigfigs;        /* accuracy of timestamps */
          guint32 snaplen;        /* max length of captured packets, in octets */
          guint32 network;        /* data link type */
  } pcap_hdr_t;

示例:
xd4xc3xb2xa1x02x00x04x00x00x00x00x00x00x00x00x00x00x00x04x00x01x00x00x00
Record (Packet) Header

typedef struct pcaprec_hdr_s {
          guint32 ts_sec;         /* timestamp seconds */
          guint32 ts_usec;        /* timestamp microseconds */
          guint32 incl_len;       /* number of octets of packet saved in file */
          guint32 orig_len;       /* actual length of packet */
  } pcaprec_hdr_t;

Packet Data
The actual packet data will immediately follow the packet header as a data blob of incl_len bytes without a specific byte alignment.
查看tcpdump 数据

sudo tcpdump -c 1 -w test.pcap tcp

查看Global Header

hexdump -C -n 24 test.pcap 

00000000 d4 c3 b2 a1 02 00 04 00 00 00 00 00 00 00 00 00 |................|
00000010 00 00 04 00 01 00 00 00 |........|
00000018

查看Record (Packet) Header

 hexdump -C -s 24 -n 16 test.pcap 

00000018 54 f0 69 63 ab 52 0b 00 42 00 00 00 42 00 00 00 |T.ic.R..B...B...|
00000028

查看包数据Packet Data

hexdump -C -s 40 test.pcap
00000028 b8 ac 6f 3b 20 d0 38 f3 ab 09 44 1c 08 00 45 00 |..o; .8...D...E.|
00000038 00 34 3e c0 40 00 40 06 76 6b c0 a8 02 40 c0 a8 |.4>.@.@.vk...@..|
00000048 02 08 9c 08 1f 92 5e 7b f8 00 12 7f 1e 3e 80 11 |......^{.....>..|
00000058 01 f5 85 bf 00 00 01 01 08 0a 20 82 fb f2 d0 6a |.......... ....j|
00000068 41 0e |A.|
0000006a

How to Keep Alive SSH Sessions
To enable the keep alive system-wide (root access required), edit /etc/ssh/ssh_config; to set the settings for just your user, edit ~/.ssh/config (create the file if it doesn’t exist). Insert the following:

Host *
    ServerAliveInterval 300
    ServerAliveCountMax 2

You can also make your OpenSSH server keep alive all connections with clients by adding the following to /etc/ssh/sshd_config:

ClientAliveInterval 300
ClientAliveCountMax 2

Add timestamp to SSH verbose logs

ssh -v 192.168.0.151 exit 2>&1 | while read line; do printf '[%s] %s\n' "$(date '+%Y-%m-%d %H:%M:%S')" "$line"; done

Store SSH client VERBOSE logs into log file

ssh -v 192.168.0.151 exit 2>&1 | while read line; do printf '[%s] %s\n' "$(date '+%Y-%m-%d %H:%M:%S')" "$line"; done > "/tmp/ssh-debug.log"

ssh exit

How does 'ssh <destination> exit' terminate the session?

The exit executed by the remote shell would terminate that shell. In
the case when true is executed, the remote shell would terminate due
to not having any further commands to execute, but exit would
terminate it even if there were further commands afterwards (as in any
script).

In the simple case where the SSH session is only for executing a set
of commands (where it does not set up tunnels or use connection
sharing), the session would terminate when the remote shell
terminates, no matter how the remote shell terminates (either by exit
or by some error, or receiving a HUP signal, or by simply reaching the
end of the script).

Note that the manual says "[...] and all X11 and TCP connections have
been closed". This means that the connection may not terminate just
because the remote shell has terminated. This will be the case when
you, for example, are using connection sharing with ssh -M and ssh -S
(or the ControlMaster setting in ~/.ssh/config; see man ssh and man
ssh_config). I assume that SSH tunnels would also keep the SSH session
alive until they are explicitly closed.

To truly terminate the SSH connection, you may send the exit control
command using ssh -O exit user@host. This would terminate all shared
SSH sessions to user@host.

linux sshfs

SSHFS is available for most Linux distributions. On Ubuntu, you can install it using apt.

First, use apt update to refresh your package sources:

sudo apt update

Then, use apt install to install the sshfs package.

sudo apt install sshfs

Mounting the Remote Filesystem
Create a subdirectory within /mnt called droplet using the mkdir command:

sudo mkdir /mnt/droplet

You can now mount a remote directory using sshfs.

sudo sshfs -o allow_other,default_permissions sammy@your_other_server:~/ /mnt/droplet

If you no longer need this mount, you can unmount it with the umount command:

sudo umount /mnt/droplet

sshfs remote host has disconnected
修改/etc/sshd/sshd_config中的

Subsystem sftp /usr/lib/openssh/sftp-server

Subsystem sftp internal-sftp

Both sftp-server and internal-sftp are part of OpenSSH. The sftp-server is a standalone binary. The internal-sftp is just a configuration keyword that tells sshd to use the SFTP server code built-into the sshd, instead of running another process (what would typically be the sftp-server).

The internal-sftp was added much later (OpenSSH 4.9p1 in 2008?) than the standalone sftp-server binary. But it is the default by now. The sftp-server is now redundant and is kept probably for a backward compatibility.

I believe there's no reason to use the sftp-server for new installations.

On Linux it’s available as a snap:

sudo snap install multipass --classic
sudo snap install multipass --beta --classic

Find available images

multipass find

multipass find
Image Aliases Version Description
snapcraft:core18 18.04 20201111 Snapcraft builder for Core 18
snapcraft:core20 20.04 20210921 Snapcraft builder for Core 20
snapcraft:core22 22.04 20220426 Snapcraft builder for Core 22
snapcraft:devel 20221109 Snapcraft builder for the devel series
core core16 20200818 Ubuntu Core 16
core18 20211124 Ubuntu Core 18
core20 20210630 Ubuntu Core 20
core22 20220610 Ubuntu Core 22
18.04 bionic 20221014 Ubuntu 18.04 LTS
20.04 focal 20221018 Ubuntu 20.04 LTS
22.04 jammy,lts 20221101.1 Ubuntu 22.04 LTS
22.10 kinetic 20221101 Ubuntu 22.10

运行镜像
From the output, there are several Ubuntu LTS versions. You can launch an instance from the list using the syntax below.

multipass launch --name test-instance 18.04

This command will launch an instance for Ubuntu 18.04.

Launch a fresh instance of the current Ubuntu LTS

$ multipass launch ubuntu

Connect to a running instance

$ multipass shell test-instance
lsb_release -a

No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04.6 LTS
Release: 18.04
Codename: bionic

Mount and Unmount a local directory
To mount a local directory use the following command syntax:

multipass mount <source> <target> [<target> ...]