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:

By Linux Stans

The official Linux Stans account.

1 comment

  1. I taught Linux for entertainment. Linux is the 18 operatng system in my lifetime. I am an old man now at 75. The one thing that gets me upset is using the acrrnym CLI in reference to the Shell you choose in Unix Linux. AIX uses natively the KSH korn shell. Solaris and IRIX use the TCSH shell. Red Hat and most Linux distributions use the BASH or Born SHELL. Why do I get my pantys in a wad. Because the SHELL is a way to talk to the Kernel. Yes you can issue commands to the KERNEL. But you can issue instructions to higher level pprogramming languages through the SHELL. You can issue instructions to the Kernel through the SHELL. Even the GUI uses the SHELL underneath. You can accomplish all Mouse inputs through the SHELL To say the shell is a way of sending commands. Is a limited statement and my OS is only limited to the commands I enter through the keyboard. The fact that you are the least intelligent component of your Kernel. So set aside the Bill Gates term CLI. Your not using that limited Operating System.

    Enjoy the blessing Linus Torvalds has given you. There hundreds of thousands of contributors to Linux. All of them have contributed their works to you through the GPL. Meaning you are not required to pay for this pleasure. They will not refuse a gift though. So for the respect of the Linux Community do not pollute Linux with Windows language.

    Francis

Leave a comment

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

Exit mobile version