Skip to main content

Essential Linux Commands

In Linux, every piece of knowledge is stored as a file, and collections of files are organized into directories. This unified design makes Linux powerful and consistent: whether you are interacting with text documents, executables, or devices, the system treats them all as files. Mastering file and directory operations is the foundation of system administration.


Understand Files in Linux

  • Everything is a file: In Linux, almost everything - text, programs, devices are represented as a file.
File Type Description
Regular files Text, images, executables
Directories Special files that act as containers
Symbolic links Shortcuts pointing to other files
Special files Devices (/dev/sda), sockets, pipes
This “everything is a file” philosophy makes Linux powerful and consistent. Whether accessing a disk, a network socket, or a text document, the interaction feels the same.

Core File Commands

Essential commands for managing files and directories:

  • touch: Creates a new empty file
  • cat: Reads the contents of file
  • cp: Copies a file to another directory
  • mv: Moves or renames a file
  • rm: Deletes a file
  • mkdir: Creates a new directory
  • rmdir: Removes an empty directory

File Paths and Navigation

  • Absolute Path: Starts from the root directory (e.g. /home/user/notebook/intro.txt)
  • Relative Path: Starts from the current directory (e.g. ../notebook/intro.txt)
  • Special Symbols:
    • . → Current directory
    • .. → Parent directory
    • ~ → Home directory
Understanding paths is crucial for scripting and automation.

Viewing & Editing Files

  • less: Opens a file for reading, page by page
  • nano / vim: Magical quills for editing file
  • head / tail: Reads the beginning or end of a file

Practical Exercises

# Create a directory and read a file
mkdir Notebook
cd Notebook
touch intro.txt
echo "Introduction to Linux" > intro.txt
cat intro.txt

# Copy and move files
cp intro.txt copy_intro.txt
mv copy_intro.txt ../

# Delete a file and directory
rm intro.txt
cd ..
rmdir Notebook

Hackers Quest - Mini Project

  • Build a directory called Spellbook
  • Inside, create 5 files (spell1.txtspell5.txt)
  • Write a unique “spell” (sentence) in each
  • Copy one file to another directory
  • Delete one file, then directory and reflect: “What happens when knowledge is lost?”

Hackers Notebook

Files and directories are the scrolls and libraries of Linux. Every command, every script, and every system operation begins with them. Mastering file management is the first step toward mastering the kingdom of Linux.


Tips, Tricks, Roadmaps, Resources, Networking, Motivation, Guidance, and Cool Stuff ♥

Updated on Dec 31, 2025