Fundamentals 5 min read

Unlock Hidden Linux Command Options: Practical Tips for ls, find, less, and More

This guide reveals often‑overlooked Linux command parameters—such as sorting files with ls, filtering with find, viewing logs with less, and using -r, -p, -C, -d options across common utilities—providing concrete examples and code snippets to boost everyday shell productivity.

Liangxu Linux
Liangxu Linux
Liangxu Linux
Unlock Hidden Linux Command Options: Practical Tips for ls, find, less, and More

1. ls command options

Use -S to sort files by size and combine with -r for reverse order. ls -lhS Reverse (largest to smallest):

ls -lhSr

-t: sort by modification time

ls -lht

Find files modified today:

ls -l / --time-style=+%D | grep `date +%D`

2. find command options

-size

is frequently used; other useful flags are highlighted below.

-iname

Case‑insensitive name matching.

find . -iname get_test

-name

Case‑sensitive name matching (contrast with -iname).

-type

Search by file type.

find . -type f
find . -type d

-empty

Locate empty files.

find . -type f -empty

-maxdepth

Limit recursion depth.

find /etc -maxdepth 2 -name passwd

3. less command options

Prefer less over vim for quick log viewing.

-N

Show line numbers.

less -N test.log
For small files, cat -n also displays line numbers.

+F

Equivalent to tail -f or tailf, continuously appending output.

less +F test.log

4. -r option examples

grep

Recursively search for a pattern in all files under a directory.

grep -r "xxx" /home

scp

Copy directories recursively.

scp -r [email protected]:/home/config/ .

5. -p option examples

mkdir

Create nested directories in one command.

mkdir -p /home/test/log

tar cp

Preserve file attributes while archiving.

tar -cpvzf mysql.tar.gz /var/lib/mysql

6. -C and -d options for extraction

Extract archives directly into a target directory.

tar

tar -xzvf tt.tar.gz -C /home

Alternative without -C:

cd /home
tar -xzvf tt.tar.gz

Or extract then move:

tar -xzvf tt.tar.gz
mv tt /home

unzip

unzip -d /home tt.zip
Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

command-linelesslsfind
Liangxu Linux
Written by

Liangxu Linux

Liangxu, a self‑taught IT professional now working as a Linux development engineer at a Fortune 500 multinational, shares extensive Linux knowledge—fundamentals, applications, tools, plus Git, databases, Raspberry Pi, etc. (Reply “Linux” to receive essential resources.)

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.