Skip to content

Linux basics for interview

November 4, 2012

At the post no. 3, I talked about CRS-3 and I said, that it is working on IOS XR from IOS train, which  stands for Internetworking  Operating System.

I mentioned, that it is a type of QNX kernel based linux. So let’s talk Linux for a while, and get warm for an simple Linux user interview. Believe me or not. Linux is as easy as you know the proper command:D

I’d like to invite you to visit one of my favorite YouTube channels, Eli the computer guy and these series of videos, where he talks about Linux. Enjoy!

Lesson one: Basics

========================================================================================== 

– What is an OS?

OS is a S.W. that is resided on H.W. and other SWs ( lets call them applications )  are running over it.

– What is Linux?

Basically Linux is an OS, created by Linus Torvalds between 1991 to 1994.  Linux is not UNIX and Linus wrote it from scratch!. There are some similarities, but Linux has nothing to do with UNIX

– What are Linux Distributions or Distros?

Once Linux came out, different companies started to giving their own versions out in different forms. These are famous Distros of Linux, each has a different functionality: 1- Redhat ( for enterprise, with customer service support ) 2- Ubuntu (Free) 3- DSL (Damn Small Linux) 4-Trustic Linux.

– What is Open Source Licensing?

It means, that you can see the source codes, but it doesn’t mean, it is necessarily free. However some of them are free,  So what is the point of having an open source software?  The answer is: To study, To change and To improve  it

– What is ROOT?

Root is highest level of everything in Linux. Let’s say, it is equivalent to admin in windows world.

– Importance of  Capitalization in Linux?

Linux is case sensitive, but Windows is not. So Cisco is different from CISCO or cisco.

– What is Linux best at?

Being a server. Minimum trouble. Let’s say, it works life time until the hardware fails. Restart time is very short. When you install a server version, it will install a minimum required components for.  The weird thing is after installation, you will see only blinking cursor.(It sucks!!  but it’s as simple as you know the commands!, lol). Linux for everyday desktop functionality is poor at this time of  technology.

– What is Shell?

Shell is user interface in Linux. There are two types of shell. LUI and GUI. GUI stands for graphical user interface and LUI stands for command line user interface.

Lesson two:  Basic Linux tasks in LUI Shell

========================================================================================== 

$ man xxx : gets a manual from the command xxx. it is help command of shell!  To quite this help script, you have to press q.  (Windows tricks ctrl+z ,  ctrl+c, ctrl+break  do not wok here ;p. So don’t get panic just press q)

$ sudo xxx: comes before a command xxx. It makes that command acts like” Root user”

$ sudo tasksel is used to install a S.W. packages.

$ sudo apt-get (install/remove/upgrade) xxx:  is used to install, remove and upgrade a software (xxx here).

$ sudo /etc/init.d/xxx (start/stop/ restart) xxx : is used to start, stop and restart a service (xxx here).

$ top : This command looks like Windows task manager(not that beautiful! ), you see a list of tasks running over Linux with a PID (processing ID number), then by pressing k, and typing PID number, you can kill the process.

Lesson three: files in Linux using the text editor VIM.

========================================================================================== 

$ Sudo vim xxx: opens a file, or creates file (here xxx).  Sometimes you need sudo, sometimes not… if you use it it will always work…

In the vim, for editing, and navigating:

a = insert, esc = exit insert
:/ = find (use wildcards)- by pressing n, you can got to the next found word
:/? = Find backward

Exiting and Saving
:q = quit
:q! = quit no save
:wq = save and quit
:e = open file when you are in the vim editor
:w = save as

Lesson four: navigate through the file directories in Linux

========================================================================================== 

 $ cd : changes directories. cd .. is used to turn back one directory and cd  is used to go to home directory.(Do you remember this DOS command, back in the day! 🙂 )

$ ls (-l -m):  lists the file names and  folder names. option -l is used to show more details in the list such as permissions, date of creation, and etc. Option -m is used to get the list compressed(looks like A,B,C)

$ sudo find (-iname) xxx: is used for searching a file/directory place. -iname arguement is used to make the search case insensitive, wildcards can be used at xxx string

$sudo mkdir xxx: Makes directories

$ sudo rm xxx: Removes files

$ sudo rm xxx -r : Removes folders with whatever they have inside (Recursive)

$ sudo mv file/directory (-r) (place1) (place2): Moves file/directories.  Note that, this command is also used in Linux to rename a file or folders

$ sudo cp xxx place1 place2 (-r):  copies files/directories (add –r for directories)

