Here’s a Unix Commands cheat sheet:
Navigation
Change Directory:
cd directory_path
List Files and Directories:
ls
List All Files (Including Hidden):
ls -a
Present Working Directory:
pwd
File Operations
Create a File:
touch filename
Create a Directory:
mkdir directory_name
Copy File:
cp source_file destination
Copy Directory:
cp -r source_directory destination
Move/Rename File or Directory:
mv old_name new_name
Remove File:
rm filename
Remove Directory:
rm -r directory_name
Viewing and Editing Files
Display File Contents:
cat filename
View File with Pager (e.g., less):
less filename
Edit File:
nano filename
File Permissions
Change File Permissions:
chmod permissions filename
Searching
Search for a String in Files:
grep "search_string" file_pattern
Find Files and Directories:
find directory -name "file_pattern"
Compression and Archiving
Create Tar Archive:
tar -cvf archive_name.tar files_to_archive
Extract Tar Archive:
tar -xvf archive_name.tar
Create Zip Archive:
zip archive_name.zip files_to_archive
Extract Zip Archive:
unzip archive_name.zip
Process Management
List Running Processes:
ps
Kill Process by ID:
kill process_id
System Information
Display System Information:
uname -a
Show Disk Usage:
df -h
Show Memory Usage:
free -m
Networking
Check Network Configuration:
ifconfig
Ping a Host:
ping host
Check Open Ports:
netstat -tulpn
Transfer Files (e.g., SCP):
scp source_file user@host:destination_path
User Management
Create User:
sudo adduser username
Change User:
su username
Change User Password:
passwd username
This cheat sheet provides a quick reference to commonly used Unix commands. For more detailed information and options, you can refer to the man pages for each command or explore Unix documentation.