File Management Commands in Linux for Beginners
Introduction
Working with files is one of the most important tasks in Linux. In this post, we will cover the basic commands to create, view, and manage files from the command line.
Step 1: Create an Empty File (touch)
The touch command creates a new empty file.
touch file1.txt
➡️ This will create a file named file1.txt.
Step 2: View File Content (cat)
The cat command displays the contents of a file.
cat file1.txt
➡️ Useful for quickly reading small text files.
Step 3: View File with Paging (less)
The less command shows file content page by page.
less file1.txt
➡️ Press q to quit.
Step 4: Copy a File (cp)
The cp command copies files from one location to another.
cp file1.txt /home/user/Documents/
➡️ This copies file1.txt into the Documents folder.
Step 5: Move or Rename a File (mv)
The mv command moves files or renames them.
mv file1.txt file2.txt
➡️ This renames file1.txt to file2.txt.
Step 6: Delete a File (rm)
The rm command removes files permanently.
rm file2.txt
➡️ Be careful—deleted files cannot be recovered easily.
Conclusion
These file management commands are essential for daily Linux tasks. In the next post, we will explore user and permission management to understand how Linux controls access and security.

Comments
Post a Comment