- 👉🏻What to do if my terminal is not reponding (blocked/jammed/frozen) etc?
- Press
q - Presss
ctrl+c - Presss
ctrl+cmultiple times. - Kill the terminal by:
- 🗑️ bin icon on top of terminal (for VS Code)
- ❌ cross button on top-right or top-left corner (for native operating system terminal)
- Press
ls stands for list.
# List all files in current directory (it is also called as working directory sometimes).
ls
# Print hidden files as well
ls -a
# Print in long list format
ls -l
# Print in long list format + show hidden files
ls -alpwd stands for Print working directory. It tell in which folder you are currently in your terminal:
pwdpwd AFTER EACH cd COMMAND BELOW TO SEE THAT YOUR CURRENT WORKING DIRECTORY HAS ACTUALLY CHANGED.
# `cd` stands for `change directory` and it used use to goto specified directory
cd ~/Documents
# If you pass no arguments to cd command it will go to ~ (i.e., your home directory)
cd
# Go to parent foler
cd ..This command is used to create empty files.
ls AFTER EACH touch COMMAND BELOW TO SEE THAT THE SPECIFIED FILE IS ACTUALLY CREATED.
touch myfile1
touch myfile2 myfile3cd ~/Documents
# Creates a test directory (folder) in current directory (folder)
# mkdir test
# Note: If we create test directory again using same command we get error:
mkdir test
# Output: mkdir: test: File exists
# Output: mkdir: cannot create directory 'test': File exists
# To avoid above error we can use -p option (flag) so that error is supressed.
mkdir -p test
# Also, -p option is useful to create multiple directories of the provided path as well.
# Below statement will create folder1 and create fodler2 inside that; and folder3 inside that.
mkdir -p folder1/folder2/folder3cd ~/Documents/
# ⚠️⚠️ NOTE: BEFORE EXECUTING COMMAND `mkdir test` (below command) PLEASE CHECK WITH `ls` COMMAND IF
# test DIRECTORY ALREADY EXISTS OR NOT. IF test DIRECTORY ALREADY EXISTS THEN DO NOT RUN
# BELOW COMMAND BECAUSE IT WILL THROW ERROR SAYING `file already exists`.
mkdir test
cd test
mkdir "$(date +%Y-%m-%d)" # Simply copy/paste this command, no need to remeber any syntax here.
ls
# Output: We must see a new folder with today's date.
# Tip 1: Use TAB key to auto complete folder path after typing some letters for e.g, cd 2026-<TAB> to auto complete the folder path.
# Tip 2: Replace XX-XX with the today's month and date respectively to match the folder you created using mkdir command.
cd 2026-XX-XX
ls
# Output: <See that the folder is empty>
touch file1
ls
# Output: <See that file1 is created>
rm file1
ls
# Output: <See that file1 is deleted and the folder is empty again>
touch file3 file4
ls
# Output: <See that file3 and file4 are created>
# Go to parent foler
cd ..
# Go to previous folder again
cd -