Here's a cheatsheet I'm using to remember some of the most common bash
commands:
This is a command that stands for change directory
and is commonly used to navigate the file system
cd ~
takes you back homecd filename
takes you to the desired location that you choose
This is the command for listing out everything in the directory(folder) ls
. if you want to see everything, including the hidden, use this command ls -a
.
If you have tree
downloaded, type in tree
to get a nice diagram of the contents within your directory.
Use the command mkdir
to create new directories.
- example:
mkdir new-file-name
Use the touch
command.
Us the mv
command. Heres how to move one file to another directory:
mv ~/directory1/folder/file ~/directory1/otherfolder
This is like moving the file but using the same directory but with a different name:
mv ~/drawers/pjs/warm.pjs ~/drawers/pjs/summer.pjs
Use the rm
command to delete both files
- ex:
rm filename
Use the command rm -r
to delete a directory and it's files. If the directory is empty, just use rm
.
Use the cp
command for files and the cp -R
command for entire directories
You can type the command clear
or press cmd k
. You are still able to see history by using the up arrow or by scrolling up.