Show Menu
Cheatography

Linux+ Cheat Sheet (DRAFT) by

Linux+ is a pirate ship that stoles goods from other ships.

This is a draft cheat sheet. It is a work in progress and is not finished yet.

bash

Ctrl + xx
move between start of command line and current cursor position (and back again)
command 2> file
redirect stderr to file (creates the file if it doesn't exist and overwrite it if it does exist)
command &> file
redirect stdout and stderr to file (creates the file if it doesn't exist and overwrite it if it does exist)
command1 | xargs -i command2
uses the output of the command1 as the input of the command2. output will be accessible via {} in command2

bash loops

if elseif fi
if <ex­pre­ssi­on>; then[s­tat­ements] elif <ex­pre­ssi­on>; then [state­ments] else [state­ments] fi

bash loops

 
if <expression>;
then
    [statements]
elif <expression>;
then
    [statements]
else
    [statements]
fi
 
for var in <expression>;
do
    echo $var
    [statements]
done