[内容] iptables 防火墙数据接收情况和发出情况的查看

# iptables -nvL

Chain INPUT (policy ACCEPT 5 packets, 500 bytes)
......
Chain FORWARD (policy DROP 0 packets, 0 bytes)
......
Chain OUTPUT (policy DROP 1000 packets, 200K bytes)
......


补充:
1) 这里的 policy ACCEPT 5 packets, 500 bytes 是指接收了 5 个数据包和 500 bytes 流量,ACCEPT 是指接收的状态
2) 这里的 policy DROP 1000 packets, 200K bytes 是指发出了 1000 数据包和 200K bytes 流量。DROP 是拒绝的状态

[STEP] Shortcut Script Creation (Windows 10 Edition)

Text:

Step One: Open a PowerShell terminal

(Steps omitted)

Step Two: Execute follow script

$installedapps = get-AppxPackage

$aumidList = @()
foreach ($app in $installedapps)
{
    foreach ($id in (Get-AppxPackageManifest $app).package.applications.application.id)
    {
        $aumidList += $app.packagefamilyname + "!" + $id
    }
}

$aumidList
Microsoft.Windows.CloudExperienceHost_cw5n1h2txyewy!App
Microsoft.BioEnrollment_cw5n1h2txyewy!App
1527c705-839a-4832-9118-54d4Bd6a0c89_cw5n1h2txyewy!Microsoft.Windows.FilePicker
c5e2524a-ea46-4f67-841f-6a9465d9d515_cw5n1h2txyewy!App
E2A4F912-2574-4A75-9BB0-0D023378592B_cw5n1h2txyewy!Microsoft.Windows.AppResolverUX
Microsoft.LockApp_cw5n1h2txyewy!WindowsDefaultLockScreen
Microsoft.Win32WebViewHost_cw5n1h2txyewy!DPI.PerMonitorAware
Microsoft.Win32WebViewHost_cw5n1h2txyewy!DPI.SystemAware
Microsoft.Win32WebViewHost_cw5n1h2txyewy!DPI.Unaware
Microsoft.MicrosoftEdgeDevToolsClient_8wekyb3d8bbwe!App
Microsoft.Windows.ContentDeliveryManager_cw5n1h2txyewy!App
Microsoft.Windows.OOBENetworkCaptivePortal_cw5n1h2txyewy!App
Microsoft.Windows.NarratorQuickStart_8wekyb3d8bbwe!App
Microsoft.Windows.ParentalControls_cw5n1h2txyewy!App
Microsoft.Windows.PeopleExperienceHost_cw5n1h2txyewy!App
Microsoft.Windows.CallingShellApp_cw5n1h2txyewy!Microsoft.Windows.CallingShellApp
Microsoft.Windows.CapturePicker_cw5n1h2txyewy!App
NcsiUwpApp_8wekyb3d8bbwe!App
MicrosoftWindows.UndockedDevKit_cw5n1h2txyewy!App
Windows.CBSPreview_cw5n1h2txyewy!Microsoft.Windows.CBSPreview
Microsoft.Windows.XGpuEjectDialog_cw5n1h2txyewy!Microsoft.Windows.XGpuEjectDialog
Microsoft.Windows.StartMenuExperienceHost_cw5n1h2txyewy!App
Microsoft.Windows.SecHealthUI_cw5n1h2txyewy!SecHealthUI
Microsoft.AccountsControl_cw5n1h2txyewy!App
Microsoft.CredDialogHost_cw5n1h2txyewy!App
Microsoft.Windows.ShellExperienceHost_cw5n1h2txyewy!App
Microsoft.AAD.BrokerPlugin_cw5n1h2txyewy!App
Microsoft.Windows.OOBENetworkConnectionFlow_cw5n1h2txyewy!App
F46D4000-FD22-4DB4-AC8E-4E1DDDE828FE_cw5n1h2txyewy!App
Microsoft.XboxGameCallableUI_cw5n1h2txyewy!Microsoft.XboxGameCallableUI
Microsoft.AsyncTextService_8wekyb3d8bbwe!App
Microsoft.Windows.PinningConfirmationDialog_cw5n1h2txyewy!App
Windows.PrintDialog_cw5n1h2txyewy!Microsoft.Windows.PrintDialog
Microsoft.Windows.Apprep.ChxApp_cw5n1h2txyewy!App
windows.immersivecontrolpanel_cw5n1h2txyewy!microsoft.windows.immersivecontrolpanel
Microsoft.WindowsCamera_8wekyb3d8bbwe!App
Microsoft.Wallet_8wekyb3d8bbwe!App
RealtekSemiconductorCorp.RealtekAudioControl_dt26b99r8h8gj!App
Microsoft.GetHelp_8wekyb3d8bbwe!App
Microsoft.ECApp_8wekyb3d8bbwe!App
Microsoft.MicrosoftEdge.Stable_8wekyb3d8bbwe!App
Microsoft.MicrosoftPCManager_8wekyb3d8bbwe!App
Microsoft.MicrosoftPCManager_8wekyb3d8bbwe!PCWndManager
Microsoft.MicrosoftPCManager_8wekyb3d8bbwe!PCManagerService
Microsoft.ScreenSketch_8wekyb3d8bbwe!App
Microsoft.LanguageExperiencePackzh-CN_8wekyb3d8bbwe!App
Microsoft.LanguageExperiencePackzh-TW_8wekyb3d8bbwe!App
Microsoft.LanguageExperiencePacken-GB_8wekyb3d8bbwe!App
Clipchamp.Clipchamp_yxz26nhyzhsrt!App
Clipchamp.Clipchamp_yxz26nhyzhsrt!CLI
AppleInc.iTunes_nzyj5cx40ttqa!iTunes
AppleInc.iTunes_nzyj5cx40ttqa!AppleInc.Defaults
AppleInc.iTunes_nzyj5cx40ttqa!AppleInc.MDCrashReporter
Microsoft.HEIFImageExtension_8wekyb3d8bbwe!App
Microsoft.XboxGameOverlay_8wekyb3d8bbwe!App
Microsoft.XboxSpeechToTextOverlay_8wekyb3d8bbwe!App
Microsoft.Xbox.TCUI_8wekyb3d8bbwe!Microsoft.Xbox.TCUI
Microsoft.WebMediaExtensions_8wekyb3d8bbwe!Microsoft.WebMediaExtensions
Microsoft.XboxIdentityProvider_8wekyb3d8bbwe!Microsoft.XboxIdentityProvider
Microsoft.MicrosoftStickyNotes_8wekyb3d8bbwe!App
Microsoft.Getstarted_8wekyb3d8bbwe!App
Microsoft.ZuneVideo_8wekyb3d8bbwe!Microsoft.ZuneVideo
Microsoft.WindowsStore_8wekyb3d8bbwe!App
Microsoft.StorePurchaseApp_8wekyb3d8bbwe!App
Microsoft.VP9VideoExtensions_8wekyb3d8bbwe!App
Microsoft.Whiteboard_8wekyb3d8bbwe!Whiteboard
Microsoft.WebpImageExtension_8wekyb3d8bbwe!App
Microsoft.WindowsSoundRecorder_8wekyb3d8bbwe!App
Microsoft.XboxGamingOverlay_8wekyb3d8bbwe!App
Microsoft.Windows.Photos_8wekyb3d8bbwe!App
Microsoft.YourPhone_8wekyb3d8bbwe!App
Microsoft.DesktopAppInstaller_8wekyb3d8bbwe!App
Microsoft.DesktopAppInstaller_8wekyb3d8bbwe!PythonRedirector
Microsoft.DesktopAppInstaller_8wekyb3d8bbwe!winget
Microsoft.DesktopAppInstaller_8wekyb3d8bbwe!WinGetComServer
Microsoft.Windows.Search_cw5n1h2txyewy!CortanaUI
Microsoft.Windows.Search_cw5n1h2txyewy!ShellFeedsUI
MicrosoftWindows.Client.CBS_cw5n1h2txyewy!PackageMetadata
MicrosoftWindows.Client.CBS_cw5n1h2txyewy!Global.Accounts
MicrosoftWindows.Client.CBS_cw5n1h2txyewy!Global.AppListBackup
MicrosoftWindows.Client.CBS_cw5n1h2txyewy!Global.BackupBanner
MicrosoftWindows.Client.CBS_cw5n1h2txyewy!Global.DesktopSpotlight
MicrosoftWindows.Client.CBS_cw5n1h2txyewy!InputApp
MicrosoftWindows.Client.CBS_cw5n1h2txyewy!Global.IrisService
MicrosoftWindows.Client.CBS_cw5n1h2txyewy!Global.RulesEngine
MicrosoftWindows.Client.CBS_cw5n1h2txyewy!ScreenClipping
MicrosoftWindows.Client.CBS_cw5n1h2txyewy!WebExperienceHost
MicrosoftWindows.Client.CBS_cw5n1h2txyewy!WindowsBackup
AppleInc.iCloud_nzyj5cx40ttqa!iCloud
AppleInc.iCloud_nzyj5cx40ttqa!iCloudPhotoViewer
AppleInc.iCloud_nzyj5cx40ttqa!iCloudPasswords
AppleInc.iCloud_nzyj5cx40ttqa!iCloudChrome
AppleInc.iCloud_nzyj5cx40ttqa!iCloudPasswordsExtensionHelper
AppleInc.iCloud_nzyj5cx40ttqa!iCloudFirefox
AppleInc.iCloud_nzyj5cx40ttqa!eReporter
AppleInc.iCloud_nzyj5cx40ttqa!iCloudDrive
AppleInc.iCloud_nzyj5cx40ttqa!iCloudPhotos
AppleInc.iCloud_nzyj5cx40ttqa!ApplePhotoStreams
AppleInc.iCloud_nzyj5cx40ttqa!iCloudCKKS
AppleInc.iCloud_nzyj5cx40ttqa!APSDaemon
Microsoft.WindowsTerminal_8wekyb3d8bbwe!App

