buymeasoda RefDocs
  • Overview
  • General
    • Android
    • Apache
    • Fish
    • Git
    • Github
    • Gmail
    • Homebrew
    • iOS
    • iTerm
    • MacOS
    • MacPorts
    • Mamp
    • Media
    • Mercurial
    • MySQL
    • Node
    • npm
    • nvm
    • Obsidian
    • PHP
    • React Native
    • Rust
    • Server
    • Slack
    • Sourcegraph
    • Tools
    • Vim
    • VS Code
    • Yarn
  • Unix
    • Checksum and hash utilities
    • Command line history
    • Command line keyboard shortcuts
    • Compress files and folders
    • Crontab
    • Diff files and folders
    • Disk usage and file sizes
    • Find and search files
    • Firewall configuration
    • Help and manual pages
    • HostName and Local HostName for Mac OSX
    • Navigating the file system
    • Network, domains and routing
    • Run and manage background tasks
    • Secure FTP SFTP and Secure Copy SCP
    • Secure Shell SSH
    • Sync files and folders
    • System and process management
    • System and user information
    • Useful characters
    • Useful commands
    • User, file and group permissions
    • Working with cURL
    • Working with files and directories
    • Working with text
Powered by GitBook
On this page
  1. Unix

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

cd <dir>

Go to home directory

cd ~

Go to system root directory

cd /

Return to last directory

cd -

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

pwd

Tree

Display files and sub directories graphically

tree

Ignore (or include) specific files and directories

tree -I <path>
tree -P <path>

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

tree -L <depth>

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

PreviousHostName and Local HostName for Mac OSXNextNetwork, domains and routing

Last updated 1 year ago