🎓 A1Learner
🔍
0 of 50 lessons completed

A Day with Linux

This lesson puts the whole course to work in one morning check. The same commands run in order, on real files.

Where you stand

The day starts with the folder and its notes.

$ cd ~/practice
$ pwd
$ ls notes

Room on the disk

df shows the disk. free shows the memory.

$ cd ~/practice
$ df -h ~/practice
$ free -h

Load and logs

uptime shows the load. find lists the text files. grep finds the errors.

$ cd ~/practice
$ uptime
$ find data -name "*.txt"
$ grep ERROR data/logs.txt

Example

$ cd ~/practice
$ pwd
$ ls notes
$ df -h ~/practice
$ free -h
$ uptime
$ find data -name "*.txt"
$ grep ERROR data/logs.txt

Key points

  • Use pwd to print the folder you stand in.
  • Use ls to list the files in one folder.
  • Use df -h to show free disk space.
  • Use free -h to show free memory.
  • Use uptime to show the load.
  • Use find to find files by name.
  • Use grep to find lines with a word.
  • Your numbers will differ from the numbers shown here.

In this example, one session checks the folder, the disk, the memory, the load, and the logs. pwd and ls show where you stand. df and free show the room left. uptime shows the load. find lists the text files, and grep finds the two errors.

Try it Yourself

Edit the code, then press Run.

Running is simulated

Exercise

Which command shows free memory?