Essential Linux Commands: Navigation, File Management, and System Inspection

Linux systems rely on a powerful command-line interface for file management, navigation, and system inspection. Unlike graphical operating systems, Linux uses a hierarchical directory tree rooted at /. Mastering core commands enables efficient interaction with the system.

Filesystem Structure Overview

The root directory (/) contains key subdirectories:

  • /bin: Essential user binaries (e.g., ls, cp)
  • /etc: System-wide configuration files
  • /home: User home directories
  • /usr: Secondary hierarchy to user-installed software
  • /tmp: Temporary files
  • /var: Variable data like logs

Command Syntax and Output Colors

Commands follow the pattern: command [options] [arguments]. Terminal colors indicate file types:

  • Blue: Directories
  • White: Regular files
  • Green: Executable files
  • Cyan: Symbolic links
  • Red: Archives/compressed files

Navigation and Path Handling

Use absolute paths (starting with /) or relative paths (using . for current directory, .. for parent):

# Show current absolute path
pwd

# Change directory
cd /etc          # Absolute path
cd ../projects   # Relative path
cd ~             # Home directory

File and Directory Operations

Create, copy, move, and delete files/directories:

# List directory contents
ls -l /home      # Detailed view
ls -a            # Include hidden files

# Create directories
mkdir reports
mkdir -p projects/2024/q3  # Create nested directories

# Create empty files
touch notes.txt
touch report_{jan,feb,mar}.txt  # Multiple files

# Copy files/directories
cp config.txt backup/
cp -r projects/ archive/     # Recursive copy

# Move/rename
mv old.txt new.txt
mv documents/ ~/archive/

# Delete (use cautiously)
rm temp.log
rm -rf obsolete_folder/      # Force recursive delete

File Inspection and Text Processing

View and analyze file contents:

# Display entire file (small files)
cat /etc/hosts

# Paginated viewing (medium/large files)
less /var/log/syslog
more /etc/passwd

# View file ends/beginnings
tail -n 20 error.log    # Last 20 lines
head -n 5 data.csv      # First 5 lines

# Count lines/words
wc -l document.txt      # Line count

Searching and Filtering

Locate files and content:

# Find executables in PATH
which python3

# Search filesystem
find /home -name "*.log"        # By name
find . -size +100M              # Large files
find /etc -type f               # Only files

# Search text patterns
grep "error" /var/log/syslog
grep -r "TODO" ~/projects/      # Recursive search

# Combine commands with pipes
ls -l | grep ".py" | wc -l      # Count Python files

Archiving and Compression

Manage compressed archives:

# Tar operations
tar -czf backup.tar.gz /data    # Create gzipped archive
tar -xzf backup.tar.gz          # Extract

# Zip operations
zip -r docs.zip documents/
unzip docs.zip

Network and System Checks

Verify connectivity and network configuration:

# Test connectivity
ping -c 4 google.com

# Show network interfaces
ip addr show    # Modern replacement for ifconfig

Getting Help

Access documentation:

man ls          # Detailed manual
ls --help       # Brief usage summary

Tags: Linux bash CLI filesystem shell-scripting

Posted on Wed, 04 Nov 2026 16:20:47 +0000 by OttoBufonto