[go: up one dir, main page]

0% found this document useful (0 votes)
34 views2 pages

Bash Cheat Sheet

This document is a cheat sheet for basic Bash commands, variable usage, quoting, control structures, functions, and useful wildcards. It provides a concise reference for common commands like 'pwd', 'ls', and 'mkdir', as well as syntax for setting and accessing variables. Additionally, it outlines control structures and wildcards used in Bash scripting.

Uploaded by

fg55.superman
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
34 views2 pages

Bash Cheat Sheet

This document is a cheat sheet for basic Bash commands, variable usage, quoting, control structures, functions, and useful wildcards. It provides a concise reference for common commands like 'pwd', 'ls', and 'mkdir', as well as syntax for setting and accessing variables. Additionally, it outlines control structures and wildcards used in Bash scripting.

Uploaded by

fg55.superman
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Bash Commands and Quoting Cheat Sheet

Basic Bash Commands

pwd - Show current directory

ls - List files

cd <dir> - Change directory

cp src dest - Copy files/directories

mv src dest - Move/rename files/directories

rm file - Remove files

mkdir dir - Create a directory

touch file - Create an empty file

cat file - View file contents

Variable Usage

VAR=value - Set a variable

echo $VAR - Access variable

${VAR} - Safer variable access

Quoting

'...' - Single quotes (no interpretation)

"..." - Double quotes (expand variables)

\ - Escape a single character

Control Structures

if [ condition ]; then ... fi

for var in list; do ... done

while [ condition ]; do ... done

case $var in pattern) ... ;; esac

Functions
function_name() {

commands

Useful Wildcards

* - Matches any number of characters

? - Matches exactly one character

[abc] - Matches any character inside brackets

You might also like