Linux Shell Scripting Command Cheat Sheet

Shell scripting commands are used to create scripts that automate tasks on Linux systems. The shell script is a program written in a scripting language that runs on the command line or from within another script.

Command Description
echo This command is used to print messages or variables to the standard output.
read This command is used to read input from the user and store it in a variable.
if This command is used to conditionally execute a block of code based on a specified condition.
else This command is used to execute a block of code if the previous condition is not true.
elif This command is used to execute a block of code if the previous condition is not true, but another condition is true.
while This command is used to repeatedly execute a block of code as long as a specified condition is true.
for This command is used to iterate over a list of items and execute a block of code for each item in the list.
case This command is used to execute a block of code based on a specified value or pattern.
function This command is used to define a reusable block of code that can be called multiple times with different parameters.
exit This command is used to exit the shell or a script with a specified exit code.
test This command is used to evaluate expressions or test conditions, such as file existence, equality, or numeric comparison.
expr This command is used to evaluate mathematical expressions or manipulate strings.
cut This command is used to extract a specific portion of a line or file based on a specified delimiter or field.
sed This command is used to manipulate and transform text based on a specified pattern or regular expression.
awk This command is used to process and manipulate text data using a series of patterns and actions.
grep This command is used to search for a specific pattern or string in a file or output.
find This command is used to search for files or directories that match a specified pattern or criteria.
xargs This command is used to build and execute commands from standard input or arguments.
kill This command is used to send signals to processes, such as terminating or restarting them.
ps This command is used to display information about running processes on the system.
[ and ] These are shorthand for the "test" command and are used to evaluate conditional expressions.
&& and || These are used to chain commands together and execute them conditionally based on the success or failure of the previous command.
$ This symbol is used to reference the value of a variable in the shell.
# This symbol is used to comment out a line of code in a shell script.
cd This command is used to change the current working directory.
ls This command is used to list the contents of a directory.
touch This command is used to create an empty file or update the modification time of an existing file.
mkdir This command is used to create a new directory.
rm This command is used to remove files or directories.
mv This command is used to move or rename files or directories.
cp This command is used to copy files or directories.
cat This command is used to display the contents of a file or concatenate files.
grep This command is used to search for a pattern in a file or stream.
awk This command is used to manipulate and analyze text data.
cut This command is used to extract specific columns or fields from a file or stream.
find This command is used to search for files or directories that match certain criteria.
chmod This command is used to change the permissions of a file or directory.
chown This command is used to change the owner of a file or directory.
tar This command is used to create or extract compressed archive files.
zip This command is used to create or extract compressed zip archive files.
curl This command is used to transfer data from or to a server.
wget This command is used to download files from the internet.
export This command is used to set an environment variable.
source This command is used to execute a script within the current shell.
alias This command is used to create a shortcut for a command or a set of commands.

About John Gomez

John Britto Founder & Cheif-Editor @LinuxTeck. A Computer Geek and Linux Intellectual having more than 10+ years of experience in Linux and Open Source technologies.

View all posts by John Gomez →

Leave a Reply

Your email address will not be published.

L