You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

SLURM集群中source ~/.bashrc后命令全失效的问题及解决

Fixing "command not found" Errors After Adding BWA Path to ~/.bashrc on SLURM Clusters

I recently ran into a frustrating issue when trying to add the BWA tool's path to my ~/.bashrc on a SLURM cluster—here's what happened and how I fixed it, along with the correct way to avoid this problem in the future.

The Problem

I edited my ~/.bashrc file to add BWA's path using:

export PATH=/path/to/bwa

After running source ~/.bashrc, every command I tried (like bwa, ls, cat, etc.) threw the error:

-bash: xxx: command not found

The root cause was obvious once I thought about it: I had completely overwritten the existing PATH variable instead of appending the new path to it. This wiped out all the global system paths that let the shell find basic commands.

Immediate Recovery

To get back access to all my commands right away, I sourced the global bash configuration files from /etc:

source /etc/bashrc
source /etc/profile

This restored the original global PATH settings, and all commands started working again immediately.

Correct Way to Add BWA Path

Instead of replacing PATH, append the new directory to the existing variable. Edit your ~/.bashrc with this line instead:

export PATH=$PATH:/path/to/bwa

The $PATH preserves all existing paths, and we just add the BWA directory at the end (you can put it at the start if you want priority over system versions, but the end is safer for avoiding unintended conflicts).

After making this change, run source ~/.bashrc again, and you'll have access to BWA without breaking any other commands.

内容的提问来源于stack exchange,提问作者Some student

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.14 06:29:00