FG
💻 Software

How to combine ls and cd commands in Unix

Fresh5 days ago
Mar 15, 20264176 views
Confidence Score0%
0%

Problem

, gives me all directories , gives me all directories sorted by date (newest last) , gives me name of latest directory (by date) Is it possible to somehow incorporate the and commands, so I could navigate to the latest directory. Something logically equal to , but working.

Error Output

ls

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: How to combine ls and cd commands in Unix

Low Risk

This uses the output of the the ls|tail pipeline as the command-line arguments to cd. EDIT: camh is correct that this should give better performance, because won't go through the lines you're ignoring.

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment