Monday 23 June 2014

Basic Bash commands for Beginners

Posted: July 15, 2012 in Linux
Tags: ,
0
Hi :) in My Previous post i have mentioned about Bash shell. Now in this Article i will tell you SOME of the Important Bash command’s and How to use them in Debian, Ubuntu, Backtrack, Redhat, or in Fedora:) So 1st i will start in alphabetic order. :D
But Before i would like to show you something, when you execute any command in Terminal . And after that you want to check wheather it successfully run or not. JUst use
1
# echo $?
This is how it looks in Backtrack

This is how it looks in Fedora :)
When you get the output 0 . Then it means you programmed successfully run, otherwise not.

Bash command’s start with A. :)

1. alias Create an alias 
2. apt-get Search for and install software packages (Debian/Ubuntu/Backtrack)
3. aptitude Search for and install software packages Debian/Ubuntu/Backtrack)

1. ALIAS

This alias command allow us to create command shortcuts within your shell for example type this fllowing command.
1
# alias vipul='uname -a'
(uname -a will give you the details of you Kerenel)
1
# vipul
This is how it looks in Backtrack.
This is how it looks in ubuntu.
Image and video hosting by TinyPic
This is How it looks in Fedora.
Image and video hosting by TinyPic

2. APT-GET

APT is acronym for Advanced Package Tool. It supports installing packages over internet such as ftp or http. We can also upgrade all packages in single operations, which makes it more attractive.For example,
1
# apt-get install
1
# apt-get install samba
(Here Samba is software that can be run on a platform other than Microsoft Windows, for example, UNIX, Linux, IBM System, OpenVMS, and other operating systems. it allows to interact with a Microsoft Windows client or server, as if it is a Windows file and print server. I will post about samba configuration in my coming article.)
This is how it looks in Backtrack.
Image and video hosting by TinyPic
This is how it looks in Ubuntu.
Image and video hosting by TinyPic
Note i have use ‘sudo’. As in ubuntu i Have loged in as bipul account. And you can remove this Package by simply using this command
1
# apt-get remove samba
Now for Fedora no ‘apt-get’. As they belongs to Redhat family,They uses ‘Yum’ which i will show you in next, in Y segment. :)

 3. APTITUDE

Same for this Command in Ubuntu and Backtrack as They Belongs to Debian Family :)
1
# aptitude-get install samba
YOu can use MAN page i.e man aptitude and also for the Other Bash command.

Bash command’s start with B (Basics)

1. bzip2 Compress The file(s)
bzip2 will compresses you files using the Burrows-Wheeler block sorting text compression algorithm, and Huffman coding. I will explain this in details in coming article.
1
2
# bzip2 file file1 file2
#ls
Image and video hosting by TinyPic
This is How it looks in Backtrack whear i have 1st creacted Directory name hacker with mkdir.
After that i went inside it by command cd and created two file (File, File1) with command.touch Now i am compressing it. As you can see the extension .bz2 in both by command bunzip ,Now i will Decompress it by using
1
# bunzip2 File.bz2
Try the second file File1.bz2 from you side
Image and video hosting by TinyPic
This is How it looks in Ubuntu whear i have 1st creacted Directory name hacker with mkdir
After that i went inside it, and created two file (file, file1) with touch command. Now i am compressing it as you can see the extension .bz2 in both by bunzip command,Now i will Decompress it by using
1
# bunzip2 file.bz2
Try the second file file1.bz2
Image and video hosting by TinyPic
This is how it looks in Fedora whear i have 1st creacted Directory name hacker with mkdir
After that i went inside it, and created two file (file, file1) with touch command. Now i am compressing it,as you can see the extension .bz2 in both by bunzip command,Now i will Decompress it by using
1
# bunzip2 file.bz2
Try the second file file1.bz2
Bash command’s start with C (Basics)
1. CAL
It display calendar and present date :) . Simply type
1
# cal
Image and video hosting by TinyPic
This is How in Backtrack
Image and video hosting by TinyPic
That’s how in Ubuntu

2. CAT

