Listing directories

| 1 min read | Unix things I always forget 2/7

A listing of my favorite ls features.

To know wich directory you’re in now, use the pwd command. pwd stands for “print working directory”.

> pwd

List the current directory, use the ls command. ls is short for “list”.

> ls  assets     index.html

Include hidden files with -a.

> ls -a
.          ..         .git  assets     index.html

List everything in a single column with -1. This is useful when you want to copy/paste a directory.

> ls -1

Add a trailing slash to directories with -F. Also can be useful for copy/pasting purposes.

> ls -1F
Unix things I always forget

This series is an attempt to document the Unix commands I know, and the ones I occasionally need.

Follow along, and you might learn some tricks along the way! Consider this series a living document that will grow organically; I won’t be updating or adding new posts on a set schedule.

  1. Introduction
  2. Listing directories
  3. Zipping
  4. Rsync
  5. Finding files (by filename)
  6. Finding files (by content)
  7. Permissions


I occasionally send out a newsletter with personal stories, things I’ve been working on in the past month, and interesting things I come across.

More about cli

Unix things I always forget