Professional Mounting drives:

There are three steps to mount a drive in Linux: Create Directory — List Attached Drives — Link Directory to Drive

To Create A Directory : $ sudo mkdir /mnt/folder (Create folder in /mnt directory for easier administration)

To List Attached Drives : $ sudo fdisk –l

To Link Directory to Drive: $ sudo mount /dev/cdrom /folder       (here, to enter desire drive that were listed back in fdisk command)

To unmount drive : $ sudo umount drive

Lesson five: managing users, groups and permissions in a Linux environment

========================================================================================== 

 Users:

$ sudo adduser username :  Adds user

$ sudo passwd username : Changes user password

$ sudo userdel username :  Deletes user

$ sudo vim /etc/passwd : shows usernames, names of users, home directories

Groups:

$ sudo groupadd groupname :  Adds group

$ sudo groupdel groupname:  Deletes group

$ sudo vim /etc/group : shows groups and users information

$ sudo adduser username groupname: Adds user to the group == hiring somebody at Cisco

$ sudo deluser username groupname: Removes user from group == Firing somebody from Cisco

Permissions:

Understanding the three digits magic permission number xxx: x(1) is for user, x(2) is for group, and x(3) is for everyone else, each x is summation of 4,2, and 1. considering 4 = read, 2 = write, 1 = execute

$ sudo chmod xxx file/folder (-R for recursive): Chaneges permissions of a files/folders

$ sudo chown (-R) username file/folder : Changes user ownership

$ sudo chgrp (-R) groupname file/folder: Changes group ownership

Lesson 6:  Linux network configuration commands:

========================================================================================== 

 $ sudo ifconfig:  Shows current IP addresses and network configuration  This command is equivalent to ipconfig in Wondows

$ sudo dhclient: Releases and renew IP address

$ sudo /etc/init.d/networking restart: Restarts the networking service. Remember, always to restart the networking service after changing network configurations

$ sudo vim /etc/network/interfaces : is used to edit the network adapter onfigurations

inside this file, we have :

auto eth0 = Auto Negotiate Speed for Ethernet Card 0

iface eth0 inet static /dhcp = Ethernet Card 0 Either Static or DHCP Address. If DHCP Don’t Go Further.

address 192.168.1.100 = Static IP Address

netmask 255.255.255.0 = Subnet Mssk

network 192.168.1.0 = Network (Generally Your IP Address Siply with a 0 in the Last Octet))

broadcast 192.168.1.255 = Broadcast Address (The Last Address in Your Subnet. Generally Your IP Address with a 255 in the Last Octet.)

gateway 192.168.1.1 = Default Gateway. Generally Your ISP Modem or Router

$ vim /etc/resolv.conf : is used to edit the DNS resolution file

$ sudo /bin/hostname :  is used to see current Hostname

$ ping xxx : This command is used for ICMP echo checking. Basically it says to network device helooooolo!!! Are you there???? And it is waiting for hello back from it. xxx can be IP address or a domain name.  (Same command is in Windows but there is small difference here, at Windows there four times repeat, but in Linux it repeats, it repeats until it cut it)

Working with firewall: UFW

$ sudo ufw status:  Checks the status of firewall

$ sudo ufw default (allow/deny): Changes default handling of ports when UFW is enabled

$ sudo ufw (enable/disable):  Turns UFW on or Off

$ sudo ufw (allow/deny) port#: Opens or close ports for everyone

$ sudo ufw delete (allow/deny) port#: Deletes a UFW rule

$ sudo ufw allow from IP Address: Allows access to all ports from a specific IP address

$ sudo ufw allow from IP Address to any port port#:  Allows access to a specific port from a specific IP address

Ali.

Post no. 6

Advertisements

From → Cisco

10 Comments
  1. If your current photostream features photos which – if good or perhaps not : triggered an important spirited comments¡ä line, we wish to see the application!

  2. Hi. Wonderful introduction. Well done. This blog looks great. I have hunger for more. Greetings. Yours sincerely.

  3. Hey! Would you mind if I share your blog with my facebook group?
    There’s a lot of people that I think would really enjoy your content. Please let me know. Many thanks

  4. I found something similar elsewhere and really found it interesting. Some more of this please! Thx

  5. You are so interesting! I don’t believe I’ve truly read through a single thing like this before. So great to find somebody with a few unique thoughts on this topic. Seriously.. thanks for starting this up. This site is something that is required on the internet, someone with a little originality!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: