Skip to main content

Flags

Flags, also known as options, are command-line parameters that can be used to modify the behavior of a command.

  • You can add Flags in command by adding one - hyphen and name of the flag.

It return the details of ls command.

ls --help

It return the list of all the directory.

ls -l

a mean show also hidden files and directory on this folder.

ls -l -a
  • you can also write the Flags on combine without any arrange restruction.
  • you can also write multiple flag at same so that we not write -help they consider it -h,-e,-l,-p so that why we used the double hyphen.
ls -la
  • You can also ignore the folder using flags not showing on the terminal.
ls --ignore=folderName

Both are Valid. It can hide the Vide Folder from the terminal not showing it.

ls --ignore Video
ls -I Video
  • You can also ignore multiple Folder by adding the multiple ignore flags.
ls --ignore=Video --ignore=Documents
  • return the full details of directory e.g size, permissions, user, group, update date etc.
    • -l => list
    • -s => size
    • -a => all hidden
    • -h => with -l and -s, print sizes like 1K 234M 2G etc
ls -lsah
  • return the Documents directory size, permissions, user, group, update date etc.
ls Documents -lsah