What is a command?
Basic description of command structures
What is a command?
A command is tool in the terminal that typically accepts options and arguments. The syntax is generally command [options] (arguments)
many commands can be run with or without arguments and most can be run without options in this instance we'll utilize ls
as our example.
ls
# without any arguments this list all files in the current directory
# output will look like the following:
directory1 directory2 file1 file2
# ls can be run with options one example is the all option
# all can be run as such
`ls --all` OR `ls -a`
# Options typically have long and short forms. The short form is called
# with a single `-` while the long form is called with a double `--`
# without an argument this will still list items in the current directory
# however this option will also show hidden files
# the ouput will be similar to the following:
.bashrc .hiddendirectory .hiddenfile .ssh directory1 directory2 file1 file2
# you can also call ls with both options and an argument let's look into
# our directory1 directory
ls -a directory1
# this is an empty directory so the only results will be the directory
# itself `.` and the reference to the directory before it `..`
./ ../
Last updated
Was this helpful?