Basic Bash (CLI) Cheat Sheet

This Bash cheat sheet provides a quick reference guide to commonly used commands in the Bash shell. Whether you’re a beginner or an experienced user, this cheat sheet will help you navigate the Linux command line and perform various tasks efficiently. You can also download a high quality printable version of this cheat sheet below.

Navigating the File System
cd [directory]Change directory
pwdPrint working directory
ls [options] [directory]List directory contents
mkdir [directory]Create a new directory
rmdir [directory]Remove a directory
cp [source] [destination]Copy files or directories
mv [source] [destination]Move or rename files or directories
rm [options] [file]Remove files or directories
touch [file]Create an empty file

Process Management
ps [options]Display information about active processes
kill [process_ID]Terminate a process
topDisplay and manage the top processes
bg [job_ID]Move a job to the background
fg [job_ID]Bring a background job to the foreground

The commands are organized into different categories to make it easier to find what you need. From navigating the file system to manipulating files, managing processes, and working with permissions, this cheat sheet covers a wide range of essential Bash commands.

Each command is presented in a clear and concise format, enclosed in code tags for easy identification. Additionally, options and arguments are included where applicable to provide further context and usage examples.

Feel free to refer to this cheat sheet whenever you need a quick reminder or want to explore new Bash commands. With practice, you'll become more proficient in using the Bash shell and streamline your workflow on the command line.

File Manipulation
cat [file]Output the contents of a file
head [options] [file]Output the first lines of a file
tail [options] [file]Output the last lines of a file
less [file]View the contents of a file interactively
grep [pattern] [file]Search for a pattern in a file
wc [options] [file]Count the number of lines, words, or characters in a file

Permissions
chmod [permissions] [file]Change the permissions of a file or directory
chown [user:group] [file]Change the owner and group of a file or directory
chgrp [group] [file]Change the group of a file or directory
umask [mask]Set the default file permissions for newly created files

Archiving and Compression
tar [options] [files/directories]Create or extract tar archives
gzip [file]Compress a file
gunzip [file.gz]Decompress a gzipped file
zip [archive.zip] [files/directories]Create a zip archive
unzip [archive.zip]Extract files from a zip archive

Download a printable version of this bash cheat sheet

It's available in PDF and PNG. These files are high quality and print-ready.

Here's a preview:

Leave a comment

Your email address will not be published. Required fields are marked *

One thought on “Basic Bash (CLI) Cheat Sheet”