Terminal Cheat Sheet 🔥 - The most useful terminal commands 🚀
Tags: webdev, javascript, bash, productivity
Published: 2021-03-13 14:34:54

`Hello world!` Here is a list of the basic terminal commands you should know by heart.

🔖 - Bookmark the article to save the cheat sheet

> And remember to smash that like button ❤️ and maybe 🦄

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/053fp0jns34vxhnjesrb.gif)

You absolutely need to read that:
{% link https://dev.to/devlorenzo/200-js-resources-to-master-programming-3aj6 %}

## Basics

[I love the git bash (I'm on windows)](https://git-scm.com/downloads) - version 4.4.23

> Git Bash emulates a bash environment on windows. It lets you use all git features in command line plus most of standard unix commands.

+ 3 basics commands to remember:
```js
Clear: type "clear" / ctrl + l (windows - Linux) / Command + K (Mac)
help - show all comands
help commandName - help about a specific command
ctrl+D or ctrl+C * 2 to exit 
```

## Working with Directories:
```js
ls - list / list the contents on your current directory
ls -la - Give more information about the list 
pwd - Print Working directory / Print the path to the working directory
cd directory - Change directory / Move between folders - Relative Path (just folders directly contained in the one you are currently)
cd /firstDirectory/secondDirectory/FinalDirectory - Absolute Path (search a directory anywhere in pc)
cd .. - Go back a directory
cd ~ - return to the home directory
mkdir - make directory / create a new directory+
mkdir -v - Make directory + add lines that say you created a directory
touch - Create a file (or multiple) or "touch", change a file (update when it was last modified)
rm - Remove / Delete a File (forever)
rm -rf - Remove recursive force / Delete a directory add all file nested in the directory (also other directories)
rmdir - remove a directory (only work on empty folders)
```

More readable way:

![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/a2l2b5nh8r1bz0ao3r9i.png) 

---

## Basic commands:

Write: `help` to access

![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3zeyhe4vkxkoxt2bea23.png) 

## Git available commands:

![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/u9j4f06k34y3yi0bol2f.png)

Write: `git --help` to access

---

![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/aetgne4gsubcnyfw858k.png)
 
Write: `git help -g` to access

---

> Extra: Writing `git help git` the command line redirect you to a download with all the git bash available commands in a more readable way

> Type `git help -a` to have access to a more advanced line by line commands description - Write q to exit

---

Hope this helped!

> And remember to smash that like button ❤️ and maybe 🦄

---

### You added:

```js
# opens .zprofile for editing (zsh profile)
alias prof='nano /<<ROOTDIRECTORYHERE>>/.zprofile' 
# opens .zshrc for editing
alias rc='nano /<<ROOTDIRECTORYHERE>>/.zshrc' 
# source profiles (should be done every time after changing profile)
alias s='source /<<ROOTDIRECTORYHERE>>/.zprofile; source /<<ROOTDIRECTORYHERE>>/.zshrc;'
# fancy ls
alias lk='ls -lhkart'
# for 'lk' typos ;)
alias kl='ls -lhkart' 
# open current folder in GUI
alias show='open .'
# go back a folder
alias back='cd ..'
# previous folder
alias prev='cd -'
# cd with no arguments brings you to your root folder :)
alias home='cd'
```

`cd (without args)` - Return to the home directory

`pushd and popd.` 

> The pushd command saves the current working directory in memory so it can be returned to at any time, pushd moves to the parent directory. The popd command returns to the path at the top of the directory stack.[5][6] This directory stack is accessed by the command dirs in Unix or Get-Location -stack in Windows PowerShell.
[Learn more](https://en.wikipedia.org/wiki/Pushd_and_popd)

Other articles:

{% link https://dev.to/devlorenzo/how-to-start-learning-coding-at-30-40-28m %}

{% link https://dev.to/devlorenzo/how-to-write-css-like-a-pro-4glj %}

[**Recommended reading!**](https://dev.to/devlorenzo/the-ultimate-compilation-of-cheat-sheets-100-268g)

{% link https://dev.to/devlorenzo/the-ultimate-compilation-of-cheat-sheets-100-268g %} 

---

## **[Subscribe to my Newsletter!](https://chipper-motivator-3112.ck.page/05710ea3d3)**
A loooong, and fun, weekly recap for you 
Free PDF version of my articles
Highly customizable inbox
That's --> free <-- and you help me!