Skip to content

Cheat sheets

On this page we collected a set of notes used for quick reference.

Apocrita / Andrena cheat sheet

Job submission / Information

Command Description
qsub jobscript.sh Submits job script jobscript.sh to the queue (man qsub)
qstat -j jobnumber Shows information about job jobnumber
qhold jobnumber Apply a hold on job jobnumber - jobs is held from running (qhold)
qsub -hold_jid jobscript.sh Submits job script jobscript.sh and apply hold (qhold)
qrls jobnumber Releases job for execution (removes hold) (qhold)
qdel jobnumber Deletes running/queued job jobnumber (man qdel)
jobstats Show details of completed cluster jobs (jobstats)
qacct -j jobnumber Report and account for job usage (man qacct)
qmquota Displays your current storage quotas and usage (qmquota)

Queues / Nodes

Command Description
qstat Show the status of submitted cluster jobs (man qstat)
showqueue Show details of submitted jobs waiting to run (showqueue)
showqueue -F Show details of submitted jobs waiting to run, with additional information (showqueue)
nodestatus Shows the status of the cluster nodes (nodestatus)

Modules

Command Description
module avail Show the available modules on the cluster
module list Show loaded modules in the current environment
module load modulename Loads module modulename e.g. module load python
module switch moduleversion Switch version of previously loaded module to moduleversion e.g. module switch python
module unload modulename Unload a specific loaded module e.g. module unload python
module purge Unload all loaded modules

Linux commands cheat sheet

Basic commands

Command Description
man command Show manual for command

Directory Operations

Command Description
pwd Show current directory
mkdir dir Create directory dir
cd dir Change directory to dir
ls List directory contents

File Operations

Command Description
cat file1 file2 Print the contents of files file1 and file2 to the stdout
less file1 Display the contents of file1 in a paginated form
file file1 Display the file type of object file1
cp file1 file2 Copy file1 to file2
mv file1 file2 Move (or rename) file1 to file2
rm file1 Delete file1
head file1 Show first 10 (default) lines of file1
tail file1 Show last 10 (default) lines of file1
tail -f file1 Output appended data as file1 grows

File Permissions

Command Description
chmod 755 file Change mode of file to 755 (rwxr-xr-x)
chmod -R 600 directory Recursively change access mode of directory to 600 (rw-------)
chown user:group file Change file owner to user and group to group

Process Management

Command Description
ps Show snapshot of processes
top Show real time processes
kill pid Kill process with id pid

Bash Shortcuts

Shortcut Description
CTRL + c Stop current command
CTRL + r Search history
!! Repeat last command

See the Linux cheat sheet for more Linux commands.

GIT cheat sheet

Git basics

Command Description
git init Create an empty Git repo in the specified directory.
git clone repo Clone repo located at repo onto local machine.
git config user.name name Define author name to be used for all commits in the current repo.
git add directory Stage all changes in directory for the next commit. Replace directory with a file to change a specific file.
git commit -m "message" Commit the staged snapshot using message as the commit message
git status List which files are staged, unstaged, and untracked.
git log Display the entire commit history using the default format.
git pull Fetch remote’s copy of current branch and merge it into the local copy.
git pull --rebase remote Fetch the remote’s copy of current branch and rebase it into the local copy.
git push remote branch Push the branch to remote, along with the necessary commits and objects.
git push remote --force Forces the git push even if it results in a non-fast-forward merge.

Git branches

Command Description
git branch List all of the branches in your repo.
git checkout branch Check out an existing branch named branch.
git checkout -b branch Create and check out a new branch named branch.

See the Git cheat sheet for more Git commands.

Anaconda / Mamba / Miniconda cheat sheet

Tips and recommendations

  • It is recommended to create a new environment for any new project or workflow.
  • Package dependencies and platform specifics are automatically resolved when using conda.
  • When importing an environment, conda resolves platform and package specifics.
  • Specifying the environment name confines conda commands to that environment.
  • Name the export file "environment". Environment name will be preserved.

Quick start

Command Description
conda info Verify conda install and check version
conda create --name ENVNAME create a new environment with name ENVNAME (tip: name environment descriptively)
conda activate ENVNAME activate environment ENVNAME (do this before installing packages)

Working with conda environments

Command Description
conda env list list all environments and locations
conda list -n ENVNAME --show-channel-urls list all packages + source channels in ENVNAME
conda install -n ENVNAME PKG1 PKG2 install packages PKG1 PKG2 in environment ENVNAME
conda uninstall PKGNAME -n ENVNAME remove package PKGNAME from environment ENVNAME
conda update --all -n ENVNAME update all packages in environment ENVNAME

Environment management

Command Description
conda create -n ENVNAME python=3.10 create environment ENVNAME with Python version 3.10
conda remove -n ENVNAME --all delete environment by name
conda list -n ENVNAME --revisions list revisions made to environment ENVNAME

Importing environments

Command Description
conda env create -n ENVNAME --file ENVNAME.yml Create environment ENVNAME from a ENVNAME.yml file
conda create -n ENVNAME --file ENVNAME.txt Create environment ENVNAME from a ENVNAME.txt file

Exporting environments

Command Description
conda env export --from-history>ENVNAME.yml cross-platform compatible
conda env export ENVNAME>ENVNAME.yml platform + package specific
conda list --explicit>ENVNAME.txt platform + package + channel specific

Channels and packages

Command Description
conda list list installed packages
conda update --all update all packages
conda install -c CHANNELNAME PKG1 PKG2 install packages PKG1 PKG2 from specific channel CHANNELNAME
conda install PKGNAME=3.1.4 install specific version 3.1.4 of package PKGNAME
conda install CHANNELNAME::PKGNAME install a package PKGNAME from specific channel CHANNELNAME
conda uninstall PKGNAME uninstall package PKGNAME
conda config --add channels CHANNELNAME add channel CHANNELNAME

Additional hints

Command Description
conda COMMAND --help get help for command COMMAND
conda search PKGNAME --info get info for package PKGNAME
conda install PKG1 PKG2 --yes run commands w/o user prompt e.g., installing multiple packages
conda clean --all remove all unused files
conda config --show examine conda configuration

See the Anaconda cheat sheet for more Anaconda commands.

Vi / Vim cheat sheet

Exiting

Command Description
:q Close file
:q! Close without saving
:w Save
:wq Save and close file
:x Save and close file

Clipboard

Command Description
x Delete character
dd Delete line (Cut)
yy Yank line (Copy)
p Paste
P Paste before

Editing

Command Description
a Append
i Insert
u Undo changes
Esc Exit insert mode

Operators list

Command Description
d Delete
y Yank (copy)
c Change (delete then insert)

See the Vim cheat sheet for more Vim commands.