SystemV vs systemd Boot Order

Hola! I decided to put together this compare and contrast the boot order between SystemV and systemd. Contact me if you have any questions.

StageSystemV (SysVinit)systemd
Firmware startBIOS or UEFI loads bootloaderBIOS or UEFI loads bootloader
BootloaderGRUB loads kernel + initramfsGRUB loads kernel + initramfs
Kernel startKernel initializes hardwareKernel initializes hardware
First process/sbin/init (PID 1)/usr/lib/systemd/systemd (PID 1)
Config read/etc/inittabUnit files + generators
Default stateRunlevel (0–6)Target (multi-user.target)
Startup methodSequential shell scriptsParallel unit activation
OrderingNumeric prefixes (S10, S20)Dependency graph
Service location/etc/init.d//usr/lib/systemd/system/
Runlevel dirs/etc/rc.d/rc*.d//etc/systemd/system/
Dependency handlingManual, fragileAutomatic, strong
Boot speedSlowerFaster
Loggingsyslogjournal
Status trackingLimitedFull state tracking

Remember to stay strong and keep brewing great coffee at home!

Practical Linux File Management Examples

Below are real-world examples practical Linux file management examples you can try on any test server.
Every command includes a quick explanation and a useful scenario. But, before trying the below Linux commands, I need to brew a great cup of specialty coffee at home.

Directory and File Basics

Create a folder for logs files:

mkdir logs

Create nested folders:

mkdir -p proj/some/folder/

Create an empty file with the touch command:

touch somefile.txt

Update file’s timestamp: (file that was already created)

touch somefile.txt

List all files with details:

ls -l

Show hidden files:

ls -la

Sort files by time:

ls -lt

Copy files:

cp file1.txt somedir/

Copy a directory recursively:

cp -r /dir/youdir backupdir/

Rename a file:

mv onefile.txt onefile-old.txt

Move to another folder:

mv mylog.log somelogsdir/

Remove a file:

rm filetoremove.txt

Remove a directory and contents:

rm -rf dirtoremove/

⚠️ Always double check before running the above command!

Remove empty folder:

rmdir emptydir/

If directory is NOT empty:

rm -rf notemptydir/

Find all .log files using the find command:

find /sampledir/dir-to-search -name "*.log"

The logic of the find command is:

find <location_to_search> -name "what-you-want-to-find"

Find files bigger than 100 MB:

find / -type f -size +100M

The logic of the above find command:

find <locationToSearch> -<typeOfFile> <file> -<sizeOfFile> +<largerThanMB>

Find and delete files older than 7 days:

find /somedir -type f -mtime +7 -delete

Find file by owner:

find /home -user paco

Detect file type using the file command:

file oneimage.png

Check binary:

file /usr/bin/ls

You should get an output like this:

/usr/bin/ls: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, BuildID[sha1]=ddcbef552f9c2ea0dbe2a1f38c312d26e0ac975b, stripped

Archiving & Compression

tar — bundle & compress:

Create a tar archive:

tar -cvf backit.tar proj/myfiles

The logic for the above is:

tar -<options> fileNameTobeCreated.tar <dir/filesYouWanttoCompress>

Extract a tar:

tar -xvf backit.tar

Create compressed tar.gz:

tar -czvf thisiscomp.tar.gz /etc/sshd

Extract tar.gz:

tar -xzvf tobeExtracted.tar.gz

cpio — copy files based on a list:

Archive files listed by find:

find /etc -type f | cpio -ov > thefiles.cpio

Extract a cpio file:

cpio -id < thefiles.cpio

dd command – block-level copying:

Clone a drive:

dd if=/dev/sda of=/dev/sdb bs=4M status=progress

Create a file of specific size:

dd if=/dev/zero of=thefile.img bs=1M count=100

Backup MBR (Master Boot Record):

dd if=/dev/sda of=mbr_backup.bin bs=512 count=1

Linux Compression Tools

Compress:

gzip afile.txt

Decompress the file:

gunzip afile.txt.gz

zip2 and bunzip2 examples. Higher compression, slower.

Compress:

bzip2 bigfile.iso

Decompress:

bunzip2 bigfile.iso.bz2

xz and unxz commands. Very high compression.

Compress:

xz somesql.sql

Decompress:

unxz somesqldb.sql.xz

Linux File Globbing (very useful!)

Globbing = smart wildcard matching. Very cool.

Match all .txt files:

ls *.txt

Match any file starting with “log”:

ls log*

Match files with one character:

