Setting Linux cshrc

在Linux环境中,配置cshell的环境变量主要通过编辑.cshrc文件。用户可以创建.cshrc.user文件来存放个人配置,并通过source命令引入。文章介绍了如何设置环境变量,如P4DIFF,以及定制命令行提示符。此外,还展示了如何创建命令别名,如cd、ls和gvim的快捷方式。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >


前言

        进入Linux环境后,需要设置c shell的环境变量,则需要配置cshrc。也可以在其中设置一些命令。cshrc为 C Shell Run Commamds的简写。


一、cshrc在哪里?

        使用命令<cd> ,可以到用户根目录下面,然后<gvim ~/.cshrc>打开。

二、设置内容

1.个人配置建议单独放在一个文件

        在用户根目录下面新建一个文件为 .cshrc.user ,并在.cshrc文件中source,如下:

        source ~/.cshrc.user

2. 设置环境变量

        可以在 .cshrc或者 .cshrc.user中设置环境变量,例如:

        setenv P4DIFF bcompare

        setenv P4DIFF tkdiff

3. 设置命令行提示符

        set prompt="%B%n@%m[%/] ->"

        set prompt="${system} : ${cwd}[ \~ ] -->"

4. 映射命令

        alias setprompt 'set prompt="[%n@%m: %c] [%h] -->" '

        alias cd 'chdir \!* && setprompt'

        alias c 'cd ../'

        alias ls 'ls -GF --color-auto'

        alias g 'gvim'

        alias sc 'source ~/.cshrc'

        alias gc 'gvim ~/.cshrc.user'

        alias gcl 'gvim /home/exxx/commandlines'

        alias a alias

### WRF Model Environment Variable Configuration in Intel Environment For configuring the environment variables required by the WRF (Weather Research and Forecasting) model within an Intel environment, ensuring these settings persist across sessions involves modifying shell profile files or using specific scripts tailored for the setup. To make sure that the environment variables are permanently set, one should add them to initialization files such as `.bash_profile`, `.bashrc` for Bash users, or equivalent files like `.cshrc`, `.profile` depending on the shell being used[^2]. For instance, when working with a Linux system under the Intel compiler suite, adding lines similar to those below into the appropriate file ensures necessary configurations: ```bash export PATH=/opt/intel/bin:$PATH source /opt/intel/mkl/bin/mklvars.sh intel64 source /opt/intel/compilers_and_libraries/linux/bin/compilervars.sh intel64 ``` These commands adjust the `PATH` so that Intel binaries can be located easily while sourcing additional scripts provided by Intel sets up library paths needed for compiling applications against MKL libraries among others. After editing any of these startup files, either restarting the terminal session or executing `source ~/.bashrc` (or corresponding command based on which file was edited) applies changes immediately without needing to log out and back in again. Verifying whether custom environment variables have been successfully added after setting them through methods mentioned above can utilize tools like `printenv`. Commands such as `printenv DIR` or `printenv EXAMPLE` display values assigned specifically to `DIR` or `EXAMPLE`; similarly checking other defined variables confirms their presence and correctness[^1]. --related questions-- 1. What are common issues encountered during WRF compilation with Intel compilers? 2. How does one verify successful installation of Intel Parallel Studio XE components? 3. Can you provide tips for optimizing performance when running WRF simulations using Intel hardware? 4. Are there alternative ways besides modifying dotfiles to manage environment variables more dynamically?
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值