
0.1 Basic Unix Commands#
Tutorials at the 2026 paleoCAMP | June 15–June 29, 2026
Jiang Zhu
jiangzhu@ucar.edu
Climate & Global Dynamics Laboratory
NSF National Center for Atmospheric Research
Learning Objectives#
By the end of this notebook, you will be able to:
Navigate between directories with
cdand check your location withpwdInspect files and folders with
lsCopy, move, and remove files with
cp,mv, andrmSearch file contents with
grepand use*as a wildcardClone a repository from GitHub with
git clone
Time to learn: 10 minutes
Quick reference#
Click a command to jump to its details. (You can also open the Table of Contents sidebar in Jupyter for the same navigation.)
cd#
Description: cd is used to navigate from one directory to another.
Examples:
cd paleocamp- changes the current directory to thepaleocampdirectorycd ~- brings you to yourhomedirectory
ls#
Description: ls lists the files and directories in the current directory, or in a directory you specify.
Examples:
ls- lists files and directories in the current directoryls -l- shows more detail such as permissions, file size, and modification timels -ltr- sorts by modification time, with the most recently modified files near the bottom; handy when a model run crashes and you want to find the newest log file
pwd#
Description: pwd displays the name of the current working directory — the directory you are currently in.
Example:
pwd- displays the current working directory, e.g./Users/jiangzhu/paleocamp
cp#
Description: cp copies files or directories from a source location to a destination.
Examples:
cp file1 file2- copies the contents of file1 to file2cp -r directory1 directory2- copies directory1 to directory2. The-rflag means “recursively”
mv#
Description: mv moves or renames files and directories. It can also move files from one directory to another.
Examples:
mv file1 file2- renames file1 to file2mv file1 directory1- moves file1 into the directory directory1
rm#
Description: rm deletes files or directories. Be cautious — the operation is often irreversible.
Examples:
rm file- deletes a file named filerm -rf directory- removes directory and all of its contents.-fmeans “force it” with no prompts
Warning There is no trash bin in most Unix workflows. After
rm, files are usually gone. Double-check the path before running commands such asrm -rorrm -rf.
grep#
Description: grep searches for lines containing a specified pattern within one or more text files. Useful for text searching and pattern matching.
Examples:
grep hello file.txt- finds the string hello in file.txt and prints every line containing itgrep -r hello directory- searches recursively through all files in directorygrep -ir hello directory- same, but ignores case (uppercase/lowercase)
wildcards#
Description: * represents any combination of characters in Unix.
Examples:
grep hello *.txt- searches for the string hello, but only in files that end in .txt
git clone#
Description: git clone clones a repository into a newly created directory.
Example:
git clone https://github.com/jiang-zhu/paleocamp2026- clones the paleocamp2026 repository (including the notebooks) into a newly created folder, paleocamp2026, in the working directory
Keep going: Unix Tutorial from UCAR’s COMET Program#
UCAR’s COMET Program offers a free, self-paced Introduction to Unix course. From it you can learn:
the basics of Unix file structures,
how to navigate in a Unix environment, and
how to create, store and search for files.
Time to complete: about 15–30 minutes if you have some Unix experience, or 30–60 minutes if you’re new to it.