Terminal/Console/Command Line cheatsheets like this is everywhere on the internet, however I am still going to make my own in the spirit of learning in public :)
Also please do let me know if I didn't get something quite right the first time!
pwd
Print Working Directory, this will show you where you currently are
.
A dot means your current directory, so the location shown when you type your pwd
..
Your parent directory, this is one folder above your current directory
~
This is your home directory
cd <folder_name>
Change directory, this will move your position into the folder name, you can also cd into a path so that you can move a few folders in. You can also do cd .. to go back a directory
ls
This will show all the files and folders in your current directory
ll
Another way of checking all files and folders in your current directory, it will return a table format
mkdir <folder_name>
Make directory, this will create a new directory at your current directory (This creates a folder within your current folder)
touch <file_name>
This creates a file, for example, touch index.html
creates index.html
within your current directory
mv <file_location> <file_location2>
This moves the file from location one to location 2.
For example:
mv index.html tmp/index.html
moves the file index.html from the current directory into a directory called tmp within the current directory
rm <file_name>
Remove, but PLEASE MAKE SURE YOU NO WHAT YOU"RE DOING WHEN YOU USE THIS. Sometimes a stack overflow answer might ask you to use this to clear a roadblock. THINK TWICE before blindly using rm because once you've removed your file. It's gone, you can't revert back the change unless you use version control.
When you use rm
, sometimes your command prompt will have a safe gate message, this is because rm
is so dangerous your terminal is asking you whether you are sure you wanna remove that thing. If you are 100% sure you want to rm something, do the following:
rm -rf <file_name>
That's it for the Terminal 101 cheatsheet. These are the most basic command line tools you might use. I recommend trying to play around with this, create new files and folders, move things into different folders, and as much as possible try to navigate your files and folders using terminal only to get good.
For extra resource, try learn enough command line to be dangerous
Hope that helps and let me know what other command line tools you use daily :) Happy coding!
Top comments (0)