Linux
useradd
sudo useradd <$name> -m -r -s /bin/bash -p <$password>
telnet
a command line interface for communication with a remote device or serve
telnet <$ip> <$port>
lsof (list as open files)
everything is a file
lsof <$option:value>
awk (Aho, Weinberger, and Kernighan [Names])
awk
is a scripting language used for manipulating data and generating reports.
# awk [params] 'script'
awk <$params> <$string_content>
ss (socket statistics)
view detailed information about your system’s network connections, including TCP/IP, UDP, and Unix domain sockets
ss [options]
clean files 3 days ago
find /aaa/bbb/ccc/*.gz -mtime +3 -exec rm {} \;
ssh without affect $HOME/.ssh/known_hosts
ssh -o "UserKnownHostsFile /dev/null" root@aaa.domain.com
ssh -o "UserKnownHostsFile /dev/null" -o "StrictHostKeyChecking=no" root@aaa.domain.com
sync clock
[yum|dnf] install -y chrony \
&& systemctl enable chronyd \
&& (systemctl is-active chronyd || systemctl start chronyd) \
&& chronyc sources \
&& chronyc tracking \
&& timedatectl set-timezone 'Asia/Shanghai'
set hostname
hostnamectl set-hostname develop
add remote key to other server
ssh -o "UserKnownHostsFile /dev/null" \
root@aaa.bbb.ccc \
"mkdir -p /root/.ssh && chmod 700 /root/.ssh && echo '$SOME_PUBLIC_KEY' \
>> /root/.ssh/authorized_keys && chmod 600 /root/.ssh/authorized_keys"
set -x
This will print each command to the standard error before executing it, which is useful for debugging scripts.
set -x
set -e
Exit immediately if a command exits with a non-zero status.
set -x
sed (Stream Editor)
sed <$option> <$file_path>
fdisk
list all disk
fdisk -l
create CFS file system
Use mkfs.xfs command to create xfs file system and internal log on the same disk, example is shown below:
mkfs.xfs <$path>
modprobe
program to add and remove modules from the Linux Kernel
modprobe nfs && modprobe nfsd
disown
disown
command in Linux is used to remove jobs from the job table.
disown [options] jobID1 jobID2 ... jobIDN
generate SSH key
ssh-keygen -t rsa -b 4096 -C "aaron19940628@gmail.com"
create soft link
sudo ln -sf <$install_path>/bin/* /usr/local/bin
append dir into $PATH (temporary)
export PATH="/root/bin:$PATH"
copy public key to ECS
ssh-copy-id -i ~/.ssh/id_rsa.pub root@10.200.60.53