Post

Essential Linux Command Guide

Essential Linux Command Guide

Essential Linux Command Guide

Change to a different directory

```bash cd /path/to/directory

Change to a different directory

cd /path/to/directory

Example: Change to the home directory

cd ~

Listing Files and Directories

List files and directories with detailed information

ls -l

Example: List all files including hidden ones

ls -la

Viewing File Contents

Display the contents of a file

cat filename

Example: View the contents of ‘myfile.txt’

cat myfile.txt

Searching for Text in Files

Search for a string within files

grep ‘search_term’ filename

Example: Search for ‘error’ in ‘logfile.log’

grep ‘error’ logfile.log

Managing Processes

Display the currently running processes

ps aux

Example: Find a specific process by name

ps aux | grep ‘process_name’

Disk Usage

Check the disk usage of directories

du -h

Example: Check the disk usage of the current directory

du -h .

System Updates

Update package lists and upgrade all packages (Debian/Ubuntu)

sudo apt update && sudo apt upgrade

Example: Update and upgrade on Ubuntu

sudo apt update && sudo apt upgrade -y

This post is licensed under CC BY 4.0 by the author.