It is used to create file and also display the content of files. And it is most important command. Let me show you How you can create File even. Write data inside it and Display it, via cat command.
1
# cat > hacker
(Then type the data what ever you like to type in hacker file. you can Give the extension of a file also like .html .txt what ever you like :) and Press Ctrl + D to Save it )
1
# cat > hack.html
(It will create html file with name hacker.You can type data inside file hack.html. And press Ctrl + D to save it )
1
# cat hacker hack.html
(It will show you the contents of data of both file which you have writeen inside. which is called Concatenate files.[Concatenation means putting multiple file contents together] You can have singal command also ‘# cat hacker‘)
Image and video hosting by TinyPic
That’s how in Backtrack it Looks
Image and video hosting by TinyPic
That is how in Fedora it looks like. :)
You can overwritte the existing data by simple double operator “>>” i.e
1
# cat >> hacker
The exact meaning of “>” is to take out the STDN Out put of the given file. “<" is to take out the STDN input from a file
1
# cat &lt; anaconda-ks.cfg
Image and video hosting by TinyPic
This is how it looks in Fedora

3 CD To Change Directory

This command is used to change the Directory. :)
1
# cd
1
# cd .
(One level up)
1
# cd .
(Remain in same Directory)
1
# cd --
(will move in last working Directory)
Image and video hosting by TinyPic
That’s how it looks in Backtrack
Image and video hosting by TinyPic
This is How it looks in Fedora

CLEAR

This command is used to clear the terminal screen. And i think i don’t need to give a screen shot for that:)
1
# clear

EXIT

This command will help you to get out from Terminal and shell. And again i think i don’t need to give a screen shot for that :)
1
# exit

GREP

grep Search files for lines that match a given pattern.Grep command often used with pipes.
1
# grep hack /etc/passwd
1
# cat /proc/cpuinfo | grep -i 'Model'
Image and video hosting by TinyPic
This is how it looks in Backtrack
Image and video hosting by TinyPic
This is How it looks in Fedora

GZIP

1
gzip
Compress or decompress named file. File extension (.gz) are created using gzip program which reduces the size of the named files using Lempel-Ziv coding (LZ77).
1
2
3
# gzip file  (compress)
# gunzip file.gz (decompress)
Image and video hosting by TinyPic
This is how it looks in Backtrack
Image and video hosting by TinyPic
This is how it looks in Fedora
head /tail Output the first/last part of files
head command will show the beginning of a file. By default it will show the first 5 lines of a file.tail will show the end of it. Here’s an example. (dmseg=dmesg – print or control the kernel ring buffer).Here’s an example.
1
2
3
# head -n 5 /var/log/dmesg
# tail -n 5 /var/log/dmesg
Image and video hosting by TinyPic
This is How it looks in Backtrack
Image and video hosting by TinyPic
This is how it looks in Fedora
head /tail Output the first/last part of files. Head command will show the beginning of a file. By default it will show the first 5 lines of a file. Tail will show the end of it. Here’s an example. (dmseg=dmesg – print or control the kernel ring uffer).Here’s an example.
1
2
3
# head -n 5 /var/log/dmesg
# tail -n 5 /var/log/dmesg
Image and video hosting by TinyPic
This is How it looks in Backtrack
Image and video hosting by TinyPic
This is how it looks in Fedora

Protect Your Email and Other Online Accounts from Hackers

Protect your Email Account from Hackers 
In this post, I will teach you how to protect your email account from getting hacked in a very simple and easy to understand manner. The tips provided in this post not only applies to your email account, but can also be used to protect any other online account such as your bank logins, Paypal or your social networking account. Nowadays, I get a lot of emails from people where most of them ask me for help on getting back their email accounts. This is because, they have simply fallen victims and have got their email accounts hacked!
Today, it is a common problem for many Internet users to have their email accounts compromised by hackers. But this arises one BIG question in my mind!
“Is it so easy to hack an email account? OR Is it so difficult for people to protect their email account from getting hacked?”.
The single answer to these two questions is “Absolutely NOT!“. It is neither easy to hack an email nor difficult to protect an email account from being hacked.
If this is the case, then what is the reason for many people to lose their accounts?
The answer is very simple. They do not know how to protect themselves from getting hacked! In fact, most of the people who lose their online accounts to hackers are not the victims of hacking but the victims of trapping. They get hacked not because they are hacked by some expert hackers, but because they are fooled to such an extent that they themselves give away their password.
Are you confused? If so continue reading and you’ll come to know…
Now I will mention some of the most common pitfalls by which people often fall victims and get their accounts compromised. In addition to this, I will also give information on how to avoid these pitfalls and stay protected.

1. Website Spoofing (Phishing Scam)

