Navigating the file system

List files in the current directory

ls

List filenames only one per line (numerical value 1)

ls -1

Long listing (l) of all files (a) with human readable sizes (h)

ls -lah

List directory not the files within

ls -d <dir>

Reverse sort order

ls -r

Recursively list subdirectories

ls -R

Useful sort order flags

  • Modified time -t

  • Last accessed time -u

  • Creation time -U

  • File size -S

Change directory

Go to home directory

Go to system root directory

Return to last directory

Show the path of the current directory location (print working directory)

Tree

Display files and sub directories graphically

Ignore (or include) specific files and directories

Limit output to set folder depth (eg. 2 levels -L 2)

Other useful options

  • -a All files (including hidden)

  • -d List directories only

  • -f Print full paths

  • -i Do not indent output

  • -h Print human readable size

  • -s Print size in raw bytes

  • -C Colourize output

Last updated