Linux Command Reference
Quick guide for developers
Essential Linux Commands
for Developers
A practical quick reference for the most commonly used Linux and Bash commands. Perfect for developers, sysadmins, and anyone working with the command line.
💻 Basic Commands Essential
pwd
Print Working Directory
Display the current directory path
$ pwd
/home/user/projects
ls
List Directory
List files and directories
$ ls -la
drwxr-xr-x 5 user user 4096 Jan 10 10:00 .
-rw-r--r-- 1 user user 512 Jan 10 09:00 file.txt
cd
Change Directory
Navigate to a different directory
$ cd /var/log
$ cd ~ # home directory
$ cd .. # parent directory
mkdir
Make Directory
Create new directories
$ mkdir new_folder
$ mkdir -p path/to/nested/dir
touch
Create File
Create empty file or update timestamp
$ touch newfile.txt
$ touch file1.txt file2.txt file3.txt
echo
Print Text
Display text or variables
$ echo "Hello World"
Hello World
$ echo $PATH
📁 File Operations Files
cp
Copy
Copy files or directories
$ cp file.txt backup.txt
$ cp -r folder/ backup_folder/
mv
Move/Rename
Move or rename files and directories
$ mv old.txt new.txt
$ mv file.txt /path/to/dest/
rm
Remove
Delete files and directories
$ rm file.txt
$ rm -rf directory/ # careful!
cat
Concatenate
Display file contents
$ cat file.txt
$ cat file1.txt file2.txt > combined.txt
head / tail
View Start/End
View beginning or end of files
$ head -n 10 file.txt
$ tail -f /var/log/syslog
find
Search Files
Search for files and directories
$ find . -name "*.txt"
$ find /home -type f -size +100M
grep
Search Text
Search for patterns in files
$ grep "error" log.txt
$ grep -r "TODO" ./src/
chmod
Change Permissions
Modify file permissions
$ chmod +x script.sh
$ chmod 755 file.txt
chown
Change Owner
Change file owner and group
$ chown user:group file.txt
$ chown -R user:group dir/
🔧 System Administration System
ps
Process Status
Display running processes
$ ps aux
$ ps aux | grep node
top / htop
System Monitor
Real-time system monitoring
$ top
$ htop # better interface
kill
Terminate Process
Kill running processes
$ kill 1234
$ kill -9 1234 # force kill
df
Disk Free
Display disk space usage
$ df -h
Filesystem Size Used Avail Use%
du
Disk Usage
Estimate file space usage
$ du -sh *
$ du -h --max-depth=1
free
Memory Usage
Display memory usage
$ free -h
total used free
Mem: 16G 8G 6G
uname
System Info
Print system information
$ uname -a
Linux server 5.4.0 x86_64 GNU/Linux
systemctl
Service Manager
Manage system services
$ systemctl status nginx
$ systemctl restart nginx
journalctl
System Logs
Query systemd journal logs
$ journalctl -u nginx
$ journalctl -f # follow
🌐 Networking Network
curl
HTTP Client
Transfer data from URLs
$ curl https://api.example.com
$ curl -X POST -d "data" url
wget
Download Files
Download files from web
$ wget https://example.com/file.zip
$ wget -O output.zip url
ssh
Secure Shell
Connect to remote servers
$ ssh user@hostname
$ ssh -i key.pem user@host
scp
Secure Copy
Copy files over SSH
$ scp file.txt user@host:/path/
$ scp -r folder/ user@host:/path/
ping
Network Test
Test network connectivity
$ ping google.com
$ ping -c 4 192.168.1.1
netstat / ss
Network Stats
Network connection statistics
$ ss -tulpn
$ netstat -an | grep LISTEN
ip / ifconfig
Network Config
Display network configuration
$ ip addr show
$ ip route
nslookup
DNS Lookup
Query DNS records
$ nslookup google.com
$ dig google.com MX
rsync
Remote Sync
Efficient file synchronization
$ rsync -avz src/ dest/
$ rsync -avz folder/ user@host:/path/
🌿 Git Version Control Git
git init
Initialize Repo
Create a new Git repository
$ git init
$ git init my-project
git clone
Clone Repo
Clone a remote repository
$ git clone https://url/repo.git
$ git clone repo.git my-folder
git status
Check Status
Show working tree status
$ git status
$ git status -s # short format
git add
Stage Changes
Add files to staging area
$ git add file.txt
$ git add . # stage all
git commit
Commit Changes
Record changes to repository
$ git commit -m "message"
$ git commit -am "message"
git push / pull
Sync Remote
Push/pull changes to/from remote
$ git push origin main
$ git pull origin main
💡 Useful Tips & Shortcuts
Keyboard Shortcuts
Ctrl + LCtrl + CCtrl + ECtrl + ACtrl + R↑ ArrowTabHandy One-Liners
history | grep "search"
Search command history
!!
Repeat last command
sudo !!
Repeat last command with sudo
command1 && command2
Run command2 if command1 succeeds