Tuesday, 2 September 2014

Back|Track OS Tools Tutorials Episode 1: Basic Linux Commands


Back|Track OS Tools Tutorials
                        Episode 1 
    Basic Linux Commands


Now there are some commands in linux that you wouldn't be able to start this series without, if you're already comfortable with using linux you can skip this episode, Otherwise stick around because you'd feel pretty lost in the upcoming episodes if you weren't familiar with these commands, their syntax and what they do.
I assume that by now you have downloaded a virtual machine software and you loaded your Backtrack image and ready to go, if not watch this lovely video which tells you how to do just that while 50Cent rhymes in the background and come back the page isn't going anywhere.

Alright ! now that you got your Backtrack installation up and running we can start getting our hands dirty !
In the matter of fact you actually have a head start already since you now know a command and saw what it did ! That's right remember when that black screen with all the text came up and when you wanted something human-y and you typed startx ?
That's right you've just used your first linux command, What startx does is that it starts something called and "Xsession" which is basically a GUI (Graphical user interface) for you to interact with the system, the term GUI means all the windows, icons and bars and you click and drag around while using the system, The opposite of that is called CLI when stands for Command Line Interface and that's the interface where you saw all the text and where you typed the startx command, They're basically two different ways to interact with the system.

Before you can start throwing commands at the system you need to know where to type these commands because you can't just shout them at the screen which would be crazy cool (Tony Stark will relate).
if you look at the upper bar you'd find an icon that looks like this:

Fig 0.1
Terminal Icon


If you click that you'll be presented with a "Terminal" you can think of a terminal as a piece of the CLI implemented in your GUI to enable you to pass gas commands (i sounded smart there didn't i)
And THAT ladies and gentlemen what will be taking our commands.
so FINALLY we reached the part with the actual commands so go ahead there and type in your terminal cowsay (Notice that Linux Commands are case-Sensitive which means that Cowsay isn't the same as cowsay (it cares about the small and the capital letters.))
If everything went as it should you'll see nothing.
Note: If it said something like "The program cowsay isn't currently installed" type in
apt-get install cowsay

The reason why you saw nothing there is that you didn't give it any data to process which brings us the other thing you need to know about linux commands: Arguments\Parameters, And until we get to a much more advanced stage in this series the two terms Arguments and Parameters are interchangeable, We're going to use the term Argument (or arg.) here though but you can change it to parameter in your head while reading if it keeps you up at night.

Basically what arguments are are some data that you pass to the command you're typing in order to be processed by that command, and every command will act on the data given based on what it does.
For example when the cowsay command is given the argument "0xcf" is the shiznet" the following happens:

The "0xCF is the shiznet" part is the argument for the command cowsay, and since its a command that takes whatever you type there and makes a cow say it (Pure magic.) it took the data i gave it and well .. made a cow say it.

Now that you're familiar with the how the commands are passed to the system, how to bring up and use Terminal and the syntax of a command you can go ahead and try commands from the table below which contains names of commands, what they do and the syntax of the ones that have special syntax.




Command Function
pwd (Print Working Directory)
(Print. Current. Directory.)prints the current directory you're working from
ls (LIST)
lists all the the contents of the directory you're currently in
cd (Change Directory)
Changed your current working directory to another one, Takes the directory path as an argument or two dots .. to go back a directory)
cp (Copy)
copies a file from one place to the other, takes two mandatory arguments which are the source file that you're copying and destination for it.
whoami Outputs the name of the current user
sudo (SuperUser DO)
allows you to execute a command with superuser privileges
cat (Concatenate)
Outputs the contents of a file
mkdir (Make directory)
Makes a directory duh
rmdir (Remove directory)
Sets your dog on fire.
just kidding but seriously though...
apt (Aptitude)
Summons aptitude package manager which enables you to install packages (Programs) on your computer, for now we'll use the syntax apt-get install [programnamehere] to install our stuff
telnet connects to a computer using the telnet protocol and starts a telnet session
takes an address as a mandatory argument 
For fun try telnet towel.blinkenlights.nl
ping sends a packet to a computer to check if its alive (online)
takes an address to ping as a mandatory argument
traceroute traces the route a packet takes to get to somewhere
takes an address to trace route to as a mandatory argument
man (Manual)
Takes another command for an argument and gives you a complete  "Manual" on how to use it.


Next Episode: Network debugging commands

No comments:

Post a Comment