Quick Reference Guide: Difference between revisions
No edit summary |
(→Linux) |
||
(5 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
=Linux= | =Linux= | ||
Below are the minimum Linux commands and shortcuts that you should know to do work on an HPC cluster. | Below are the minimum Linux definitions, commands, and shortcuts that you should know to do work on an HPC cluster. Some videos covering introductory Linux commands are available '''[https://kaltura.uga.edu/playlist/dedicated/176125031/1_uwkiealj/1_81u2kfi2 here]'''. | ||
==Definitions== | |||
1. '''Command''' - Word or letters typed into a terminal to make a computer do something. Executed by pressing enter after typing the command. | |||
2. '''Command line''' - Literally, the line on which your cursor is on in the terminal. Sometimes used to describe the whole experience of not a graphical user interface, i.e. "Command Line Interface" or "CLI". | |||
3. '''Command prompt''' - The text at the beginning of the command line, before your cursor. Typically [''username''@''computername'']. | |||
4. '''Directory''' - Another word for "Folder" (just like a folder in Windows or Mac). Often shortened to "dir" in commands, documentation, conversation, etc... | |||
5. '''Terminal''' - Category of software that allows you to interact with your computer via commands, and can allow you to connect to a remote computer (via a CLI). | |||
6. '''Path''' - The location of a file or directory. A series of subsequent directories to get to some file or directory. e.g., /home/john/file.txt | |||
7. '''First /''' (in a path) - The root directory, where everything starts in the Linux file system. | |||
8. '''Absolute path''' - a path that is written beginning with / (root) | |||
9. '''Relative path''' - a path that is written relative to some other directory (does not begin with /) | |||
10. (Command) '''Option''' - extra letter or word (-''SomeLetter'' or --''SomeWord'') put after a command to modify its behavior. | |||
---- | |||
==Commands== | ==Commands== | ||
<big>'''Getting Help'''</big> (most important) | <big>'''Getting Help'''</big> (most important) | ||
Line 34: | Line 56: | ||
| <code>less</code> || View the contents of a file (better for longer files) || <code>less slurm-42342.out</code> | | <code>less</code> || View the contents of a file (better for longer files) || <code>less slurm-42342.out</code> | ||
|- | |- | ||
| <code>cp</code> || Copy a file or files (<code>cp ''sourcepath(s) destinationpath</code>) || <code>cp /scratch/'''MyID'''/workdir/sub.sh /work/'''labgroup'''</code> | | <code>cp</code> || Copy a file or files (<code>cp ''sourcepath(s) destinationpath''</code>) || <code>cp /scratch/'''MyID'''/workdir/sub.sh /work/'''labgroup'''</code> | ||
|- | |||
| <code>mv</code> || Move a file or files (<code>mv ''sourcepath(s) destinationpath''</code>) || <code>mv /scratch/'''MyID'''/workdir/sub.sh /work/'''labgroup'''</code> | |||
|- | |- | ||
| <code>rm</code> || Remove a file or files || <code>rm oldfile.txt</code> | | <code>rm</code> || Remove a file or files || <code>rm oldfile.txt</code> | ||
|- | |- | ||
| <code>rm -r</code> || Remove a directory and '''all''' of its contents, recursively (starting with the last dir in the path)|| <code>rm -r /home/'''MyID'''/olddir</code> | | <code>rm -r</code> || Remove a directory and '''all''' of its contents, recursively (starting with the last dir in the path)|| <code>rm -r /home/'''MyID'''/olddir</code> | ||
|- | |||
| <code>dos2unix</code> || Removes DOS/Windows line endings in file || <code>dos2unix file.txt</code> | |||
|- | |||
| <code>mac2unix</code> || Removes Mac line endings in file. || <code>mac2unix file.txt</code> | |||
|- | |||
|} | |} | ||
<big>'''Software'''</big> | |||
{| class="wikitable" | |||
|- | |||
!Command!!Description!!Examples | |||
|- | |||
|<code>ml spider <software name></code>||See if a software is available, will also show you which versions are available||<code>ml spider Blast+</code> | |||
|- | |||
|<code>ml <software name></code>||Load a software module||<code>ml BLAST+/2.12.0-gompi-2020b</code> | |||
|- | |||
|} | |||
Also see the [[Software]] page and [[Frequently Asked Questions#Software|Software]] section of our FAQ. | |||
---- | ---- | ||
[[#top|Back to Top]] | [[#top|Back to Top]] | ||
==Shortcuts== | ==Shortcuts == | ||
'''Linux''' | '''Linux''' | ||
Line 48: | Line 89: | ||
{| class="wikitable" | {| class="wikitable" | ||
|- | |- | ||
! Shortcut !! Description | !Shortcut!! Description | ||
|- | |- | ||
| ctrl + l (lowercase L)|| Clear your terminal screen (scroll up to see previous output) | | ctrl + l (lowercase L)||Clear your terminal screen (scroll up to see previous output) | ||
|- | |- | ||
| up/down arrow keys || Cycle through previously entered commands | |up/down arrow keys||Cycle through previously entered commands | ||
|- | |- | ||
| | |tab||auto-complete a file or directory name when typing a path (tab tab if more than one file begins with the letters you've typed) | ||
|- | |- | ||
| | |esc, . (escape, then period)||Cycle through previous arguments to commands | ||
|- | |- | ||
| ctrl + c || Cancel typed text on the command line | |ctrl + w||Backspace typed text on the command line, one word at a time | ||
|- | |||
|ctrl + c|| Cancel typed text on the command line | |||
|- | |- | ||
|} | |} | ||
Line 66: | Line 109: | ||
{| class="wikitable" | {| class="wikitable" | ||
|- | |- | ||
! Shortcut !! Description | !Shortcut!!Description | ||
|- | |||
| shift + g ||Go to the end of file | |||
|- | |- | ||
| | |gg||Go to the beginning of file | ||
|- | |- | ||
| | | -N then enter ||Display/hide line numbers | ||
|- | |- | ||
| | |/''SomePattern''||Search forward through a file for ''SomePattern'' (/ then enter to keep searching forward for the same pattern) | ||
|- | |- | ||
| | |?''SomePattern''||Search backwards through a file for ''SomePattern'' (? then enter to keep searching forward for the same pattern) | ||
|- | |- | ||
| | |q ||Exit less | ||
|- | |- | ||
|} | |} | ||
---- | ---- | ||
[[#top|Back to Top]] | [[#top|Back to Top]] | ||
=Slurm= | =Slurm= | ||
Below are the minimum Slurm commands that you should know to do work on an HPC cluster. The first table are default Slurm commands. The next table are GACRC pre-formatted wrapper scripts of the Slurm commands to provide more information and flexibility. | Below are the minimum Slurm commands that you should know to do work on an HPC cluster. The first table are default Slurm commands. The next table are GACRC pre-formatted wrapper scripts of the Slurm commands to provide more information and flexibility. | ||
Line 88: | Line 133: | ||
'''Default Slurm Commands''' | '''Default Slurm Commands''' | ||
{| class="wikitable" | {| class="wikitable" | ||
! Command !! Description !! Examples | !Command!!Description!!Examples | ||
|- | |- | ||
| <code>sbatch</code> || Submit a submission script to the cluster|| <code>sbatch sub.sh</code> | |<code>sbatch</code>|| Submit a submission script to the cluster||<code>sbatch sub.sh</code> | ||
|- | |- | ||
| <code>squeue</code> || Check status currently running jobs (--me for only your jobs) || <code>squeue --me</code> | |<code>squeue</code>||Check status currently running jobs (--me for only your jobs)||<code>squeue --me</code> | ||
|- | |- | ||
| <code>sacct -X</code> || Check status of your jobs started since midnight of current day (-X for one line per job)|| <code>sacct -X</code> | |<code>sacct -X</code>||Check status of your jobs started since midnight of current day (-X for one line per job)||<code>sacct -X</code> | ||
|- | |- | ||
| <code>sacct -X -S yyyy-mm-dd</code> || Check status of your jobs since yyyy-mm-dd || <code>sacct -X -S 2021-10-20</code> | |<code>sacct -X -S yyyy-mm-dd</code>||Check status of your jobs since yyyy-mm-dd||<code>sacct -X -S 2021-10-20</code> | ||
|- | |- | ||
| <code>sacct -j ''jobID'' || Check status of a particular job || <code>sacct -j 234213</code> | |<code>sacct -j ''jobID'' ||Check status of a particular job||<code>sacct -j 234213</code> | ||
|- | |- | ||
| <code>scancel ''jobID'' || Cancel one of your running jobs || <code>scancel 456781</code> | |<code>scancel ''jobID'' ||Cancel one of your running jobs ||<code>scancel 456781</code> | ||
|- | |- | ||
| <code>sinfo</code> || Check the status of partitions || <code>sinfo -p batch</code> | |<code>sinfo</code>||Check the status of partitions||<code>sinfo -p batch</code> | ||
|- | |- | ||
|} | |} | ||
'''GACRC Slurm Commands''' | '''GACRC Slurm Commands''' | ||
{| class="wikitable" | {| class="wikitable" | ||
! Command !! Description/Slurm Equivalent !! Examples | !Command!!Description/Slurm Equivalent!!Examples | ||
|- | |- | ||
| <code>interact</code> || Start an interactive job. (Same as <code>qlogin</code> but with more flexibility) || <code>interact -c 4 --mem 10gb --time 01:00:00</code> | |<code>interact</code>||Start an interactive job. (Same as <code>qlogin</code> but with more flexibility)||<code>interact -c 4 --mem 10gb --time 01:00:00</code> | ||
|- | |- | ||
| <code>sq</code> || <code>squeue</code> || <code>sq --me</code> | |<code>sq</code>||<code>squeue</code>||<code>sq --me</code> | ||
|- | |- | ||
| <code>sacct-gacrc -X</code> || <code>sacct</code>|| <code>sacct-gacrc -X</code> | |<code>sacct-gacrc -X</code>||<code>sacct</code>||<code>sacct-gacrc -X</code> | ||
|- | |- | ||
|} | |} |
Latest revision as of 12:48, 6 March 2023
Linux
Below are the minimum Linux definitions, commands, and shortcuts that you should know to do work on an HPC cluster. Some videos covering introductory Linux commands are available here.
Definitions
1. Command - Word or letters typed into a terminal to make a computer do something. Executed by pressing enter after typing the command.
2. Command line - Literally, the line on which your cursor is on in the terminal. Sometimes used to describe the whole experience of not a graphical user interface, i.e. "Command Line Interface" or "CLI".
3. Command prompt - The text at the beginning of the command line, before your cursor. Typically [username@computername].
4. Directory - Another word for "Folder" (just like a folder in Windows or Mac). Often shortened to "dir" in commands, documentation, conversation, etc...
5. Terminal - Category of software that allows you to interact with your computer via commands, and can allow you to connect to a remote computer (via a CLI).
6. Path - The location of a file or directory. A series of subsequent directories to get to some file or directory. e.g., /home/john/file.txt
7. First / (in a path) - The root directory, where everything starts in the Linux file system.
8. Absolute path - a path that is written beginning with / (root)
9. Relative path - a path that is written relative to some other directory (does not begin with /)
10. (Command) Option - extra letter or word (-SomeLetter or --SomeWord) put after a command to modify its behavior.
Commands
Getting Help (most important)
Command | Description | Examples |
---|---|---|
command --help |
Print a commands help output to the terminal | ls --help
|
man command |
Read a command's manual (press q to exit) | man ls
|
Directories
Command | Description | Examples |
---|---|---|
ls |
List the contents of a particular directory (current dir if no path specified) | ls /scratch/MyID
|
mkdir |
Make a new directory at the specified path | mkdir /scratch/MyID/workdir
|
cd |
Change directory to a particular directory (personal /home dir if no path specified) | cd /scratch/MyID/workdir
|
rmdir |
Remove an empty directory | rmdir tmpdir
|
Files
Command | Description | Examples |
---|---|---|
nano |
Create or edit a file with nano (to save and exit: ctrl + x, y, enter) | nano sub.sh
|
cat |
Print the contents of a file to the terminal (better for shorter files) | cat slurm-42342.out
|
less |
View the contents of a file (better for longer files) | less slurm-42342.out
|
cp |
Copy a file or files (cp sourcepath(s) destinationpath ) |
cp /scratch/MyID/workdir/sub.sh /work/labgroup
|
mv |
Move a file or files (mv sourcepath(s) destinationpath ) |
mv /scratch/MyID/workdir/sub.sh /work/labgroup
|
rm |
Remove a file or files | rm oldfile.txt
|
rm -r |
Remove a directory and all of its contents, recursively (starting with the last dir in the path) | rm -r /home/MyID/olddir
|
dos2unix |
Removes DOS/Windows line endings in file | dos2unix file.txt
|
mac2unix |
Removes Mac line endings in file. | mac2unix file.txt
|
Software
Command | Description | Examples |
---|---|---|
ml spider <software name> |
See if a software is available, will also show you which versions are available | ml spider Blast+
|
ml <software name> |
Load a software module | ml BLAST+/2.12.0-gompi-2020b
|
Also see the Software page and Software section of our FAQ.
Shortcuts
Linux
Shortcut | Description |
---|---|
ctrl + l (lowercase L) | Clear your terminal screen (scroll up to see previous output) |
up/down arrow keys | Cycle through previously entered commands |
tab | auto-complete a file or directory name when typing a path (tab tab if more than one file begins with the letters you've typed) |
esc, . (escape, then period) | Cycle through previous arguments to commands |
ctrl + w | Backspace typed text on the command line, one word at a time |
ctrl + c | Cancel typed text on the command line |
less
Shortcut | Description |
---|---|
shift + g | Go to the end of file |
gg | Go to the beginning of file |
-N then enter | Display/hide line numbers |
/SomePattern | Search forward through a file for SomePattern (/ then enter to keep searching forward for the same pattern) |
?SomePattern | Search backwards through a file for SomePattern (? then enter to keep searching forward for the same pattern) |
q | Exit less |
Slurm
Below are the minimum Slurm commands that you should know to do work on an HPC cluster. The first table are default Slurm commands. The next table are GACRC pre-formatted wrapper scripts of the Slurm commands to provide more information and flexibility.
Default Slurm Commands
Command | Description | Examples |
---|---|---|
sbatch |
Submit a submission script to the cluster | sbatch sub.sh
|
squeue |
Check status currently running jobs (--me for only your jobs) | squeue --me
|
sacct -X |
Check status of your jobs started since midnight of current day (-X for one line per job) | sacct -X
|
sacct -X -S yyyy-mm-dd |
Check status of your jobs since yyyy-mm-dd | sacct -X -S 2021-10-20
|
sacct -j jobID |
Check status of a particular job | sacct -j 234213
|
scancel jobID |
Cancel one of your running jobs | scancel 456781
|
sinfo |
Check the status of partitions | sinfo -p batch
|
GACRC Slurm Commands
Command | Description/Slurm Equivalent | Examples |
---|---|---|
interact |
Start an interactive job. (Same as qlogin but with more flexibility) |
interact -c 4 --mem 10gb --time 01:00:00
|
sq |
squeue |
sq --me
|
sacct-gacrc -X |
sacct |
sacct-gacrc -X
|