Website spoofing, also known as phishing is the act of creating a fake website with the intention of misleading the visitors. The website will be created by a different person or organization (other than the original) especially for the purpose of cheating. Normally, the website will adopt the design of the target website and sometimes has a similar URL.
For example a spoofed website of Yahoo.com appears exactly same as Yahoo Website. So, most people would believe this as the original site and lose their passwords. The main intention of spoofed websites is to fool users and take away their login details. For this, the spoofed sites offer fake login pages. These fake login pages resemble the original login pages of sites like Yahoo, Gmail or Facebook. Since they resemble the original login page, people believe that it is true and give away their login details to the hackers by trying to login to their accounts.

Solution:

  • Never try to login/access your online account from the sites other than the original site.
  • Always type the URL of the site in the address bar to get into the site. Do not click on a hyperlink to enter the site.

2. By using Keylogger (Spyware)

The other commonly used method to steal password is by using a Keylogger. A Keylogger is nothing but a spyware. The detailed description of keylogger and its usage is discussed in the post How to Use Keyloggers. If you read this post you’ll come to know that it is too easy to steal the password using a keylogger program. If you just access your account from a computer installed with keylogger, you definitely lose your password. This is because the keylogger records each and every keystroke that you type on the computer’s keyboard.

Solution:

Protecting yourselves from a keylogger scam is very easy. Just install a good anti-spyware program and update it regularly. This keeps your PC secure from a keylogger. For more information, you may read my other post on How to Protect your Computer from keyloggers?

3. Accessing your Email from a Public Place

Do you access your email from public places like cyber cafes? If so, you are definitely under the risk of losing your password. In fact, many people lose their email account in cyber cafes. For the owner of the cyber cafe, it is just a cakewalk to steal your password. For this, all he need to do is install a keylogger program on his computers. So, when you login to your email account from this PC, you give away your password to the cafe owner. Also, there are many Remote Administration Tools (RATs) which can be used to monitor your browsing activities in real time.
This doesn’t mean that you should never use cyber cafes for surfing the Internet. I know, not all the cyber cafe owners will be so wicked. However, it is recommended not to use public places for accessing confidential information. If it comes to the matter of security never trust anyone, not even your friend. I always use my own computer to login to my accounts so as to ensure the safety.
So with this I conclude my post and assume that I have helped my readers to protect their online accounts from being hacked. Please pass your comments. :)
Telephone number list by wiki

http://en.wikipedia.org/wiki/Mobile_telephone_numbering_in_India

Windows TCP/IP Utilities

Windows TCP/IP Utilities 
The following are the IP utilities available in Windows that help in finding out the information about IP Hosts and domains. These are the basic IP commands that every beginner in the field of hacking must know!
Please note that the the term Host used in this article may also be assumed as a Website for simple understanding purpose.

1. PING

PING is a simple application (command) used to determine whether a host is online and available. PING command sends one or more ICMP “Echo message” to a specified host requesting a reply. The receiver (Target Host) responds to this ICMP “Echo message” and returns it back to the sender. This confirms that the host is online and available. Otherwise the host is said to be unavailable.
Syntax: C:\>ping gohacking.com

2. TELNET

Telnet command is used to connect to a desired host on a specified port number. Just like a house having several doors, a host or a server has different ports running different services. For example port 80 runs HTTP, port 23 runs TELNET while port 25 SMTP. Like this there are several ports on a server through which it is possible for a remote client to establish a connection.
For a connection to be established, the port has to be open. For example, in the following command, we are trying to establish a connection with the Yahoo server on port 25.:
Syntax: C:\>telnet yahoo.com 25
C:\>telnet yahoo.com
The default port number is 23. When the port number is not specified the default number is assumed.
NOTE: If you are using Vista or Windows 7, Telnet feature may not be available by default. .

3. NSLOOKUP

Many times, we think about finding out the IP address of a given site. Say for example google.com, yahoo.com, microsoft.com etc. But how to do this? There are several websites out there that can be used to find out the IP address of any given website. However, in the Windows operating itself, we have an inbuilt tool to do this job for us. It is called “nslookup”.
This tool can be used for resolving a given domain name into its IP address (determine the IP of a given site name). Not only this, it can also be used for reverse IP lookup. That is, if the IP address is given it determines the corresponding domain name for that IP address.
Syntax: C:\>nslookup google.com

4. NETSTAT

The netstat command can be used to display the current TCP/IP network connections. For example, the following “netstat” command displays all the currently established connections and their corresponding listening port numbers on your computer.
Syntax: C:\>netstat -a
Type “Ctrl+Z” to exit.
This command can be used to determine the IP address/Host names of all the applications connected to your computer. If a hacker is connected to your system even the hacker’s IP is displayed. So, the “netstat” command can be used to get an idea of all the active connections of a given system.