Linux Commands
Linux command-line tools are the building blocks of interaction, enumeration, file manipulation, and system control during any hacking operation. This page breaks down commonly used Linux commands, their usage, categories, and real-world hacking relevance.
Essential Commands
Navigation
Command |
Description |
Example
|
pwd |
Show current working directory |
pwd
|
cd |
Change directory |
cd /etc
|
mkdir |
Create directory |
mkdir testdir
|
rmdir |
Remove empty directory |
rmdir testdir
|
File Operations
Command |
Description |
Example
|
ls |
List contents |
ls -la
|
cat |
View file contents |
cat /etc/passwd
|
less |
Scrollable file viewer |
less file.txt
|
head |
Show first lines |
head -n 10 log.txt
|
tail |
Show last lines |
tail -f log.txt
|
cp |
Copy file |
cp file.txt /tmp/
|
mv |
Move or rename file |
mv old.txt new.txt
|
rm |
Delete file |
rm secrets.txt
|
User Management
Command |
Description |
Example
|
whoami |
Print current user |
whoami
|
id |
Show user/group ID |
id
|
Permissions
Command |
Description |
Example
|
chmod |
Change file permissions |
chmod 755 script.sh
|
System Info
Command |
Description |
Example
|
df -h |
Disk usage |
df -h
|
Networking
Connectivity Tools
Command |
Description |
Example
|
ping |
Send ICMP packets |
ping -c 4 google.com
|
curl |
Fetch URL/API data |
curl http://example.com
|
ssh |
Remote shell access |
ssh user@host
|
Search & Output Manipulation
Text Processing
Command |
Description |
Example
|
grep |
Search for patterns |
grep root /etc/passwd
|
Help & Documentation
Learning a Command
Command |
Description |
Example
|
man |
Show manual page |
man nmap
|
echo |
Output text |
echo "Hello" > out.txt
|
history |
Show command history |
history
|
Examples
SSH with Custom Port
Fetch a Remote Web Page
Make Script Executable
Search for Usernames
grep /bin/bash /etc/passwd
See Also