
By: masjter_ZA
October 23, 2018
Linux Basics Terminal Commands

By: masjter_ZA
October 23, 2018
Terminal commands: Command Line Interface
What is a command? A command is a software program that when executed on the CLI (command line interface) in the terminal, performs an action on the computer. When you type in a command, a process is run by the operating system that can read input, manipulate data and produce output. A command runs a process on the operating system, which then causes the computer to perform a job.
NB: Commands are CASE sensitive
For example, the ls
command displays a listing of information about files.
Arguments
command [options…] [arguments…]
An argument can be used to specify something for the command to act upon. The ls
command can be given the name of a directory as an argument, and it will list the contents of that directory. In the next example, the Documents
directory will be used as an argument:
Options can be used to alter the behavior of a command. On the previous page, the ls command was used to list the contents of a directory. In the following example, the -l option is provided to the ls command, which results in a “long display” output, meaning the output gives more information about each of the files listed
Like choosing the letter l for long or r for reverse. By default the ls command prints the results in alphabetical order, so adding the -r option will print the results in reverse alphabetical order.
Multiple options can be used at once, either given as separate options like -l -r or combined like -lr. The output of all of these examples would be the same:
Printing Working Directory
In order to discover where you are currently located within the filesystem, the pwd command can be used. The pwd command prints the working directory, your current location within the filesystem:
This helps you locate which folder you are currently situated in. As seen below you have a view of the file system structure.
To navigate the filesystem structure, use the cd (change directory) command to change directories.
Directories are equivalent to folders on Windows and Mac OS. Like these more popular operating systems, a Linux directory structure has a top level. It is not called “My Computer”, but rather the root directory and it is represented by the / character. To move to the root directory, use the / character as the argument to the cd command.
And the ~ character is the home directory for current user as seen below.
The .. Characters
Regardless of which directory you are in, .. always represents one directory higher relative to the current directory, sometimes referred to as the parent directory.
The . Character
Regardless of which directory you are in, the . character always represents your current directory. For the cd this shortcut is not very useful, but it will come in handy for commands covered in subsequent sections.
The ~ Character
The home directory of the current user is represented by the ~ character. As stated above, you always begin as the sysadmin user, whose home is located at /home/sysadmin.
Please note this tutorial is incomplete, I hope to squeeze in more time. Hope this helps some guys ;-) masjter_ZA aka JD out