Examining the Linux / FreeBSD / UNIX filesystem with ls command

www‮iruttual.‬.com
Examining the Linux / FreeBSD / UNIX filesystem with ls command

The ls command is a utility in Linux, FreeBSD, and other Unix-like operating systems that is used to list the contents of a directory. By default, the ls command displays the names of the files and directories in the current directory.

Here are some examples of how you can use the ls command to examine the filesystem:

  • To list the files and directories in the current directory, you can use the ls command with no arguments:
ls
  • To list the files and directories in a specific directory, you can specify the directory path as an argument to the ls command:
ls /path/to/directory
  • To display hidden files and directories, you can use the -a option:
ls -a
  • To display the file permissions, ownership, and size in a long format, you can use the -l option:
ls -l
  • To sort the output by the last modified date and time, you can use the -t option:
ls -t
  • To display the file sizes in a human-readable format, you can use the -h option:
ls -h

There are many other options available for the ls command, including options for displaying file timestamps, inode numbers, and more. You can learn more about the ls command by consulting the man page or by using the --help option.

man ls
ls --help
Created Time:2017-10-28 20:14:16  Author:lautturi