Read Anthropic’s case study about Graphite Reviewer

Mac terminal commands cheat sheet for developers

Kenny DuMez
Kenny DuMez
Graphite software engineer

The macOS Terminal provides a command-line interface that can greatly enhance productivity for developers. Understanding and utilizing the right terminal commands can simplify complex tasks and automate repetitive ones. This cheat sheet covers the most common and useful terminal commands that developers typically use in the macOS environment.

CommandDescription
pwdPrint the current directory path.
lsList all files and directories in the current directory.
ls -aList all entries including hidden files.
ls -lList with long format - show permissions, owner, size, and modification date.
cd directory_nameChange directory to directory_name.
cd ..Go up one directory level.
cd ~ or cdGo to the home directory.
mkdir directory_nameCreate a new directory named directory_name.
rmdir directory_nameDelete an empty directory named directory_name.
rm file_nameDelete a file named file_name.
rm -r directory_nameRecursively delete a directory and its contents.
cp file1 file2Copy file1 to file2.
cp -r dir1 dir2Copy directory dir1 to dir2; create dir2 if it doesn't exist.
mv old_name new_nameRename or move a file/directory from old_name to new_name.
CommandDescription
touch file_nameCreate a new file or update the timestamp of file_name.
cat file_nameDisplay the content of file_name.
more file_nameDisplay the content of file_name one screen at a time.
less file_nameAn improved version of more, with backward navigation.
open file_nameOpen file_name with the default associated application.
nano file_nameOpen file_name in the nano editor, installed by default.
vi file_nameOpen file_name in the Vi editor.
CommandDescription
topDisplay active processes and system stats.
htop (if installed)An interactive process viewer (not installed by default).
ps auxShow detailed status of all current processes.
kill pidKill a process with process ID pid.
killall process_nameKill all processes named process_name.
dfDisplay disk space usage.
duShow the disk usage of the files and directories in the current directory.
CommandDescription
ping hostCheck the network connection to host.
curl urlDownload the file from url.
wget urlDownload the file from url (if installed).
ssh user@hostConnect to host as user via SSH.
scp file user@host:pathSecurely copy file to host under path.
ftp hostConnect to host using FTP.
CommandDescription
chmod permissions file_nameChange the permissions of file_name to permissions (e.g., chmod 755 file_name).
chown user file_nameChange the owner of file_name to user.
chgrp group file_nameChange the group of file_name to group.
CommandDescription
man commandDisplay the manual for command.
echo "text"Print text to the terminal.
dateShow the current date and time.
calShow the month's calendar.
uptimeShow how long the system has been running.
alias new='commands'Create an alias new that executes commands.

This cheat sheet should serve as a quick reference for macOS terminal commands, helping developers to navigate and utilize their Mac systems more effectively. Whether you're a beginner looking to learn the basics or an experienced developer needing a quick refresher, these commands are essential for your daily development tasks.

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