Step three: Create local boot script

Create a new bat file and create follow content:

start shell:Appsfolder\Microsoft.WindowsTerminal_8wekyb3d8bbwe!App

(Add: taking starting the Terminal application as an example here)

Step Four: Double click this boot script

(Steps omitted)

Reference:

https://forum.rainmeter.net/viewtopic.php?t=22716

[步骤] Linux 虚拟内存 (交换分区) swap 的设置

步骤一:理解 Linux 虚拟内存 (交换分区) swap 使用优先级的设置机制

Linux 的 swappiness 参数用于控制虚拟内存 (交换分区) swap 的使用。
swappiness 参数的默认值是 60,也就是说当物理内存使用率达到 40 时,开始使用虚拟内存 (交换分区) swap。
当 swappiness 参数的值是 0 时,则只有当物理机内存耗尽了以后才会使用虚拟内存 (交换分区) swap。
当 swappiness 参数的值是 100 时,则立刻使用虚拟内存 (交换分区) swap。

步骤二:Linux 虚拟内存 (交换分区) swap 开关的设置

2.1 查看虚拟内存 (交换分区) swap

# swapon -s

2.2 开启虚拟内存 (交换分区) swap

# swapon -a

2.3 关闭虚拟内存 (交换分区) swap

# swapoff -a

