Monday, August 26, 2013

How to use linux command-line...




What is Linux? 

First of all let me introduce to you what is Linux. Linux is a reliable, secure and flexible operating system. It's easier to use than most people think. It's easy to install and most of all its free. You can download different distros available on the internet. Linux distribution includes basic Linux operating system bundled with a number of free applications. Some of the free applications includes graphics and multimedia programs, fully featured office suite and many more. In these series of tutorial you will learn how to use linux and some of its basic commands.

The heart of Linux is the command-line interface. And here are the following steps that will teach you how to use it. As an introduction to command-line interface, these steps will teach you some of the basic commands needed to get around with what we call Terminal program. It is the standard command-line interface for Linux. Some of the basic commands I will teach you are pwd, ls and some of its options, touch, rm and clear.

Lets start:

Go to Application > Accessories > Terminal


A terminal window will open.


First you have to know what directory you are in, in order to get around with the terminal.
On the terminal type the command "pwd" and press enter.

 pwd    -present working directory. Type this command and you will see the absolute path to your current directory.

Next command is "ls"

On the terminal type the command "ls" and press enter.

ls    -lists all files in the current directory.

This command is versatile when used with proper options. Perhaps the most important option is
"l", which will list all files in the directory, including size, owner and permissions.

 Lets try typing "ls -l" and press enter...


 Some other options that can be used with ls command are:

-a   Lists all files in the current directory, including hidden files.

-r   Lists in reverse alphabetical order all nonhidden files in the current directory.

-i   Lists files with inode numbers.

-t   Lists files by the last time they were changed.

-F   Lists all files by type.

-u   Lists files by the last time they were accessed.

Next command is "touch".

 touch    -This command creates an empty file.

On the terminal type the command "touch myfile.cpp" and press enter.

A myfile.cpp file will be created on your current working directory.
When you run the ls -l command on the myfile.cpp file, you will see the following output:


Next is the "rm" command.

rm   -remove/delete files and directories.

On the terminal type the command "rm myfile.cpp. This will delete myfile.cpp

Next command is

clear   -clears the terminal screen.

Just type "clear" on the command-line and press enter.

Hope this simple command will help you in learning the basics of linux command-line.

Watch this video for instructions...



No comments :

Post a Comment