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]
ComponentMeaning
commandAction to perform
optionsModify command behavior
argumentsFiles, folders, or values used by the command

Essential Linux Commands

Linux provides various commands to navigate directories and manage files.

CommandPurposeExample
pwdShows current directorypwd
lsLists files and foldersls -l
cdChanges directorycd Documents
mkdirCreates new directorymkdir project
touchCreates empty filetouch notes.txt

File Management Commands

Linux provides commands to copy, move, rename, and remove files efficiently.

CommandFunctionExample
cpCopies filescp file1.txt backup.txt
mvMoves or renames filesmv old.txt new.txt
rmRemoves filesrm file.txt
rmdirRemoves empty directoriesrmdir 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

Navigate Directory
Create Files/Folders
Edit & Manage Files
Execute Commands

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.