Forrest logo
back to context overview

ls

List of commands for ls:

  • ls:ai:1cda4 Lists files in two columns
    $ ls -C
    try on your machine
    explain this command
  • ls:ai:2c05e find all directories only in the current directory sort by month date time
    $ ls -l -t -d */ | awk '{print $6,$7,$8,$9}' | sed 's/ /-/g' | awk '{print $1, $2, $4, $3}' | jq -nR '${inputs | split("-") | {month: .[0}, day: .${1}, time: .${2}, directory: .${3}}]'
    try on your machine
    explain this command
  • ls:ai:38a23 List all pdf files inside directory then, using a for cycle, print on scren each filename in alphabetical order adding "_num" before the extension, where "num" is a 3-digit counter starting from 001
    $ ls -1 *.pdf | awk '{ printf "%s_%03d\n", substr($0, 0, length($0)-4), NR }' | sort
    try on your machine
    explain this command
  • ls:ai:38f90 List all pdf files, sort by size, and rename by progressive number
    $ ls -Sl --format='json' | awk 'BEGIN{c=1} {print "mv -i ",$0, "",c++.".pdf"}' | bash
    try on your machine
    explain this command
  • ls:ai:561ba List all pdf files inside directory then print on scren each filename in alphabetical order, adding "_num" before the extension, where "num" is a 3-digit counter starting from 001
    $ ls | grep .pdf | awk '{print $0, "_" sprintf("%03d", NR) }' | sort | awk '{print "{\"filename\": \""$1"\"}"}' | sed ':a;N;$!ba;s/\n/,\n/g'
    try on your machine
    explain this command
  • ls:ai:6ba8f what to do if dvb stick and tuner is recognized but i don't have the directory frontend0
    $ ls /dev/dvb/
    try on your machine
    explain this command
  • ls:ai:735c8 This command will list the file size in a human-readable format.
    $ ls -lh ${filename}
    try on your machine
    explain this command
  • ls:ai:85022 Lists the inode number of the specified file
    $ ls -i ${filename}
    try on your machine
    explain this command
  • ls:ai:a3c1f Lists files in the current directory and filters out directories
    $ ls -p | grep -v /
    try on your machine
    explain this command
  • ls:ai:b3c0e find all directories sort by month date time
    $ ls -ltF --time-style=long-iso | grep '^d'
    try on your machine
    explain this command
  • ls:ai:b5019 List the contents of the /home directory
    $ ls /home
    try on your machine
    explain this command
  • ls:ai:bb455 How to re-run a command when files in a directory are updated using entr
    $ ls | entr ${your command here}
    try on your machine
    explain this command
  • ls:ai:f5a4d List the permissions for the file 'foo'
    $ ls -l foo
    try on your machine
    explain this command
  • ls:ai:ffff8 find all directories in the current directory sort by month date time
    $ ls -lt --time-style=long-iso --group-directories-first
    try on your machine
    explain this command
  • ls:tldr:48011 ls: Long format list of all files, sorted by modification date (oldest first).
    $ ls -ltr
    try on your machine
    explain this command
  • ls:tldr:5f7f4 ls: List all files, with trailing `/` added to directory names.
    $ ls -F
    try on your machine
    explain this command
  • ls:tldr:79e2f ls: Long format list with size displayed using human-readable units (KiB, MiB, GiB).
    $ ls -lh
    try on your machine
    explain this command
  • ls:tldr:7f9e5 ls: Only list directories.
    $ ls -d */
    try on your machine
    explain this command
  • ls:tldr:a2da9 ls: Long format list (permissions, ownership, size, and modification date) of all files.
    $ ls -la
    try on your machine
    explain this command
  • ls:tldr:c52fd ls: List all files, including hidden files.
    $ ls -a
    try on your machine
    explain this command
  • ls:tldr:de51c ls: Long format list sorted by size (descending).
    $ ls -lS
    try on your machine
    explain this command
  • ls:tldr:f52d3 ls: List files one per line.
    $ ls -1
    try on your machine
    explain this command
back to context overview