DEV Community

Nagesh K
Nagesh K

Posted on

Day -2 : Essential Linux File System Knowledge for DevOps Engineers.

As a DevOps engineer, understanding the Linux file system is non‑negotiable. It’s the foundation of where you store code, configure services, check logs, and deploy applications. In this post, I’ll walk you through the most important directories, their purposes, and how you should use them in daily DevOps work.

🏠 User Workspaces vs System Areas

  • User workspace (/home/): This is where you should keep your project code, scripts, and personal files. For example, if your username is ubuntu, your workspace is /home/ubuntu.
  • System areas (/etc, /var, /usr, etc.): These directories are reserved for configurations, logs, binaries, and deployments. You’ll often need sudo to work here because they affect the whole system.

📂 Key Directories Every DevOps Engineer Must Know
/home/
Purpose: User’s personal workspace
DevOps Usage: Store project code, scripts, configs
Example Commands:
cd ~
cd /home/ubuntu

/root
Purpose: Root user’s home directory
DevOps Usage: Reserved for admin tasks, not coding
Example Commands:
sudo su -
cd /root

/etc
Purpose: System configuration files
DevOps Usage: Manage service configs (Nginx, SSH, systemd)
Example Commands:
cd /etc/nginx
nano /etc/ssh/sshd_config

/var/log
Purpose: System and application logs
DevOps Usage: Debug services, monitor errors
Example Commands:
tail -f /var/log/syslog
less /var/log/nginx/error.log

/var/www
Purpose: Web server files
DevOps Usage: Deploy websites and applications
Example Commands:
cd /var/www/html
git clone

/usr/bin
Purpose: User binaries (commands available to all users)
DevOps Usage: Run system commands like ls, grep, etc.
Example Commands:
ls /usr/bin

/bin
Purpose: Essential binaries for boot and recovery
DevOps Usage: Core commands like cat, cp, mv
Example Commands:
ls /bin

/sbin
Purpose: System binaries for admin tasks
DevOps Usage: Commands like shutdown, mount
Example Commands:
ls /sbin
shutdown -h now

/opt
Purpose: Optional software packages
DevOps Usage: Install custom tools or third‑party apps
Example Commands:
cd /opt

/tmp
Purpose: Temporary files (cleared on reboot)
DevOps Usage: Scratch space for testing or temporary storage
Example Commands:
cd /tmp

/dev
Purpose: Device files
DevOps Usage: Interfaces to hardware (disks, terminals)
Example Commands:
ls /dev/sda
ls /dev/tty

/proc
Purpose: Virtual filesystem with process and kernel info
DevOps Usage: Check CPU, memory, and process details
Example Commands:
cat /proc/cpuinfo
cat /proc/meminfo

/mnt and /media
Purpose: Mount points for external drives
DevOps Usage: Access USBs, external disks
Example Commands:
cd /mnt
ls /media/ubuntu

One‑liners for each directory (quick reference).
/home → user workspace
/root → root’s home
/etc → configs
/var/log → logs
/var/www → web apps
/usr/bin → user binaries
/bin → essential binaries
/sbin → admin binaries
/opt → optional software
/tmp → temporary files
/dev → devices
/proc → process info
/mnt,/media → mount points

⚙️ Best Practices for DevOps Work

Workspace: Keep your project repos inside /home/ubuntu.

Example: mkdir myproject && cd myproject && git init
System Configs: Edit service configs in /etc using sudo.

Example: sudo nano /etc/nginx/nginx.conf
Logs: Monitor logs in /var/log for debugging.

Example: tail -f /var/log/syslog
Deployments: Place production code in /var/www.

Example: sudo git clone <repo> /var/www/html
Installations: Use sudo apt install … — packages go into /usr/bin, /usr/lib, etc.

Scratch Work: Use /tmp for temporary files.

📝 Conclusion
For a DevOps engineer, knowing the Linux file system is like knowing the map of a city. You need to know where to live (/home), where the government offices are (/etc), where the logs are kept (/var/log), and where the factories produce tools (/usr/bin). Once you master this structure, you’ll navigate servers confidently, troubleshoot faster, and deploy with precision.

Top comments (0)