B a s h
By CP
B a su i c
n icx o m m a n
How to work with unix
on Windows OS
01 02 03
Download Install it in Click Windows
Git Bash administrator Button &
mode start using
Download link : https://git-scm.com/downloads/win
B a su i c
n icx o m m a n
1 pwd
pwd (Print Working Directory)
Purpose: Shows you the full path of your current directory.
It's like asking "Where am I?"
Syntax: pwd
Example: If you're in your home directory, it might show
/home/yourusername or /Users/yourusername.
B a su i c
n icx o m m a n
2 ls
ls (List Directory Contents)
Purpose: Lists the files and directories in your current location.
Syntax: ls [options] [path]
Common Options:
-l: Long listing format (shows permissions, owner, size, date, etc.)
-a: All files, including hidden ones (those starting with a .)
-h: Human-readable file sizes (e.g., 1K, 234M, 2G)
Examples:
ls (list contents of current directory)
ls -l (list in long format)
ls -la (list all files in long format)
ls /etc (list contents of the /etc directory)
b a su i c
n icx o m m a n
3 cd
cd (Change Directory)
Purpose: Allows you to navigate between directories (folders).
Syntax: cd [directory]
Special Symbols:
~ : Your home directory (e.g., /home/yourusername)
. : The current directory
.. : The parent directory (one level up)
Examples:
cd Documents (move into the "Documents" folder within your
current directory)
cd .. (move one directory up)
cd ~ (go to your home directory)
cd /var/log (go to the /var/log directory from anywhere)
B a su i c
n icx o m m a n
4 mkdir
mkdir (Make Directory)
Purpose: Creates a new directory (folder).
Syntax: mkdir [directory_name]
Common Option:
-p: Create parent directories as needed (e.g., mkdir -p
projects/myproject/src will create all three if they don't exist).
Examples:
mkdir new_folder (creates a directory named new_folder)
mkdir -p my_app/data/logs
B a su i c
n icx o m m a n
5 touch
touch (Create Empty File / Update Timestamp)
Purpose:
Creates an empty new file.
Updates the access and modification times of an existing file to the
current time.
Syntax: touch [file_name]
Examples:
touch my_file.txt (creates my_file.txt if it doesn't exist, or updates
its timestamp if it does)
touch report_2025.txt
B a su i c
n icx o m m a n
6 cp
cp (Copy Files and Directories)
Purpose: Copies files or directories from one location to another.
Syntax: cp [options] source_path destination_path
Common Option:
-r (or -R): Required for copying directories (recursive).
Examples:
cp file1.txt backup/file1.txt (copies file1.txt to the backup directory,
renaming it)
cp report.pdf . (copies report.pdf to the current directory)
cp -r my_project_folder backup/ (copies the entire
my_project_folder and its contents to backup/)
B a su i c
n icx o m m a n
7 mv
mv (Move/Rename Files and Directories)
Purpose: Moves files or directories from one location to another, or
renames them.
Syntax: mv [options] source_path destination_path
Examples:
mv old_name.txt new_name.txt (renames old_name.txt to
new_name.txt in the same directory)
mv document.pdf archived/ (moves document.pdf into the
archived directory)
b a su i c
n icx o m m a n
8 rm
rm (Remove Files or Directories)
Purpose: Deletes files or directories. Be very careful with this
command, as deleted files are not easily recovered!
Syntax: rm [options] file_or_directory
Common Options:
-r (or -R): Required for removing directories (recursive).
-f: Force removal (don't prompt for confirmation). Use with
extreme caution!
-i: Prompt before every removal (safer).
Examples:
rm unwanted_file.txt (deletes unwanted_file.txt)
rm -r old_folder (deletes old_folder and its contents)
rm -rf temporary_files/ (deletes temporary_files and its contents
without prompting - highly dangerous if misused!).
B a su i c
n icx o m m a n
9 cat
cat (Concatenate and Display Files)
Purpose: Displays the content of a file directly to your terminal. Can
also be used to concatenate multiple files.
Syntax: cat [file_name]
Examples:
cat my_document.txt (displays the content of my_document.txt)
cat file1.txt file2.txt (displays content of both files one after
another)
b a su i c
n icx o m m a n
10 man
man (Manual Pages)
Purpose: Provides a manual page (documentation) for most commands
available on your system. It's your best friend for learning more about a
command's options and usage.
Syntax: man [command_name]
To exit man: Press q
Examples:
man ls (opens the manual page for the ls command)
man cp (opens the manual page for the cp command)
b a su i c
n icx o m m a n
How to practice
Create a temporary directory : mkdir my_practice
Move into it : cd my_practice
Create some files : touch file1.txt file2.txt
Create a subdirectory : mkdir sub_dir
Copy a file : cp file1.txt sub_dir/
Move a file : mv file2.txt renamed_file.txt
List contents to see changes : ls -l
View a file's content (if you've added some text) :
echo "Hello World" > file1.txt ; cat file1.txt
(The echo part writes text to the file)
Explore man pages : man cd (then press q to exit)
Clean up : cd .. ; rm -rf my_practice (This removes the my_practice folder
and everything inside it.)