Basic Linux Commands: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
= Linux Commands = | = Linux Commands = | ||
'''Linux command‑line tools''' are the backbone of reconnaissance, exploitation, and post‑exploitation on Unix‑like systems | '''Linux command‑line tools''' are the backbone of reconnaissance, exploitation, and post‑exploitation on Unix‑like systems. | ||
== <span id="commands"></span>Common Commands == | == <span id="commands"></span>Common Commands == |
Revision as of 18:06, 12 May 2025
Linux Commands
Linux command‑line tools are the backbone of reconnaissance, exploitation, and post‑exploitation on Unix‑like systems.
Common Commands
Command | Description |
---|---|
pwd |
Print working directory |
cd |
Change directory |
ls |
List directory contents |
mkdir |
Create directory |
rmdir |
Remove empty directory |
cp |
Copy files or directories |
mv |
Move or rename files/directories |
rm |
Delete files or directories |
Viewing & Text Processing
Command | Description |
---|---|
cat |
Concatenate & display files |
less |
Paginate large files |
head |
Show first lines of a file |
tail |
Show last lines / follow file |
grep |
Search for patterns |
System & User Info
Command | Description |
---|---|
whoami |
Show current user |
id |
Display user/group IDs |
df |
Disk usage overview |
history |
List previously executed commands |
Networking
Command | Description |
---|---|
ping |
Test network connectivity (ICMP) |
curl |
Retrieve data from URLs / APIs |
ssh |
Secure remote shell & tunnelling |
Help & Documentation
Command | Description |
---|---|
man |
Read manual pages |
echo |
Display text / variables |
Examples
Print Working Directory
pwd
Change Directory
cd /var/www
ls -la
Create Directory
mkdir backups
Remove Empty Directory
rmdir backups
Copy File
cp secrets.txt /tmp/secrets.bak
Move & Rename
mv old.log archive/old.log
Force‑Delete Directory
rm -rf /tmp/testdir
Show File Contents
cat /etc/passwd | grep ":/bin/bash"
View Large Log
less /var/log/auth.log
First 10 Lines
head -n 10 notes.txt
Follow File Growth
tail -f /var/log/nginx/access.log
Search Pattern
grep -R \"passwd\" /etc
Current User
whoami
User & Group IDs
id
Human‑Readable Disk Usage
df -h
Show Last 20 Commands
history | tail -n 20
Ping Host 4 Times
ping -c 4 example.com
Download Web Page
curl -o index.html http://example.com
SSH on Custom Port
ssh -p 2222 user@target
Read Manual Page
man ssh
Write to File
echo \"hacked\" > /tmp/proof.txt