One Pager Cheat Sheet
- In this lesson, we will learn about
bash
and its basic commands, with a focus on understanding how to perform operations using the command line. - Bash enables users to provide
commands
after aprompt
, which then executes these commands and displays the prompt again when done. - With basic Bash commands you can
navigate
through a system to effectively manage files and directories. - The
echo
command displays its arguments on the standard output on the terminal, with an optional option, and can also be used to output the values of system variables when preceded with a dollar sign ($). - The command
pwd
is used toPrint Working Directory
, displaying the current directory in the output. ls
is a command used to list down the contents of a directory, often withoptions
or a specificlocation
specified.- We can use the
cd
command tochange directory
both with a specificpath
and by goingup the hierarchy of parent directories
with a shortcut. - The
echo
command can be modified usingoptions
,flags
and/orswitches
, such as-n
, to alter its default behavior of ending the output with a newline character. - Through the use of bash commands, files can be
renamed
,moved
,created
, anddeleted
. - The
mkdir
command allows users toMake Directory
with the specified name, using the syntaxmkdir[option]<directory name>
. - Using
rmdir
with thesyntax: rmdir[option]<directory name>
removes a specified and empty directory, however, there is no undo option so users should exercise caution. - The
touch
command is used to create blank files with thesyntax
touch[option]<filename>
. - The command
rm
is used toremove
files, with the addition of the-r
option allowing therecursive
removal of non-empty directories. - The
mv
command can be used to move or rename a file or directory. - The
touch
command is used to create empty files and update file timestamps, while themkDIR
command is used to create new directories that don't already exist. - This command does not rename the file but instead moves it using the
mv
command to a different directory. To customize Linux and Bash commands, use
--helpoption with a command and for more advanced commands and tips, refer to our guide to advanced commands.