-xr-x 4 robert staff 128B Aug 8 10:03 bin
drwxr-rw-r--r--@ 1 robert staff 20M Jun 24 09:11 boots.png
-rw-r--r--@ 1 robert staff 26M Jun 23 15:23 boots1.pdf
2025-09-03
In general you want to name your files in a way that is related to their contents and specifies how they relate to other files.
The Smithsonian Data Management Best Practices has “Five precepts of file naming and organization”
For specific recommendations we highly recommend you follow The Tidyverse Style Guide
Instead of clicking, dragging, and dropping to organize our files and folders, we will be typing Unix commands into the terminal.
The way we do this is similar to how we type commands into the R console, but instead of generating plots and statistical summaries, we will be organizing files on our system.
The file system is hierarchical, you create directories (folders) in other folders
When you log in to a Unix computer you are in your home directory
the command line has a prompt that is configurable and is printed on screen to let you know that the terminal is ready for input
Environment variables control your computing environment and many are customizable by users
LLMs are useful tools for finding commands and getting help navigating through your first exposure to Unix and the ideas it is based on
The terminal is integrated into Mac and Linux systems, but Windows users will have to install an emulator.
Once you have a terminal open, you can start typing commands.
You should see a blinking cursor at the spot where what you type will show up. This position is called the command line.
within each directory you can create files and other directories
files whose names start with a period .
are hidden by default; use ls -a
to view them
files have permissions: use ls -lh
to view details
The working directory is the directly you are currently in.
Commands you issue will generally take effect in this directory
You can see your working directory using the Unix command pwd
You can list the contents of the directory (files and other directories) using ls
You can find out about how ls
works by issuing the command: man ls
The string returned by pwd
command is the full path to the working directory.
The full path to your home directory is stored in an environment variable.
You can see it like this echo $HOME
In Unix, we use the shorthand ~
as a nickname for your home directory
~/docs
.A common default for the prompt is to show the path to the working directory (that path might be long, but you can change it)
Let’s open a terminal window and see what the prompt is.
you have an environment variable called PATH
which you can display using echo
that variable is a set of individual paths, separated by :
(colon) and it tells your Unix shell where to look for commands
you can modify that path, so that you can have it look for commands in other, non-standard places (eg make your own bin
directory)
ls
: Listing directory content
mkdir
and rmdir
: make and remove a directory
cd
: navigating the filesystem by changing directories
pwd
: see your workding directory
mv
: moving files
cp
: copying files
rm
: removing files
more
and less
: display the contents of a file
In Unix you can auto-complete by hitting tab.
This means that we can type cd d
then hit tab.
Unix will either auto-complete if docs
is the only directory/file starting with d
or show you the options.
Try it out! Using Unix without auto-complete will make it unbearable.
Command-line text editors are essential tools, especially for system administrators, developers, and other users who frequently work in a terminal environment. Here are some of the most popular command-line text editors:
curl
- download data from the internet.
tar
- archive files and directories into one file.
gzip
- and other compression tools - make big files small
ssh
- connect to another computer.
find
- search for files by filename in your system.
grep
- search for patterns in a file.
awk/sed
- These are two very powerful commands that permit you to find specific strings in files and change them.
The shell you use helps to organize and facilitate your interactions with the operating system
echo $SHELL
will display the shell you are using
many software tools use hidden files and directories to provide customization e.g. .gitconfig
or .ssh
most shells have two files that are commonly used to provide user level customization .zsh
, and .zprofile
To get started.