Linux command notes - lyonwang/TechNotes GitHub Wiki
How Do I Find Out My Linux Distribution name and version
[lyonwang@UAT-Graylog ~]$ cat /etc/*-release
CentOS Linux release 7.2.1511 (Core)
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"
CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"
CentOS Linux release 7.2.1511 (Core)
CentOS Linux release 7.2.1511 (Core)
How Do I Find Out My Kernel Version?
[lyonwang@UAT-Graylog ~]$ uname -a
Linux UAT-Graylog 3.10.0-327.el7.x86_64 #1 SMP Thu Nov 19 22:10:57 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
How Do I Find Out My Linux Kernel version and GCC version used to build?
[lyonwang@UAT-Graylog ~] cat /proc/version
Linux version 3.10.0-327.el7.x86_64 ([email protected]) (gcc version 4.8.3 20140911 (Red Hat 4.8.3-9) (GCC) ) #1 SMP Thu Nov 19 22:10:57 UTC 2015
How Do I Install Package for CentOS?
yum install perf
How CentOS 7 add user with sudo permission?
sudo adduser mynewuser
sudo passwd mynewuser
sudo visudo
mynewuser ALL=(ALL) ALL
How to increase centos 7 system/process(service) open file limit?
System
- check
sudo ulimit -a
- modify no persistent
sudo ulimit -HSn 102400
- modify with persistent (/etc/security/limits.conf add the following lines)
soft nofile 102400
hard nofile 102400
Increase open file limits in linux
Process or service
- check
sudo cat /proc/[process id]/limits
or
ls -l /proc/[process id]/fd | wc -l
- modify process get process id
sudo ps -ef | grep [process name]
modify by gdb (sudo gdb -p [process id])
(gdb) set $rlim = &{0ll, 0ll}
# the number 7 here is important. (the 7th item in check step)
(gdb) print getrlimit(7, $rlim)
(gdb) print *$rlim
# update the value retrieved above with getrlimit
(gdb) set *$rlim[0] = 40960
(gdb) print *$rlim
(gdb) print setrlimit(7, $rlim)
modify service add LimitNOFILE (sudo vim /usr/lib/systemd/system/[service name].service) and retart service
[Unit]
Description=...
After=network.target
[Service]
Restart=always
ExecStart=...
LimitNOFILE=40960
[Install]
WantedBy=multi-user.target