Linux - chanandrew96/MyLearning GitHub Wiki

SSH

在使用SSH連線時,如果發現了現有的連線與以往在電腦上的紀錄不同時會出現WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!的警告。
如果這是一個已知的原因,可以通過清除對應的紀錄。

ssh-keygen -R <IP-Address>
rm -rf  /root/.ssh/known_hosts
vim /root/.ssh/known_hosts

SSH Reference

SSH連線出現錯誤 WARNING REMOTE HOST IDENTIFICATION HAS CHANGED

Command

systemctl

systemctl用於控制systemd系統和管理系統上運行的服務

apt

apt用於取代apt-getapt對於處理每個套件的依賴上有更好的處理,會判斷以正確順序安裝套件的複雜相依性鏈結,同時會提供可升級的套件
apt整合了apt-getapt-cache的功能
兩者間更多的差異可參考aws上的文件

lsblk

列出块设备信息
lsblk
lsblk命令 – 查看系统的磁盘使用情况

cfdisk

磁盘分区
cfdisk命令 – 用于磁盘分区

sfdisk

sfdisk命令 – 硬盘分区工具

repquota

repquota命令 – 显示文件系统配额的汇总信息

getent

getent命令 – 查看系统数据库中的记录信息

Service Unit

Linux上使用Service Unit來建立與Windows Service類似的服務,要建立Service Unit我們先要建一個.service檔案

Automount

Automount need to use with Mount
Quota from Mount vs automount systemd units: which one to use for what?

automount units are optional; but, when they exist, corresponding mount units must also exist.

Service Unit Reference

Ubuntu

Reference

samwhelp - Ubuntu Basic Skill

Timestamp & DateTime

  • Unix Timestamp sample: 1704271981
  • Unix DateTime sample: 2024-01-03T07:20:50.022686119Z
Command Purpose
DateTimeOffset.FromUnixTimeSeconds(Timestamp).DateTime Convert Unix Timestamp to DateTime in C#
DATEADD(s, CAST(Timestamp as float), '1970-01-01') Convert Unix Timestamp to DateTime in SQL Server
CAST(Timestamp as datetime2) Convert Unix DateTime to DateTime2 in SQL Server
(Get-Date -Date "1970-01-01 00:00:00Z").toUniversalTime().addSeconds(1704272015) Convert Unix Timestamp to DateTime in PowerShell

References (Timestamp & DateTime)

⚠️ **GitHub.com Fallback** ⚠️