How to know CPU info
cat /proc/cpuinfo
arch
How to know memory info:
cat /proc/meminfo
or
sudo dmidecode -t memory
free
How to know Linux release info
CentOS:
vim /etc/redhat-release
How to check if Mysql running?
sudo netstat -tap | grep mysql
How to check if one pkg is installed?
dpkg -l | grep mysql
How to check linux version
redhat: rpm -q redhat-release-server
How to check free disk space
df -h
How to check size of folder
[mashuai191@instance-1 ~]$ sudo du -h --max-depth=1 /home/
5.6G / home / mashuai191
4.1G / home / rsa-key-20190322mashuai191
9.6G / home /
Get the most CPU resources 10 processes under linux, you can use the following command combinations:
ps aux|head -1;ps aux|grep -v PID|sort -rn -k +3|head
To get the most memory resources 10 processes under linux, you can use the following command combinations:
ps aux|head -1;ps aux|grep -v PID|sort -rn -k +4|head
Network config:
Config hostname:
Redhat:
hostname xxx
Start to take effect, modify / etc / sysconfig / network
extract rpm into one directory
rpm2cpio logrotate-1.0-1.i386.rpm | cpio -ivd
Add date for created file
cp /etc/login.defs /etc/login.defs.`date +"%Y%m%d"`
vi copies of all
gg"+yG
man distortion output to a file, solution follows
man command | col -b >/home/command.txt
CentOS win7 shared access
mount -t cifs -o sec=ntlm, password="" //10.200.78.2/f /home/mashuai/A_B_port/team_share_drive
user login history:
who /var/log/wtmp
last
-w full username/domain
Find hang process:
ps aux | grep -w 'D'
Redirect prints
- ]$ cmd 2>/dev/null, redirect stderr to null
-
]$ cmd 2>&1 1>/dev/null, Capturing STDERR only
CentOS
package:
yum install docker-ce
yum list docker-ce.x86_64 --showduplicates
yum remove docker-ce
systemctl start docker
bash stint with the welcome message: / etc / issue, / etc / motd
Login bash to read the file
- / Etc / profile: This is the overall system configuration, you should not modify this file; it will call / etc / inputrc, /etc/profile.d/*.sh, / etc / sysconfig / i18n
- ~ / .Bash_profile or ~ / .bash_login or ~ / .profile: belongs to the user's personal configuration, you have to change your own data, is written here! In fact, the login shell bash configuration wherein a read only three documents above is sequentially read in the order above. Therein will call ~ / .bashrc
Non-Login bash to read the file
~/.bashrc
su command
su using non-login way to become root, or the previous user's environment variables
su - to become root login mode, switched to the environment variables of the root
netstat
The computer network port detection
traceroute
Multi-machine network detection