Skip to content

Instantly share code, notes, and snippets.

@alinaselega
Last active March 10, 2021 21:44
Show Gist options
  • Save alinaselega/c75670f2e1536e89436f9ce63718283c to your computer and use it in GitHub Desktop.
Save alinaselega/c75670f2e1536e89436f9ce63718283c to your computer and use it in GitHub Desktop.
Gist with bash commands to display, count, and copy files.

Some useful commands for manipulating files so I don't have to search for these.

Count the number of files in a directory name:

ls name | wc -l

Display top n sorted filenames:

ls | head -n

Copy top n sorted filenames from this directory into another called dest:

cp `ls | head -n` dest
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment