Skip to main content

Basic Shell Commands

Common Shell Commands Collection

Quick File Writing

  1. Method One
	cat > a.txt << 'EOF'
afasdf
EOF
  1. Method Two
tee a.txt <<- 'EOF'
afsafdsf
EOF

Linux System Scheduled Network Time Synchronization

Reference Article

# 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

FieldRequiredAllowed ValuesAllowed Special CharactersNotes
SecondsYes0–59*``,``-Standard implementation does not support this field.
MinutesYes0–59*``,``-
HoursYes0–23*``,``-
Day of monthYes1–31*``,``-``?``L``W?``L``W are only implemented by some software
MonthYes1–12 or JAN–DEC*``,``-
Day of weekYes0–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
YearNo1970–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.

image-20211216221256892

image-20211216221335326

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

image-20240525230752153

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}')