1.2 Flags

I’ve already mentioned this at the beginning, but a flag is an option that one can choose to execute with their commands.

The flags I cover are those for two commands: ls and rm.

1.2.1 Flags for rm

In this sub-section, I talk about the -r and the -f flags.

  1. -r

    The “r” is short for recurse: this causes thte rm command to recursively delete a directory’s files

    I think it is also worth pointing out that if the directory that you are trying to delete is an empty directory, then you can use the rmdir command instead like so: rmdir <empty directory name here>.

  2. -f

    The “f” flag is short for force: this causes the machine to forcibly delete a file (i.e., delete a file without asking you - the user - for confirmation).

1.2.2 Flags for ls

Here, I talk about the -l and the -a flags:

  1. -a

    The “a” represents all: it tells the machine to list all files - including hidden ones on the current directory. Here is what I get when I run ls -a on my machine:

    ls -a on my Machine

    Figure 1.2: ls -a on my Machine

    There are two hidden files in each of your computer’s directory that I think are worth pointing out:

    1. ..

      This represents the parent directory. Hence, cd .. causes the machine to change the working environment to the parent directory.

    2. .

      This represents the current working directory (i.e., the directory that you are currently working in).

    Otherwise, if some other file is hidden on your system, then it is probably best to leave that file be (unless you know what you are doing). If a file is hidden, it is likely hidden for a good reason: so that inexperienced users do not “destroy” their computers unknowingly!

  2. -l

    “l” represents long: hence, ls -l lists various pieces of information about your computer’s files:

    ls -l on my Machine

    Figure 1.3: ls -l on my Machine

    This “information” include (but are not limited to) the following: read / write permissions, date of creation, file size, and the files’ names.