ls thefile?.txt

This will match:

  • file1.txt
  • fileA.txt
  • fileb.txt
  • it will not match:
    • file12.txt

Match a range:

ls somefile[1-5].txt

Real-Life Sysadmin Examples Using Globbing

Delete all logs older than 7 days: (Cool way to keep your file system clean)

find /var/log -name "*.log" -mtime +7 -delete

Brief explanation of the above command:

/var/log → directory to search

-name "*.log" → match only *.log files

-mtime +7 → modified more than 7 days ago

–delete -> go ahead and delete the files

But, always remember this: Never delete blind! Check first:

find /var/log -type f -name "*.log" -mtime +7

How to Logout a User Using macOS Terminal

The other day after I just brewed a fantastic single origin specialty coffee from Peru I got a message from one of my clients. They wanted to find out how to logout a user Using macOS Terminal. They needed to do this in order to install new printers and the user’s screen was locked. All the macs were joined to Active Directory. So there was no ‘switch between accounts’ options at the login screen.

I have been using macOS Terminal for a while, but I still have a long way to go and learn. There are so many options in the Terminal that differ from the Linux command line.

The command to logout a user Using macOS Terminal is quite simple. Open your Terminal in you mac and run:

sudo launchctl bootout gui/$(id -u <username>)

You need admin rights. The above will logout a user from the GUI and return you to the login screen.

Hope this very short tutorial helps somebody out there. Thank you and have a great day. If you like, you can support me by shopping one of my IT Handy man T-Shirts and coffee mugs below.

One or more rules cannot be uploaded to Microsoft Exchange

A friend of a client called me the other day about an error in her Outlook “One or more rules cannot be uploaded to Microsoft Exchange”.

Since I don’t use Windows anymore, I had to brew a nice specialty coffee from Brazil at home. This is a great idea whenever you are lacking inspiration. The problem was a “rule mail quota” was set to 64kb for this user. I have no idea there was a limit set in Microsoft Office 365 for rules.

The solution for the error one or more rules cannot be uploaded to Microsoft Exchange was quite simple. The step-by-step solution I found is below:

  1. Open your PowerShell as Administrator.
  2. View the current rules quota for a mailbox by running this command
Get-Mailbox marta@petacon.com |FL displayname, rulesquota

This will give you an output like this or similar to:

Display name: Marta Mckany
RulesQuota: 64 KB

To change the Rules Quote from 64KB to the maximum value of 256KB run the below command in PowerShell:

Set-Mailbox marta@petacon.com -RulesQuota:256kb

That is all! The user should be able to create more rules in Outlook365. I still don’t understand why there is a rule limit and also why a user needs so many rules.

Support my work by shopping one of my designs below or in my IT shop.

Filesystem Hierarchy Standard (FHS) in Linux

This is a very practical topic and it shows up a lot in a real sysadmin life. Filesystem Hierarchy Standard (FHS) in Linux is something every Linux admin should have knowledge of. I tend to forget things very easy. So, after brewing a fine single origin specialty coffee from Latin America I put this practical tutorial together.

Linux File Hierarchy (FHS) and Finding Files

The FHS defines where files should go in Linux, so all distros are consistent. Here’s the essential map you need to know as a sysadmin.

DirectoryPurpose
/Root of the filesystem, everything starts here.
/binEssential user commands (ls, cp, mv, rm, cat). Available even if /usr isn’t mounted.
/sbinEssential system binaries (reboot, fsck, ip, mount).
/bootKernel and bootloader files (vmlinuz, initramfs, grub/).
/devDevice files (/dev/sda, /dev/null, /dev/tty).
/etcSystem-wide configuration (/etc/passwd, /etc/ssh/sshd_config).
/homeUser home directories.
/lib, /lib64Shared libraries needed by binaries in /bin and /sbin.
/mediaMount point for removable media (USB, CD-ROM).
/mntTemporary mount point for filesystems.
/optOptional software (third-party apps, not from the distro).
/procVirtual filesystem, process and kernel info (/proc/cpuinfo).
/rootRoot user’s home directory.
/runRuntime data since boot (like PID files, sockets).
/srvData served by the system (e.g., websites /srv/www).
/sysKernel objects and hardware info.
/tmpTemporary files (cleaned at reboot).
/usrUser programs and libraries (non-essential at boot).
/varVariable data (logs in /var/log, spool, caches).

Finding Files and Commands in Linux

You can locate commands. The below shows the path of a command in $PATH.

which ls
# /bin/ls

