StefanPapp
11/19/2019 - 2:21 PM

Advanced ls #linux #cli

Advanced ls #linux #cli

# Finding the biggest files
ls -lSrh
ls -lSrh *.<file format extension like txt or mp3>


# Count number of files within a directory in Linux (not using wc)
 ls -l . | egrep -c ‘^-’

#Take top n files in a folder/directory and then next m files into a new directory
ls dir1 | head -n 10 | xargs -I X cp dir1/X dir2
ls dir1 |tail -n +11 | head -n 5 | xargs -I X cp dir1/X dir2

#recent dirs
ls -Art | tail -n 30