Terminal
Directories & Files
```terminal
# Where am I? (print working directory) pwd
# Where can I go? ls, ll
# Move directory cd path/to/directory
# Move back? cd ..
# Return to home folder (~) cd
```
Create a new directory
```terminal
mkdir new_directory_name
mkdir first_directory_name second_directory_name
# Delete a directory (⚠️ careful, there's no going back!)
rm -r directory_name
rm -rf directory_name
# Create a new file touch file_name.rb
# Move a file somewhere mv file_name.rb path/to/new/directory
# Rename a file mv file_name.rb new_file_name.rb
# Delete a file (⚠️ careful, there's no going back!) rm file_name.rb
# Open current directory in VSCODE stt, code
# Open current directory in finder (OS X only) open .
```
Useful commands
```terminal
# Clear the command line window clear
# List running processes ps aux
# List running processes of a certain application ps aux | grep 'ruby'
# Kill a process with PID kill <pid>, kill 2209
# Find PID of process used by a specific port: lsof -i :<port> lsof -i :3000
# Check local storage usage df -hP
# Check file sizes of files in current directory du -shc *
# Check latest system errors dmesg
```
Keyboard Shortcuts
```terminal
clear window (keeping history) # ctrl + l
clear window (losing history) # cmd + k
go to the next word # alt + →
go to the previous word # alt + ←
go to the beginning of line # ctrl + a
go to the end of line # ctrl + e
erase the whole line # ctrl + u
```
Enjoy Reading This Article?
Here are some more articles you might like to read next: