Wednesday, August 3, 2011

Basic in Linux

Linux is one of the operation system. We can tell it as UNIX like operating system. It is open source, It come under GNU public license. We can use it as free. For more and updated details about Linux try Wikipedia.

Now we'll go for learning Linux throw command line, Before go administration these are some basics,


The terminal is using for executing commends in Linux box. If we open terminal, it looks as bellow

[[email protected] ~]$

Here "kumar" is user account in Linux box. "LocalHost" is host name of your system, that means your system name. Normally till (~) symbol mention home directory of the logged user. If you are as root user , it looks as bellow

[[email protected] ~]#

Here you can see a difference in both things, that is dollar ($) symbol and Hash (#). There normal user have $ symbol at end and root user have # symbol at the end. This is easily to identify which user we have logged.

Executable commends in Linux are stored in /bin and /sbin directories. The normal user are can access only commends under /bin , They can's use /sbin commends. But the root user can access both /bin and /sbin directory commends.

root is the administrator account. If we made and mistakes while in root account, there is chance to crash hole system.


man is a very basic command in Linux box. We normal know it as man pages. The man pages are manual of commands. most of the commands in Linux have man pages. It describe all about commands. The syntax of the man page is "man {command}"

[[email protected] ~]$man ls 


ls is the basic command in Linux box, ls is used to list files.
[[email protected] ~]$ ls
[[email protected] ~]$

Here we didn't create any files, so it didn't give any output.


cat command is used to show the file. And also this is used to create and append the file.

cat {FileName} - Open file
cat > {FileName} - Create file
cat >> {FileName} - Append file
[[email protected] ~]$ cat > filename
hi this is my first file

[[email protected] ~]$ cat filename
hi this is my first file
[[email protected] ~]$ cat >> filename
this is additional lines

[[email protected] ~]$ cat filename
hi this is my first file
this is additional lines
[[email protected] ~]$

"ctrl + c" used to quit file, It'll save and exit from cat.

We can't edit already created file with "cat" command. For this we are going for other editors available in Linux.
ex: vi, vim etc.,

Before we going to editors we'll see the "ls" command, As seen before ls is the command used for list file in Linux,

[[email protected] ~]$ ls
[[email protected] ~]$

This is the file we created as before by "cat".

[[email protected] ~]$ ls -l
total 4
-rw-rw-r-- 1 kumar kumar 50 Aug  3 11:47 filename

Here -l is the option for ls command, It give some detailed information about the file or directory.

"total 4" is blocks used by the file "filename".

"-rw-rw-r--" is about file permission, we'll see about it later.
"1" is about file count.
"kumar" is owner of file
"kumar" is group under this file
"50"  file size
"Aug 3 11.47" file creation date and time
"filename" name of the file

for more option try man pages and try more,


mkdir is the command used to create folder in Linux box.
[[email protected] ~] mkdir myfolder


rm is the command used to remove folder or file.
rm {filename}

-f used to force the deletion, it won't ask conformation
-r used for recursive deletion, i meant it used to delete entire folder

[[email protected] ~] rm -f filename
[[email protected] ~] rm -fr myfolder

vim is the editor, It is advance version of the vi editor. vim editor can be used to create, edit and update file.

[[email protected] ~] vim newfile

It'll open editor window, Normally it in uneditable mode. By press "i" key we can move to edit mode, to quit from edit mode, press "esc" key.
After finish typing, press "esc" key and type ":wq" for save and quit. Here w for save and q for quid vim. We can use this command separately. For quit without changes, ":q!".

For more options try man pages.

No comments: