{"id":137927,"date":"2021-12-03T15:13:13","date_gmt":"2021-12-03T20:13:13","guid":{"rendered":"http:\/\/www.bu.edu\/tech\/?page_id=137927"},"modified":"2024-09-04T15:38:53","modified_gmt":"2024-09-04T19:38:53","slug":"configuring-environment","status":"publish","type":"page","link":"https:\/\/www.bu.edu\/tech\/support\/research\/system-usage\/scc-environment\/configuring-environment\/","title":{"rendered":"Configuring your Environment"},"content":{"rendered":"<p>This page has instructions for various tasks you might wish to do to customize your environment or perform a few other common tasks under the Linux operating system running on the Shared Computing Cluster (SCC).<\/p>\n<h4>Topics<\/h4>\n<ul>\n<li><a href=\"#PROJECT\">Setting default project<\/a><\/li>\n<li><a href=\"#SHELL\">Changing your shell<\/a><\/li>\n<li><a href=\"#DOTFILES\">Basic dotfiles<\/a><\/li>\n<li><a href=\"#FORWARD\">Setting up a .forward file<\/a><\/li>\n<li><a href=\"#ENVIRONMENT\">Setting environment variables<\/a><\/li>\n<li><a href=\"#PATH\">Adding items to your path<\/a><\/li>\n<li><a href=\"#ALIAS\">Create shortcuts with the \u2018alias\u2019 command<\/a><\/li>\n<li><a href=\"#ADDITIONAL\">Additional help\/documentation<\/a><\/li>\n<\/ul>\n<h4>Setting default project <a name=\"PROJECT\" id=\"PROJECT\" href=#PROJECT style=\"text-decoration:none;\">&#x1F517;<\/a><\/h4>\n<p>Each account on the system has an assigned default Project. Any computing resources you use will be applied to it. You can see the list of projects that you belong to by typing <code><span class=\"command\">groups<\/span><\/code> on the command line. The first one listed is your default project. Note that Projects are implemented as Linux groups.<\/p>\n<p>Four ways to control your default project:<\/p>\n<ol>\n<li>When you submit a job you can override the default by using the <code>-P <span class=\"placeholder\">projectname<\/span><\/code> flag.<\/li>\n<li>For frequent use, you can include <code>-P <span class=\"placeholder\">projectname<\/span><\/code> line in the <a href=\"https:\/\/www.bu.edu\/tech\/support\/research\/system-usage\/running-jobs\/advanced-batch\/#sge_request\"><strong>.sge_request<\/strong> file<\/a> in your home directory.<\/li>\n<li>You can change the project for the current session by typing <code><span class=\"command\">newgrp<\/span> <span class=\"placeholder\">projectname<\/span><\/code> on the command line.<\/li>\n<li>You can permanently change your default project on your individual <a href=\"https:\/\/acct.bu.edu\/cgi-bin\/perl\/secure\/redirect.pl\">Research Computing User Information<\/a> page. Your default project will be changed the next time the system configuration files are updated, generally overnight.<\/li>\n<\/ol>\n<h4>Changing your shell <a name=\"SHELL\" id=\"SHELL\" href=#SHELL style=\"text-decoration:none;\">&#x1F517;<\/a><\/h4>\n<p>New accounts on the SCC are currently set to use the <b>bash<\/b> shell . You can switch to the <b>tcsh<\/b> or <b>zsh<\/b> shell on your individual <a href=\"https:\/\/acct.bu.edu\/htbin\/perl\/secure_kerb\/change_shell.pl\">Change Shell Form<\/a><span>.<\/span> You can run the command <code><span class=\"command\">printenv SHELL<\/span><\/code> or <code><span class=\"command\">echo $SHELL<\/span><\/code> to see which shell you are using.<\/p>\n<h4>Basic dotfiles <a name=\"DOTFILES\" id=\"DOTFILES\" href=#DOTFILES style=\"text-decoration:none;\">&#x1F517;<\/a><\/h4>\n<p><em>Dotfiles<\/em> are special files and directories in your home directory, with names starting with the dot\/period (<b>.<\/b>) character. These files generally control your environment, for example setting environment variables such as your <a href=\"#PATH\">PATH<\/a>.<\/p>\n<p>The content of the <em>dotfiles<\/em> (such as <strong>.bashrc, .cshrc, or .login<\/strong>) are set to reasonable defaults for new accounts and you should be very careful in modifying them as it can lead you to being unable to log in to the system or cause other major difficulties using your account. If by any chance you delete or corrupt one of your <em>dotfiles<\/em>, you can run the command <code><span class=\"command\">dotfiles<\/span><\/code> to back up your existing <em>dotfiles<\/em> and install new <em>dotfiles<\/em> which should provide you with a good, basic working environment.<\/p>\n<ul>\n<li><b><i>bash users -&gt; <\/i><\/b><code>.bashrc<\/code> &#8211; This file is usually the one which is modified, for bash shell users, to change your <a href=\"#PATH\"><code>PATH<\/code><\/a> or set <a href=\"#ENVIRONMENT\">other environment variables<\/a>.<\/li>\n<li><b><i>tcsh users -&gt; <\/i><\/b><code>.cshrc<\/code> &#8211; This file is used just like its bash equivalent .bashrc for tcsh users. This file could also be named <b>.tcshrc<\/b>.<\/li>\n<li><b><i>zsh users -&gt; <\/i><\/b><code>.zshrc<\/code> &#8211; This file is used just like its bash equivalent .bashrc for zsh users.<\/li>\n<li><b><i>all users -&gt; <\/i><\/b><code>.forward<\/code> &#8211; This file is used to forward your email and is explained in <a href=\"https:\/\/www.bu.edu\/tech\/support\/research\/system-usage\/scc-environment\/configuring-environment\/#FORWARD\">Setting up a .forward file<\/a> section.<\/li>\n<\/ul>\n<h4>Setting up a .forward file <a name=\"FORWARD\" id=\"FORWARD\" href=#FORWARD style=\"text-decoration:none;\">&#x1F517;<\/a><\/h4>\n<p>Your <code>.forward<\/code> file contains an email address that is used to forward emails sent to <code><span class=\"placeholder\">your_login_name<\/span><span class=\"command\">@scc.bu.edu<\/span><\/code>, for example emails related to your batch jobs. By default this email is set to be your @bu.edu BU email address.<\/p>\n<p>If you are not receiving emails going to <code><span class=\"placeholder\">your_login_name<\/span><span class=\"command\">@bu.edu<\/span><\/code>, or you would like to get them at a different address, you have a different issue. Please follow these instructions on <a href=\"https:\/\/www.bu.edu\/tech\/services\/cccs\/email\/forwarding\/\">how to use BU&#8217;s email forwarding tools<\/a>.<\/p>\n<h4>Setting environment variables <a name=\"ENVIRONMENT\" id=\"ENVIRONMENT\" href=#ENVIRONMENT style=\"text-decoration:none;\">&#x1F517;<\/a><\/h4>\n<p>Environment variables are named values, stored within the system and used by applications. They allow you to customize how the system works and how applications behave on the system. For example, the variable <code>HOSTNAME<\/code> is usually set to indicate the name of the system you are on, such as <code><span class=\"command\">scc1<\/span><\/code>. All environment variables have names in ALL CAPS and you can get a list of all the environment variables you currently have set in your current shell by issuing the command <code><span class=\"command\">printenv<\/span><\/code>. You can set an environment variable or assign a new value to an existing environment variable. For example, to change the default editor in your current shell to <code><span class=\"command\">emacs<\/span><\/code>, execute:<\/p>\n<pre class=\"code-block\"><code><i><b>bash and zsh shell -&gt;<\/b><\/i>  <span class=\"prompt\">scc1% <\/span><span class=\"command\">export EDITOR='<\/span><span class=\"placeholder\">\/usr\/local\/bin\/emacs<\/span><span class=\"command\">'<\/span>\r\n<i><b>tcsh shell -&gt;<\/b><\/i>  <span class=\"prompt\">scc1% <\/span><span class=\"command\">setenv EDITOR<\/span> <span class=\"placeholder\">\/usr\/local\/bin\/emacs<\/span><\/code><\/pre>\n<p>If you often need to set a given environment variable , you may want to add the appropriate <code><span class=\"command\">export<\/span><\/code> or <code><span class=\"command\">setenv<\/span><\/code> command to one of your dotfiles, such as your <code>.bashrc<\/code> or <code>.cshrc<\/code>. If you do this, the variable will be set every time you open a new shell. However, if you wish to immediately take advantage of this change without logging out or starting a new shell, execute <code><span class=\"command\">source<\/span> .bashrc<\/code> or <code><span class=\"command\">source<\/span> .cshrc<\/code>.<\/p>\n<h4>Adding items to your path <a name=\"PATH\" id=\"PATH\" href=#PATH style=\"text-decoration:none;\">&#x1F517;<\/a><\/h4>\n<p>PATH is an environmental variable that tells the shell which directories to search in for a command or an executable file. If the system returns a message saying &#8220;<code><span class=\"placeholder\">command<\/span>: <span class=\"output\">Command not found<\/span><\/code>&#8220;, that indicates that either the command doesn&#8217;t exist at all on the system or it is not in your path. For example, to run <code><span class=\"placeholder\">exampleapp<\/span><\/code>, you need to directly specify the path to your application: <code><span class=\"placeholder\">\/path\/to\/your\/app\/exampleapp<\/span><\/code> or you need to have the directory <code><span class=\"placeholder\">\/path\/to\/your\/app\/<\/span><\/code> in your path:<\/p>\n<pre class=\"code-block\"><code><i><b>bash and zsh users -&gt;<\/b><\/i>  <span class=\"prompt\">[scc1 ] <\/span><span class=\"command\">export PATH=$PATH:<\/span><span class=\"placeholder\">\/path\/to\/your\/app\/<\/span>\r\n<i><b>tcsh users -&gt;<\/b><\/i>  <span class=\"prompt\">scc1% <\/span><span class=\"command\">set<\/span> path=($path <span class=\"placeholder\">\/path\/to\/your\/app\/<\/span>)<\/code><\/pre>\n<p>Also, note that the order in which items appear in your path is important as, if two items have the same name, the one which is in the directory appearing earliest in your path will be executed.<be><br \/>\n<\/be><\/p>\n<p>You can add path changing commands to your dotfiles, such as your <code>.bashrc<\/code> or <code>.cshrc<\/code>, so that you do not have to change your path manually every time you log in. A good practice is to put the most important directories towards the front of your path (examples: <code>\/bin<\/code>, <code>\/usr\/bin<\/code>, <code>\/usr\/local\/bin<\/code>) and your current directory ( <code>.<\/code> ) and application-specific directories towards the end of your path.<\/p>\n<h4>Create shortcuts with the \u2018alias\u2019 command <a name=\"ALIAS\" id=\"ALIAS\" href=#ALIAS style=\"text-decoration:none;\">&#x1F517;<\/a><\/h4>\n<p>The <code><span class=\"command\">alias<\/span><\/code> command can be used to create an easy to type shortcut for long and\/or frequently used commands. This is a convenient tool for avoiding errors and saving typing. To make aliases permanent, add them to your <code>.bashrc<\/code> file:<\/p>\n<pre class=\"code-block\"><code><span class=\"comment\"># create an alias to change directory to a project subdirectory<\/span>\r\n<span class=\"command\">alias<\/span> cdwd=\"cd <span class=\"placeholder\">\/restricted\/projectnb\/myproject\/myspace<\/span>\"\r\n\r\n<span class=\"comment\"># create a convenient shortcut to give a detailed list of all files in a directory<\/span>\r\n<span class=\"command\">alias<\/span> dir=\"ls -laF\"<\/code><\/pre>\n<h4>Additional help\/documentation <a name=\"ADDITIONAL\" href=#ADDITIONAL style=\"text-decoration:none;\">&#x1F517;<\/a><\/h4>\n<p>If you have problems or questions about any of this, please send email to <a href=\"mailto:help@scc.bu.edu\">help@scc.bu.edu<\/a>.<\/p>\n<p>We also have a <a href=\"https:\/\/www.bu.edu\/tech\/support\/research\/training-consulting\/access-training-materials\/\">tutorial on Linux<\/a> which we generally offer <a href=\"https:\/\/www.bu.edu\/tech\/about\/training\/classroom\/rcs-tutorials\/\">live<\/a> three times a year but for which the video and slides are always available.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This page has instructions for various tasks you might wish to do to customize your environment or perform a few other common tasks under the Linux operating system running on the Shared Computing Cluster (SCC). Topics Setting default project Changing your shell Basic dotfiles Setting up a .forward file Setting environment variables Adding items to&#8230;<\/p>\n","protected":false},"author":1692,"featured_media":0,"parent":137925,"menu_order":1,"comment_status":"closed","ping_status":"closed","template":"","meta":[],"_links":{"self":[{"href":"https:\/\/www.bu.edu\/tech\/wp-json\/wp\/v2\/pages\/137927"}],"collection":[{"href":"https:\/\/www.bu.edu\/tech\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.bu.edu\/tech\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.bu.edu\/tech\/wp-json\/wp\/v2\/users\/1692"}],"replies":[{"embeddable":true,"href":"https:\/\/www.bu.edu\/tech\/wp-json\/wp\/v2\/comments?post=137927"}],"version-history":[{"count":26,"href":"https:\/\/www.bu.edu\/tech\/wp-json\/wp\/v2\/pages\/137927\/revisions"}],"predecessor-version":[{"id":154086,"href":"https:\/\/www.bu.edu\/tech\/wp-json\/wp\/v2\/pages\/137927\/revisions\/154086"}],"up":[{"embeddable":true,"href":"https:\/\/www.bu.edu\/tech\/wp-json\/wp\/v2\/pages\/137925"}],"wp:attachment":[{"href":"https:\/\/www.bu.edu\/tech\/wp-json\/wp\/v2\/media?parent=137927"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}