Basic Terminal
Basic Terminal
Essential terminal commands for file system navigation, file management, and system operations across different operating systems.
Change Directory
Change the current working directory
cd path/to/directory
List Directory Contents
List files and directories in the current directory
ls
List Directory Contents (Windows)
List files and directories in the current directory (Windows)
dir
List Directory Contents (Detailed)
List files and directories with detailed information
ls -la
Print Working Directory
Print the current working directory path
pwd
Print Working Directory (Windows)
Print the current working directory path (Windows)
cd
Create Directory
Create a new directory
mkdir directory_name
Create Nested Directories
Create nested directories (including parent directories)
mkdir -p parent/child/grandchild
Create Nested Directories (Windows)
Create nested directories (Windows)
mkdir parent\child\grandchild
Remove Directory
Remove an empty directory
rmdir directory_name
Remove Directory and Contents
Remove a directory and all its contents
rm -r directory_name
Remove Directory and Contents (Windows)
Remove a directory and all its contents (Windows)
rmdir /s /q directory_name
Copy File
Copy a file to a new location
cp source_file destination_file
Copy File (Windows)
Copy a file to a new location (Windows)
copy source_file destination_file
Copy Directory Recursively
Copy a directory and all its contents
cp -r source_directory destination_directory
Copy Directory Recursively (Windows)
Copy a directory and all its contents (Windows)
xcopy source_directory destination_directory /E /I /H
Move File
Move or rename a file
mv source_file destination_file
Move File (Windows)
Move or rename a file (Windows)
move source_file destination_file
Remove File
Remove a file
rm file_name
Remove File (Windows)
Remove a file (Windows)
del file_name
View File Contents
Display the contents of a file
cat file_name
View File Contents (Windows)
Display the contents of a file (Windows)
type file_name
View File Contents (Page by Page)
View file contents page by page (use q to quit)
less file_name
View File Contents (Page by Page) (Windows)
View file contents page by page (Windows)
more file_name
Search for Files
Search for files matching a pattern
find . -name "*.txt"
Search for Files (Windows)
Search for files matching a pattern (Windows)
dir /s /b *.txt
Search for Text in Files
Search for text within a file
grep "search_term" file_name
Search for Text in Files (Windows)
Search for text within a file (Windows)
findstr "search_term" file_name
Create Symbolic Link
Create a symbolic link to a file or directory
ln -s target_path link_name
Create Symbolic Link (Windows)
Create a symbolic link to a file or directory (Windows)
mklink link_name target_path
Change File Permissions
Change file permissions (read, write, execute)
chmod 755 file_name
Change File Owner
Change the owner and group of a file
chown user:group file_name
Compress Files (Tar)
Create a compressed tar archive
tar -czvf archive.tar.gz file1 file2 directory1
Extract Files (Tar)
Extract files from a compressed tar archive
tar -xzvf archive.tar.gz
Compress Files (Zip)
Create a zip archive
zip -r archive.zip file1 file2 directory1
Extract Files (Zip)
Extract files from a zip archive
unzip archive.zip
View Command History
Display command history
history
View Command History (Windows)
Display command history (Windows)
doskey /history
Clear Screen
Clear the terminal screen
clear
Clear Screen (Windows)
Clear the terminal screen (Windows)
cls
Display Environment Variables
Display environment variables
env
Display Environment Variables (Windows)
Display environment variables (Windows)
set
Set Environment Variable
Set an environment variable
export VARIABLE_NAME=value
Set Environment Variable (Windows)
Set an environment variable (Windows)
set VARIABLE_NAME=value
Run Command in Background
Run a command in the background
command &
Run Command in Background (Windows)
Run a command in the background (Windows)
start command
View Running Processes
Display running processes
ps aux
View Running Processes (Windows)
Display running processes (Windows)
tasklist
Kill Process
Terminate a process by ID
kill process_id
Kill Process (Windows)
Terminate a process by ID (Windows)
taskkill /PID process_id /F
Kill Process by Name
Terminate a process by name
pkill process_name
Kill Process by Name (Windows)
Terminate a process by name (Windows)
taskkill /IM process_name.exe /F