3.0 University logo
  • Home
  • About us
  • All Courses
    • Cybersecurity Programs
      • Certified Ethical Hacker (CEH v13)
      • Certified SOC Analyst
      • Certified Penitration Testing Professional
      • Computer Hacking Forensic Investigator
      • Certified Cybersecurity Technician (CCT)
      • Certified AI Program Manager
      • Certified Offensive AI Security Professional
      • Certified Responsible AI Governance & Ethics Professional
      • Artificial Intelligence Essentials
    • Crypto Market Programs
    • Blockchain & Web3 Programs
      • Digital Assets Trading & Analysis Program
      • Certified Web3 Strategy & Growth Specialist
      • Certified Web3 Governance & Compliance Expert
      • Full Stack Blockchain Developer Program
      • Private Blockchain Developer Program
      • Public Blockchain Developer Program
    • Designs Programs
      • Jewellery Design Executive Program
      • Gems & Diamond Specialist Program
      • Jewellery Business Specialist Program
  • Schools
    • School of Decentralized Economics
    • School of Cyber Resilience
    • School of Intelligent Systems
    • School of Design Thinking
  • Partners
    • Certification & Knowledge Partner
    • Academic Partner
    • Hiring Partner
    • Delivery Partner
    • Affiliate Partner
    • Hybrid Center Partner
  • Blog
  • 3.0 TV
  • Home
  • About us
  • All Courses
    • Cybersecurity Programs
      • Certified Ethical Hacker (CEH v13)
      • Certified SOC Analyst
      • Certified Penitration Testing Professional
      • Computer Hacking Forensic Investigator
      • Certified Cybersecurity Technician (CCT)
      • Certified AI Program Manager
      • Certified Offensive AI Security Professional
      • Certified Responsible AI Governance & Ethics Professional
      • Artificial Intelligence Essentials
    • Crypto Market Programs
    • Blockchain & Web3 Programs
      • Digital Assets Trading & Analysis Program
      • Certified Web3 Strategy & Growth Specialist
      • Certified Web3 Governance & Compliance Expert
      • Full Stack Blockchain Developer Program
      • Private Blockchain Developer Program
      • Public Blockchain Developer Program
    • Designs Programs
      • Jewellery Design Executive Program
      • Gems & Diamond Specialist Program
      • Jewellery Business Specialist Program
  • Schools
    • School of Decentralized Economics
    • School of Cyber Resilience
    • School of Intelligent Systems
    • School of Design Thinking
  • Partners
    • Certification & Knowledge Partner
    • Academic Partner
    • Hiring Partner
    • Delivery Partner
    • Affiliate Partner
    • Hybrid Center Partner
  • Blog
  • 3.0 TV
    Login
    ₹0.00 0 Cart

    Learn Articles

    • Home
    • Learn Articles

    Linux File Management Commands: Create, Copy, Move, Find & Delete

    • Posted by 3.0 University
    • Date July 13, 2026
    • Comments 0 comment

    To create a directory in Linux, open your terminal and run mkdir directory_name. That single command is the starting point for all file management on Linux. From there, you copy with cp, move with mv, delete with rm, search with find, and compare with diff.

    How to create a directory in Linux — quick steps:

    1. Open your terminal (Ctrl+Alt+T on Ubuntu).
    2. Type mkdir directory_name and press Enter.
    3. To create nested directories in one command, use mkdir -p parent/child/grandchild.
    4. Verify the directory was created by running ls -la.
    • mkdir creates directories; use mkdir -p to build nested paths in one shot.
    • rm -r deletes non-empty folders permanently, so always double-check the path first.
    • Soft links (symlinks) created with ln -s break if the target file moves; hard links do not.
    • find searches in real time across all directories; locate is faster but reads a cached database.
    • diff file1 file2 shows line-by-line differences and is a must-know for anyone heading into DevOps or sysadmin roles.

    How to Create, Edit and Organise Files and Directories in Linux

    Linux treats almost everything as a file, which means knowing how to create a directory in Linux is genuinely the first practical skill you need at the bash terminal. The command is simple, but a few flags save a lot of time when you are working with nested folder structures or shell scripts.

    mkdir: Creating Directories in Linux

    Run mkdir projects to create a single folder called “projects” in your current location. Need to create several nested folders at once? Use mkdir -p projects/web/frontend and Linux builds the entire path along the absolute path you specify, with no errors thrown if a parent folder does not exist yet.

    Common mistake: forgetting -p and getting a “No such file or directory” error when you try to create a subfolder inside a folder that does not exist yet. Add -p by default when you are building nested structures in your bash shell. You can also create multiple directories at once: mkdir dir1 dir2 dir3.

    touch: Creating Empty Files

    Use touch index.html to create an empty file instantly at the terminal. It also updates the timestamp on an existing file without changing its content, which is useful for scripting. Students at institutions like IIT Bombay, NIT Trichy, and those enrolled in NPTEL Linux courses on IIT Madras Open Online Courses often use touch inside shell scripts to create placeholder log files before a process runs.

    How to Copy and Move Files in Linux

    To copy a file in Linux, the command is cp source destination. For example, cp report.txt /home/user/backup/report.txt copies the file to your backup folder using its absolute path. Add -r to copy an entire directory: cp -r projects/ /mnt/backup/projects/.

    Moving files uses mv source destination. The same command doubles as a rename tool: mv old_name.txt new_name.txt renames the file in place. One thing to watch: mv overwrites the destination silently by default. Use mv -i to get an interactive prompt before any overwrite happens. Indian IT companies like Infosys, Wipro, and TCS run large Linux-based server environments where accidental overwrites during deployments can cause production incidents, making the -i flag a professional habit worth building early.

    How to Delete Files and Folders Safely in Linux

    Deletion in Linux is permanent by default. There is no Recycle Bin. That makes this the section you want to read carefully before you start typing commands in your terminal.

    rm and rmdir: The Right Tool for Each Job

    Use rmdir foldername to delete an empty directory. If the folder has files inside it, rmdir refuses and throws an error, which is actually a useful safety net. To delete a non-empty directory in Linux, you need rm -r foldername. The -r flag means recursive, so it wipes everything inside.

    Add -i for interactive mode: rm -ri foldername prompts you before deleting each file. This is the recommended approach whenever you are working near important data or running as root. Never run rm -rf / or rm -rf /*. Modern Linux distros block this, but older systems do not.

    Checking Disk Usage Before You Delete

    Before removing a large directory, run du -sh foldername to see how much space it takes. The -s flag gives a summary total, and -h makes it human-readable (MB, GB). According to the Linux Foundation’s 2023 Jobs Report, 47% of hiring managers say finding talent with Linux skills is their top challenge, which underscores why safe file management practices are tested in technical interviews.

    Command Use Case Safe for Non-Empty Folders? Recoverable?
    rmdir Delete empty directory No No
    rm -r Delete directory and all contents Yes No
    rm -ri Interactive recursive delete Yes No
    rm -f Force delete, ignore warnings Files only No
    trash-cli (third party) Move to trash instead of permanent delete Yes Yes

    If you want a safety net, install the trash-cli package and alias rm to trash in your .bashrc. This is a common setup recommendation in Kali Linux beginner guides where students are learning on live systems and cannot afford to wipe a working environment.

    How to Create Symlinks and Find Files Across the Entire System

    ln -s: Creating a Soft Link (Symlink) in Linux

    A symlink is a pointer to another file or directory. To create one, run ln -s /path/to/original /path/to/link. For example, ln -s /var/www/html/mysite ~/mysite gives you a shortcut in your home directory that points to the web root using an absolute path.

    Soft links and hard links behave differently, and the difference matters in real work.

    • Soft link (symlink): Points to a path. If the original file moves or is deleted, the symlink breaks and shows “dangling symlink” errors.
    • Hard link: Points directly to the inode (the actual data on disk). The file remains accessible even if the original is deleted, as long as at least one hard link exists.
    • Hard links cannot span different file systems or partitions. Symlinks can.

    Common mistake: creating a symlink with a relative path and then moving the link to a different directory. The relative path breaks. Use absolute paths with ln -s unless you are certain the link will not move.

    find vs locate: How to Find a File in All Directories in Linux

    The find command searches in real time across the Linux file system hierarchy. To find a file in all directories in Linux, run find / -name “config.php” 2>/dev/null. The / tells it to start from the root, -name matches the filename, and 2>/dev/null suppresses permission-denied errors so you can read the output cleanly.

    You can narrow it down: find /home -name “*.log” -mtime -7 finds all .log files in /home modified in the last seven days. That is genuinely useful for auditing or debugging on a server.

    Feature find locate
    Search method Real-time file system scan Pre-built database (updatedb)
    Speed Slower on large systems Near-instant
    Finds newly created files Yes Only after updatedb runs
    Supports filters (size, date, permissions) Yes Limited
    Example syntax find / -name “file.txt” locate file.txt

    locate is faster because it reads from a pre-built database updated by updatedb, usually run nightly. Run locate config.php and you get results almost instantly. The catch: if a file was created today and updatedb has not run yet, locate will not find it. Use find when freshness matters; use locate when speed matters and you know the file has existed for at least a day.

    According to Stack Overflow’s Developer Survey 2023, Linux is the most used operating system among professional developers globally at 53%, which means these terminal commands are not niche knowledge. They are everyday professional tools used across the Indian IT industry and globally.

    diff: How to Compare Two Files in Linux

    Run diff file1.txt file2.txt to see every line that differs between two files. Lines prefixed with < are from the first file; lines with > are from the second. If the output is empty, the files are identical.

    For a side-by-side view, use diff -y file1.txt file2.txt. For comparing entire directories, diff -rq dir1/ dir2/ lists only the files that differ without showing the actual content changes. This is a common task in DevOps pipelines and comes up regularly in DevOps interview questions at Indian product companies and service firms alike.

    A 2023 NASSCOM Tech Talent Report found that shell scripting and Linux command proficiency are among the top five skills Indian IT recruiters screen for at the entry level. Knowing how to create a directory in Linux, use find, and run diff puts you ahead of candidates who have only used graphical interfaces. Employers at firms like HCL Technologies, Cognizant, and mid-size SaaS startups in Bengaluru and Hyderabad routinely test these skills in technical screening rounds.

    Frequently Asked Questions

    How do you create a directory in Linux?

    Use the mkdir command followed by the directory name: mkdir myfolder. To create nested directories in one command at the bash terminal, add the -p flag: mkdir -p projects/web/css. This builds the full path even if intermediate directories do not exist yet. You can also create multiple directories at once: mkdir dir1 dir2 dir3.

    How do you delete a non-empty directory in Linux?

    Use rm -r foldername to recursively delete a directory and everything inside it. This is permanent with no undo option. For safety, use rm -ri foldername to confirm each deletion interactively. Check the folder size first with du -sh foldername so you know exactly what you are removing before you run the command.

    How do you create a soft link (symlink) in Linux?

    Run ln -s /absolute/path/to/original /path/to/symlink. For example, ln -s /etc/nginx/sites-available/mysite /etc/nginx/sites-enabled/mysite is the standard way to enable an Nginx site on Ubuntu. Always use absolute paths to avoid broken links if you move the symlink to a different directory later.

    How do you find a file in all directories in Linux?

    Use find / -name “filename” 2>/dev/null to search the entire file system starting from root. Replace / with a specific path like /home or /var to limit scope and speed up the search. For faster but possibly outdated results, use locate filename after running sudo updatedb to refresh the database.

    How do you compare two files in Linux?

    Run diff file1.txt file2.txt to see line-by-line differences. Use diff -y for a side-by-side comparison or diff -u for unified format, which is the standard output used in Git patches. To check if two files are identical without seeing the differences, use cmp -s file1 file2 && echo “Identical” || echo “Different”.

    How do you rename a file in Linux?

    Use the mv command: mv oldname.txt newname.txt. The mv command moves files between locations and renames them in place when the source and destination are in the same directory. There is no separate rename command in standard Linux, though some distributions include a rename utility for batch renaming with pattern matching.

    What is the difference between cp and mv in Linux?

    cp copies a file, leaving the original in place. mv moves a file, removing it from the source location. Use cp when you need a backup or duplicate; use mv when you want to relocate or rename a file. Both commands accept the -i flag to prompt before overwriting an existing file at the destination.

    These commands form the core of practical Linux use. Start with how to create a directory in Linux using mkdir and touch, get comfortable with cp and mv, and build up to find, ln -s, and diff as you work through real projects. Each one gets more intuitive with repetition, and the muscle memory pays off fast whether you are working in a bash shell locally or managing remote servers.

    If you want structured, hands-on practice with Linux, shell scripting, and the command-line skills that Indian tech employers actually test for, explore the programs at 3University. The curriculum is built around real-world tasks, not just theory.

    Last updated: July 2026. Reviewed by the 3University editorial team.

    • Share:
    3.0 University

    Previous post

    Basic Linux Commands Explained: grep, sed, awk, cp, find & More
    July 13, 2026

    Next post

    Linux File Permissions Explained: chmod, chown and Practical Examples
    July 13, 2026

    You may also like

    Free AI Certificate Course by Government of India
    FREE AI Course with Certificate Launched by Govt of India
    June 19, 2026
    Highest Paid Professions in India
    Highest Paid Profession in India
    June 12, 2026
    Cyber Security Course Eligibility
    Cyber Security Course Eligibility
    June 11, 2026

    Leave A Reply Cancel reply

    You must be logged in to post a comment.

    3.0 University is a pioneering academic initiative for creating a comprehensive knowledge ecosystem for emerging technologies. We have developed an in-house suite of course offerings for retail, institutional market participants and industry-at-large. 

    Facebook X-twitter Instagram Linkedin
    Quick Links
    • About us
    • Courses
    • Become a Partner
    • Contact Us
    • Blog
    • Learn
    Trending Courses
    • Certified SOC Analyst
    • Certified Ethical Hacker v13 Program
    • Certified Penitration Testing Professional
    • Full Stack Blockchain Developer
    • Certified AI Program Manager
    Policies
    • Privacy Policy
    • Terms and Conditions
    • Disclaimer
    • Refund Policy
    Contact Us
    FT Tower, CTS No. 256 & 257,
    Suren Road, Chakala, Andheri (E), Mumbai-400093 India.

    +91 8657961141

    support@3university.io

    Login with your site account

    Lost your password?

    Not a member yet? Register now

    Register a new account

    Are you a member? Login now

    Login with your site account

    Lost your password?

    Not a member yet? Register now

    Register a new account

    Are you a member? Login now

    Sign In

    Welcome back! Or create an account

    OR
    Forgot password?

    Need a new verification email?

    Don't have an account? Register

    Create Account

    Already have an account? Sign in

    OR

    Already have an account? Log in

    Reset Password

    Enter your email and we'll send you a reset link.

    ← Back to login

    Check Your Email

    Almost there!
    We have sent a verification link to your email address. Please check your inbox (and spam folder) and click the link to activate your account.

    Didn't receive the email? Enter your address to resend:

    Already verified? Sign in