Skip to content

Instantly share code, notes, and snippets.

@stantronic
Last active August 25, 2025 15:53
Show Gist options
  • Select an option

  • Save stantronic/0197e515a877c70a11b88874a43cf759 to your computer and use it in GitHub Desktop.

Select an option

Save stantronic/0197e515a877c70a11b88874a43cf759 to your computer and use it in GitHub Desktop.
Useful bash commands

Useful bash commands

A handful of helpful commands I've found for shell operations (works with Bash or Zsh).

  1. du -sh . Print how much memory the current folder (and everything within it) is taking up on disk.
    • du stands for disk usage, -sh asks for the info to be summarised in a human readable format.
    • output examples: 178M . or 1.2G . (178 megabytes and 1.36 Gigabytes respectively)
  2. lsof -i:8080
    • List the processes (or files) running on port 8080
    • lsof stands for list open files
    • In posix systems all processes are considered files, so this works for e.g. server processes etc.
    • The output will give you the PID (process ID) of the process
    • If you then want to kill the process you can enter kill <insert PID here>.
  3. find . -name *.kt -- search current folder (recursively) for all files with a given filename ending (in this case .kt)
    • find is a tool for working with file hierarchies
    • This will give you a list of the relative paths of the files from the current directory.
    • The * is a wildcard character matching all text before .kt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment