Read Anthropic’s case study about Graphite Reviewer

Guide to common terminal commands

Kenny DuMez
Kenny DuMez
Graphite software engineer


Note

This guide explains this concept in vanilla Git. For Graphite documentation, see our CLI docs.


This guide covers a selection of essential terminal commands used on both macOS and Linux systems.

The terminal provides a command line interface (CLI) where users can type commands to perform operations without a graphical user interface (GUI). macOS terminal commands and Linux terminal commands are often very similar because both systems are Unix-based.

  • pwd (print working directory): Displays the path of the current directory you are in.

  • cd <directory> (change directory): Changes the current directory to <directory>. Use cd .. to go up one directory level or cd to return to the home directory.

  • ls (list): Lists all files and directories in the current directory. Use ls -l for detailed information and ls -a to show hidden files.

  • touch <filename>: Creates a new empty file named <filename>.

  • mkdir <directory> (make directory): Creates a new directory named <directory>.

  • cp <source> <destination> (copy): Copies files or directories from <source> to <destination>.

  • mv <source> <destination> (move): Moves files or directories from <source> to <destination>. Also used for renaming.

  • rm <filename> (remove): Deletes a file. Use rm -r <directory> to delete a directory and all its contents.

  • top: Displays an ongoing view of process activity. It provides a dynamic real-time view of a running system. Equivalent to htop on Linux for an enhanced view.

  • df (disk free): Shows the amount of disk space available on the file system containing each file name argument.

  • du (disk usage): Displays the disk usage for the directory you specify. By using du -sh, you can see a summary of the disk space used by each directory.

  • kill <PID> (kill process): Terminates the process with the specified Process ID (PID).

  • ping <hostname>: Checks the network connection to a host. It sends ICMP ECHO_REQUEST packets to network hosts.

  • netstat: Displays network connections, routing tables, interface statistics, masquerade connections, and multicast memberships.

  • ifconfig: Used to configure the kernel-resident network interfaces. It is used at boot time to set up interfaces as necessary.

  • curl <URL>: Transfers data from or to a server, using one of the supported protocols (HTTP, HTTPS, FTP, FTPS, SCP, SFTP, TFTP, DICT, TELNET, LDAP or FILE).

  • grep <pattern> <file>: Searches for the pattern in the file and outputs the matching lines. Very useful for searching through logs or files.

  • chmod <permissions> <file>: Changes the file mode (permissions) of a file or directory.

  • chown <user>:<group> <file>: Changes the owner and group of a file or directory.

  • sudo <command>: Executes a command with superuser privileges, necessary for commands that require administrative permissions.

  • Combine commands: Use pipes (|) and redirections (>, >>) to combine multiple commands.
  • Scripting: Bash scripting can automate repetitive tasks and combine many commands into one script.
  • Customize your environment: Use .bashrc or .bash_profile to customize your shell, setting up aliases and shortcuts for common commands.
Git inspired
Graphite's CLI and VS Code extension make working with Git effortless.
Learn more

Graphite
Git stacked on GitHub

Stacked pull requests are easier to read, easier to write, and easier to manage.
Teams that stack ship better software, faster.

Or install our CLI.
Product Screenshot 1
Product Screenshot 2