type tells you if it’s an alias, shell builtin, or binary:

type ls
ls is aliased to `ls --color=auto'

whereis gives binary + manpage location:

whereis bash
bash: /usr/bin/bash /usr/share/man/man1/bash.1.gz /usr/share/info/bash.info.gz

Locate files

Find the SSH config file under /etc.

find /etc -name sshd_config

Uses a prebuilt database (fast, but may need updatedb):

locate passwd

Find log files larger than 100 MB:

find /var/log -type f -size +100M

Identify which package provides a file

On Debian-based:

dpkg -S /bin/ls

On RedHat based:

rpm -qf /bin/ls

Linux Sysadmin Rule of Thumb:

  • Config files → /etc
  • Logs → /var/log
  • Binaries → /bin, /usr/bin, /sbin, /usr/sbin
  • User data → /home, /root
  • Temporary → /tmp, /var/tmp
  • Device nodes → /dev

I also put together the below table for the most used commands to find things in the Filesystem Hierarchy in Linux.

CommandScopeChecks Real FS?Fast?Use Case
findFiles anywhere✅ Yes❌ SlowerDeep, real-time search with conditions (size, time, perms)
locateFiles anywhere❌ Uses DB✅ Very fastQuick search, less accurate if DB not updated
whichExecutables in $PATH✅ Yes✅ FastFind which binary runs when typing command
whereisExecutable + manpages✅ Yes✅ FastFind binary + man page
typeCommands✅ Shell check✅ FastIdentify alias, builtin, function, or binary

It is important to know the Filesystem Hierarchy Standard (FHS) in Linux, including the file locations and directory classifications. Let me know what you think.

Create and change hard and symbolic links in Linux

This is another topic in Linux that usually got me thinking in circles. To Create and change hard and symbolic links in Linux is something I don’t usually do on a daily basis as a Sysadmin. Maybe you don’t either. I decided to brew a great cup of Caturra variety coffee at home before taking on this one.

Create links in Linux

Hard links

  • Point directly to the same inode (data on disk).
  • Both files are equal; deleting one does not remove the other unless all links are deleted.
  • Cannot cross filesystems or link directories.
# Create a file
echo "Take this" > /etc/takeapp.conf
# Create a hard link
ln /etc/takeapp.conf /etc/takeapp_hardlink.conf
# Verify (same inode)
ls -li /etc/takeapp*
# inode_number takeapp.conf
# inode_number takeapp_hardlink.conf

Both files now share the same inode. Changing either modifies the same data.

Symbolic (soft) links

  • Work like Windows shortcuts.
  • Store a path that points to the target.
  • Can cross filesystems.
  • Can point to directories.
# Create a symlink
ln -s /etc/myapp.conf /etc/myapp_symlink.conf
# Verify
ls -l /etc/myapp*
# myapp_symlink.conf -> /etc/myapp.conf

Identify hard vs. soft links

  • Hard link: same inode number.
  • Soft link: shows -> in ls -l.
ls -li

For example you will see the below output:

12345 -rw-r--r--  2 root root 20 Jan 1  myapp.conf
12345 -rw-r--r--  2 root root 20 Jan 1  myapp_hardlink.conf
12346 lrwxrwxrwx  1 root root 12 Jan 1  myapp_symlink.conf -> myapp.conf

Copying vs. linking

Copying makes a new file with its own inode:

cp /etc/myapp.conf /etc/myapp_copy.conf

Editing myapp_copy.conf does NOT affect the original.

Use links when you want changes reflected across all references.
Use copy when you want independence.

Use links for sysadmin tasks

Example 1: Easier paths you can create a symlink(soft link)

# Symlink long paths for convenience
ln -s /var/log/nginx/access.log ~/nginx_access.log
tail -f ~/nginx_access.log

Useful for switching config versions. For example:

# Keep multiple configs
/etc/myapp.conf.v1
/etc/myapp.conf.v2
# Use symlink to choose active one
ln -sf /etc/myapp.conf.v2 /etc/myapp.conf
systemctl restart myapp

Also, for shared binaries you can do this:

# Point to a single tool version
ln -s /opt/python3.11/bin/python3 /usr/bin/python3

Key difference recap:

  • Hard links = same inode (data), no arrows.
  • Symlinks = pointer to path, shows ->.
  • Copies = independent files.

Copy vs. Hard Link vs. Soft Link comparison table

FeatureCopyHard LinkSoft (Symbolic) Link
DefinitionIndependent duplicate of fileAnother filename pointing to the same inode (data on disk)A shortcut that stores the path to the target file
InodeNew inodeSame inode as originalDifferent inode, points to original path
File contentsIndependentShared (changes affect all links)Shared (but breaks if target is deleted/moved)
Cross-filesystem?Yes❌ No (must be same filesystem)✅ Yes
Works on directories?✅ Yes❌ No (only files)✅ Yes
If original is deletedCopy remains intactOther links still access data until all are deletedLink becomes broken (dangling symlink)
PerformanceUses more disk spaceEfficient (no duplicate data)Small overhead (stores path only)
Use casesBackup, independenceDuplicate filename for same file (e.g., multiple valid paths)Shortcuts, convenience, version switching

Creating hard and symbolic links in Linux can be tricky to understand. Hopefully this tutorial helps somebody out there. Below are some of my T-Shirt and coffee mugs designs. If you like them you can place an order today. Thanks!

Manage File Permissions and Ownership in Linux

To manage file permissions and ownership in Linux take a bit of practice and patience. This is why after brewing a nice cup of specialty coffee from Bolivia at home I decided to put together tutorial together.

To start, we should go into the basics of managing file permissions and ownership in Linux.

Basic Linux Permissions (r, w, x)

Create a file and set permissions. Run the below commands in your Terminal:

touch toma.txt
ls -l toma.txt
chmod 640 toma.txt
ls -l toma.txt

What the chmod options mean:
6 = read/write for owner
4 = read for group
0 = no access for others

SUID(Set User ID)in Linux

Run program as file owner instead of user running it. For example:

ls -l /usr/bin/passwd
-rwsr-xr-x 1 root root 54256 …

s in place of x means SUID → normal users can run passwd as root to change their password.

Another example is to add SUID to a script:

chmod u+s usemyscript.sh

SGID (Set Group ID)

Files created in a directory inherit the group of the directory, not the user’s primary group. For example:

mkdir /shared
chgrp developers /shared
chmod 2775 /shared
ls -ld /shared

Now files in /shared always belong to group developers.

Sticky Bit in Linux

In a shared directory, only file owners can delete their files (not other users). For example:

mkdir /public
chmod 1777 /public
ls -ld /public

The above a common file permissions for the /tmp folder in Linux.

umask (File Creation Mask)

Defines default permissions when files/directories are create. If you want to see the current setting:

umask

Example: Set umask 027 will make new files = 640, new dirs = 750.

umask 027
touch newfile
mkdir newdir
ls -l

Nice formula to remember is:

New File = 666 - umask
New Dir  = 777 - umask

Then you subtract the umask you set:

umask 022   # files=644, dirs=755 (default on most systems)
umask 027   # files=640, dirs=750 (more secure)

For example:

666 – 022 = 644

777 – 027 = 750

Group-based Access in Linux

Add a user to a group:

sudo usermod -aG developers ali

Change file group ownership:

chgrp developers project.txt
chmod 640 project.txt

Now user ali (in developers group) can read the file.

A brief summary File Permissions and Ownership in Linux

  • Sticky bit protects /tmp from one user deleting another’s files.
  • SGID ensures project files in /shared all belong to the developers group.
  • umask ensures new config files don’t get created world-readable (security).
  • SUID lets non-root users run system tools (like passwd).

Common Octal Values:

ModeOctalMeaning
644rw-r–r–Files readable by all, writable only by owner
600rw——-Private file
755rwxr-xr-xCommon for executables/scripts
700rwx——Private dir or script
770rwxrwx—Shared group dir
1777drwxrwxrwtWorld-writable but sticky (/tmp)
4755-rwsr-xr-xSUID program
2755drwxr-sr-xSGID dir
6755-rwsr-sr-xBoth SUID and SGID

Special bits (setuid, setgid, sticky)

They are represented by an extra digit in front of the normal octal permissions:

  • 4xxx → setuid
  • 2xxx → setgid
  • 1xxx → sticky bit

Normal octal permissions

rwxr-xr-x → 755
rw-r--r-- → 644

That’s 3 digits:

  • 1st → user
  • 2nd → group
  • 3rd → others

Special bits add a 4th digit

The special permissions are encoded as an extra octal digit before those three:

  • 4xxx → setuid
  • 2xxx → setgid
  • 1xxx → sticky

So for example:

Special BitOctal DigitExample
setuid44755 = rwsr-xr-x
setgid22755 = rwxr-sr-x
sticky11777 = rwxrwxrwt

To manage file permissions and ownership in Linux might seem confusing. But, once you practice over and over you will master it. Always contact me if you have any questions. Consider supporting my work by shopping one of my T-Shirt and coffee mugs designs from my shop. You can see some of them below. Thanks!

Recommended products

Mounting and unmounting filesystems in Linux

Controlling mounting and unmounting filesystems in Linux is one of the things I hardly do when working in Linux server specifically. So, I decided to do some research while having a nice cup of specialty coffee from Peru.

Here are a few examples of mounting and unmounting of filesystems in Linux:

Manually mount and unmount filesystems

When you want to access a partition, USB drive, or ISO image temporarily:

# Create a mount point
sudo mkdir /mnt/usb
# Mount a device (e.g., USB drive)
sudo mount /dev/sdb1 /mnt/usb
# Verify mounted filesystems
mount | grep sdb1
df -h
# Unmount when done
sudo umount /mnt/usb

If the filesystem is busy (e.g., terminal is inside /mnt/usb), umount will fail. If so, run:

sudo umount -l /mnt/usb   # Lazy unmount
sudo umount -f /mnt/usb   # Force unmount

Configure filesystem mounting on bootup (/etc/fstab)

Permanent mounts are configured in /etc/fstab. Example entry:

# <device>     <mountpoint>   <fstype>  <options>         <dump> <pass>
/dev/sda1      /              ext4      defaults          0      1
/dev/sdb1      /data          ext4      defaults          0      2

Apply the above without rebooting your Linux box:

sudo mount -a   # Mount all filesystems in fstab

Common options:

  • defaults → rw, suid, dev, exec, auto, nouser, async
  • noexec → don’t allow binaries to run
  • nosuid → ignore set-user-ID bits
  • nodev → don’t interpret device files

Configure user mountable removable filesystems

Allow normal users to mount USB sticks/CDs by adding user or users option in /etc/fstab this way:

/dev/sdb1   /media/usb   vfat   rw,user,noauto   0   0

The options above are:

  • user → only the user who mounted can unmount.
  • users → any user can unmount.
  • noauto → won’t mount automatically at boot, only when requested.

The a user can mount without sudo:

mount /media/usb
umount /media/usb

Use of labels and UUIDs for identifying and mounting file systems

Using /dev/sdX is risky because device names can change. Use UUIDs or labels if possible. For example:

Find UUID for a device run the command:

sudo blkid

Example output:

/dev/sda1: UUID="1234-ABCD" TYPE="ext4" PARTLABEL="root"

Mount via UUID in /etc/fstab. You will need to add the following line in the file:

UUID=1234-ABCD /data ext4 defaults 0 2

You can also mount it via label:

LABEL=acoolusb   /media/usb   vfat   defaults   0   0

Awareness of systemd mount units

Modern Linux uses systemd which can manage mounts via mount units.
A file like /etc/systemd/system/data.mount can represent a mount point.

Example could be a file in /etc/systemd/system/data.mount:

[Unit]
Description=Mount data partition
[Mount]
What=/dev/sdb1
Where=/data
Type=ext4
Options=defaults
[Install]
WantedBy=multi-user.target

To enable this systemd mount unit you can run the below two commands:

sudo systemctl daemon-reload
sudo systemctl enable --now data.mount

This integrates mounts into systemctl workflow.

Some useful Mounting and unmounting filesystems troubleshooting

You try to reboot and /data fails to mount.

You check with:

lsblk
blkid

The partition exists, UUID matches.

Run integrity check:

sudo fsck -y /dev/sdb1

Fixed some errors.

Manually test mount:

sudo mount /dev/sdb1 /mnt/test

Works.

Fix /etc/fstab entry:

UUID=0452-CBCD   /data   ext4   defaults   0  2

Test without reboot:

sudo mount -a

If still failing under systemd:

systemctl status data.mount
journalctl -xe

How to restart sound in macOS using the Terminal

How to restart sound in macOS using the Terminal was one of those things I have been curious for a while. Yesterday one of my clients called me regarding their sound in one of their macs. They could not reboot at the moment. So, after brewing a nice cup of Catimor coffee variety at home I decided to check this one out.

I had remote access to the mac using ssh. So, I discovered the command to restart sound in macOS using the Terminal. Always make sure that any command that you run doesn’t kill your current SSH connection.

The command is:

sudo killall coreaudiod

You will be asked for your admin password. The coreaudiod process will then be terminated and automatically restarted, which should fix any temporary problems with your macOS sound. If the sound issue persists after trying this, you may need to restart your Mac.

Maintaining filesystem integrity in Linux

Maintaining filesystem integrity is critical for Linux sysadmins, especially when disks fill up or errors occur. This is a tricky topic for me. It involves good knowledge of the Linux filesystem. I put together a step by step brief tutorial with real-life commands. I had to first brew my favorite coffee variety from Cocotu Latin America Specialty Coffee.

Verify the integrity of filesystems

fsck (Filesystem Consistency Check). Used to check and repair a filesystem.
Run only on unmounted filesystems, or in single-user/recovery mode. For example:

sudo fsck /dev/sda1

Usual output:

fsck from util-linux 2.37.2
e2fsck 1.46.5 (30-Dec-2021)
/dev/sda1: clean, 150000/6553600 files, 3500000/26214400 blocks

Some fsck command options are:

-n → check only, don’t repair
-y → automatically repair errors
-f → force check even if marked clean

Example (auto repair ext4 root partition after reboot):

sudo fsck -y /dev/sda1

Monitor free space and inodes in Linux

Check disk space (human readable):

df -h

Example output:

Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1        50G   20G   27G  43% /
/dev/sdb1       100G   10G   90G  10% /data

Check inode usage (important if many small files):

df -i

Example output:

Filesystem     Inodes  IUsed   IFree IUse% Mounted on
/dev/sda1     3276800 150000 3126800    5% /

Even if disk space is free, if inodes are full, you can’t create new files. Very important to remember.

Find what’s using space:

du -sh /var/*

Example output:

1.3G /var/log
3.1G /var/lib
180M /var/cache

Repair simple filesystem integrity problems in Linux

Run fsck interactively:

sudo fsck /dev/sdb1

You might get prompts like:

Inode 12445 has illegal block(s). Clear? yes

Repairing ext4. If you suspect journal issues:

sudo e2fsck -f -y -v /dev/sdb1

Repairing XFS. XFS has no fsck, use xfs_repair:

sudo xfs_repair /dev/sdb1

Real-world Linux sysadmin scenario

  1. Disk is full → check with df -h.
  2. Too many files → check with df -i.
  3. Find big dirs → du -sh * | sort -hr.
  4. Filesystem errors after crash → reboot into rescue mode, run:
fsck -y /dev/sda1

Linux Sysadmin Tip:
Always unmount (umount /dev/sda1) before running repair tools, unless it’s the root filesystem (then you do it from rescue mode or at boot).

How to sort to show large files on the top of the list?

Simply run the du command like this:

du -sh * | sort -hr

You need to add -r to the sort command. By default sort command shows files and directories from smallest → largest. So, you will get a sorted list showing the largest files/directories at the top. Sample output can be:

$ du -sh * | sort -hr
4.5G   /var/log
2.3G   /home
512M   /tmp
20M    /etc

If you want to scan recursively through all subdirectories and find the largest ones, you can run:

du -ah / | sort -hr | head -20

User the find command in Linux to find large files

This one is useful by combining the find command. Below are some examples. You can use find + du + sort or find + ls to do it.

Find the largest files in your system (top 20):

find / -type f -exec du -h {} + 2>/dev/null | sort -hr | head -20

find / -type f → search only files (not dirs) starting at /.
du -h {} + → get human-readable sizes.
sort -hr → sort largest first.
head -20 → show top 20.
2>/dev/null → suppress permission errors.

The alternative with ls:

If you just want biggest files in current directory:

ls -lhS

-l → long format.
-h → human readable sizes.
-S → sort by size (largest first).

Find top 10 biggest files anywhere in your Linux box:

find / -type f -printf "%s %p\n" 2>/dev/null | sort -nr | head -10

-printf "%s %p\n" → prints size (bytes) and filename.
sort -nr → numeric reverse sort.
head -10 → top 10 largest files.

By default, find -printf "%s" gives bytes only.
To make it human-readable (K, M, G), you can combine du -h instead. Run this instead using du -h:

find / -type f -exec du -h {} + 2>/dev/null | sort -hr | head -20

Example output:

2.5G   /var/log/big-logfile.log
1.2G   /home/user/Downloads/big-iso-file.iso
...

GNU find doesn’t have -printf "%h" for human-readable.
But you can “pipe” into numfmt to format:

find / -type f -printf "%s %p\n" 2>/dev/null | \
sort -nr | head -20 | \
numfmt --to=iec --suffix=B --padding=7

Maintaining filesystem integrity is very important topic to learn for troubleshooting disk space issues in your Linux box.