The file system
The file system provides a structured way to name and organize files, typically using a hierarchical directory structure. Below there are some of the basic commands to move around.
Print Working Directory
The pwd
command prints the current working directory path.
pwd
/users/home/us01234
Change Directory
Use cd
to navigate between directories:
cd directory_name
: Move into a specific directorycd ..
: Move up one directory levelcd ~
: Go to home directory
List Directory Contents
The ls
command lists files and directories in the current location. Common options include:
ls -a
: List all files, including hidden onesls -l
: Long listing with details like permissions and timestamps
us01234@myMacBook course-cli % ls
README.md answers data requirements.txt
_extensions appendix index.qmd style.scss
_quarto.yml assets pages
us01234@myMacBook course-cli % ls -a
. .gitignore appendix requirements.txt
.. README.md assets style.scss
.DS_Store _extensions data
.git _quarto.yml index.qmd
.github answers pages
You can also use list filtering for specific file names or patterns.
us01234@myMacBook course-cli % ls -la *.txt
-rw-r--r--@ 1 gx18744 staff 15 26 Sep 02:06 requirements.txt