Essential Ubuntu File Management Commands for Beginners

If you’re just getting started with Ubuntu, managing files might seem like a big task. Don’t worry though. With a few simple commands, you’ll feel in control of your system in no time. In this guide, I’ll break down the essential file management commands you need. The best part? You don’t need to be a tech expert. I’ll walk you through it, step by step, in plain English.

Why You Should Know These Commands

Once you get comfortable with file management in Ubuntu, you’ll work faster and more efficiently. Whether you’re organizing personal files or managing system folders, learning these commands is essential. So let’s get started.

1. Listing Files and Folders: The ls Command

The very first thing you’ll want to do is see what’s inside a folder. That’s where ls comes in. It’s a basic but super useful command.

  • How to Use It:
ls
  • Example:
    Imagine you’re in your Documents folder and you want to see what’s inside. Just type ls and hit enter. You’ll see something like this:
file1.txt  file2.txt  Work  VacationPhotos
  • Options to Know:
  • ls -l: This shows more details, like the size of each file and when it was last modified.
  • ls -a: Want to see hidden files? This shows even the files that start with a dot (like .config). Pro Tip: Use ls -lh to make file sizes easier to read. Instead of seeing “10240,” you’ll see “10K,” which is much more understandable.

2. Creating New Folders: The mkdir Command

Need a new folder for organizing your files? The mkdir command is what you’re looking for.

  • How to Use It:
mkdir <folder-name>
  • Example:
    Let’s say you’re working on a project and need a new folder for it. Just type:
mkdir MyProject

Then, if you type ls, you’ll see MyProject right there in the list.

3. Moving and Renaming Files: The mv Command

This is one of those commands that’s super versatile. You can use it to move a file from one place to another, or even to rename a file.

  • How to Move a File:
mv <file-name> <destination-folder>
  • Example:
    Say you want to move file1.txt into the Work folder. You’d type:
mv file1.txt Work/
  • Renaming a File:
    You can also rename a file with the same command. Want to change file2.txt to notes.txt? Just type:
mv file2.txt notes.txt

Pro Tip: You can also use mv to move multiple files at once. Just list them all before the destination.

4. Copying Files: The cp Command

If you need to make a copy of a file, cp is the command to use. It’s simple and straightforward.

  • How to Use It:
cp <file-name> <destination-folder>
  • Example:
    Let’s say you want to copy file1.txt into the Backup folder. Here’s how you’d do it:
cp file1.txt Backup/
  • Copying Folders:
    If you need to copy an entire folder, just add the -r option, which stands for “recursive.” It copies everything inside the folder too.
cp -r MyProject/ Backup/

5. Deleting Files and Folders: The rm and rmdir Commands

Be careful with this one! Once you delete something with rm, it’s gone. There’s no recycling bin here, so double-check before hitting enter.

  • How to Delete a File:
rm <file-name>
  • Example:
    Want to delete oldfile.txt? Here’s how:
rm oldfile.txt
  • Deleting Folders:
    For folders, use rmdir for empty folders or rm -r for folders with files inside.
rm -r OldProject/

6. Navigating Between Folders: The cd Command

If you want to switch between folders, cd is the command you’ll use.

  • How to Use It:
cd <folder-name>
  • Example:
    To move into the Documents folder, type:
cd Documents/
  • Going Back a Step:
    If you want to go back to the previous folder, just type:
cd ..

Pro Tip: Typing cd ~ will take you right back to your home folder, no matter where you are.

7. Viewing File Contents: The cat and less Commands

Sometimes, you just want to take a quick look at what’s inside a file. cat is great for this.

  • How to Use It:
cat <file-name>
  • Example:
    Want to see what’s inside notes.txt? Just type:
  cat notes.txt

For larger files, though, less is your friend. It lets you scroll through the content, which is a lot easier for big files.

less notes.txt

Table of Common Ubuntu File Management Commands

CommandWhat It DoesExample
lsLists files in a folderls -l
mkdirCreates a new foldermkdir NewFolder
mvMoves or renames filesmv file1.txt Work/
cpCopies files or folderscp file.txt Backup/
rmDeletes files and foldersrm file.txt, rm -r MyFolder/
cdChanges the current working foldercd Documents/

Frequently Asked Questions (FQ&A)

1. How do I move multiple files at once?
Simply list all the files you want to move before specifying the destination folder. Example:

mv file1.txt file2.txt Documents/

2. Is there a way to recover deleted files?
Once you delete a file using rm, it’s gone for good. So be extra cautious.

3. How can I see hidden files in Ubuntu?
Hidden files (those that start with a dot) can be viewed using the ls -a command.

4. How do I copy an entire folder?
Use the cp -r command to copy folders, which includes everything inside the folder.

5. What’s the difference between cat and less?
cat shows you the whole file at once, while less letting you scroll through it, which is handy for longer files.

Conclusion

Getting comfortable with Ubuntu file management is one of the best things you can do to speed up your workflow. From listing files to copying and moving them around, these commands are the foundation of working efficiently in the terminal. The more you practice, the more natural it becomes. So, go ahead and try them out.

Deepak Maurya

About the Author: Deepak Maurya

I hold a Computer Science degree, which built my skills in programming and system administration. Over time, my passion for Linux grew, not just for its tech power but because of the supportive community around it. Writing about Linux, especially Ubuntu, lets me share what I’ve learned. I understand how challenging it can be to start with something as flexible as Linux, so my aim is to simplify complex topics for everyone, no matter their skill level.

Full Bio »

Leave a Comment