The simplest answer is that a command is a software program that, when executed on the CLI, performs any action.
some commands take additional input to run correctly, This input is known as
command [options] [arguments]
- Options are used to modify the behavior of command.
- Arguments are used to provide additional information.
Today we'll discuss the fundamentals of
ls command and try to cover some basic parameters. we use this command daily basic and frequently even though we never aware of all the available options.
ls command takes the argument as a name of the directory, it lists the contents of the directory, In the following example, the /etc/dpkg directory is used as an argument.
ls command also accepts multiple arguments. To list the contents of both the /etc/ppp and /etc/ssh directories
options used with commands to expend or modify the way a command behaves.
-a : The
ls command omits hidden files by default. A hidden file is any file(or directory) that begins with a dot
. character. with the used of
-a option we can display all filed including hidden files.
-l : With this option we get results in a long listing, providing additional information about the files that are listed, such as the permission, size, creation date, and other information. (I will try to cover permission in the next post. this is a very important and fundamental part of Linux file system)
-h : If the
-h option added with
-l the file sizes will be displayed in human readable order (or you can write full word form; --human-readable)
note: The order of the combined options isn't important. The output of all of these examples would be the same:
ls -l -h
-t Sorted by modified time or created time
-m List all the files and directories separated with comma
I hope this article will help you to learn a few options of
ls commands in Linux. Please refer to the manual pages by using the
man ls command to explore in-depth
Thanks! happy coding :))