2.4 重启虚拟内存 (交换分区) swap

# swapoff -a && swapon -a

步骤三:Linux 虚拟内存 (交换分区) swap 使用优先级的设置

3.1 临时设置虚拟内存 (交换分区) swap 使用优先级的设置

# sysctl -p swappiness=60

或者:

# sysctl vm.swappiness=60

或者:

# echo 60 > /proc/sys/vm/swappiness

(补充:这里以把 swappiness 的值设置成 60 为例)


注意:
1) 临时设置重启后失效
2) 临时设置了以后不会马上生效,只有当系统重新调用内存以后才会生效

3.2 永久设置虚拟内存 (交换分区) swap 使用优先级的设置

3.2.1 修改 /etc/sysctl.conf 文件
# vim /etc/sysctl.conf

添加以下内容:

......
vm.swappiness=60

(补充:这里以把 swappiness 的值设置成 60 为例)

3.2.2 让刚刚修改的 /etc/sysctl.conf 文件生效
# sysctl -p

3.3 查看虚拟内存 (交换分区) swap 使用优先级的设置

3.3.1 通过 /proc/sys/vm/swappiness 文件查看
# cat /proc/sys/vm/swappiness
3.3.2 通过 sysctl vm.swappiness 命令查看
# sysctl vm.swappiness

[步骤] Linux journal 日志的永久存储

正文:

步骤一:理解 journal 日志存储机制

默认情况下,journal 的日志存储在 /run/log/journal,而 /run 目录只是一个临时目录。

将 Storage 参数设置为 persistent 后,journal 的日志将存储在 /var/log/journal,/var/log 则是一个永久的目录。

步骤二:将 journal 日志设置为永久存储

2.1 修改 /etc/systemd/journald.conf 文件

# vi /etc/systemd/journald.conf

将部分内容修改如下:

[Journal]
......
Storage=persistent
......

2.2 重启 systemd-journald 服务

# systemctl restart systemd-journald.service

参考文献:

https://linuxconfig.org/introduction-to-the-systemd-journal