Cisco Logo

Linux Command Syntax

by Elena Mofar, Published on May 24, 2023

Since we will be mostly using the CLI for all our Linux configurations, we need to understand the common Linux command syntax structure first.

This is a sample of a Linux command:

What does the command mean? and why is it typed in like that?

Take note that almost all Linux commands follow this syntax structure:

Linux command syntax structure

Where:


<command>

  • this is the specific Linux command that will do a certain task.


<options>

  • you can inform Linux to do additional things on top of the command issued.


For example, in my sample above I used the “-rf” option. Take note that each letter is a separate option. r for recursive, and f for force.


The command I issued is cp – this means copy.


So, by default, when we copy something, Linux will ask us if we are sure, that we really want to copy the file.


If we are copying all the contents from a directory, and that directory has at least 100 files in it – we need to answer yes 100 times.


When we use an option, we alter the default behavior of the command – we inform it to do additional things.

So, when I issued the f (force) option, this informs my Linux system to not ask me questions for each file that it copies – thereby altering the default behavior of my cp (copy) command.


Linux commands can have a hundred options that you can use, we don’t have to memorize each option. There is a Linux command manual where we can check the available options on the fly. We will discuss how to use this Linux manual later in the course.

<target/source>

some commands are applied on a single target file/directory. When used as a target, we don’t have to specify a <destination>.


There are some commands that creates a new version from an old version of a file/directory.


When I say a new version – this might be a changed content, a changed location, or a changed form of a file/directory.


When this happens, the old version is the source - this can be an absolute or a relative path.


<destination>


When a command creates a new version of a file/directory, this new version is the destination, this can also be an absolute or a relative path.


Next Topic Suggestion:

Category Suggestion

Recent Posts

How to study for the CCNA (Cisco Certified Network Associate) Exam Part 1
How to Take the CCNA Exam
What is inside the CCNA 200-301 Exam Curriculum
Why should you want to be a CCNA
What is CCNA? | CCNA, Linux, and Python Trainings and Courses in the Philippines