Skip to content

Instantly share code, notes, and snippets.

@whizzalan
Created March 26, 2017 14:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save whizzalan/358f3f3e9ec3b4330b5dbf2d2bf6fe97 to your computer and use it in GitHub Desktop.
Save whizzalan/358f3f3e9ec3b4330b5dbf2d2bf6fe97 to your computer and use it in GitHub Desktop.

Arch or Linux 常用指令

tags: Linux, arch

System

check linux

  • lsb_release -a
  • uname -a (Print all Information),有時候覺得不是很詳細
  • cat /etc/*-release (GCE Check CentOS Version)

cpu

  • lscpu
  • nproc --all
  • cat /proc/cpuinfo

mem

  • free -h
  • free -m
  • cat /proc/meminfo

about Network

https://www.linuxtrainingacademy.com/linux-ip-command-networking-cheat-sheet/?utm_content=educational&utm_campaign=2017-03-21&utm_source=email-sendgrid&utm_term=278531&utm_medium=755984

Cloud System

GCE

root Access

vim /etc/ssh/sshd_config
# PermitRootLogin yes
# PasswordAuthentication yes
service sshd restart

ssh IDENTIFICATION HAS CHANGED

ssh-keygen -R <伺服器端的IP或網址>

ssh keygen 每台彼此互通 https://www.digitalocean.com/community/tutorials/how-to-set-up-ssh-keys--2

  • 先在第一台建立 sshkey: ssh-keygen -t rsa
  • 必須要複製第一台的 id_rsa 到每一台 .ssh/ 下面
# only first one
ssh-keygen -t rsa

ssh-copy-id -i .ssh/id_rsa.pub dn01
scp .ssh/id_rsa  dn01:~/.ssh/

mount iso

gcsfuse  <bucket-Name> /path/to/<mount-directory>
mount -t iso9660 -o loop /<.iso-directory> /mnt/myiso

Disk

http://blog.fens.me/linux-fdisk/

The device presents a logical sector size that is smaller than the physical sector size. Aligning to a physical sector (or optimal I/O) size boundary is recommended, or performance may be impacted

fdisk -l
fdisk /dev/sda
# 更新内核分区表
partprobe
mkfs.ext3 /dev/sda2

awk & sed

  
# 10.140.0.2	nn01	nn01.hdp
# 10.140.0.3	nn02	nn02.hdp
# 10.146.0.5	dn01	nn03.hdp
# 10.146.0.4	dn02	dn02.hdp
# 10.146.0.2	dn03	dn03.hdp
 
cat /etc/hosts | sed -n '5,200p' | ssh dn03 "cat >> /etc/hosts"

SuSE

zypper: http://maxubuntu.blogspot.tw/2012/06/zypper.html

Network

Networks

rcnetwork status

Arch

  • 刪除套件dependencies pacman -Rsc package_name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment