LearnWithShobhan

Linux system info and disk space: date, uptime, uname, df and du explained

Shobhan Biswas··5 min read
>_From the course CLI Mastery: 57 lessons, lifetime access.

You log in to a server and your first questions are always the same: What machine is this? How long has it been running? Who else is on it? How much disk is left? A handful of tiny commands answer all of it.

Here they are, with the two that people mix up the most: df and du.

What is this machine?

CommandAnswers
dateThe current date, time and time zone
uptimeHow long the system has been running, and how busy it is
unameWhich operating system and kernel
whoWho is logged in right now, and from where
usersThe names of logged-in users, on one line
bash
$ date
Thu Nov 12 10:15:32 IST 2026
$ uptime
10:15 up 17 days, 3:42, 2 users, load averages: 1.20 1.31 1.44
$ uname
Darwin
$ uname -a
Darwin shobhan-mac 25.6.0 Darwin Kernel Version 25.6.0 ... arm64
$ who
shobhan console Oct 26 06:33
shobhan ttys001 Nov 12 09:58

(Your output will differ. These are examples.)

  • uptime shows the time since the last restart. On a server, a very short uptime can mean it rebooted unexpectedly. The three numbers at the end, the load averages, are how busy the machine has been over the last 1, 5 and 15 minutes.
  • uname prints the kernel name: Darwin on a Mac, Linux on Linux. Add -a for everything, or pick one piece: uname -s (kernel), uname -r (release), uname -m (CPU type, such as arm64 or x86_64).
  • who lists every login session, including your own terminal windows. users shows the same people, just names.

On Linux, the distribution (Ubuntu, Debian and so on) is not in uname. Check cat /etc/os-release.

How much disk space is left? df

df stands for disk free. It reports on every mounted file system. Without options the sizes are in blocks, which are hard to read, so always add -h (human-readable):

bash
$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 50G 32G 16G 67% /
tmpfs 3.9G 0 3.9G 0% /dev/shm
/dev/sdb1 200G 120G 71G 63% /data

Each line is a disk or partition. Read it left to right: how big it is, how much is used, how much is available, and where it is attached in the file tree (Mounted on). On macOS the columns have slightly different names, but the idea is identical.

df works at the whole file system level, so it does not matter which folder you are in when you run it. You can also ask about one place: df -h /data shows only the disk that holds /data.

What is using the space? du

df tells you the disk is 67% full. It does not tell you why. That is du, disk usage, which measures folders and files:

bash
$ du -h
4.0K ./animal/cat
8.0K ./animal
12K ./docs
24K .

Unlike df, du starts from the current directory (or the path you give it) and walks everything inside.

Left: df shows how full the whole disk is. Right: du shows the size of each folder inside the current directory
df answers 'how full is the disk?'. du answers 'what is taking the space?'

By default it prints every nested folder, which is far too long. Limit the depth with -d (or --max-depth= on GNU/Linux):

bash
$ du -h -d 1
2.4G ./photos
180M ./docs
6.1G ./projects
900M ./.cache
6.1G ./

Only the folders one level down are listed, plus a total on the last line. Use -d 2 to look one level deeper.

Two more variants worth remembering:

du -sh *                  # one size per item here (s = summary)
du -sh /var/log           # the total size of one folder

A simple routine when a disk fills up

  1. df -h to see which file system is full.
  2. cd into its mount point and run du -h -d 1 to find the biggest folder.
  3. cd into that folder and repeat. In a few steps you find the one directory (often logs, caches or old backups) that holds the space.

Cheat sheet

GoalCommand
Current date and timedate
How long has it been up?uptime
Kernel / OS nameuname or uname -a
CPU architectureuname -m
Who is logged inwho
Disk space per file systemdf -h
Size of this folder, one leveldu -h -d 1
Total size of a folderdu -sh <folder>

Key takeaways

  • ✓date, uptime, uname and who tell you the time, how long the machine has run, the OS and who is on it.
  • ✓df -h shows how full each disk is. It does not matter where you run it.
  • ✓du -h -d 1 shows how big each folder inside the current one is.
  • ✓Use df to find which disk is full and du to find what is filling it.
  • ✓Always add -h to read sizes as K, M and G.

Learn to look around any server

These commands are the first things you type on a new machine. CLI Mastery shows them in context: processes, permissions, pipes and a real AWS server you log in to over SSH. 57 lessons, lifetime access. Start with the free lesson on terminals and shells.

Free download

Linux command line cheat sheet

One printable page: navigation, files, permissions, pipes, processes, scripts and SSH.

Occasional emails with new tutorials and courses. Unsubscribe any time.

Keep reading