Your Basic Environment
Goal: Demonstrate what a default session starts as.
- 1 Bash
- 2 Environment Variables
- 3 Keep an Eye on the Message of the Day
- 4 Forgot Which Projects You’re In? What’s My Storage Use?
- 5 Help and Manual Pages
- 6 Are There Compilers and Languages Available?
- 7 Let's run a Python script:
- 8 Let’s Run an R Script
- 9 You Can’t Break the System
- 10 What is sudo? Can I use/request sudo?
Bash
Bash is command-line shell and scripting language that allows users to interact with Unix-based operating systems.
[]$ bash --version
GNU bash, version 5.1.8(1)-release (x86_64-redhat-linux-gnu)
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Environment Variables
An environment variable is a user/system defined value that can read by users/scripts/applications, and be used to affect/influence how something can/should behave.
Lets list everything that the session is currently aware of - there’s a lot!
This demonstrates that there is a lot of things being defined and configured, behind the scenes, to make your session run as required.
[]$ env
You can view individual environment variables:
[]$ echo $PATH
# Something of the form:
/home/<username>/.local/bin:/home/<username>/bin:/apps/s/arcc/1.0/bin:/apps/s/slurm/latest/bin:/usr/share/Modules/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin
Keep an Eye on the Message of the Day
This does get updated and details office hours and important messages.
__ ___ ___ _ ____
/ |/ /__ ____/ (_)____(_)___ ___ / __ )____ _ __
/ /|_/ / _ \/ __ / / ___/ / __ \/ _ \ / __ / __ \ | /| / /
/ / / / __/ /_/ / / /__/ / / / / __/ / /_/ / /_/ / |/ |/ /
/_/ /_/\___/\__,_/_/\___/_/_/ /_/\___/ /_____/\____/|__/|__/
---------------------------------- Need Help? ----------------------------------
Check out the ARCC Wiki for more information at https://arccwiki.atlassian.net/
Alternatively, you can e-mail arcc-help@uwyo.edu with any questions.
UW ARCC has office hours-weekly over zoom at https://bit.ly/3BgoGfS
Office hours are 11am-1pm, every Tuesday and 12-2pm Wednesdays. If you need
help but can't make it, email us @ the address above.
See more at https://bit.ly/42NGhHN
--------------------------------------------------------------------------------
>>>> Important Messages <<<<
No important messages.
Forgot Which Projects You’re In? What’s My Storage Use?
At the start of each new session, the arccquota
command will be displayed.
Are you running out of storage?
+----------------------------------------------------------------------+
| arccquota | Block |
+----------------------------------------------------------------------+
| Path | Used Limit % |
+----------------------------------------------------------------------+
| /home/<username> | 08.57 GB 50.00 GB 17.14 |
| /gscratch/<username> | 00.00 GB 05.00 TB 00.00 |
| /project/<project01> | 59.63 GB 100.00 TB 00.06 |
| /project/<project02> | 00.00 GB 05.00 TB 00.00 |
+----------------------------------------------------------------------+
Notice: This lists your associated storage across the File System: Your:
/home/<username>/
/gscratch/<username>/
/projects/<project-name>/
Help and Manual Pages
Manual pages for commands are available on the login nodes.
[]$ man ls
LS(1) User Commands LS(1)
NAME
ls - list directory contents
SYNOPSIS
ls [OPTION]... [FILE]...
DESCRIPTION
List information about the FILEs (the current directory by default).
Sort entries alphabetically if none of -cftuvSUX nor --sort is specified.
Clusters are updated during maintenance periods and some aspects can change.
With this in mind, man
pages might/might not be available on the compute nodes.
Are There Compilers and Languages Available?
Let’s check what’s on the system:
GCC stands for GNU Compiler Collection, a free and open-source collection of compilers and development tools that support many programming languages, hardware architectures, and operating systems.
[]$ which gcc
/usr/bin/gcc
[]$ gcc --version
gcc (GCC) 11.4.1 20230605 (Red Hat 11.4.1-2)
Let’s look at Python:
[]$ which python
/usr/bin/python
[]$ python --version
Python 3.9.18
Let's run a Python script:
Within your home, create an intro_to_modules
folder and write into it the python01.py
file:
# Create a folder in your home folder:
[]$ cd
[~]$ mkdir intro_to_modules
[~]$ cd intro_to_modules/
[intro_to_modules]$ ls
[intro_to_modules]$
[intro_to_modules]$ pwd
/home/<username>/intro_to_modules
[intro_to_modules]$ vim python01.py
Using vim
(or some other text editor) create a file called python01.py
and enter the following:
Press
ESC
followed byi
to INSERT: Start typing.Press
ESC
followed by:wq
then Return to save the file.
import sys
print("Python version: " + sys.version)
print("Version info: " + sys.version_info)
Let's run a Python script: Fixed:
Try running the Python code:
[]$ python python01.py
Python version: 3.8.16 (default, May 31 2023, 12:44:21)
[GCC 8.5.0 20210514 (Red Hat 8.5.0-18)]
Traceback (most recent call last):
File "python01.py", line 3, in <module>
print("Version info: " + sys.version_info)
TypeError: can only concatenate str (not "sys.version_info") to str
Update the python01.py
file:
From: print("Version info: " + sys.version_info)
To: print("Version info: " + str(sys.version_info))
Now try running again:
[]$ python python01.py
Python version: 3.9.18 (main, Jan 4 2024, 00:00:00)
[GCC 11.4.1 20230605 (Red Hat 11.4.1-2)]
Version info: sys.version_info(major=3, minor=9, micro=18, releaselevel='final', serial=0)
Let’s Run an R Script
Let’s check what’s on the system:
[]$ which R
/usr/bin/which: no R in (/apps/s/arcc/1.0/bin:/apps/s/slurm/latest/bin:/home/<username>/.local/bin:/home/<username>/bin:/usr/share/Modules/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin)
Is it case-sensitive?
[]$ which r
/usr/bin/which: no r in (/apps/s/arcc/1.0/bin:/apps/s/slurm/latest/bin:/home/<username>/.local/bin:/home/<username>/bin:/usr/share/Modules/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin)
R is not available on the system by default.
But I want to use R. What can I do?
This is the reason for this module. To demonstrate how you setup your environment to make things available to you.
You Can’t Break the System
Try removing something that you do not have permissions to delete:
[]$ ls /usr/bin
[]$ cd /usr/bin
[bin]$ ls
[]$ pwd
/usr/bin
[bin]$ ls -al
[bin]$ ls -al python*
[bin]$ rm python
rm: cannot remove 'python': Permission denied
Check and confirm by looking at the permissions (ugo:rwx
) and Ownership (user:group
).
What do you notice?
What is sudo
? Can I use/request sudo
?
The sudo
command ("superuser do") , is a command to allow a user to temporarily elevate their privileges to run commands that are usually restricted.
sudo: you will not be granted sudo access – do not ask!
Similarly:
You can not use dnf
or other Linux related software management commands you might come across yum
, apt-get
…
You won’t have permissions, and we will not provide you permission - do not ask!