Linux Commands for Developers
File and Directory Management
ls - Lists files and directories in the current directory. Example: ls -l shows
details.
cd - Changes the current directory. Example: cd /home navigates to the /home
directory.
pwd - Displays the current working directory.
mkdir - Creates a new directory. Example: mkdir project creates a folder named
'project'.
rm - Deletes files or directories. Example: rm [Link] deletes '[Link]'. Use rm -r for
directories.
cp - Copies files or directories. Example: cp [Link] [Link] copies [Link] to
[Link].
mv - Moves or renames files and directories. Example: mv [Link] [Link] renames
[Link] to [Link].
touch - Creates an empty file. Example: touch [Link] creates a blank '[Link]'.
find - Searches files and directories. Example: find / -name [Link] looks for '[Link]'.
locate - Finds files quickly using an indexed database. Example: locate [Link].
Text Processing
cat - Displays file contents. Example: cat [Link] shows the content of '[Link]'.
less - Views file content page by page. Example: less [Link].
grep - Searches for patterns in files. Example: grep 'error' [Link] finds 'error' in
[Link].
awk - Processes and analyzes text data. Example: awk '{print $1}' [Link] prints the
first column.
sed - Performs text substitution and manipulation. Example: sed 's/old/new/g'
[Link] replaces 'old' with 'new'.
Networking
ping - Tests connectivity to a host. Example: ping [Link].
curl - Fetches data from URLs. Example: curl [Link] downloads the
page content.
wget - Downloads files from the internet. Example: wget [Link]
netstat - Displays network connections, routing tables, etc.
ss - Shows detailed network statistics. Example: ss -tuln displays listening ports.
scp - Securely copies files between servers. Example: scp [Link] user@host:/path
transfers [Link].
ftp - Transfers files using the FTP protocol. Example: ftp hostname.
Process Management
ps - Displays current running processes. Example: ps aux shows all processes
with details.
top - Displays real-time system resource usage and running processes.
htop - An interactive process viewer (similar to top).
kill - Terminates a process by its PID. Example: kill 1234 kills the process with
PID 1234.
killall - Kills processes by name. Example: killall firefox ends all Firefox processes.
bg - Resumes a suspended job in the background.
fg - Resumes a job in the foreground.
Version Control (Git)
git init - Initializes a new Git repository.
git clone - Clones an existing repository. Example: git clone <repo_url>.
git add - Stages changes for commit. Example: git add [Link].
git commit - Commits staged changes. Example: git commit -m 'message'.
git push - Pushes changes to a remote repository. Example: git push origin main.
git pull - Fetches and merges changes from a remote repository.
git status - Displays the status of the working directory.
git log - Shows the commit history.
git branch - Lists, creates, or deletes branches.
git merge - Merges branches together.
System Monitoring and Disk Usage
df - Displays disk space usage. Example: df -h shows human-readable disk
usage.
du - Shows directory size. Example: du -sh /home gives the size of /home.
free - Displays memory usage. Example: free -h shows human-readable memory
usage.
uptime - Shows how long the system has been running.
uname - Displays system information. Example: uname -a shows all details.
who - Shows logged-in users.
dmesg - Displays kernel log messages.
Archive and Compression
tar - Archives files. Example: tar -cvf [Link] [Link] creates an archive.
gzip - Compresses files. Example: gzip [Link] compresses '[Link]'.
gunzip - Decompresses files. Example: gunzip [Link] decompresses '[Link]'.
zip - Creates zip archives. Example: zip [Link] [Link].
unzip - Extracts zip archives. Example: unzip [Link].
Package Management
apt-get - Installs or removes packages on Debian-based systems. Example: apt-get
install git.
yum - Installs or removes packages on RHEL-based systems. Example: yum install
git.
dnf - A newer package manager for RHEL-based systems. Example: dnf install
git.
pip - Installs Python packages. Example: pip install flask.
Development Utilities
gcc - Compiles C/C++ code. Example: gcc main.c -o main compiles 'main.c'.
make - Builds projects using Makefiles. Example: make all builds all targets.
vim - Edits text files in the terminal. Example: vim [Link] opens '[Link]' for editing.
nano - A simple text editor. Example: nano [Link] opens '[Link]' for editing.
ssh - Connects to remote servers securely. Example: ssh user@host.