Home

Linux/macOS Terminal Commands Cheat Sheet

🗂️ File and Directory Commands

Command Full Form Description Works On
pwdPrint Working DirectoryDisplays the full path of the current working directory.Linux & macOS
lsListLists files and directories in the current directory.Linux & macOS
cdChange DirectoryChanges the current directory.Linux & macOS
mkdirMake DirectoryCreates a new directory.Linux & macOS
rmRemoveDeletes a file.Linux & macOS
rm -rRemove RecursivelyDeletes a directory and its contents.Linux & macOS
mvMoveMoves or renames files and directories.Linux & macOS
cpCopyCopies files or directories.Linux & macOS
touchCreate FileCreates an empty file.Linux & macOS

📄 File Content Commands

Command Full Form Description Works On
catConcatenateDisplays the content of a file.Linux & macOS
lessLessDisplays file content page by page.Linux & macOS
headHeadShows the first 10 lines of a file.Linux & macOS
tailTailDisplays the last 10 lines of a file.Linux & macOS
nanoNano EditorA simple terminal text editor.Linux & macOS
vimVi ImprovedAn advanced text editor.Linux & macOS

🔍 Search & Find

Command Full Form Description Works On
findFindSearches for files and directories.Linux & macOS
grepGlobal Regular Expression PrintSearches for patterns in files.Linux & macOS

⚙️ System & Permissions

Command Full Form Description Works On
sudoSuperuser DoRuns commands with superuser privileges.Linux & macOS
chmodChange ModeChanges file permissions.Linux & macOS
chownChange OwnerChanges file ownership.Linux & macOS
topTable of ProcessesDisplays running processes and system resources.Linux & macOS (different look)

📦 Package Management

Command Full Form Description Works On
apt updateUpdate PackagesRefreshes the list of available packages.Linux (Debian/Ubuntu)
apt installInstall PackageInstalls a package on Ubuntu/Debian.Linux (Debian/Ubuntu)
brew installHomebrew InstallInstalls a package on macOS.macOS only

🌍 Network & Misc

Command Full Form Description Works On
pingPacket Internet GroperTests network connectivity to a host.Linux & macOS
curlClient URLTransfers data to/from a server.Linux & macOS
sshSecure ShellSecurely connects to remote systems.Linux & macOS
clearClear ScreenClears the terminal screen.Linux & macOS
exitExitCloses the terminal session.Linux & macOS

🖥️ Process Management & System Monitoring

Command Full Form Description Works On
psProcess StatusDisplays running processes.Linux & macOS
killKill ProcessTerminates a running process by its PID.Linux & macOS
htopInteractive TopEnhanced process viewer (needs install on macOS).Linux & macOS
dfDisk FreeShows disk space usage for filesystems.Linux & macOS
duDisk UsageShows disk usage of files and directories.Linux & macOS
freeFree MemoryDisplays memory usage.Linux only

🔒 Security & User Management

Command Full Form Description Works On
chmodChange ModeChanges file or directory permissions.Linux & macOS
chownChange OwnerChanges file or directory ownership.Linux & macOS
passwdPasswordChanges a user's password.Linux & macOS
useraddUser AddCreates a new user.Linux only
usermodUser ModifyModifies an existing user's account.Linux only
userdelUser DeleteDeletes a user account.Linux only