Saturday, March 28, 2015

what exactly is a Shell in ubuntu or Linux

shell ==>
1.The default interface to linux
2. The program that accepts your commands and execute those commands
3. Also called commandline interpreter

To acess it on ubuntu desktop/laptop(ctrl+alt+t)
when shell(Terminal emulator application) is opened it shows you prompt.Prompt waits for you to type something in it.
(type whoami)

question: Why use a CLI when we have graphical interdace?
If you want to acess some linux server ,most server distributions doesn't include GUI.
There will be many tedious tasks like renaming a 1000 files....
So in GUI you have to right click and rename,but if you get familiar with commandline you can do it with a command..

Normal VS root

A prompt  will typically look like
[username@computername ~]$
But if you want to have more privelages then you need to change to root prompt.
To change to root prompt you have to type
An Example from my laptop

cam@hack3r:~$ sudo su
[sudo] password for cam:

Observe there is a different symbol for root at the end(#)

Now in the last post we've discussed a root (directory),mother of all directories.Is that root is same is this root prompt??
No..That is a directory.This root is an account,like super account.

Root,The Superman account
It's like Administrator account in windows.
I've an account called cam on my laptop..
for that matter any account on my ubuntu have less privelages than root.

Why is there a root account when i can access it with a simple command.why can't my user account have all privelages?
Simple,In most linux servers there will be multiple user with different tasks...
Only system admins have access to root.You might have seen in many movies people trying to access root.

Tilde(~) Expansion

wait i've seen this somewhere??
Yes it's on your prompt and it is called Tilde

~cam = /home/cam
~ftp = /srv/ftp

Try out these:

cam@hack3r:~$ sudo su
[sudo] password for cam:
root@hack3r:/home/cam# pwd
root@hack3r:/home/cam# cd ~
root@hack3r:~# pwd
root@hack3r:~# cd ~cam
root@hack3r:/home/cam# pwd
root@hack3r:/home/cam# exit

Take out from this post

===========                        ==========
command                          Action
===========                        ==========

1.pwd                             displays present working directory                             Change directory[you cannot type any directory.You've type the exact path]

3.sudo su                         To access root account from terminal

4.exit                             To exit from root account to normal account(Use root account carefully..)

5.Clear                            Clears the terminal application

Learn python for fun.The popular blog with questions and answers to the python.Solutions to facebookhackercup,codejam,codechef.The fun way to learn python with me.Building some cool apps.

No comments:

Post a Comment