Linux & Docker · Lesson 2 of 7

Files, search & permissions

Creating, copying and viewing files, searching with grep and find, and chmod/chown.

Everyday file commands:

  • mkdir, touch, cp, mv, rm (careful: rm -r deletes folders with no recycle bin).
  • cat, less, head, tail to read files; tail -f follows a log live.
  • grep searches inside files; find searches for files by name or age.
  • The pipe | sends one command's output into another.

Permissions

Each file has read (r=4), write (w=2) and execute (x=1) permissions for the owner, the group and everyone else. chmod 755 deploy.sh gives the owner rwx and others r-x. Use sudo only when you need administrator rights.

Example in the terminal

Run these on your own computer
$ mkdir -p logs && cp app.log logs/
$ tail -n 3 logs/app.log
2026-11-10 10:01:12 INFO  Server started on port 8080
2026-11-10 10:05:40 ERROR Database connection timed out
2026-11-10 10:05:41 INFO  Retrying connection

$ grep -n "ERROR" logs/app.log
2:2026-11-10 10:05:40 ERROR Database connection timed out

$ grep -c "ERROR" logs/app.log | xargs echo "Errors today:"
Errors today: 1

$ find . -name "*.log" -mtime -1
./logs/app.log

$ ls -l deploy.sh
-rw-r--r-- 1 anu anu 220 Nov 10 10:20 deploy.sh
$ chmod +x deploy.sh && ./deploy.sh
Deploying build 42...

Lines starting with $ are commands you type; the rest is what the terminal prints. Use Linux, macOS, WSL on Windows or a free cloud shell. Names and paths are examples.

Key points

  • cp, mv, rm, mkdir manage files — rm has no undo.
  • tail -f follows logs live; grep finds text in files.
  • Pipes (|) chain commands together.
  • chmod sets permissions; +x makes a script executable.

Quick check

What does chmod 644 file.txt give?

Practice task

Create a folder with three .txt files, write a word into one of them, use grep to find which file contains it, and make a small script executable with chmod +x.

Interview corner

How do you find which files contain a word?

grep -rn "word" folder/ searches recursively and shows file names and line numbers. Add -i to ignore case.

What does chmod 755 mean?

Owner gets read, write and execute (7); group and others get read and execute (5). It's typical for scripts and folders that others may run or open but not change.

Further reading

Official documentation, linked for deeper study. These are outside sites; this lesson's text is our own.

Original lesson written by the InfoparkDaily team · © 2026 InfoparkDaily · Free to learn — no paid course or subscription.