Moving around
pwd- Print the folder I'm in.
ls -la- List files, hidden ones too, with details.
cd folder/cd ..- Go into a folder, or one level up.
Files and folders
mkdir -p a/b/c- Make folders, parents included.
touch file.txt- Create an empty file.
cp a.txt b.txt- Copy a file.
mv old.txt new.txt- Move or rename.
rm file.txt/rmdir folder- Delete a file, or an empty folder. There is no recycle bin.
Reading and writing text
echo "hi" > file- Write to a file, replacing what was there.
echo "hi" >> file- Add a line at the end.
cat file- Print the whole file.
wc -l < file- Count the lines.
find . -name "*.js"- Search for files by name.
Git basics
git init- Start a repository in this folder.
git status- See what changed and what is staged.
git add .- Stage every change.
git commit -m "message"- Save a snapshot with a message.
git log --oneline- Short history, one commit per line.
git push origin main- Send my commits to GitHub.