Spring 2023
Smith College
To learn how to navigate through a directory structure in the terminal
We have been using file paths all along.
Dot (.
) is “here,” so
read.csv("./data/dates.csv)
Is “start here, then look in data for dates.csv
”
.
├── data
│ ├── country_stats.csv
│ ├── country_users.csv
│ ├── dates.csv
│ ├── landing_page.csv
│ ├── pages.csv
│ ├── project_1_data.zip
│ ├── referrals.csv
│ ├── search.csv
│ ├── shop.csv
│ ├── state_stats.csv
│ └── state_users.csv
├── docs
│ └── standards_report.qmd
├── Project-1-SCMA.Rproj
├── src
│ └── PUT_CODE_HERE.txt
└── vis
└── SAVE_VIS_HERE.txt
Every file on a computer has certain permissions attached to it.
On your computer, you typically have access to everything. On a shared computer, you may not.
On your own computer, you can run commands as super-user (sudo) to run anything regardless of permissions.
List files
ls [Where you want to list] [Optional flags]
Common Flags:
Change Directory
cd [where you want to go]
cd ~
to return to your user foldercd ..
will take you up one level.
├── data
│ ├── country_stats.csv
│ ├── country_users.csv
│ ├── dates.csv
│ ├── landing_page.csv
│ ├── pages.csv
│ ├── project_1_data.zip
│ ├── referrals.csv
│ ├── search.csv
│ ├── shop.csv
│ ├── state_stats.csv
│ └── state_users.csv
├── docs
│ └── standards_report.qmd
├── Project-1-SCMA.Rproj
├── src
│ └── PUT_CODE_HERE.txt
└── vis
└── SAVE_VIS_HERE.txt
Concatenate
cat [path to file to Concatenate]
Will print out the fill content of a file smooshed into one long string of characters
Manual
man [name of command]
A community driven manual that provides more readable help for a ton of commands. Always a great palce to start.
touch [name of empty file you want to make]
mkdir [name of directory you want to make]
cp [path of file/directory to copy] [path to where to create copy]
Will create a copy of whatever you point it at.
mv [path of file/directory to move] [path of where to move to]
Also used to re-name things
nano
nano [path of file to edit]
nano is a tiny text editor on the command line
Remove
rm [path to thing you absolutely never want to see again]
USE WITH THE UTMOST CAUTION
Remote Servers
SDS 270: Advanced Programming for Data Science