DevOps & Linux Administration
Basic Linux Commands
Module III: Basic Linux Commands. This module introduces commonly used Linux commands for file handling, directory management, file viewing, copying, moving, deleting, and basic terminal operations. These commands form the core foundation of Linux system usage and DevOps workflows.
Why Linux Commands are Important
Linux commands allow users to interact efficiently with the operating system. Most professional Linux environments, cloud servers, and DevOps systems are managed primarily through terminal commands instead of graphical interfaces.
Speed
Commands execute tasks much faster than GUI operations.
Automation
Commands can be automated using shell scripts.
Remote Access
Servers are usually managed remotely using terminal commands.
Basic Linux Command Syntax
Most Linux commands follow a standard structure:
command [options] [arguments]
| Component | Meaning |
|---|---|
| command | Action to perform |
| options | Modify command behavior |
| arguments | Files, folders, or values used by the command |
Essential Linux Commands
Linux provides various commands to navigate directories and manage files.
| Command | Purpose | Example |
|---|---|---|
| pwd | Shows current directory | pwd |
| ls | Lists files and folders | ls -l |
| cd | Changes directory | cd Documents |
| mkdir | Creates new directory | mkdir project |
| touch | Creates empty file | touch notes.txt |
File Management Commands
Linux provides commands to copy, move, rename, and remove files efficiently.
| Command | Function | Example |
|---|---|---|
| cp | Copies files | cp file1.txt backup.txt |
| mv | Moves or renames files | mv old.txt new.txt |
| rm | Removes files | rm file.txt |
| rmdir | Removes empty directories | rmdir folder |
File Viewing Commands
Linux includes commands for reading and displaying file contents directly in the terminal.
- cat – Displays complete file content
- less – Displays file content page by page
- head – Displays first few lines of a file
- tail – Displays last few lines of a file
Example Usage
$ cat notes.txt Linux is an open-source operating system. $ head notes.txt Linux is an open-source operating system.
Typical Linux Workflow
Summary
In this chapter, we explored important Linux commands used for navigation, file handling, directory management, and viewing file contents. These commands are essential for working efficiently in Linux systems and DevOps environments.