DEV Community

Devon Argent
Devon Argent

Posted on

Day 2: Navigating Linux Like a Pro (CRUD for Files) πŸ“‚

Continuing my #1HourADayJourney, today was a deep dive into Linux file management. As an aspiring Database Engineer, mastering the OS is just as important as mastering SQL. If you can't navigate the server, you can't manage the data.

πŸ› οΈ What I Practiced Today

I spent my hour practicing how to manipulate files and directories directly through the terminal. Here’s the breakdown:

1. Inspection & Navigation

Before moving things around, you need to know exactly where you are and what’s there.

bash
pwd              # Print Working Directory
echo ~           # Check the Home directory path
ls -la           # List all files, including hidden (.file) and details
ls -R            # Recursive view to see inside all sub-folders
Enter fullscreen mode Exit fullscreen mode

2. File & Directory CRUD (Create, Read, Update, Delete)

bash
# Create
touch file1.txt             # Create an empty file
mkdir testdir               # Create a new directory
echo "Hello Linux" > f2.txt # Create file with content

# Copy & Move (Rename)
cp file1.txt file1_copy.txt # Copy file
cp -r testdir testdir_copy  # Copy entire directory
mv oldname.txt newname.txt  # Rename file
mv file.txt ./target_dir/   # Move file to a specific path

# Delete
rm file.txt                 # Remove a file
rm -i file.txt              # Interactive delete (asks for confirmation - SAFEST!)
rm -rf folder_name          # Force remove a directory and its content
Enter fullscreen mode Exit fullscreen mode

πŸ’‘ The "Aha!" Moment

Today I learned the importance of Paths. I hit a few No such file or directory errors because of typos and wrong relative paths.

Lesson learned: Always use ls to verify your location before moving or deleting files. In a production database environment, a small typo in an rm command could be catastrophic!

🎯 Progress

[x] Terminal Setup (Day 1)

[x] File System Navigation (Day 2)

[ ] File Permissions & Ownership (Coming soon)

Follow my journey: #1HourADayJourney

Top comments (0)