Practical Command Line Recipes Print

  • 0

Commands worth knowing by shape.

FINDING THE LARGEST DIRECTORIES

Summarise usage one level deep, sort numerically, take the top few.

FINDING RECENTLY CHANGED FILES

find with a modification time restriction, on a specific path.

COUNTING REQUESTS PER ADDRESS IN A LOG

Extract the first field, sort, count unique, sort by count.

FINDING THE BUSIEST REQUESTED PATHS

Extract the request field, then the same counting pattern.

WATCHING A LOG FOR A SPECIFIC TERM

Follow the file and filter it.

FINDING WHAT HOLDS A PORT

List listening sockets with process names.

FINDING WHAT IS FILLING A DISK RIGHT NOW

Interactive disk usage, or repeated usage summaries.

SEARCHING WEB FILES FOR A STRING

Recursive search restricted to the document root, listing filenames only.

COUNTING FILES IN A DIRECTORY

List and count lines, being aware of hidden files.

CHANGING PERMISSIONS ON FILES BUT NOT DIRECTORIES

find with a type restriction and the execute option.

REPLACING TEXT ACROSS MANY FILES

find the files, confirm the list, then apply a substitution with a backup.

CHECKING A CERTIFICATE'S EXPIRY REMOTELY

Connect and read the dates.

COMPARING TWO DIRECTORIES

rsync with a dry run.

WHAT TO DO WITH ANY OF THESE

Read it before running it, and check the path.


Was this answer helpful?
Back

Are you happy with your experience? Leave us a review on Trustpilot.


Trustpilot