Basic Shell Commands
Common Shell Commands Collection
Quick File Writing
- Method One
cat > a.txt << 'EOF'
afasdf
EOF
- Method Two
tee a.txt <<- 'EOF'
afsafdsf
EOF
Linux System Scheduled Network Time Synchronization
# Set scheduled task
crontab -e
*/5 * * * * ntpdate time.nist.gov
# View scheduled task list
crontab -l
# View scheduled task logs
tail -f /var/log/cron
# Several time servers
ntpdate time.nist.gov
ntpdate time.nuri.net
ntpdate 0.asia.pool.ntp.org
ntpdate 1.asia.pool.ntp.org
ntpdate 2.asia.pool.ntp.org
ntpdate 3.asia.pool.ntp.org
Crontab scheduled task parameter meanings
Field | Required | Allowed Values | Allowed Special Characters | Notes |
---|---|---|---|---|
Seconds | Yes | 0–59 | *``,``- | Standard implementation does not support this field. |
Minutes | Yes | 0–59 | *``,``- | |
Hours | Yes | 0–23 | *``,``- | |
Day of month | Yes | 1–31 | *``,``-``?``L``W | ?``L``W are only implemented by some software |
Month | Yes | 1–12 or JAN–DEC | *``,``- | |
Day of week | Yes | 0–7 or SUN–SAT | *``,``-``?``L``# | ?``L``# are only implemented by some software. Linux and Spring allow 0-7, where 0 and 7 are Sunday. Quartz allows 1-7, where 1 is Sunday |
Year | No | 1970–2099 | *``,``- | Standard implementation does not support this field. |
VMware Network Setup
Note: It's best to use VMware 15, VMware 16 version seems to have network issues.
Query Current Folder Total Size
du -sh ./
Query Current Directory Structure First n Level Directory Tree
Display first level directory for /d %i in (*) do @echo %i
Install lrzsz
yum install -y lrzsz
sz download, rz upload
Linux Kill Java Process
kill -9 $(ps -ef | grep -w "xxx-1.0.jar" | grep -v "grep" | awk '{print $2}')