Linux Classroom notes 25/mar/2026

Linux Commands

File Viewing & Editing

cat — Display file content

Prints entire file to terminal.

cat file.txt
  • Useful for quick file checks or piping output.

less — View large files interactively

Scroll through files page by page.

less largefile.log
  • q → Quit
  • /text → Search

Best for reading logs or big files.


head — View beginning of file

head file.txt
head -n 20 file.txt

Quickly inspect file headers.


tail — View end of file

tail file.txt
tail -n 50 file.txt
tail -f app.log

Common for live log monitoring.


nano — Simple text editor

nano file.txt
  • Ctrl + O → Save
  • Ctrl + X → Exit

Beginner-friendly editing.


vim — Advanced text editor

vim file.txt
  • i → Insert mode
  • Esc → Normal mode
  • :wq → Save & quit

Search & Find

find — Locate files (ec2)

find . -name "file.txt"
find /var/log -type f -name "*.log"

Precise but slower search.


grep — Search inside files

grep "error" app.log
grep -i "warning" app.log
grep -r "config" .

Essential for debugging & log analysis.


locate — Fast file search (ec2)

sudo apt-get update && sudo apt-get install plocate -y
locate service
sudo updatedb

Extremely fast (uses indexed database).


System Information

uname — System details

uname -a

top — Real-time processes

top

Press q to exit.


htop — Enhanced process viewer

htop

Easier navigation (if installed).


df — Disk space usage

df -h

du — Directory size

du -sh folder/

free — Memory usage

free -h

Process Management

ps — List processes

ps aux

kill — Stop process (by PID)

kill 1234
kill -9 1234

Use -9 only when necessary.


killall — Stop by name

killall chrome

bg — Resume in background

bg

fg — Bring to foreground

fg

Tips

Use manual pages

man grep

Combine commands (pipes)

cat file.txt | grep "error"

Monitor logs live

tail -f /var/log/syslog

Leave a comment

Turn on JavaScript to leave a comment.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Please turn AdBlock off
Customized Social Media Icons from Acurax Digital Marketing Agency
Exit mobile version
%%footer%%