env
enter a sh session which has customer's environment
env - `cat ~/customer` /bin/sh
Date
date +%Y%m%d
20170831
date --date="1 day ago" +%F
2017-08-30
Mount
list device mount status
mount -l
mount all according to /etc/fstab
mount -a
umount
mount ${mount_point}
mount windows share folder with specific user by /etc/fstab
//${win_ip}/${share_name} /${local_mnt_point} cifs username=${share_user},password=${share password},uid=${local_user_id},gid=${local_group_id} 0 0
e.g.
//192.168.0.83/sync /mnae/m11_sync cifs username=mount_user,password=1234,uid=501,gid=501 0 0
Ulimit - Increase The Maximum Number Of Open Files / File Descriptors (FD)
User Level FD Limits
reboot required.
# /etc/security/limits.conf elk soft nofile 65536 elk hard nofile 65536# Ubuntu /etc/pam.d/common-session session required pam_limits.socheck setting
ulimit -Hn ulimit -Sn
Awk
insert an new column before the 1st field
awk -F'\t' '{$1="NewField" FS $1;}1' OFS='\t' ol.tsv
where,
- FS - Input field separator
- OFS - output field separator
- $1 - 1st field
chkconfig
To list the auditd service.
chkconfig --list google-fluentdTo turn auditd off in runlevels 3, 4, and 5.
chkconfig --level 2345 google-fluentd off
ssh-copy-id
copy public key into a remote machine's authorized_keys
ssh-copy-id -i ~/.ssh/id_rsa.pub $user@$domain
iconv
file character encoding converter.
convert a text file from big5 character encoding to utf8
iconv -f BIG5 -t UTF-8 big5.txt -o utf8.txt
iptables
redirect port 80 traffic to port 8080
iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 8080