Skip to content

Linux & shell: Navigate & list

13 Linux & shell commands: Navigate & list. Click a command to see what each part does.

Index
13 items
Click a command to see what each part does.

Navigate & list13

  • cd <dir>Go into a folder

    What each part does

    1. cdchange directory (a shell built-in)
    2. <dir>relative path (logs) or absolute path (/var/log)
  • cd ~Go to your home folder

    What each part does

    1. cdchange directory
    2. ~your home directory (/home/<user>); plain "cd" with no argument does the same
  • cd ..; cd -Go up one level / back to the previous folder

    What each part does

    1. cd ..".." is the parent of the current folder
    2. ;then
    3. cd -jump back to the folder you were in before (and print it)
  • pwdShow where you are

    What each part does

    1. pwdprint working directory: the full path of the current folder
  • lsList files

    What each part does

    1. lslist the current folder (names only, hidden dot-files not shown)
  • ls -lLong listing: permissions, owner, size, date

    What each part does

    1. lslist directory contents
    2. -llong format: permissions, links, owner, group, size in bytes, modified date, name
  • ls -laInclude hidden files (.env, .git …)

    What each part does

    1. -llong format
    2. -a--all: also show entries starting with "." (including . and ..)

    Tip ls -lA shows hidden files but leaves out . and ..

  • ls -lhLong listing with readable sizes

    What each part does

    1. -llong format
    2. -h--human-readable: sizes like 4.0K, 12M, 1.3G instead of bytes (works with -l)
  • ls -ltrNewest files last (great for log folders)

    What each part does

    1. -llong format
    2. -tsort by modification time, newest first
    3. -r--reverse: flip the order, so the newest ends up at the bottom next to your prompt
  • ls -lhSBiggest files first

    What each part does

    1. -l -hlong format with readable sizes
    2. -Ssort by size, largest first
  • ls -d */List only sub-folders

    What each part does

    1. -d--directory: list the folders themselves, not what is inside them
    2. */shell glob that matches only directories
  • ls -R <dir>List everything below, recursively

    What each part does

    1. -R--recursive: list every sub-folder too
  • tree -L 2 <dir>Folder tree, two levels deep

    What each part does

    1. treedraw the folder structure (install it: apt install tree)
    2. -L 2limit depth to 2 levels

My DevOps Playbook by Angelo John Calleja

New runbook

GitHub not connected

Saving is handled by the site: the GitHub token is stored in Cloudflare, not in your browser. Enter the editor password (the EDITOR_PASSWORD secret) to unlock saving in this browser.

Saving commits to gelogrammer/My_DevOps_Playbook. Create a fine-grained token with access to only this repo andContents: Read and write, then paste it here. It is stored only in this browser.

src/content/docs/…