Skip to content

Files and Folders

Everything on your computer is organized into files (documents, pictures, programs) and folders (containers that hold files and other folders). In the terminal, folders are often called directories — the two words mean the same thing.

Remember pwd? It shows your current folder:

Terminal window
pwd

When you first open lash, you start in your home directory. This is your personal space on the computer. You can always refer to it with the shortcut ~ (the tilde character). So ~/Documents means “the Documents folder inside my home directory.”

The cd command lets you move into a different folder. It stands for “change directory.”

Terminal window
cd Documents

Now you are inside the Documents folder. Check with pwd to confirm.

To go back up one level (to the folder that contains your current folder), use two dots:

Terminal window
cd ..

To jump straight back to your home directory from anywhere:

Terminal window
cd ~

Or simply:

Terminal window
cd

A path is the address of a file or folder. There are two styles:

  • Absolute path — Starts from the very top of your file system, beginning with /. For example: /home/yourname/Documents/notes.txt. This works no matter where you currently are.

  • Relative path — Starts from wherever you are right now. If you are in /home/yourname, then Documents/notes.txt refers to the same file. It is shorter, but only works from the right starting point.

Think of it like street addresses. An absolute path is the full address including city and country. A relative path is “turn left at the corner” — it only makes sense if you know the starting point.

You already know ls. Here are some useful variations:

Terminal window
ls -l

The -l flag shows a long listing with extra details: file sizes, dates, and permissions (who is allowed to read or change the file).

Terminal window
ls -a

The -a flag shows all files, including hidden ones. Hidden files start with a dot (like .bashrc or .lash).

Make a new folder with mkdir (make directory):

Terminal window
mkdir my-projects

You can create nested folders in one step:

Terminal window
mkdir -p my-projects/website/images

The -p flag means “create parent directories as needed.”

Copy a file from one place to another with cp:

Terminal window
cp notes.txt notes-backup.txt

This creates a copy called notes-backup.txt in the same folder. To copy into a different folder:

Terminal window
cp notes.txt ~/Documents/

The mv command moves a file. It also doubles as a rename tool:

Terminal window
mv old-name.txt new-name.txt

To move a file into a different folder:

Terminal window
mv report.txt ~/Documents/

Remove a file with rm:

Terminal window
rm unwanted-file.txt

Remove an empty folder with rmdir:

Terminal window
rmdir empty-folder

To remove a folder and everything inside it, use rm with the -r flag (recursive — meaning it goes into every subfolder):

Terminal window
rm -r old-project

Be careful with rm. Deleted files do not go to a trash can. They are gone for good.

Typing long folder names is tedious. lash has tab completion to help. Start typing a path and press Tab:

Terminal window
cd Doc

Press Tab, and lash will complete it to cd Documents/ if that is the only match. If there are multiple possibilities, press Tab twice to see all of them. This works for files, folders, and commands.

The z command is one of lash’s nicest features. It learns which folders you visit most often and lets you jump to them with just a keyword:

Terminal window
z projects

If you frequently visit /home/yourname/work/projects, lash will take you there instantly. No need to type the full path. The more you use lash, the smarter z becomes.

CommandWhat it does
pwdShow current folder
cd folderMove into a folder
cd ..Go up one level
cd ~Go to your home directory
lsList files in current folder
mkdir nameCreate a new folder
cp source destCopy a file
mv source destMove or rename a file
rm fileDelete a file
rmdir folderDelete an empty folder
z keywordJump to a frequently visited folder

Now that you can find your way around, let’s make lash look and feel the way you want.