Our cheat sheet will help you efficiently navigate and control your system from the command line. From understanding file types and permissions to debugging, from controlling jobs to understanding regular expressions, this cheat sheet will have you covered.
The information in this cheat sheet is valuable to casual Linux and Mac users, system administrators, information security professionals, and students preparing for a wide range of exams, from the LPIC to the OSCP and beyond.
However you choose to use it, we hope you’ve found it a helpful resource to keep around. Click here to download a copy now. When you’re ready, scroll down, and let’s get into it!
What Is Bash?
Bash (Bourne Again Shell) is a shell language built on top of the original Bourne Shell, which was distributed with V7 Unix in 1979 and became the standard for writing shell scripts.
Today it is primary to most Linux distributions (see our Linux Command Line Cheat Sheet), MacOS, and it has even recently been enabled to run on Windows through something called WSL (Windows Subsystem for Linux).
File Test Operators
Testing files in scripts is easy and straightforward. This is where shell scripting starts to show its glory! In Bash, you can do file testing for permissions, size, date, file type, or existence.
FLAG DESCRIPTION-eFile exists-aFile exists (identical to -e but is deprecated and outdated)-fFile is a regular file (not a directory or device file)-sfile is not zero size-dfile is a directory-bfile is a block device-cfile is a