Linux 延时执行命令

一、目标需求

让 Linux 在 5 秒后执行指定命令,并且立即返回,不阻塞当前终端。


二、常见实现方式

✅ 方法 1:子 Shell + sleep(最常用)

( sleep 5; your_command ) &

📌 特点


✅ 方法 2:使用 at 命令

echo "your_command" | at now + 5 seconds

📌 特点