Linux Command Line Basics

Every true geek must be a of master of the Linux command line interface. If you are new to this interface so will reading and then practising the content of this post get you started on the path to geekness.

What It Is

A command-line interface or command language interpreter (CLI), is a way of interacting with a computer program where the user issues commands to the program in the form of successive lines of text (command lines). A program which handles the interface is called a terminal, command language interpreter, or shell.

Launching a CLI

Assuming that a Ubuntu based Linux distribution so can the CLI be launched by the use of the short command ctrl + alt + t.

If this command does not work so can the CLI also be opened by searching for “Terminal” int the part of the graphical user interface where programs are started, will not go into details because how to do this will vary depending on what flavor of Linux being used.

Listing Child Directories and Files

The child directories files in the current directory can be seen by typing the command ls which is short for list.

Creating a Directory

A new child directory can be created by typing the command mkdir followed by the name of the directory to be created, mkdir is short for make directory. For example to create a directory called test so shall mkdir test be entered.

Deleting a Directory

A directory can be deleted by the use of the command rmdir which is short for remove directory. For example to remove a directory called test so shall rmdir test be entered.

Navigating in the Directory Tree

Variants of the command cd which is short for change directory is used to navigate through the directory tree.

Just entering the command cd will take us to the default home directory, this is the same directory that we are in at the CLI start up.

To go up towards the root of the directory tree so shall the cd .. be used, note that there is a space between the command and the two dots.

To go into a child directory so shall the change directory command be used in combination with the name of the directory. For example cd test to move into a directory called test.

Creating Files

A file can be created by the use of the command touch. For example to create a file called test.txt so shall the touch test.txt be entered.

This command is not short for anything it’s interpretation is instead just the verb touch. When you touch a file, you’re “putting fresh fingerprints on it”, updating its last-modified date or creating it if it did not yet exist.

Deleting Files

A file can be deleted by the use of the command rm, which is short for remove. For example to remove a file called test.txt so shall rm test.txt be entered.

Learn More

A great resource for learning more about the CLI is to read the material in the following link

Leave a Reply

Your email address will not be published. Required fields are marked *